summaryrefslogtreecommitdiff
path: root/drivers/clk/stm32
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2023-12-15 13:33:11 -0500
committerTom Rini <trini@konsulko.com>2023-12-15 13:33:11 -0500
commitc936ef78704fa33afa71dfec347e8785bcb3d46c (patch)
treebbb4ca27e12343b541eaacabaeaa484f017a8aa5 /drivers/clk/stm32
parentd7a2c7ff7528653612dfeed175a127b1e691e855 (diff)
parent395507e50d7137e0bcfce74e1b4122e49d9984cb (diff)
Merge tag 'u-boot-stm32-20231215' of https://source.denx.de/u-boot/custodians/u-boot-stm into next
_ run savedefconfig on all STM32 defconfig STM32 MCU: _ Sync stm32f469-disco DT with Linux 6.5 _ rework ltdc node for stm32f769-disco _ clk: stm32f: Fix settings for LCD_CLK _ Support display on stm32f469-disco board STM32 MPU: _ stm32mp_dfu : Fix board_get_alt_info_mtd() _ stm32mp_dfu : Simplify MTD device parsing
Diffstat (limited to 'drivers/clk/stm32')
-rw-r--r--drivers/clk/stm32/clk-stm32f.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/clk/stm32/clk-stm32f.c b/drivers/clk/stm32/clk-stm32f.c
index ed7660196ef..d68c75ed201 100644
--- a/drivers/clk/stm32/clk-stm32f.c
+++ b/drivers/clk/stm32/clk-stm32f.c
@@ -522,17 +522,20 @@ static ulong stm32_set_rate(struct clk *clk, ulong rate)
/* get the current PLLSAIR output freq */
pllsair_rate = stm32_clk_get_pllsai_rate(priv, PLLSAIR);
- best_div = pllsair_rate / rate;
-
- /* look into pllsaidivr_table if this divider is available*/
- for (i = 0 ; i < sizeof(pllsaidivr_table); i++)
- if (best_div == pllsaidivr_table[i]) {
- /* set pll_saidivr with found value */
- clrsetbits_le32(&regs->dckcfgr,
- RCC_DCKCFGR_PLLSAIDIVR_MASK,
- pllsaidivr_table[i]);
- return rate;
- }
+ if ((pllsair_rate % rate) == 0) {
+ best_div = pllsair_rate / rate;
+
+ /* look into pllsaidivr_table if this divider is available */
+ for (i = 0 ; i < sizeof(pllsaidivr_table); i++)
+ if (best_div == pllsaidivr_table[i]) {
+ /* set pll_saidivr with found value */
+ clrsetbits_le32(&regs->dckcfgr,
+ RCC_DCKCFGR_PLLSAIDIVR_MASK,
+ pllsaidivr_table[i] <<
+ RCC_DCKCFGR_PLLSAIDIVR_SHIFT);
+ return rate;
+ }
+ }
/*
* As no pllsaidivr value is suitable to obtain requested freq,