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