Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 23 Jun 2018 15:03:54 +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: r335581 - head/sys/arm/allwinner/clkng
Message-ID:  <201806231503.w5NF3sN0053054@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Sat Jun 23 15:03:54 2018
New Revision: 335581
URL: https://svnweb.freebsd.org/changeset/base/335581

Log:
  allwinner: clkng: Correct mux width and flags
  
  The test for checking if the clock have a mux was inverted and the mask
  to calculate the parent index was wrong was wrong too.
  It means that upon creation the incorrect parent was resolved as the current
  one and upon reparent the switch was never made.
  
  Pointy hat (lots of them): manu

Modified:
  head/sys/arm/allwinner/clkng/aw_clk_nkmp.c
  head/sys/arm/allwinner/clkng/aw_clk_nm.c

Modified: head/sys/arm/allwinner/clkng/aw_clk_nkmp.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk_nkmp.c	Sat Jun 23 10:41:52 2018	(r335580)
+++ head/sys/arm/allwinner/clkng/aw_clk_nkmp.c	Sat Jun 23 15:03:54 2018	(r335581)
@@ -128,12 +128,12 @@ aw_clk_nkmp_set_mux(struct clknode *clk, int index)
 
 	sc = clknode_get_softc(clk);
 
-	if ((sc->flags & AW_CLK_HAS_MUX) != 0)
+	if ((sc->flags & AW_CLK_HAS_MUX) == 0)
 		return (0);
 
 	DEVICE_LOCK(clk);
 	READ4(clk, sc->offset, &val);
-	val &= ~(sc->mux_mask >> sc->mux_shift);
+	val &= ~sc->mux_mask;
 	val |= index << sc->mux_shift;
 	WRITE4(clk, sc->offset, val);
 	DEVICE_UNLOCK(clk);

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk_nm.c	Sat Jun 23 10:41:52 2018	(r335580)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.c	Sat Jun 23 15:03:54 2018	(r335581)
@@ -125,12 +125,12 @@ aw_clk_nm_set_mux(struct clknode *clk, int index)
 
 	sc = clknode_get_softc(clk);
 
-	if ((sc->flags & AW_CLK_HAS_MUX) != 0)
+	if ((sc->flags & AW_CLK_HAS_MUX) == 0)
 		return (0);
 
 	DEVICE_LOCK(clk);
 	READ4(clk, sc->offset, &val);
-	val &= ~(sc->mux_mask >> sc->mux_shift);
+	val &= ~sc->mux_mask;
 	val |= index << sc->mux_shift;
 	WRITE4(clk, sc->offset, val);
 	DEVICE_UNLOCK(clk);



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