Rename 'atheros' target to 'ath25'
[openwrt.git] / target / linux / ath25 / patches-3.18 / 020-early-printk-support.patch
1 --- /dev/null
2 +++ b/arch/mips/ath25/early_printk.c
3 @@ -0,0 +1,44 @@
4 +/*
5 + * This file is subject to the terms and conditions of the GNU General Public
6 + * License.  See the file "COPYING" in the main directory of this archive
7 + * for more details.
8 + *
9 + * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
10 + */
11 +
12 +#include <linux/mm.h>
13 +#include <linux/io.h>
14 +#include <linux/serial_reg.h>
15 +
16 +#include "devices.h"
17 +#include "ar2315_regs.h"
18 +#include "ar5312_regs.h"
19 +
20 +static inline void prom_uart_wr(void __iomem *base, unsigned reg,
21 +                               unsigned char ch)
22 +{
23 +       __raw_writel(ch, base + 4 * reg);
24 +}
25 +
26 +static inline unsigned char prom_uart_rr(void __iomem *base, unsigned reg)
27 +{
28 +       return __raw_readl(base + 4 * reg);
29 +}
30 +
31 +void prom_putchar(unsigned char ch)
32 +{
33 +       static void __iomem *base;
34 +
35 +       if (unlikely(base == NULL)) {
36 +               if (is_ar2315())
37 +                       base = (void __iomem *)(KSEG1ADDR(AR2315_UART0_BASE));
38 +               else
39 +                       base = (void __iomem *)(KSEG1ADDR(AR5312_UART0_BASE));
40 +       }
41 +
42 +       while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0)
43 +               ;
44 +       prom_uart_wr(base, UART_TX, ch);
45 +       while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0)
46 +               ;
47 +}
48 --- a/arch/mips/ath25/Makefile
49 +++ b/arch/mips/ath25/Makefile
50 @@ -9,5 +9,8 @@
51  #
52  
53  obj-y += board.o prom.o devices.o
54 +
55 +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
56 +
57  obj-$(CONFIG_SOC_AR5312) += ar5312.o
58  obj-$(CONFIG_SOC_AR2315) += ar2315.o
59 --- a/arch/mips/Kconfig
60 +++ b/arch/mips/Kconfig
61 @@ -106,6 +106,7 @@ config ATH25
62         select SYS_HAS_CPU_MIPS32_R1
63         select SYS_SUPPORTS_BIG_ENDIAN
64         select SYS_SUPPORTS_32BIT_KERNEL
65 +       select SYS_HAS_EARLY_PRINTK
66         help
67           Support for Atheros AR231x and Atheros AR531x based boards
68