John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 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. |
| 5 | * |
John Crispin | 97b9210 | 2016-05-05 09:57:56 +0200 | [diff] [blame] | 6 | * Copyright (C) 2010 John Crispin <john@phrozen.org> |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 7 | */ |
| 8 | |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 9 | #include <linux/cpu.h> |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 10 | #include <lantiq_soc.h> |
| 11 | |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 12 | #define ASC_BUF 1024 |
Thomas Langer | 7705f68 | 2012-05-02 12:27:38 +0200 | [diff] [blame] | 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 |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 19 | #define TXMASK 0x3F00 |
| 20 | #define TXOFFSET 8 |
| 21 | |
| 22 | void prom_putchar(char c) |
| 23 | { |
| 24 | unsigned long flags; |
| 25 | |
| 26 | local_irq_save(flags); |
| 27 | do { } while ((ltq_r32(LTQ_ASC_FSTAT) & TXMASK) >> TXOFFSET); |
| 28 | if (c == '\n') |
Thomas Langer | 7705f68 | 2012-05-02 12:27:38 +0200 | [diff] [blame] | 29 | ltq_w8('\r', LTQ_ASC_TBUF); |
| 30 | ltq_w8(c, LTQ_ASC_TBUF); |
John Crispin | 171bb2f | 2011-03-30 09:27:47 +0200 | [diff] [blame] | 31 | local_irq_restore(flags); |
| 32 | } |