Maxime Bizon | e7300d0 | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 1 | /* |
| 2 | * This file is subject to the terms and conditions of the GNU General Public |
| 3 | * License. See the file "COPYING" in the main directory of this archive |
| 4 | * for more details. |
| 5 | * |
| 6 | * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> |
| 7 | */ |
| 8 | |
Maxime Bizon | e7300d0 | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 9 | #include <bcm63xx_io.h> |
Florian Fainelli | e95acd3 | 2013-12-05 18:26:08 -0800 | [diff] [blame] | 10 | #include <linux/serial_bcm63xx.h> |
Maxime Bizon | e7300d0 | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 11 | |
Aaro Koskinen | f7be4e7 | 2013-02-11 20:51:49 +0000 | [diff] [blame] | 12 | static void wait_xfered(void) |
Maxime Bizon | e7300d0 | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 13 | { |
| 14 | unsigned int val; |
| 15 | |
| 16 | /* wait for any previous char to be transmitted */ |
| 17 | do { |
| 18 | val = bcm_uart0_readl(UART_IR_REG); |
| 19 | if (val & UART_IR_STAT(UART_IR_TXEMPTY)) |
| 20 | break; |
| 21 | } while (1); |
| 22 | } |
| 23 | |
Aaro Koskinen | f7be4e7 | 2013-02-11 20:51:49 +0000 | [diff] [blame] | 24 | void prom_putchar(char c) |
Maxime Bizon | e7300d0 | 2009-08-18 13:23:37 +0100 | [diff] [blame] | 25 | { |
| 26 | wait_xfered(); |
| 27 | bcm_uart0_writel(c, UART_FIFO_REG); |
| 28 | wait_xfered(); |
| 29 | } |