Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

clk: meson: Support PLL with fixed fractional denominators

Some PLLS with fractional multipliers have fractional denominators with
fixed values, instead of the previous "(1 << pll-> frc.width)".

Signed-off-by: Chuan Liu <chuan.liu@amlogic.com>
Link: https://lore.kernel.org/r/20240909-fix_clk-v3-1-a6d8f6333c04@amlogic.com
Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>

authored by

Chuan Liu and committed by
Jerome Brunet
c939154e eb61a126

+6 -3
+5 -3
drivers/clk/meson/clk-pll.c
··· 57 57 struct meson_clk_pll_data *pll) 58 58 { 59 59 u64 rate = (u64)parent_rate * m; 60 + unsigned int frac_max = pll->frac_max ? pll->frac_max : 61 + (1 << pll->frac.width); 60 62 61 63 if (frac && MESON_PARM_APPLICABLE(&pll->frac)) { 62 64 u64 frac_rate = (u64)parent_rate * frac; 63 65 64 - rate += DIV_ROUND_UP_ULL(frac_rate, 65 - (1 << pll->frac.width)); 66 + rate += DIV_ROUND_UP_ULL(frac_rate, frac_max); 66 67 } 67 68 68 69 return DIV_ROUND_UP_ULL(rate, n); ··· 101 100 unsigned int n, 102 101 struct meson_clk_pll_data *pll) 103 102 { 104 - unsigned int frac_max = (1 << pll->frac.width); 103 + unsigned int frac_max = pll->frac_max ? pll->frac_max : 104 + (1 << pll->frac.width); 105 105 u64 val = (u64)rate * n; 106 106 107 107 /* Bail out if we are already over the requested rate */
+1
drivers/clk/meson/clk-pll.h
··· 43 43 unsigned int init_count; 44 44 const struct pll_params_table *table; 45 45 const struct pll_mult_range *range; 46 + unsigned int frac_max; 46 47 u8 flags; 47 48 }; 48 49