Skip to contentSkip to conversation

soc: imx: gpcv2: Assert reset before ungating clock

PATCH Applied Marek Vasut 4 participants 4 messages Aug 12, 2022 – Aug 21, 2022 Arm i.MX and Layerscape

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 soc: imx: gpcv2: Assert reset before ungating clock

In case the power domain clock are ungated before the reset is asserted, the system might freeze completely. This is likely due to a device is an undefined state being attached to bus, which sporadically leads to a bus hang. Assert the reset before the clock are enabled to assure the device is in defined state before being attached to bus.

Fixes fe58c887fb8ca ("soc: imx: gpcv2: add support for optional resets")

---
Cc: Fabio Estevam <[email protected]>
Cc: Frieder Schrempf <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Shawn Guo <[email protected]>
To: [email protected]
---
V2: - Always assert the reset before enabling clock
- Update commit message
- Add Fixes tag
V3: Move the extra delay past clk_prepare_enable()

---
 drivers/soc/imx/gpcv2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/soc/imx/gpcv2.c +4 -1
index 6383a4edc3607..88aee59730e39 100644
@@ -335,6 +335,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		}
 	}
 
+	reset_control_assert(domain->reset);
+
 	/* Enable reset clocks for all devices in the domain */
 	ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
 	if (ret) {
@@ -342,7 +344,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		goto out_regulator_disable;
 	}
 
-	reset_control_assert(domain->reset);
+	/* delays for reset to propagate */
+	udelay(5);
 
 	if (domain->bits.pxx) {
 		/* request the domain to power up */
Signature · 7 lines
2.35.1


_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Reviewed-by on v3 1/1
#1 lore raw

Hi Marek,

Quoted 8 lines · Marek Vasut

In case the power domain clock are ungated before the reset is asserted, the system might freeze completely. This is likely due to a device is an undefined state being attached to bus, which sporadically leads to a bus hang. Assert the reset before the clock are enabled to assure the device is in defined state before being attached to bus.

Fixes fe58c887fb8ca ("soc: imx: gpcv2: add support for optional resets")

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Reviewed-by on v3 1/1
#2 lore raw
In reply to Marek Vasut

Am Freitag, dem 12.08.2022 um 19:08 +0200 schrieb Marek Vasut:

Quoted 8 lines

In case the power domain clock are ungated before the reset is asserted, the system might freeze completely. This is likely due to a device is an undefined state being attached to bus, which sporadically leads to a bus hang. Assert the reset before the clock are enabled to assure the device is in defined state before being attached to bus.

Fixes fe58c887fb8ca ("soc: imx: gpcv2: add support for optional resets")
Quoted 31 lines

---
Cc: Fabio Estevam <[email protected]>
Cc: Frieder Schrempf <[email protected]>
Cc: Lucas Stach <[email protected]>
Cc: NXP Linux Team <[email protected]>
Cc: Peng Fan <[email protected]>
Cc: Shawn Guo <[email protected]>
To: [email protected]
---
V2: - Always assert the reset before enabling clock
- Update commit message
- Add Fixes tag
V3: Move the extra delay past clk_prepare_enable()

---
 drivers/soc/imx/gpcv2.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/soc/imx/gpcv2.c +2 -0
index 6383a4edc3607..88aee59730e39 100644
@@ -335,6 +335,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		}
 	}
 
+	reset_control_assert(domain->reset);
+
 	/* Enable reset clocks for all devices in the domain */
 	ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
 	if (ret) {

drivers/soc/imx/gpcv2.c static int imx_pgc_power_up(struct generic_pm_domain *genpd) · line 351

Quoted 9 lines
drivers/soc/imx/gpcv2.c +2 -1
@@ -342,7 +344,8 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		goto out_regulator_disable;
 	}
 
-	reset_control_assert(domain->reset);
+	/* delays for reset to propagate */
+	udelay(5);
 
 	if (domain->bits.pxx) {
 		/* request the domain to power up */

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

Applied
#3 lore raw
In reply to Marek Vasut
Quoted 8 lines · Marek Vasut

In case the power domain clock are ungated before the reset is asserted, the system might freeze completely. This is likely due to a device is an undefined state being attached to bus, which sporadically leads to a bus hang. Assert the reset before the clock are enabled to assure the device is in defined state before being attached to bus.

Fixes fe58c887fb8ca ("soc: imx: gpcv2: add support for optional resets")

Applied, thanks!

_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel