Skip to content

Commit 25b4763

Browse files
JackyBaiabelvesa
authored andcommitted
clk: imx: Add some delay before deassert the reset
Some of the PCCs on i.MX8ULP have a sw_rst bit to control the peripheral reset through SW method. For peripherals like GPU that need sync reset, some delay is necessary befere & after release the reset to make sure the HW is reset into a known status. So add some delay before & after release reset. Signed-off-by: Jacky Bai <ping.bai@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com> Link: https://lore.kernel.org/r/20250801072153.1974428-1-ping.bai@nxp.com Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
1 parent 3a86608 commit 25b4763

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

drivers/clk/imx/clk-composite-7ulp.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include <linux/bits.h>
99
#include <linux/clk-provider.h>
10+
#include <linux/delay.h>
1011
#include <linux/err.h>
1112
#include <linux/io.h>
1213
#include <linux/slab.h>
@@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)
3637
if (ret)
3738
return ret;
3839

40+
/* Make sure the IP's clock is ready before release reset */
41+
udelay(1);
42+
3943
spin_lock_irqsave(gate->lock, flags);
4044
/*
4145
* release the sw reset for peripherals associated with
@@ -47,6 +51,15 @@ static int pcc_gate_enable(struct clk_hw *hw)
4751

4852
spin_unlock_irqrestore(gate->lock, flags);
4953

54+
/*
55+
* Read back the register to make sure the previous write has been
56+
* done in the target HW register. For IP like GPU, after deassert
57+
* the reset, need to wait for a while to make sure the sync reset
58+
* is done
59+
*/
60+
readl(gate->reg);
61+
udelay(1);
62+
5063
return 0;
5164
}
5265

0 commit comments

Comments
 (0)