Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2019 19:28:47 +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: r344893 - head/sys/arm/allwinner/clkng
Message-ID:  <201903071928.x27JSldR018168@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: manu
Date: Thu Mar  7 19:28:47 2019
New Revision: 344893
URL: https://svnweb.freebsd.org/changeset/base/344893

Log:
  arm: allwinner: Fix NM clock recalc
  
  If the NM clock is using a fractional divider the formula isn't the same.

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

Modified: head/sys/arm/allwinner/clkng/aw_clk_nm.c
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk_nm.c	Thu Mar  7 18:57:43 2019	(r344892)
+++ head/sys/arm/allwinner/clkng/aw_clk_nm.c	Thu Mar  7 19:28:47 2019	(r344893)
@@ -300,7 +300,11 @@ aw_clk_nm_recalc(struct clknode *clk, uint64_t *freq)
 		else
 			prediv = 1;
 
-		*freq = *freq / prediv / n / m;
+		/* For FRAC NM the formula is freq_parent * n / m */
+		if (sc->flags & AW_CLK_HAS_FRAC)
+			*freq = *freq * n / m;
+		else
+			*freq = *freq / prediv / n / m;
 	}
 
 	return (0);



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