mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: Use the correct PHY mode for USB3 PHY
@ 2026-10-12  9:37 Prashanth K
  2026-11-04  0:12 ` Thinh Nguyen
  0 siblings, 1 reply; 2+ messages in thread
From: Prashanth K @ 2026-10-12  9:37 UTC (permalink / raw)
  To: Thinh Nguyen, Greg Kroah-Hartman; +Cc: linux-usb, linux-kernel, Prashanth K

DWC3 currently configures USB3 PHYs with PHY_MODE_USB_HOST when
switching the controller to host mode. Even though usb_add_hcd()
sets the flag corrrectly, it gets overwritten in DWC3 layer.

Some PHY drivers distinguish between USB2 and SS host modes and
expect USB3 PHYs to be configured with PHY_MODE_USB_HOST_SS. Using
PHY_MODE_USB_HOST may result in incorrect PHY programming. Fix this
by using PHY_MODE_USB_HOST_SS for USB3 PHYs.

Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
---
 drivers/usb/dwc3/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index fd5c2cd36c59..1bb87a370725 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -251,7 +251,7 @@ static void __dwc3_set_mode(struct work_struct *work)
 			for (i = 0; i < dwc->num_usb2_ports; i++)
 				phy_set_mode(dwc->usb2_generic_phy[i], PHY_MODE_USB_HOST);
 			for (i = 0; i < dwc->num_usb3_ports; i++)
-				phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST);
+				phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST_SS);
 
 			if (dwc->dis_split_quirk) {
 				reg = dwc3_readl(dwc, DWC3_GUCTL3);
@@ -1643,7 +1643,7 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
 		for (i = 0; i < dwc->num_usb2_ports; i++)
 			phy_set_mode(dwc->usb2_generic_phy[i], PHY_MODE_USB_HOST);
 		for (i = 0; i < dwc->num_usb3_ports; i++)
-			phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST);
+			phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST_SS);
 
 		ret = dwc3_host_init(dwc);
 		if (ret)
-- 
2.34.1


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

* Re: [PATCH] usb: dwc3: Use the correct PHY mode for USB3 PHY
  2026-10-12  9:37 [PATCH] usb: dwc3: Use the correct PHY mode for USB3 PHY Prashanth K
@ 2026-11-04  0:12 ` Thinh Nguyen
  0 siblings, 0 replies; 2+ messages in thread
From: Thinh Nguyen @ 2026-11-04  0:12 UTC (permalink / raw)
  To: Prashanth K; +Cc: Thinh Nguyen, Greg Kroah-Hartman, linux-usb, linux-kernel

Hi,

On Mon, Oct 12, 2026, Prashanth K wrote:
> DWC3 currently configures USB3 PHYs with PHY_MODE_USB_HOST when
> switching the controller to host mode. Even though usb_add_hcd()
> sets the flag corrrectly, it gets overwritten in DWC3 layer.
> 
> Some PHY drivers distinguish between USB2 and SS host modes and
> expect USB3 PHYs to be configured with PHY_MODE_USB_HOST_SS. Using
> PHY_MODE_USB_HOST may result in incorrect PHY programming. Fix this
> by using PHY_MODE_USB_HOST_SS for USB3 PHYs.
> 
> Signed-off-by: Prashanth K <prashanth.k@oss.qualcomm.com>
> ---
>  drivers/usb/dwc3/core.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
> index fd5c2cd36c59..1bb87a370725 100644
> --- a/drivers/usb/dwc3/core.c
> +++ b/drivers/usb/dwc3/core.c
> @@ -251,7 +251,7 @@ static void __dwc3_set_mode(struct work_struct *work)
>  			for (i = 0; i < dwc->num_usb2_ports; i++)
>  				phy_set_mode(dwc->usb2_generic_phy[i], PHY_MODE_USB_HOST);
>  			for (i = 0; i < dwc->num_usb3_ports; i++)
> -				phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST);
> +				phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST_SS);
>  
>  			if (dwc->dis_split_quirk) {
>  				reg = dwc3_readl(dwc, DWC3_GUCTL3);
> @@ -1643,7 +1643,7 @@ static int dwc3_core_init_mode(struct dwc3 *dwc)
>  		for (i = 0; i < dwc->num_usb2_ports; i++)
>  			phy_set_mode(dwc->usb2_generic_phy[i], PHY_MODE_USB_HOST);
>  		for (i = 0; i < dwc->num_usb3_ports; i++)
> -			phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST);
> +			phy_set_mode(dwc->usb3_generic_phy[i], PHY_MODE_USB_HOST_SS);
>  
>  		ret = dwc3_host_init(dwc);
>  		if (ret)
> -- 
> 2.34.1
> 

Can you take a look at Sashiko's review comments? I think the points
raised there are valid and should be addressed:

https://lore.kernel.org/linux-usb/sashiko-outbox-167906@kernel.org/

Thanks,
Thinh

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

end of thread, other threads:[~2026-11-04  0:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-12  9:37 [PATCH] usb: dwc3: Use the correct PHY mode for USB3 PHY Prashanth K
2026-11-04  0:12 ` Thinh Nguyen

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

all inboxes | Powered by JetHome®