Date: Thu, 29 Dec 2016 17:31:38 +0000 (UTC) From: Adrian Chadd <adrian@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310781 - head/sys/mips/atheros Message-ID: <201612291731.uBTHVc74015366@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: adrian Date: Thu Dec 29 17:31:38 2016 New Revision: 310781 URL: https://svnweb.freebsd.org/changeset/base/310781 Log: [ar71xx] add EARLY_PRINTF support for the AR933x (Hornet) UART. Tested: * Carambola 2 Modified: head/sys/mips/atheros/uart_bus_ar933x.c Modified: head/sys/mips/atheros/uart_bus_ar933x.c ============================================================================== --- head/sys/mips/atheros/uart_bus_ar933x.c Thu Dec 29 17:31:07 2016 (r310780) +++ head/sys/mips/atheros/uart_bus_ar933x.c Thu Dec 29 17:31:38 2016 (r310781) @@ -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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201612291731.uBTHVc74015366>