xref: /linux/arch/mips/bcm63xx/early_printk.c (revision 3eb66e91a25497065c5322b1268cbc3953642227)
1e7300d04SMaxime Bizon /*
2e7300d04SMaxime Bizon  * This file is subject to the terms and conditions of the GNU General Public
3e7300d04SMaxime Bizon  * License.  See the file "COPYING" in the main directory of this archive
4e7300d04SMaxime Bizon  * for more details.
5e7300d04SMaxime Bizon  *
6e7300d04SMaxime Bizon  * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr>
7e7300d04SMaxime Bizon  */
8e7300d04SMaxime Bizon 
9e7300d04SMaxime Bizon #include <bcm63xx_io.h>
10e95acd3dSFlorian Fainelli #include <linux/serial_bcm63xx.h>
11*5c93316cSAlexander Sverdlin #include <asm/setup.h>
12e7300d04SMaxime Bizon 
wait_xfered(void)13f7be4e75SAaro Koskinen static void wait_xfered(void)
14e7300d04SMaxime Bizon {
15e7300d04SMaxime Bizon 	unsigned int val;
16e7300d04SMaxime Bizon 
17e7300d04SMaxime Bizon 	/* wait for any previous char to be transmitted */
18e7300d04SMaxime Bizon 	do {
19e7300d04SMaxime Bizon 		val = bcm_uart0_readl(UART_IR_REG);
20e7300d04SMaxime Bizon 		if (val & UART_IR_STAT(UART_IR_TXEMPTY))
21e7300d04SMaxime Bizon 			break;
22e7300d04SMaxime Bizon 	} while (1);
23e7300d04SMaxime Bizon }
24e7300d04SMaxime Bizon 
prom_putchar(char c)25f7be4e75SAaro Koskinen void prom_putchar(char c)
26e7300d04SMaxime Bizon {
27e7300d04SMaxime Bizon 	wait_xfered();
28e7300d04SMaxime Bizon 	bcm_uart0_writel(c, UART_FIFO_REG);
29e7300d04SMaxime Bizon 	wait_xfered();
30e7300d04SMaxime Bizon }
31