d900712639047201b512318dc9fb87ab3ce81d81
[openwrt/openwrt.git] / target / linux / adm5120 / files-3.14 / arch / mips / adm5120 / common / early-printk.c
1 /*
2 * ADM5120 specific early printk support
3 *
4 * Copyright (C) 2007-2008 Gabor Juhos <juhosg@openwrt.org>
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published
8 * by the Free Software Foundation.
9 *
10 */
11
12 #include <linux/init.h>
13 #include <linux/io.h>
14
15 #include <asm/addrspace.h>
16 #include <asm/mach-adm5120/adm5120_defs.h>
17 #include <asm/mach-adm5120/adm5120_uart.h>
18
19 #define UART_READ(r) \
20 __raw_readl((void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r)))
21 #define UART_WRITE(r, v) \
22 __raw_writel((v), (void __iomem *)(KSEG1ADDR(ADM5120_UART0_BASE)+(r)))
23
24 void __init prom_putchar(char ch)
25 {
26 while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0)
27 ;
28 UART_WRITE(UART_REG_DATA, ch);
29 while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0)
30 ;
31 }