Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Jun 2018 17:36:02 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r335162 - head/sys/arm/allwinner/clkng
Message-ID:  <201806141736.w5EHa2kB004085@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Thu Jun 14 17:36:02 2018
New Revision: 335162
URL: https://svnweb.freebsd.org/changeset/base/335162

Log:
  aw_ccung: Support clock factors where factor=0, factor is effectively 1
  
  This happens in two cases for a20 clocks:
  
  pll_core for 'n' factor:
  factor=0, val=1
  factor=n, val=n
  
  ahb divisor:
  factor=0,val=/2
  factor=n,val=/2^n
  
  Reviewed by:	manu
  Differential Revision:	https://reviews.freebsd.org/D15806

Modified:
  head/sys/arm/allwinner/clkng/aw_clk.h

Modified: head/sys/arm/allwinner/clkng/aw_clk.h
==============================================================================
--- head/sys/arm/allwinner/clkng/aw_clk.h	Thu Jun 14 17:32:23 2018	(r335161)
+++ head/sys/arm/allwinner/clkng/aw_clk.h	Thu Jun 14 17:36:02 2018	(r335162)
@@ -72,6 +72,7 @@ struct aw_clk_init {
 #define	AW_CLK_FACTOR_ZERO_BASED	0x0002
 #define	AW_CLK_FACTOR_HAS_COND		0x0004
 #define	AW_CLK_FACTOR_FIXED		0x0008
+#define	AW_CLK_FACTOR_ZERO_IS_ONE	0x0010
 
 struct aw_clk_factor {
 	uint32_t	shift;		/* Shift bits for the factor */
@@ -110,6 +111,8 @@ aw_clk_get_factor(uint32_t val, struct aw_clk_factor *
 		return (factor->value);
 
 	factor_val = (val & factor->mask) >> factor->shift;
+	if (factor_val == 0 && (factor->flags & AW_CLK_FACTOR_ZERO_IS_ONE))
+		factor_val = 1;
 
 	if (factor->flags & AW_CLK_FACTOR_POWER_OF_TWO)
 		factor_val = 1 << factor_val;



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