Skip to contentSkip to conversation

soc: ti: omap-prm: Fix external abort for am335x pruss

PATCH In review Tony Lindgren 2 participants 3 messages Sep 30, 2021 – Oct 6, 2021 TI Keystone multicore navigator drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 soc: ti: omap-prm: Fix external abort for am335x pruss

Starting with v5.15-rc1, we may now see some am335x beaglebone black device produce the following error on pruss probe:

Unhandled fault: external abort on non-linefetch (0x1008) at 0xe0326000

This has started with the enabling of pruss for am335x in the dts files.

Turns out the is caused by the PRM reset handling not waiting for the reset bit to clear. To fix the issue, let's always wait for the reset bit to clear, even if there is a separate reset status register.

We attempted to fix a similar issue for dra7 iva with a udelay() in commit effe89e40037 ("soc: ti: omap-prm: Fix occasional abort on reset deassert for dra7 iva"). There is no longer a need for the udelay() for dra7 iva reset either with the check added for reset bit clearing.

Cc Drew Fustini <[email protected]>
Cc Grygorii Strashko <[email protected]>
Cc "H. Nikolaus Schaller" <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Yongqin Liu <[email protected]>
Fixes effe89e40037 ("soc: ti: omap-prm: Fix occasional abort on reset deassert for dra7 iva")
---
 drivers/soc/ti/omap_prm.c | 27 +++++++++++++++------------
 1 file changed, 15 insertions(+), 12 deletions(-)
drivers/soc/ti/omap_prm.c +15 -12
@@ -825,25 +825,28 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev,
 	writel_relaxed(v, reset->prm->base + reset->prm->data->rstctrl);
 	spin_unlock_irqrestore(&reset->lock, flags);
 
-	if (!has_rstst)
-		goto exit;
+	/* wait for the reset bit to clear */
+	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
+						reset->prm->data->rstctrl,
+						v, !(v & BIT(id)), 1,
+						OMAP_RESET_MAX_WAIT);
+	if (ret)
+		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
+		       reset->prm->data->name, id);
 
 	/* wait for the status to be set */
-	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
+	if (has_rstst) {
+		ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
 						 reset->prm->data->rstst,
 						 v, v & BIT(st_bit), 1,
 						 OMAP_RESET_MAX_WAIT);
-	if (ret)
-		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
-		       reset->prm->data->name, id);
+		if (ret)
+			pr_err("%s: timedout waiting for %s:%lu\n", __func__,
+			       reset->prm->data->name, id);
+	}
 
-exit:
-	if (reset->clkdm) {
-		/* At least dra7 iva needs a delay before clkdm idle */
-		if (has_rstst)
-			udelay(1);
+	if (reset->clkdm)
 		pdata->clkdm_allow_idle(reset->clkdm);
-	}
 
 	return ret;
 }
Signature · 6 lines
2.33.0

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

Thanks Tony!

This was _much_ appreciated :)

Quoted 16 lines · Tony Lindgren

Starting with v5.15-rc1, we may now see some am335x beaglebone black device produce the following error on pruss probe:

Unhandled fault: external abort on non-linefetch (0x1008) at 0xe0326000

This has started with the enabling of pruss for am335x in the dts files.

Turns out the is caused by the PRM reset handling not waiting for the reset bit to clear. To fix the issue, let's always wait for the reset bit to clear, even if there is a separate reset status register.

We attempted to fix a similar issue for dra7 iva with a udelay() in commit effe89e40037 ("soc: ti: omap-prm: Fix occasional abort on reset deassert for dra7 iva"). There is no longer a need for the udelay() for dra7 iva reset either with the check added for reset bit clearing.

Quoted 7 lines
Cc Drew Fustini <[email protected]>
Cc Grygorii Strashko <[email protected]>
Cc "H. Nikolaus Schaller" <[email protected]>
Cc Robert Nelson <[email protected]>
Cc Yongqin Liu <[email protected]>
Fixes effe89e40037 ("soc: ti: omap-prm: Fix occasional abort on reset deassert for dra7 iva")
Quoted 12 lines
---
  drivers/soc/ti/omap_prm.c | 27 +++++++++++++++------------
  1 file changed, 15 insertions(+), 12 deletions(-)
drivers/soc/ti/omap_prm.c +0 -0
@@ -825,25 +825,28 @@ static int omap_reset_deassert(struct reset_controller_dev *rcdev,
  	writel_relaxed(v, reset->prm->base + reset->prm->data->rstctrl);
  	spin_unlock_irqrestore(&reset->lock, flags);
 

drivers/soc/ti/omap_prm.c static int omap_reset_deassert(struct reset_controller_dev *rcdev, · line 835

Quoted 10 lines
drivers/soc/ti/omap_prm.c +8 -2
-	if (!has_rstst)
-		goto exit;
+	/* wait for the reset bit to clear */
+	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
+						reset->prm->data->rstctrl,
+						v, !(v & BIT(id)), 1,
+						OMAP_RESET_MAX_WAIT);
+	if (ret)
+		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
+		       reset->prm->data->name, id);

If I was writing this I might drop the __func__. AFAIR dyndbg allows enabling the functipn names to be printed by +f. This is just a 'nit' though - I am happy if this fix gets in no matter how this print eventually looks like. I just thought I mention this as the __func__ catched my eye.

Quoted 4 lines
drivers/soc/ti/omap_prm.c +1 -1
  	/* wait for the status to be set */
-	ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
+	if (has_rstst) {

drivers/soc/ti/omap_prm.c static int omap_reset_deassert(struct reset_controller_dev *rcdev, · line 845

Quoted 10 lines
drivers/soc/ti/omap_prm.c +4 -3
+		ret = readl_relaxed_poll_timeout_atomic(reset->prm->base +
  						 reset->prm->data->rstst,
  						 v, v & BIT(st_bit), 1,
  						 OMAP_RESET_MAX_WAIT);
-	if (ret)
-		pr_err("%s: timedout waiting for %s:%lu\n", __func__,
-		       reset->prm->data->name, id);
+		if (ret)
+			pr_err("%s: timedout waiting for %s:%lu\n", __func__,
+			       reset->prm->data->name, id);

Same here (although that would be unrelated change as the print exists prior this patch).

I tested this patch on v5.15-rc3 using my BBB Rev C - it seems to fix the boot issue on my board! Thanks a bunch!

Best Regards
--Matti Vaittinen

#2 lore raw
Quoted 3 lines · Matti Vaittinen

Thanks Tony!

This was _much_ appreciated :)

Thanks for testing, applying this into fixes.

Regards,

Tony