| 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 | UART_WRITE(UART_REG_DATA, ch); |
| 28 | while ((UART_READ(UART_REG_FLAG) & UART_FLAG_TXFE) == 0); |
| 29 | } |
| 30 | |