All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch
@ 2025-06-27  4:52 Balaji Selvanathan
  2025-06-27  7:26 ` Mattijs Korpershoek
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Balaji Selvanathan @ 2025-06-27  4:52 UTC (permalink / raw)
  To: marex, trini, mkorpershoek, s-vadapalli, patrice.chotard,
	jan.kiszka, balaji.selvanathan, u-boot

Added delays before and after setting the PIPE_UTMI_CLK_SEL and
PIPE3_PHYSTATUS_SW bits in the Qscratch GENERAL_CFG register
during UTMI clock selection for DWC3 on Qualcomm platforms.

These delays help ensure proper timing and stability of the UTMI
clock switching sequence, potentially avoiding race conditions or
unstable PHY behavior during initialization.

Tested on platforms using Qscratch-based DWC3 PHY configuration.

This change is taken from this Linux kernel implementation:
https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?id=a4333c3a6ba9ca9cff50a3c1d1bf193dc5489e1c

Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
---
Changes in v2:
- Corrected typo in email id in Signed-off (in v1)
- Link to v1: https://lore.kernel.org/u-boot/20250627044304.2223767-1-balaji.selvanathan@oss.qualcomm.com/
---
 drivers/usb/dwc3/dwc3-generic.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 21452ad1569..4800eb64484 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -460,9 +460,13 @@ static void dwc3_qcom_select_utmi_clk(void __iomem *qscratch_base)
 	setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
 			  PIPE_UTMI_CLK_DIS);
 
+	udelay(100);
+
 	setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
 			  PIPE_UTMI_CLK_SEL | PIPE3_PHYSTATUS_SW);
 
+	udelay(100);
+
 	clrbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
 			  PIPE_UTMI_CLK_DIS);
 }
-- 
2.34.1


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

* Re: [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch
  2025-06-27  4:52 [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch Balaji Selvanathan
@ 2025-06-27  7:26 ` Mattijs Korpershoek
  2025-06-27  8:37 ` neil.armstrong
  2026-01-16 18:03 ` Casey Connolly
  2 siblings, 0 replies; 4+ messages in thread
From: Mattijs Korpershoek @ 2025-06-27  7:26 UTC (permalink / raw)
  To: Balaji Selvanathan, marex, trini, s-vadapalli, patrice.chotard,
	jan.kiszka, balaji.selvanathan, u-boot

Hi Balaji,

Thank you for the patch.

On Fri, Jun 27, 2025 at 10:22, Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com> wrote:

> Added delays before and after setting the PIPE_UTMI_CLK_SEL and
> PIPE3_PHYSTATUS_SW bits in the Qscratch GENERAL_CFG register
> during UTMI clock selection for DWC3 on Qualcomm platforms.
>
> These delays help ensure proper timing and stability of the UTMI
> clock switching sequence, potentially avoiding race conditions or
> unstable PHY behavior during initialization.
>
> Tested on platforms using Qscratch-based DWC3 PHY configuration.
>
> This change is taken from this Linux kernel implementation:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?id=a4333c3a6ba9ca9cff50a3c1d1bf193dc5489e1c

Thank you for mentioning this link, it's very helpful for the review.

>
> Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>

Reviewed-by: Mattijs Korpershoek <mkorpershoek@kernel.org>

> ---
> Changes in v2:
> - Corrected typo in email id in Signed-off (in v1)
> - Link to v1: https://lore.kernel.org/u-boot/20250627044304.2223767-1-balaji.selvanathan@oss.qualcomm.com/
> ---
>  drivers/usb/dwc3/dwc3-generic.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 21452ad1569..4800eb64484 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -460,9 +460,13 @@ static void dwc3_qcom_select_utmi_clk(void __iomem *qscratch_base)
>  	setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
>  			  PIPE_UTMI_CLK_DIS);
>  
> +	udelay(100);
> +
>  	setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
>  			  PIPE_UTMI_CLK_SEL | PIPE3_PHYSTATUS_SW);
>  
> +	udelay(100);
> +
>  	clrbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
>  			  PIPE_UTMI_CLK_DIS);
>  }
> -- 
> 2.34.1

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

* Re: [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch
  2025-06-27  4:52 [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch Balaji Selvanathan
  2025-06-27  7:26 ` Mattijs Korpershoek
@ 2025-06-27  8:37 ` neil.armstrong
  2026-01-16 18:03 ` Casey Connolly
  2 siblings, 0 replies; 4+ messages in thread
From: neil.armstrong @ 2025-06-27  8:37 UTC (permalink / raw)
  To: Balaji Selvanathan, marex, trini, mkorpershoek, s-vadapalli,
	patrice.chotard, jan.kiszka, u-boot

On 27/06/2025 06:52, Balaji Selvanathan wrote:
> Added delays before and after setting the PIPE_UTMI_CLK_SEL and
> PIPE3_PHYSTATUS_SW bits in the Qscratch GENERAL_CFG register
> during UTMI clock selection for DWC3 on Qualcomm platforms.
> 
> These delays help ensure proper timing and stability of the UTMI
> clock switching sequence, potentially avoiding race conditions or
> unstable PHY behavior during initialization.
> 
> Tested on platforms using Qscratch-based DWC3 PHY configuration.
> 
> This change is taken from this Linux kernel implementation:
> https://web.git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/usb/dwc3/dwc3-qcom.c?id=a4333c3a6ba9ca9cff50a3c1d1bf193dc5489e1c
> 
> Signed-off-by: Balaji Selvanathan <balaji.selvanathan@oss.qualcomm.com>
> ---
> Changes in v2:
> - Corrected typo in email id in Signed-off (in v1)
> - Link to v1: https://lore.kernel.org/u-boot/20250627044304.2223767-1-balaji.selvanathan@oss.qualcomm.com/
> ---
>   drivers/usb/dwc3/dwc3-generic.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
> index 21452ad1569..4800eb64484 100644
> --- a/drivers/usb/dwc3/dwc3-generic.c
> +++ b/drivers/usb/dwc3/dwc3-generic.c
> @@ -460,9 +460,13 @@ static void dwc3_qcom_select_utmi_clk(void __iomem *qscratch_base)
>   	setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
>   			  PIPE_UTMI_CLK_DIS);
>   
> +	udelay(100);
> +
>   	setbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
>   			  PIPE_UTMI_CLK_SEL | PIPE3_PHYSTATUS_SW);
>   
> +	udelay(100);
> +
>   	clrbits_le32(qscratch_base + QSCRATCH_GENERAL_CFG,
>   			  PIPE_UTMI_CLK_DIS);
>   }

Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>

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

* Re: [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch
  2025-06-27  4:52 [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch Balaji Selvanathan
  2025-06-27  7:26 ` Mattijs Korpershoek
  2025-06-27  8:37 ` neil.armstrong
@ 2026-01-16 18:03 ` Casey Connolly
  2 siblings, 0 replies; 4+ messages in thread
From: Casey Connolly @ 2026-01-16 18:03 UTC (permalink / raw)
  To: marex, trini, mkorpershoek, s-vadapalli, patrice.chotard,
	jan.kiszka, u-boot, Balaji Selvanathan


On Fri, 27 Jun 2025 10:22:44 +0530, Balaji Selvanathan wrote:
> Added delays before and after setting the PIPE_UTMI_CLK_SEL and
> PIPE3_PHYSTATUS_SW bits in the Qscratch GENERAL_CFG register
> during UTMI clock selection for DWC3 on Qualcomm platforms.
> 
> These delays help ensure proper timing and stability of the UTMI
> clock switching sequence, potentially avoiding race conditions or
> unstable PHY behavior during initialization.
> 
> [...]

Applied, thanks!

[1/1] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch
      https://source.denx.de/u-boot/custodians/u-boot-snapdragon/-/commit/fba8fc4a9620

Best regards,
-- 
// Casey (she/they)



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

end of thread, other threads:[~2026-01-16 18:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-27  4:52 [PATCH v2] usb: dwc3: qcom: Add delays in UTMI clock selection for Qscratch Balaji Selvanathan
2025-06-27  7:26 ` Mattijs Korpershoek
2025-06-27  8:37 ` neil.armstrong
2026-01-16 18:03 ` Casey Connolly

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.