From: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Date: Sat, 11 Nov 2023 10:46:18 +0000 (+0100)
Subject: clk: stm32f: fix setting of division factor for LCD_CLK
X-Git-Tag: v2025.01-rc5-pxa1908~579^2~31^2~10
X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=bd6eb5ddd715e7441d804c67f434418e172a1423;p=u-boot.git

clk: stm32f: fix setting of division factor for LCD_CLK

The value to be written to the register must be appropriately shifted,
as is correctly done in other parts of the code.

Fixes: 5e993508cb25 ("clk: clk_stm32f: Add set_rate for LTDC clock")
Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

diff --git a/drivers/clk/stm32/clk-stm32f.c b/drivers/clk/stm32/clk-stm32f.c
index ed7660196e..4c18641933 100644
--- a/drivers/clk/stm32/clk-stm32f.c
+++ b/drivers/clk/stm32/clk-stm32f.c
@@ -530,7 +530,8 @@ static ulong stm32_set_rate(struct clk *clk, ulong rate)
 			/* set pll_saidivr with found value */
 			clrsetbits_le32(&regs->dckcfgr,
 					RCC_DCKCFGR_PLLSAIDIVR_MASK,
-					pllsaidivr_table[i]);
+					pllsaidivr_table[i] <<
+					RCC_DCKCFGR_PLLSAIDIVR_SHIFT);
 			return rate;
 		}