[ar71xx] add EARLY_PRINTF support for the AR933x (Hornet) UART.

Tested:

* Carambola 2
This commit is contained in:
Adrian Chadd 2016-12-29 17:31:38 +00:00
parent ccfb1ab87c
commit 0013dd123f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=310781

View File

@ -44,6 +44,9 @@ __FBSDID("$FreeBSD$");
#include <mips/atheros/ar71xx_cpudef.h>
#include <mips/atheros/uart_dev_ar933x.h>
#ifdef EARLY_PRINTF
#include <mips/atheros/ar933x_uart.h>
#endif
#include "uart_if.h"
@ -88,4 +91,25 @@ uart_ar933x_probe(device_t dev)
return (uart_bus_probe(dev, 2, freq, 0, 0));
}
/*
* Assume the UART is setup by the bootloader and just echo that.
*/
#if defined(EARLY_PRINTF)
static void
ar933x_early_putc(int c)
{
int i = 1000;
/* Wait until FIFO is clear */
while ((i > 0) && (ATH_READ_REG(AR71XX_UART_ADDR + AR933X_UART_CS_REG) &
AR933X_UART_CS_TX_BUSY))
i--;
/* Write it out */
ATH_WRITE_REG(AR71XX_UART_ADDR + AR933X_UART_DATA_REG,
(c & 0xff)| AR933X_UART_DATA_TX_CSR);
}
early_putc_t *early_putc = ar933x_early_putc;
#endif /* EARLY_PRINTF */
DRIVER_MODULE(uart, apb, uart_ar933x_driver, uart_devclass, 0, 0);