Skip to content

Commit c939154

Browse files
Chuan Liujbrun3t
authored andcommitted
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jerome Brunet <[email protected]>
1 parent eb61a12 commit c939154

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

drivers/clk/meson/clk-pll.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ static unsigned long __pll_params_to_rate(unsigned long parent_rate,
5757
struct meson_clk_pll_data *pll)
5858
{
5959
u64 rate = (u64)parent_rate * m;
60+
unsigned int frac_max = pll->frac_max ? pll->frac_max :
61+
(1 << pll->frac.width);
6062

6163
if (frac && MESON_PARM_APPLICABLE(&pll->frac)) {
6264
u64 frac_rate = (u64)parent_rate * frac;
6365

64-
rate += DIV_ROUND_UP_ULL(frac_rate,
65-
(1 << pll->frac.width));
66+
rate += DIV_ROUND_UP_ULL(frac_rate, frac_max);
6667
}
6768

6869
return DIV_ROUND_UP_ULL(rate, n);
@@ -100,7 +101,8 @@ static unsigned int __pll_params_with_frac(unsigned long rate,
100101
unsigned int n,
101102
struct meson_clk_pll_data *pll)
102103
{
103-
unsigned int frac_max = (1 << pll->frac.width);
104+
unsigned int frac_max = pll->frac_max ? pll->frac_max :
105+
(1 << pll->frac.width);
104106
u64 val = (u64)rate * n;
105107

106108
/* Bail out if we are already over the requested rate */

drivers/clk/meson/clk-pll.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ struct meson_clk_pll_data {
4343
unsigned int init_count;
4444
const struct pll_params_table *table;
4545
const struct pll_mult_range *range;
46+
unsigned int frac_max;
4647
u8 flags;
4748
};
4849

0 commit comments

Comments
 (0)