linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset()
@ 2023-08-21 14:24 Julien Panis
  2023-08-22  9:27 ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Julien Panis @ 2023-08-21 14:24 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: linux-omap, linux-kernel, vigneshr, Julien Panis

The am335x-evm started producing boot errors because of subtle timing
changes:

Unhandled fault: external abort on non-linefetch (0x1008) at 0xf03c1010
...
sysc_reset from sysc_probe+0xf60/0x1514
sysc_probe from platform_probe+0x5c/0xbc
...

The fix consists in using the appropriate sleep function in sysc reset.
For flexible sleeping, fsleep is recommended. Here, sysc delay parameter
can take any value in [0 - 255] us range. As a result, fsleep() should
be used, calling udelay() for a sysc delay lower than 10 us.

Signed-off-by: Julien Panis <jpanis@baylibre.com>
Fixes: e709ed70d122 ("bus: ti-sysc: Fix missing reset delay handling")
---
Fix boot errors for am335x-evm in sysc_reset(), by using fsleep() instead
of usleep_range() function. Thus, udelay() will be called if the configured
sysc delay is lower than 10 us (which is usually the case, since the value
set in the device tree is currently 2 us).
---
 drivers/bus/ti-sysc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index 4cb23b9e06ea..59b8bdd9203e 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -2147,8 +2147,7 @@ static int sysc_reset(struct sysc *ddata)
 	}
 
 	if (ddata->cfg.srst_udelay)
-		usleep_range(ddata->cfg.srst_udelay,
-			     ddata->cfg.srst_udelay * 2);
+		fsleep(ddata->cfg.srst_udelay);
 
 	if (ddata->post_reset_quirk)
 		ddata->post_reset_quirk(ddata);

---
base-commit: f7757129e3dea336c407551c98f50057c22bb266
change-id: 20230821-fix-ti-sysc-reset-5c164051345b

Best regards,
-- 
Julien Panis <jpanis@baylibre.com>


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset()
  2023-08-21 14:24 [PATCH] bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset() Julien Panis
@ 2023-08-22  9:27 ` Tony Lindgren
  2023-09-13  8:27   ` Tony Lindgren
  0 siblings, 1 reply; 3+ messages in thread
From: Tony Lindgren @ 2023-08-22  9:27 UTC (permalink / raw)
  To: Julien Panis; +Cc: linux-omap, linux-kernel, vigneshr

* Julien Panis <jpanis@baylibre.com> [230821 14:24]:
> The am335x-evm started producing boot errors because of subtle timing
> changes:
> 
> Unhandled fault: external abort on non-linefetch (0x1008) at 0xf03c1010
> ...
> sysc_reset from sysc_probe+0xf60/0x1514
> sysc_probe from platform_probe+0x5c/0xbc
> ...
> 
> The fix consists in using the appropriate sleep function in sysc reset.
> For flexible sleeping, fsleep is recommended. Here, sysc delay parameter
> can take any value in [0 - 255] us range. As a result, fsleep() should
> be used, calling udelay() for a sysc delay lower than 10 us.
> 
> Signed-off-by: Julien Panis <jpanis@baylibre.com>
> Fixes: e709ed70d122 ("bus: ti-sysc: Fix missing reset delay handling")
> ---
> Fix boot errors for am335x-evm in sysc_reset(), by using fsleep() instead
> of usleep_range() function. Thus, udelay() will be called if the configured
> sysc delay is lower than 10 us (which is usually the case, since the value
> set in the device tree is currently 2 us).

OK, interesting. Yeah I've only ever seen values of 2 us needed here.

Regards,

Tony

> ---
>  drivers/bus/ti-sysc.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
> index 4cb23b9e06ea..59b8bdd9203e 100644
> --- a/drivers/bus/ti-sysc.c
> +++ b/drivers/bus/ti-sysc.c
> @@ -2147,8 +2147,7 @@ static int sysc_reset(struct sysc *ddata)
>  	}
>  
>  	if (ddata->cfg.srst_udelay)
> -		usleep_range(ddata->cfg.srst_udelay,
> -			     ddata->cfg.srst_udelay * 2);
> +		fsleep(ddata->cfg.srst_udelay);
>  
>  	if (ddata->post_reset_quirk)
>  		ddata->post_reset_quirk(ddata);
> 
> ---
> base-commit: f7757129e3dea336c407551c98f50057c22bb266
> change-id: 20230821-fix-ti-sysc-reset-5c164051345b
> 
> Best regards,
> -- 
> Julien Panis <jpanis@baylibre.com>
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset()
  2023-08-22  9:27 ` Tony Lindgren
@ 2023-09-13  8:27   ` Tony Lindgren
  0 siblings, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2023-09-13  8:27 UTC (permalink / raw)
  To: Julien Panis; +Cc: linux-omap, linux-kernel, vigneshr

* Tony Lindgren <tony@atomide.com> [230822 09:27]:
> * Julien Panis <jpanis@baylibre.com> [230821 14:24]:
> > The am335x-evm started producing boot errors because of subtle timing
> > changes:
> > 
> > Unhandled fault: external abort on non-linefetch (0x1008) at 0xf03c1010
> > ...
> > sysc_reset from sysc_probe+0xf60/0x1514
> > sysc_probe from platform_probe+0x5c/0xbc
> > ...
> > 
> > The fix consists in using the appropriate sleep function in sysc reset.
> > For flexible sleeping, fsleep is recommended. Here, sysc delay parameter
> > can take any value in [0 - 255] us range. As a result, fsleep() should
> > be used, calling udelay() for a sysc delay lower than 10 us.
> > 
> > Signed-off-by: Julien Panis <jpanis@baylibre.com>
> > Fixes: e709ed70d122 ("bus: ti-sysc: Fix missing reset delay handling")
> > ---
> > Fix boot errors for am335x-evm in sysc_reset(), by using fsleep() instead
> > of usleep_range() function. Thus, udelay() will be called if the configured
> > sysc delay is lower than 10 us (which is usually the case, since the value
> > set in the device tree is currently 2 us).
> 
> OK, interesting. Yeah I've only ever seen values of 2 us needed here.

Applied into fixes thanks

Tony

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-09-13  8:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21 14:24 [PATCH] bus: ti-sysc: Use fsleep() instead of usleep_range() in sysc_reset() Julien Panis
2023-08-22  9:27 ` Tony Lindgren
2023-09-13  8:27   ` Tony Lindgren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).