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

Reply via email to