4661d970b0f377b2db2d7aa0c36ee3e946d9cb7f
[openwrt/svn-archive/archive.git] / target / linux / ar71xx / files / arch / mips / ar71xx / early_printk.c
1 /*
2 * Atheros AR71xx SoC early printk support
3 *
4 * Copyright (C) 2008-2009 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License version 2 as published
9 * by the Free Software Foundation.
10 */
11
12 #include <linux/io.h>
13 #include <linux/serial_reg.h>
14 #include <asm/addrspace.h>
15
16 #include <asm/mach-ar71xx/ar71xx.h>
17
18 #define UART_READ(r) \
19 __raw_readl((void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE) + 4 * (r)))
20
21 #define UART_WRITE(r, v) \
22 __raw_writel((v), (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE) + 4*(r)))
23
24 void prom_putchar(unsigned char ch)
25 {
26 while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0);
27 UART_WRITE(UART_TX, ch);
28 while (((UART_READ(UART_LSR)) & UART_LSR_THRE) == 0);
29 }
30