From owner-svn-src-stable@freebsd.org Fri Dec 9 21:17:41 2016 Return-Path: Delivered-To: svn-src-stable@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 98B4CC6F19E; Fri, 9 Dec 2016 21:17:41 +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 4F59CC56; Fri, 9 Dec 2016 21:17:41 +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 uB9LHekx069911; Fri, 9 Dec 2016 21:17:40 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uB9LHexT069910; Fri, 9 Dec 2016 21:17:40 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201612092117.uB9LHexT069910@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 9 Dec 2016 21:17:40 +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: r309771 - stable/11/sys/arm/allwinner/clk X-SVN-Group: stable-11 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.23 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: Fri, 09 Dec 2016 21:17:41 -0000 Author: manu Date: Fri Dec 9 21:17:40 2016 New Revision: 309771 URL: https://svnweb.freebsd.org/changeset/base/309771 Log: MFC r302785, r308300, r308441 r302785 (jmcneill): H3/A83T: Use PLL_PERIPH/2 for AHB2 parent clock. Reviewed by: manu r308300: For AHB clock we need to set the assigned parents for cpufreq(4) to work. r308441: Do not fail to attach the clock if we cannot set the assigned parents as this property isn't mandatory. Modified: stable/11/sys/arm/allwinner/clk/aw_ahbclk.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm/allwinner/clk/aw_ahbclk.c ============================================================================== --- stable/11/sys/arm/allwinner/clk/aw_ahbclk.c Fri Dec 9 21:07:03 2016 (r309770) +++ stable/11/sys/arm/allwinner/clk/aw_ahbclk.c Fri Dec 9 21:17:40 2016 (r309771) @@ -140,10 +140,14 @@ aw_ahbclk_init(struct clknode *clk, devi A83T_AHB1_CLK_SRC_SEL_SHIFT; break; case AW_H3_AHB2: + /* Set source to PLL_PERIPH/2 */ + index = H3_AHB2_CLK_CFG_PLL_PERIPH_DIV2; DEVICE_LOCK(sc); AHBCLK_READ(sc, &val); + val &= ~H3_AHB2_CLK_CFG; + val |= (index << H3_AHB2_CLK_CFG_SHIFT); + AHBCLK_WRITE(sc, val); DEVICE_UNLOCK(sc); - index = (val & H3_AHB2_CLK_CFG) >> H3_AHB2_CLK_CFG_SHIFT; break; default: return (ENXIO); @@ -189,12 +193,7 @@ aw_ahbclk_recalc_freq(struct clknode *cl pre_div = 1; break; case AW_H3_AHB2: - src_sel = (val & H3_AHB2_CLK_CFG) >> H3_AHB2_CLK_CFG_SHIFT; - if (src_sel == H3_AHB2_CLK_CFG_PLL_PERIPH_DIV2) - div = 2; - else - div = 1; - pre_div = 1; + div = pre_div = 1; break; default: div = 1 << ((val & A10_AHB_CLK_DIV_RATIO) >> @@ -351,6 +350,12 @@ aw_ahbclk_attach(device_t dev) goto fail; } + error = clk_set_assigned(dev, node); + if (error != 0 && error != ENOENT) { + device_printf(dev, "cannot set assigned parents: %d\n", error); + goto fail; + } + if (bootverbose) clkdom_dump(clkdom);