2 +++ b/arch/mips/ar231x/early_printk.c
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
9 + * Copyright (C) 2010 Gabor Juhos <juhosg@openwrt.org>
12 +#include <linux/mm.h>
13 +#include <linux/io.h>
14 +#include <linux/serial_reg.h>
15 +#include <asm/addrspace.h>
17 +#include <asm/mach-ar231x/ar2315_regs.h>
18 +#include <asm/mach-ar231x/ar5312_regs.h>
21 +static inline void prom_uart_wr(void __iomem *base, unsigned reg,
24 + __raw_writeb(ch, base + 4 * reg);
27 +static inline unsigned char prom_uart_rr(void __iomem *base, unsigned reg)
29 + return __raw_readb(base + 4 * reg);
32 +void prom_putchar(unsigned char ch)
34 + static void __iomem *base;
36 + if (unlikely(base == NULL)) {
38 + base = (void __iomem *)(KSEG1ADDR(AR2315_UART0));
40 + base = (void __iomem *)(KSEG1ADDR(AR531X_UART0));
43 + while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0);
44 + prom_uart_wr(base, UART_TX, ch);
45 + while ((prom_uart_rr(base, UART_LSR) & UART_LSR_THRE) == 0);
48 --- a/arch/mips/ar231x/Makefile
49 +++ b/arch/mips/ar231x/Makefile
53 obj-y += board.o prom.o devices.o
55 +obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
57 obj-$(CONFIG_ATHEROS_AR5312) += ar5312.o
58 obj-$(CONFIG_ATHEROS_AR2315) += ar2315.o
59 --- a/arch/mips/Kconfig
60 +++ b/arch/mips/Kconfig
61 @@ -70,6 +70,7 @@ config ATHEROS_AR231X
62 select SYS_SUPPORTS_BIG_ENDIAN
63 select SYS_SUPPORTS_32BIT_KERNEL
65 + select SYS_HAS_EARLY_PRINTK
67 Support for AR231x and AR531x based boards