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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to