allwinner: clk: Correct aw_clk_get_factor
Switch test between zero based factor and power of two one. This resulted in a miscalculation of the factor if it was a power of two one. Some clocks frequencies were not calculated correctly because of that.
This commit is contained in:
parent
2ae63d9ae0
commit
bc71e06405
@ -110,10 +110,11 @@ aw_clk_get_factor(uint32_t val, struct aw_clk_factor *factor)
|
||||
return (factor->value);
|
||||
|
||||
factor_val = (val & factor->mask) >> factor->shift;
|
||||
if (!(factor->flags & AW_CLK_FACTOR_ZERO_BASED))
|
||||
factor_val += 1;
|
||||
else if (factor->flags & AW_CLK_FACTOR_POWER_OF_TWO)
|
||||
|
||||
if (factor->flags & AW_CLK_FACTOR_POWER_OF_TWO)
|
||||
factor_val = 1 << factor_val;
|
||||
else if (!(factor->flags & AW_CLK_FACTOR_ZERO_BASED))
|
||||
factor_val += 1;
|
||||
|
||||
return (factor_val);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user