mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] phy: stm32-usphyc: add mdelay(1) to fix timeout on some machines
@ 2023-01-24 20:31 Michael Grzeschik
  2023-01-26  8:15 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Grzeschik @ 2023-01-24 20:31 UTC (permalink / raw)
  To: barebox

An mdelay of 1 seems to be necessary on some machines, since
the monsel status does not seem to be accurate. On rare occasions just
working with the phy after this pll check lead to no functional usb.
With this short mdelay this issue was not reported again.

Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---
 drivers/phy/phy-stm32-usbphyc.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
index 657824405f..aff6b60d5e 100644
--- a/drivers/phy/phy-stm32-usbphyc.c
+++ b/drivers/phy/phy-stm32-usbphyc.c
@@ -271,6 +271,15 @@ static int stm32_usbphyc_phy_init(struct phy *phy)
 		goto pll_disable;
 	}
 
+	/* This is a workaround that seems to be necessary on some
+	 * machines, since the monsel status does not seem to be
+	 * accurate. On rare occasions just working with the phy after
+	 * this pll check the usb peripheral (e.g. on the dwc2) run into
+	 * timeout issues and leading to no functional usb. With this
+	 * short mdelay this issue was not reported again.
+	 */
+	mdelay(1);
+
 	usbphyc_phy->active = true;
 
 	return 0;
-- 
2.30.2




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

* Re: [PATCH] phy: stm32-usphyc: add mdelay(1) to fix timeout on some machines
  2023-01-24 20:31 [PATCH] phy: stm32-usphyc: add mdelay(1) to fix timeout on some machines Michael Grzeschik
@ 2023-01-26  8:15 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-01-26  8:15 UTC (permalink / raw)
  To: Michael Grzeschik; +Cc: barebox

On Tue, Jan 24, 2023 at 09:31:19PM +0100, Michael Grzeschik wrote:
> An mdelay of 1 seems to be necessary on some machines, since
> the monsel status does not seem to be accurate. On rare occasions just
> working with the phy after this pll check lead to no functional usb.
> With this short mdelay this issue was not reported again.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
>  drivers/phy/phy-stm32-usbphyc.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Applied, thanks

Sascha

> 
> diff --git a/drivers/phy/phy-stm32-usbphyc.c b/drivers/phy/phy-stm32-usbphyc.c
> index 657824405f..aff6b60d5e 100644
> --- a/drivers/phy/phy-stm32-usbphyc.c
> +++ b/drivers/phy/phy-stm32-usbphyc.c
> @@ -271,6 +271,15 @@ static int stm32_usbphyc_phy_init(struct phy *phy)
>  		goto pll_disable;
>  	}
>  
> +	/* This is a workaround that seems to be necessary on some
> +	 * machines, since the monsel status does not seem to be
> +	 * accurate. On rare occasions just working with the phy after
> +	 * this pll check the usb peripheral (e.g. on the dwc2) run into
> +	 * timeout issues and leading to no functional usb. With this
> +	 * short mdelay this issue was not reported again.
> +	 */
> +	mdelay(1);
> +
>  	usbphyc_phy->active = true;
>  
>  	return 0;
> -- 
> 2.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



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

end of thread, other threads:[~2023-01-26  8:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-24 20:31 [PATCH] phy: stm32-usphyc: add mdelay(1) to fix timeout on some machines Michael Grzeschik
2023-01-26  8:15 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox