From owner-svn-src-all@freebsd.org Thu Aug 30 14:32:48 2018 Return-Path: Delivered-To: svn-src-all@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 C67C010A0394; Thu, 30 Aug 2018 14:32:48 +0000 (UTC) (envelope-from manu@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 7B50283A05; Thu, 30 Aug 2018 14:32:48 +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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 443665D0F; Thu, 30 Aug 2018 14:32:48 +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 w7UEWmjK080639; Thu, 30 Aug 2018 14:32:48 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w7UEWmgA080638; Thu, 30 Aug 2018 14:32:48 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201808301432.w7UEWmgA080638@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 30 Aug 2018 14:32:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r338398 - head/sys/arm/ti/omap4 X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/ti/omap4 X-SVN-Commit-Revision: 338398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 30 Aug 2018 14:32:49 -0000 Author: manu Date: Thu Aug 30 14:32:47 2018 New Revision: 338398 URL: https://svnweb.freebsd.org/changeset/base/338398 Log: omap4_prcm: Delay the frequencies read check Same as r333305, with Linux 4.17 dts the compatible for the prcm added 'simplebus', it mean that the simplebus driver will attach to it at the BUS_PASS_BUS pass. Change the pass for the prcm driver to be at BUS_PASS_BUS so we will win the attach. This introduce a problem as this driver needs the omap_scm one to be already attached. omap_scm also attach at BUS_PASS_BUS but after the prcm one as it is after in the dtb and the simplebus driver simpy walk the tree to attach it's children. Use the bus_new_pass method to defer the frequencies read at BUS_PASS_TIMER. This fixes booting on pandaboard Approved by: re (rgrimes) Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c Modified: head/sys/arm/ti/omap4/omap4_prcm_clks.c ============================================================================== --- head/sys/arm/ti/omap4/omap4_prcm_clks.c Thu Aug 30 14:32:10 2018 (r338397) +++ head/sys/arm/ti/omap4/omap4_prcm_clks.c Thu Aug 30 14:32:47 2018 (r338398) @@ -176,6 +176,7 @@ struct omap4_prcm_softc { struct resource *sc_res; int sc_rid; int sc_instance; + int attach_done; }; static int omap4_clk_generic_activate(struct ti_clock_dev *clkdev); @@ -1446,10 +1447,8 @@ static int omap4_prcm_attach(device_t dev) { struct omap4_prcm_softc *sc; - unsigned int freq; const struct ofw_compat_data *ocd; - sc = device_get_softc(dev); ocd = ofw_bus_search_compatible(dev, compat_data); sc->sc_instance = (int)ocd->ocd_data; @@ -1463,6 +1462,22 @@ omap4_prcm_attach(device_t dev) ti_cpu_reset = omap4_prcm_reset; + return (0); +} + +static void +omap4_prcm_new_pass(device_t dev) +{ + struct omap4_prcm_softc *sc = device_get_softc(dev); + unsigned int freq; + + if (sc->attach_done || + bus_current_pass < (BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY)) { + bus_generic_new_pass(dev); + return; + } + sc->attach_done = 1; + /* * In order to determine ARM frequency we need both RPM and CM1 * instances up and running. So wait until all CRM devices are @@ -1473,12 +1488,16 @@ omap4_prcm_attach(device_t dev) arm_tmr_change_frequency(freq / 2); } - return (0); + return; } static device_method_t omap4_prcm_methods[] = { DEVMETHOD(device_probe, omap4_prcm_probe), DEVMETHOD(device_attach, omap4_prcm_attach), + + /* Bus interface */ + DEVMETHOD(bus_new_pass, omap4_prcm_new_pass), + {0, 0}, }; @@ -1491,5 +1510,5 @@ static driver_t omap4_prcm_driver = { static devclass_t omap4_prcm_devclass; EARLY_DRIVER_MODULE(omap4_prcm, simplebus, omap4_prcm_driver, - omap4_prcm_devclass, 0, 0, BUS_PASS_TIMER + BUS_PASS_ORDER_EARLY); + omap4_prcm_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); MODULE_VERSION(omap4_prcm, 1);