summaryrefslogtreecommitdiff
path: root/arch/arm/mach-imx/imx8ulp/clock.c
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2021-10-29 09:46:30 +0800
committerStefano Babic <sbabic@denx.de>2022-02-05 13:38:39 +0100
commitdc77d0f9fc0f31b591a7643b77b6162cb075a98d (patch)
treeb509804bac75fde3dbdc2fd9a314c8673a8e3046 /arch/arm/mach-imx/imx8ulp/clock.c
parent0f9b10aaba20696886477f29813d85f39ed32f3e (diff)
imx8ulp: clock: Handle the DDRLOCKED when setting DDR clock
The DDRLOCKED bit in CGC2 DDRCLK will auto lock up and down by HW according to DDR DIV updating or DDR CLK halt status change. So DDR PCC disable/enable will trigger the lock up/down flow. We need wait until unlock to ensure clock is ready. And before configuring the DDRCLK DIV, we need polling the DDRLOCKED until it is unlocked. Otherwise writing ti DIV bits will not set. Reviewed-by: Peng Fan <peng.fan@nxp.com> Signed-off-by: Ye Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
Diffstat (limited to 'arch/arm/mach-imx/imx8ulp/clock.c')
-rw-r--r--arch/arm/mach-imx/imx8ulp/clock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/arch/arm/mach-imx/imx8ulp/clock.c b/arch/arm/mach-imx/imx8ulp/clock.c
index 961702310cd..91580b2c29c 100644
--- a/arch/arm/mach-imx/imx8ulp/clock.c
+++ b/arch/arm/mach-imx/imx8ulp/clock.c
@@ -107,6 +107,9 @@ void init_clk_ddr(void)
/* enable ddr pcc */
writel(0xd0000000, PCC5_LPDDR4_ADDR);
+ /* Wait until ddrclk reg lock bit is cleared, so that the div update is finished */
+ cgc2_ddrclk_wait_unlock();
+
/* for debug */
/* setclkout_ddr(); */
}
@@ -144,6 +147,9 @@ int set_ddr_clk(u32 phy_freq_mhz)
return -EINVAL;
}
+ /* Wait until ddrclk reg lock bit is cleared, so that the div update is finished */
+ cgc2_ddrclk_wait_unlock();
+
return 0;
}