Linux 3.15-rc1
[linux/fpc-iii.git] / arch / mips / lantiq / early_printk.c
blob9b28d0940ef4c9c444ae811f3ba55d6aa01ea45b
1 /*
2 * This program is free software; you can redistribute it and/or modify it
3 * under the terms of the GNU General Public License version 2 as published
4 * by the Free Software Foundation.
6 * Copyright (C) 2010 John Crispin <blogic@openwrt.org>
7 */
9 #include <linux/cpu.h>
10 #include <lantiq_soc.h>
12 #define ASC_BUF 1024
13 #define LTQ_ASC_FSTAT ((u32 *)(LTQ_EARLY_ASC + 0x0048))
14 #ifdef __BIG_ENDIAN
15 #define LTQ_ASC_TBUF ((u32 *)(LTQ_EARLY_ASC + 0x0020 + 3))
16 #else
17 #define LTQ_ASC_TBUF ((u32 *)(LTQ_EARLY_ASC + 0x0020))
18 #endif
19 #define TXMASK 0x3F00
20 #define TXOFFSET 8
22 void prom_putchar(char c)
24 unsigned long flags;
26 local_irq_save(flags);
27 do { } while ((ltq_r32(LTQ_ASC_FSTAT) & TXMASK) >> TXOFFSET);
28 if (c == '\n')
29 ltq_w8('\r', LTQ_ASC_TBUF);
30 ltq_w8(c, LTQ_ASC_TBUF);
31 local_irq_restore(flags);