Skip to content

Commit 37cfd5e

Browse files
Marco Felschabelvesa
authored andcommitted
clk: imx: pll14xx: align pdiv with reference manual
The PLL14xx hardware can be found on i.MX8M{M,N,P} SoCs and always come with a 6-bit pre-divider. Neither the reference manuals nor the datasheets of these SoCs do mention any restrictions. Furthermore the current code doesn't respect the restrictions from the comment too. Therefore drop the restriction and align the max pre-divider (pdiv) value to 63 to get more accurate frequencies. Fixes: b09c68d ("clk: imx: pll14xx: Support dynamic rates") Cc: stable@vger.kernel.org Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Reviewed-by: Abel Vesa <abel.vesa@linaro.org> Reviewed-by: Adam Ford <aford173@gmail.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Acked-by: Sascha Hauer <s.hauer@pengutronix.de> Tested-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.kernel.org/r/20230807084744.1184791-1-m.felsch@pengutronix.de Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
1 parent 4dd432d commit 37cfd5e

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

drivers/clk/imx/clk-pll14xx.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,11 +139,10 @@ static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rat
139139
/*
140140
* Fractional PLL constrains:
141141
*
142-
* a) 6MHz <= prate <= 25MHz
143-
* b) 1 <= p <= 63 (1 <= p <= 4 prate = 24MHz)
144-
* c) 64 <= m <= 1023
145-
* d) 0 <= s <= 6
146-
* e) -32768 <= k <= 32767
142+
* a) 1 <= p <= 63
143+
* b) 64 <= m <= 1023
144+
* c) 0 <= s <= 6
145+
* d) -32768 <= k <= 32767
147146
*
148147
* fvco = (m * 65536 + k) * prate / (p * 65536)
149148
*/
@@ -186,7 +185,7 @@ static void imx_pll14xx_calc_settings(struct clk_pll14xx *pll, unsigned long rat
186185
}
187186

188187
/* Finally calculate best values */
189-
for (pdiv = 1; pdiv <= 7; pdiv++) {
188+
for (pdiv = 1; pdiv <= 63; pdiv++) {
190189
for (sdiv = 0; sdiv <= 6; sdiv++) {
191190
/* calc mdiv = round(rate * pdiv * 2^sdiv) / prate) */
192191
mdiv = DIV_ROUND_CLOSEST(rate * (pdiv << sdiv), prate);

0 commit comments

Comments
 (0)