clk: imx: Add some delay before deassert the reset
Subsystems (3)
PATCH 1/1 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.
--- drivers/clk/imx/clk-composite-7ulp.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/clk/imx/clk-composite-7ulp.c +7 -0
@@ -7,6 +7,7 @@#include <linux/bits.h> #include <linux/clk-provider.h> +#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/slab.h>
@@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)if (ret)return ret; +/* wait before release reset */ +udelay (1 ); +spin_lock_irqsave (gate->lock, flags);/* * release the sw reset for peripherals associated with
@@ -47,6 +51,9 @@ static int pcc_gate_enable(struct clk_hw *hw)spin_unlock_irqrestore (gate->lock, flags); +/* wait sync reset done */ +udelay (1 ); +return 0 ; }
Signature · 1 line
2.34.1
Frank Li
maintainerQuoted 5 lines · Jacky Bai
Some of the PCCs on i.MX8ULP have a
sw_rstbit 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.
Nit: wrap at 75 char.
Quoted 20 lines
Signed-off-by Jacky Bai <[email protected]>Reviewed-by Peng Fan <[email protected]>--- drivers/clk/imx/clk-composite-7ulp.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/clk/imx/clk-composite-7ulp.c +1
-0@@ -7,6 +7,7 @@#include <linux/bits.h> #include <linux/clk-provider.h> +#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/slab.h>
drivers/clk/imx/clk-composite-7ulp.c static int pcc_gate_enable(struct clk_hw *hw) · line 42
Quoted 6 lines
drivers/clk/imx/clk-composite-7ulp.c +3
-0@@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)if (ret)return ret; +/* wait before release reset */ +udelay (1 ); +
It is quite small value. udelay()'s implement is not necessary to access MMIO register space. (arm64 use cp15)
writel(val, gate->reg);
udelay(1); // it may less than 1us as what you expect, because previous write have not reach target place yet.
It needs a readl() before udelay(1) to make sure value actually reach to target place.
Frank
Quoted 16 lines
drivers/clk/imx/clk-composite-7ulp.c +3
-1spin_lock_irqsave (gate->lock, flags);/* * release the sw reset for peripherals associated with @@ -47,6 +51,9 @@ static int pcc_gate_enable(struct clk_hw *hw)spin_unlock_irqrestore (gate->lock, flags); +/* wait sync reset done */ +udelay (1 ); +return 0 ; } --2.34.1
Quoted 10 lines
Subject: Re: [PATCH] clk: imx: Add some delay before deassert the reset
Quoted 5 lines · Jacky Bai
Some of the PCCs on i.MX8ULP have a
sw_rstbit 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.Nit: wrap at 75 char.
Thx.
Quoted 25 lines
Quoted 25 lines
Signed-off-by Jacky Bai <[email protected]>Reviewed-by Peng Fan <[email protected]>--- drivers/clk/imx/clk-composite-7ulp.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/clk/imx/clk-composite-7ulp.c +1
-0@@ -7,6 +7,7 @@#include <linux/bits.h> #include <linux/clk-provider.h> +#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/slab.h> @@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)if (ret)return ret;
Quoted 7 lines
drivers/clk/imx/clk-composite-7ulp.c static int pcc_gate_enable(struct clk_hw *hw) · line 42
Quoted 3 lines
drivers/clk/imx/clk-composite-7ulp.c +3
-0+/* wait before release reset */ +udelay (1 ); +It is quite small value. udelay()'s implement is not necessary to access MMIO register space. (arm64 use cp15)
1us should be enough as the GPU IP reset propagation only need 128 cycle of its own clock(> 200MHz). the first udelay is to add some margin to make sure the GPU clock is stable.
Quoted 7 lines
writel(val, gate->reg);
udelay(1); // it may less than 1us as what you expect, because previous write have not reach target place yet.It needs a
readl()before udelay(1) to make sure value actually reach to target place.
Sure, will add this.
BR
Jacky Bai
Quoted 18 lines
Frank
Quoted 16 lines
drivers/clk/imx/clk-composite-7ulp.c +4
-1spin_lock_irqsave (gate->lock, flags);/* * release the sw reset for peripherals associated with @@ -47,6 +51,9 @@ static int pcc_gate_enable(struct clk_hw *hw) spin_unlock_irqrestore(gate->lock, flags); +/* wait sync reset done */ +udelay (1 ); +return 0 ; } -- 2.34.1
Quoted 47 lines · Jacky Bai
Quoted 11 lines
Subject: Re: [PATCH] clk: imx: Add some delay before deassert the reset
Quoted 5 lines · Jacky Bai
Some of the PCCs on i.MX8ULP have a
sw_rstbit 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.Nit: wrap at 75 char.
Thx.
Quoted 25 lines
Quoted 25 lines
Signed-off-by Jacky Bai <[email protected]>Reviewed-by Peng Fan <[email protected]>--- drivers/clk/imx/clk-composite-7ulp.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/clk/imx/clk-composite-7ulp.c +1
-0@@ -7,6 +7,7 @@#include <linux/bits.h> #include <linux/clk-provider.h> +#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/slab.h> @@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)if (ret)return ret;Quoted 7 lines
drivers/clk/imx/clk-composite-7ulp.c static int pcc_gate_enable(struct clk_hw *hw) · line 42
Quoted 3 lines
drivers/clk/imx/clk-composite-7ulp.c +3
-0+/* wait before release reset */ +udelay (1 ); +It is quite small value. udelay()'s implement is not necessary to access MMIO register space. (arm64 use cp15)
Quoted 10 lines
1us should be enough as the GPU IP reset propagation only need 128 cycle of its own clock(> 200MHz). the first udelay is to add some margin to make sure the GPU clock is stable.
Quoted 6 lines
writel(val, gate->reg);
udelay(1); // it may less than 1us as what you expect, because previous write have not reach target place yet.It needs a
readl()before udelay(1) to make sure value actually reach to target place.
I think we should capture this explanation in a comment above the udelay.
/* wait before release reset */ doesn't really tell much. We should explain *why*
a code change is needed. The *what* is obvious from the code.
thanks,
Daniel.
Quoted 62 lines
Subject: Re: [PATCH] clk: imx: Add some delay before deassert the reset
[You don't often get email from [email protected]. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Quoted 56 lines · Jacky Bai
Quoted 4 lines
Subject: Re: [PATCH] clk: imx: Add some delay before deassert the reset
Quoted 8 lines
Quoted 5 lines · Jacky Bai
Some of the PCCs on i.MX8ULP have a
sw_rstbit 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.Nit: wrap at 75 char.
Thx.
Quoted 25 lines
Quoted 25 lines
Signed-off-by Jacky Bai <[email protected]>Reviewed-by Peng Fan <[email protected]>--- drivers/clk/imx/clk-composite-7ulp.c | 7 +++++++ 1 file changed, 7 insertions(+)drivers/clk/imx/clk-composite-7ulp.c +1
-0@@ -7,6 +7,7 @@#include <linux/bits.h> #include <linux/clk-provider.h> +#include <linux/delay.h> #include <linux/err.h> #include <linux/io.h> #include <linux/slab.h> @@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)if (ret)return ret;Quoted 7 lines
drivers/clk/imx/clk-composite-7ulp.c static int pcc_gate_enable(struct clk_hw *hw) · line 42
Quoted 3 lines
drivers/clk/imx/clk-composite-7ulp.c +3
-0+/* wait before release reset */ +udelay (1 ); +It is quite small value. udelay()'s implement is not necessary to access MMIO register space. (arm64 use cp15)
1us should be enough as the GPU IP reset propagation only need 128 cycle of its own clock(> 200MHz). the first udelay is to add some margin to make sure the GPU clock is stable.
Quoted 4 lines
writel(val, gate->reg);
udelay(1); // it may less than 1us as what you expect, because previous write have not reach target place yet.
Quoted 8 lines
Quoted 2 lines
Quoted 2 lines
It needs a
readl()before udelay(1) to make sure value actually reach to target place.I think we should capture this explanation in a comment above the udelay.
/* wait before release reset */ doesn't really tell much. We should explain *why* a code change is needed. The *what* is obvious from the code.
Thx, will add some more comments for the details.
BR
Quoted 2 lines
thanks,
Daniel.