atheros: add 3.14 configuration
[openwrt/svn-archive/archive.git] / target / linux / atheros / patches-3.10 / 101-early-printk-support.patch
1 --- /dev/null
2 +++ b/arch/mips/ar231x/early_printk.c
3 @@ -0,0 +1,46 @@
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 +#include <asm/addrspace.h>
16 +
17 +#include <asm/mach-ar231x/ar2315_regs.h>
18 +#include <asm/mach-ar231x/ar5312_regs.h>
19 +#include "devices.h"
20 +
21 +static inline void prom_uart_wr(void __iomem *base, unsigned reg,
22 + unsigned char ch)
23 +{
24 + __raw_writel(ch, base + 4 * reg);
25 +}
26 +
27 +static inline unsigned char prom_uart_rr(void __iomem *base, unsigned reg)
28 +{
29 + return __raw_readl(base + 4 * reg);
30 +}
31 +
32 +void prom_putchar(unsigned char ch)
33 +{
34 + static void __iomem *base;
35 +
36 + if (unlikely(base == NULL)) {
37 + if (is_2315())
38 + base = (void __iomem *)(KSEG1ADDR(AR2315_UART0));
39 + else
40 + base = (void __iomem *)(KSEG1ADDR(AR5312_UART0));
41 + }
42 +
43 + while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0)
44 + ;
45 + prom_uart_wr(base, UART_TX, ch);
46 + while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0)
47 + ;
48 +}
49 +
50 --- a/arch/mips/ar231x/Makefile
51 +++ b/arch/mips/ar231x/Makefile
52 @@ -9,5 +9,8 @@
53 #
54
55 obj-y += board.o prom.o devices.o
56 +
57 +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
58 +
59 obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
60 obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
61 --- a/arch/mips/Kconfig
62 +++ b/arch/mips/Kconfig
63 @@ -148,6 +148,7 @@ config ATHEROS_AR231X
64 select SYS_SUPPORTS_BIG_ENDIAN
65 select SYS_SUPPORTS_32BIT_KERNEL
66 select ARCH_REQUIRE_GPIOLIB
67 + select SYS_HAS_EARLY_PRINTK
68 help
69 Support for AR231x and AR531x based boards
70