From owner-svn-src-head@freebsd.org Thu Dec 29 17:31:39 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B120AC96B77; Thu, 29 Dec 2016 17:31:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 80B9A178D; Thu, 29 Dec 2016 17:31:39 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uBTHVcjq015367; Thu, 29 Dec 2016 17:31:38 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uBTHVc74015366; Thu, 29 Dec 2016 17:31:38 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201612291731.uBTHVc74015366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 29 Dec 2016 17:31:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r310781 - head/sys/mips/atheros X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 29 Dec 2016 17:31:39 -0000 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 #include +#ifdef EARLY_PRINTF +#include +#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);