QE/FHCI: fixed the CONTROL bug
[zen-stable.git] / arch / mips / ath79 / early_printk.c
blob7499b0e9df263e38b00181323da58debd0ae00b6
1 /*
2 * Atheros AR71XX/AR724X/AR913X SoC early printk support
4 * Copyright (C) 2008-2010 Gabor Juhos <juhosg@openwrt.org>
5 * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org>
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.
12 #include <linux/io.h>
13 #include <linux/serial_reg.h>
14 #include <asm/addrspace.h>
16 #include <asm/mach-ath79/ar71xx_regs.h>
18 static inline void prom_wait_thre(void __iomem *base)
20 u32 lsr;
22 do {
23 lsr = __raw_readl(base + UART_LSR * 4);
24 if (lsr & UART_LSR_THRE)
25 break;
26 } while (1);
29 void prom_putchar(unsigned char ch)
31 void __iomem *base = (void __iomem *)(KSEG1ADDR(AR71XX_UART_BASE));
33 prom_wait_thre(base);
34 __raw_writel(ch, base + UART_TX * 4);
35 prom_wait_thre(base);