| 1 | /* |
| 2 | * Ralink RT288x SoC early printk support |
| 3 | * |
| 4 | * Copyright (C) 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 | |
| 15 | #include <asm/addrspace.h> |
| 16 | |
| 17 | #include <asm/mach-ralink/rt288x_regs.h> |
| 18 | |
| 19 | #define UART_READ(r) \ |
| 20 | __raw_readl((void __iomem *)(KSEG1ADDR(RT2880_UART1_BASE) + 4 * (r))) |
| 21 | |
| 22 | #define UART_WRITE(r, v) \ |
| 23 | __raw_writel((v), (void __iomem *)(KSEG1ADDR(RT2880_UART1_BASE) + 4 * (r))) |
| 24 | |
| 25 | void prom_putchar(unsigned char ch) |
| 26 | { |
| 27 | while (((UART_READ(UART_REG_LSR)) & UART_LSR_THRE) == 0); |
| 28 | UART_WRITE(UART_REG_TX, ch); |
| 29 | while (((UART_READ(UART_REG_LSR)) & UART_LSR_THRE) == 0); |
| 30 | } |
| 31 | |