Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 11 May 2019 15:02:20 +0000 (UTC)
From:      Emmanuel Vadot <manu@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r347489 - head/sys/arm/allwinner/clkng
Message-ID:  <201905111502.x4BF2Kbh095546@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sat May 11 15:02:20 2019
New Revision: 347489
URL: https://svnweb.freebsd.org/changeset/base/347489

Log:
  allwinner: clk: prediv_mux: Init the current parent
  
  Do not init the first parent but read the clock register to find
  it's current parent and init this one.

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c	Sat May 11 14:22:21 2019	(r347488)
+++ head/sys/arm/allwinner/clkng/aw_clk_prediv_mux.c	Sat May 11 15:02:20 2019	(r347489)
@@ -75,7 +75,19 @@ struct aw_clk_prediv_mux_sc {
 static int
 aw_clk_prediv_mux_init(struct clknode *clk, device_t dev)
 {
-	clknode_init_parent_idx(clk, 0);
+	struct aw_clk_prediv_mux_sc *sc;
+	uint32_t val;
+
+	sc = clknode_get_softc(clk);
+
+	DEVICE_LOCK(clk);
+	READ4(clk, sc->offset, &val);
+	DEVICE_UNLOCK(clk);
+
+	/* Init the current parent */
+	val = (val & sc->mux_mask) >> sc->mux_shift;
+	clknode_init_parent_idx(clk, val);
+
 	return (0);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201905111502.x4BF2Kbh095546>