From owner-svn-src-stable@freebsd.org Tue Apr 3 06:06:40 2018 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4C0EFF84F18; Tue, 3 Apr 2018 06:06:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F158768108; Tue, 3 Apr 2018 06:06:39 +0000 (UTC) (envelope-from gonzo@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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4030207EC; Tue, 3 Apr 2018 06:06:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3366dU1014373; Tue, 3 Apr 2018 06:06:39 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3366dSJ014363; Tue, 3 Apr 2018 06:06:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804030606.w3366dSJ014363@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 3 Apr 2018 06:06:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r331907 - in stable/11/sys/arm: include ti ti/am335x X-SVN-Group: stable-11 X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in stable/11/sys/arm: include ti ti/am335x X-SVN-Commit-Revision: 331907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Apr 2018 06:06:40 -0000 Author: gonzo Date: Tue Apr 3 06:06:39 2018 New Revision: 331907 URL: https://svnweb.freebsd.org/changeset/base/331907 Log: MFC r307943-r307944, r308698 r307943 by andrew: Remove the need for the delay to be zero when MULTIDELAY is undefined, it may be useful to only enable this in some configs. Sponsored by: ABT Systems Ltd r307944 by andrew: Add MULTIDELAY support to the am335x dmtimer. This will be useful for testing Cortex-A8 support in GENERIC. Sponsored by: ABT Systems Ltd r308698 by loos: After r308533, the platform compatible string must be an exact match. Use "ti,am33xx" instead of "ti,am335x", which gives an exact match in every DTS we support. This fixes the boot on TI SoCs after r308533. Suggested by: gonzo Sponsored by: Rubicon Communications, LLC (Netgate) Modified: stable/11/sys/arm/include/platformvar.h stable/11/sys/arm/ti/am335x/am335x_dmtimer.c stable/11/sys/arm/ti/ti_machdep.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/include/platformvar.h ============================================================================== --- stable/11/sys/arm/include/platformvar.h Tue Apr 3 04:31:54 2018 (r331906) +++ stable/11/sys/arm/include/platformvar.h Tue Apr 3 06:06:39 2018 (r331907) @@ -97,7 +97,7 @@ extern platform_method_t fdt_platform_methods[]; #ifdef MULTIDELAY #define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay > 0) #else -#define FDT_PLATFORM_CTASSERT(delay) CTASSERT(delay == 0) +#define FDT_PLATFORM_CTASSERT(delay) #endif #define PLATFORM_DATA(NAME, delay) \ Modified: stable/11/sys/arm/ti/am335x/am335x_dmtimer.c ============================================================================== --- stable/11/sys/arm/ti/am335x/am335x_dmtimer.c Tue Apr 3 04:31:54 2018 (r331906) +++ stable/11/sys/arm/ti/am335x/am335x_dmtimer.c Tue Apr 3 06:06:39 2018 (r331907) @@ -38,6 +38,10 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef MULTIDELAY +#include /* For arm_set_delay */ +#endif + #include #include #include @@ -67,6 +71,8 @@ struct am335x_dmtimer_softc { static struct am335x_dmtimer_softc *am335x_dmtimer_et_sc = NULL; static struct am335x_dmtimer_softc *am335x_dmtimer_tc_sc = NULL; +static void am335x_dmtimer_delay(int, void *); + /* * We use dmtimer2 for eventtimer and dmtimer3 for timecounter. */ @@ -235,6 +241,10 @@ am335x_dmtimer_tc_init(struct am335x_dmtimer_softc *sc am335x_dmtimer_tc_sc = sc; tc_init(&sc->func.tc); +#ifdef MULTIDELAY + arm_set_delay(am335x_dmtimer_delay, sc); +#endif + return (0); } @@ -328,23 +338,13 @@ static devclass_t am335x_dmtimer_devclass; DRIVER_MODULE(am335x_dmtimer, simplebus, am335x_dmtimer_driver, am335x_dmtimer_devclass, 0, 0); MODULE_DEPEND(am335x_dmtimer, am335x_prcm, 1, 1, 1); -void -DELAY(int usec) +static void +am335x_dmtimer_delay(int usec, void *arg) { - struct am335x_dmtimer_softc *sc; + struct am335x_dmtimer_softc *sc = arg; int32_t counts; uint32_t first, last; - sc = am335x_dmtimer_tc_sc; - - if (sc == NULL) { - for (; usec > 0; usec--) - for (counts = 200; counts > 0; counts--) - /* Prevent gcc from optimizing out the loop */ - cpufunc_nullop(); - return; - } - /* Get the number of times to count */ counts = (usec + 1) * (sc->sysclk_freq / 1000000); @@ -361,3 +361,19 @@ DELAY(int usec) } } +#ifndef MULTIDELAY +void +DELAY(int usec) +{ + int32_t counts; + + if (am335x_dmtimer_tc_sc == NULL) { + for (; usec > 0; usec--) + for (counts = 200; counts > 0; counts--) + /* Prevent gcc from optimizing out the loop */ + cpufunc_nullop(); + return; + } else + am335x_dmtimer_delay(usec, am335x_dmtimer_tc_sc); +} +#endif Modified: stable/11/sys/arm/ti/ti_machdep.c ============================================================================== --- stable/11/sys/arm/ti/ti_machdep.c Tue Apr 3 04:31:54 2018 (r331906) +++ stable/11/sys/arm/ti/ti_machdep.c Tue Apr 3 06:06:39 2018 (r331907) @@ -124,5 +124,5 @@ static platform_method_t am335x_methods[] = { PLATFORMMETHOD_END, }; -FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am335x", 0); +FDT_PLATFORM_DEF(am335x, "am335x", 0, "ti,am33xx", 200); #endif