[ramips] add feature gpio
[openwrt/svn-archive/archive.git] / target / linux / ramips / files / arch / mips / ralink / rt305x / early_printk.c
1 /*
2 * Ralink RT305x SoC early printk support
3 *
4 * Copyright (C) 2009 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 #include <linux/io.h>
12 #include <linux/serial_reg.h>
13
14 #include <asm/addrspace.h>
15
16 #include <asm/mach-ralink/rt305x_regs.h>
17
18 #define UART_READ(r) \
19 __raw_readl((void __iomem *)(KSEG1ADDR(RT305X_UART1_BASE) + 4 * (r)))
20
21 #define UART_WRITE(r, v) \
22 __raw_writel((v), (void __iomem *)(KSEG1ADDR(RT305X_UART1_BASE) + 4 * (r)))
23
24 void prom_putchar(unsigned char ch)
25 {
26 while (((UART_READ(UART_REG_LSR)) & UART_LSR_THRE) == 0);
27 UART_WRITE(UART_REG_TX, ch);
28 while (((UART_READ(UART_REG_LSR)) & UART_LSR_THRE) == 0);
29 }