Skip to contentSkip to conversation

soc: imx: gpcv2: Assert reset before ungating clock

PATCH Superseded Marek Vasut 2 participants 2 messages Aug 2, 2022 – Aug 10, 2022 Arm i.MX and Layerscape

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 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

---
 drivers/soc/imx/gpcv2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/imx/gpcv2.c +5 -2
index 85aa86e1338af..f38a4420e94a6 100644
@@ -333,6 +333,11 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		}
 	}
 
+	reset_control_assert(domain->reset);
+
+	/* delays for reset to propagate */
+	udelay(5);
+
 	/* Enable reset clocks for all devices in the domain */
 	ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
 	if (ret) {
@@ -340,8 +345,6 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		goto out_regulator_disable;
 	}
 
-	reset_control_assert(domain->reset);
-
 	if (domain->bits.pxx) {
 		/* request the domain to power up */
 		regmap_update_bits(domain->regmap, domain->regs->pup,
Signature · 7 lines
2.35.1


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

Am Mittwoch, dem 03.08.2022 um 01:37 +0200 schrieb Marek Vasut:

Quoted 28 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")
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

---
 drivers/soc/imx/gpcv2.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/soc/imx/gpcv2.c +0 -0
index 85aa86e1338af..f38a4420e94a6 100644

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

Quoted 8 lines
drivers/soc/imx/gpcv2.c +5 -0
@@ -333,6 +333,11 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		}
 	}
 
+	reset_control_assert(domain->reset);
+
+	/* delays for reset to propagate */
+	udelay(5);
+

Most peripheral resets in the i.MX are synchronous, so they won't propagate without the clocks being enabled. If this delay is really necessary, it should be placed after the clock enable below.

Regards,
Lucas

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

Quoted 12 lines
drivers/soc/imx/gpcv2.c +0 -2
 	/* Enable reset clocks for all devices in the domain */
 	ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks);
 	if (ret) {
@@ -340,8 +345,6 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 		goto out_regulator_disable;
 	}
 
-	reset_control_assert(domain->reset);
-
 	if (domain->bits.pxx) {
 		/* request the domain to power up */
 		regmap_update_bits(domain->regmap, domain->regs->pup,

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