From owner-svn-src-head@freebsd.org Thu Oct 19 20:56:31 2017 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 7E1BFE47621; Thu, 19 Oct 2017 20:56:31 +0000 (UTC) (envelope-from manu@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 4BD6E8096B; Thu, 19 Oct 2017 20:56:31 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v9JKuU4S050753; Thu, 19 Oct 2017 20:56:30 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v9JKuUpQ050752; Thu, 19 Oct 2017 20:56:30 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201710192056.v9JKuUpQ050752@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 19 Oct 2017 20:56:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r324773 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 324773 X-SVN-Commit-Repository: base 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, 19 Oct 2017 20:56:31 -0000 Author: manu Date: Thu Oct 19 20:56:30 2017 New Revision: 324773 URL: https://svnweb.freebsd.org/changeset/base/324773 Log: Allwinner: Add EARLY_PRINTF function EARLY_PRINTF can help debugging early problems. Add it for Allwinner SoCs. Tested On: OrangePi One (H3) Modified: head/sys/arm/allwinner/aw_machdep.c Modified: head/sys/arm/allwinner/aw_machdep.c ============================================================================== --- head/sys/arm/allwinner/aw_machdep.c Thu Oct 19 20:54:55 2017 (r324772) +++ head/sys/arm/allwinner/aw_machdep.c Thu Oct 19 20:56:30 2017 (r324773) @@ -164,6 +164,29 @@ allwinner_cpu_reset(platform_t plat) while (1); } +/* + * To use early printf on Allwinner SoC, add to kernel config + * options SOCDEV_PA=0x01C00000 + * options SOCDEV_VA=0x10000000 + * options EARLY_PRINTF + * And remove the if 0 +*/ +#if 0 +#ifdef EARLY_PRINTF +static void +allwinner_early_putc(int c) +{ + volatile uint32_t * UART_STAT_REG = (uint32_t *)0x1002807C; + volatile uint32_t * UART_TX_REG = (uint32_t *)0x10028000; + const uint32_t UART_TXRDY = (1 << 2); + + while ((*UART_STAT_REG & UART_TXRDY) == 0) + continue; + *UART_TX_REG = c; +} +early_putc_t *early_putc = allwinner_early_putc; +#endif /* EARLY_PRINTF */ + #if defined(SOC_ALLWINNER_A10) static platform_method_t a10_methods[] = { PLATFORMMETHOD(platform_attach, a10_attach),