Linux kernel and device drivers for NXP i.MX platforms
 help / color / mirror / Atom feed
* [PATCH] usb: core: hcd: only check primary hcd skip_phy_initialization
@ 2024-11-05  9:01 Xu Yang
  2024-12-02  2:50 ` Xu Yang
  0 siblings, 1 reply; 2+ messages in thread
From: Xu Yang @ 2024-11-05  9:01 UTC (permalink / raw)
  To: gregkh, niko.mauno, dvyukov, stanley_chang, andreyknvl, tj, viro
  Cc: linux-usb, imx, jun.li

Before commit 53a2d95df836 ("usb: core: add phy notify connect and
disconnect"), phy initialization will be skipped even when shared hcd
doesn't set skip_phy_initialization flag. However, the situation is
changed after the commit. The hcd.c will initialize phy when add shared
hcd. This behavior is unexpected for some platforms which will handle phy
initialization by themselves. To avoid the issue, this will only check
skip_phy_initialization flag of primary hcd since shared hcd normally
follow primary hcd setting.

Fixes: 53a2d95df836 ("usb: core: add phy notify connect and disconnect")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/usb/core/hcd.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index 500dc35e6477..0b2490347b9f 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2794,8 +2794,14 @@ int usb_add_hcd(struct usb_hcd *hcd,
 	int retval;
 	struct usb_device *rhdev;
 	struct usb_hcd *shared_hcd;
+	int skip_phy_initialization;
 
-	if (!hcd->skip_phy_initialization) {
+	if (usb_hcd_is_primary_hcd(hcd))
+		skip_phy_initialization = hcd->skip_phy_initialization;
+	else
+		skip_phy_initialization = hcd->primary_hcd->skip_phy_initialization;
+
+	if (!skip_phy_initialization) {
 		if (usb_hcd_is_primary_hcd(hcd)) {
 			hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
 			if (IS_ERR(hcd->phy_roothub))
-- 
2.34.1


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

* Re: [PATCH] usb: core: hcd: only check primary hcd skip_phy_initialization
  2024-11-05  9:01 [PATCH] usb: core: hcd: only check primary hcd skip_phy_initialization Xu Yang
@ 2024-12-02  2:50 ` Xu Yang
  0 siblings, 0 replies; 2+ messages in thread
From: Xu Yang @ 2024-12-02  2:50 UTC (permalink / raw)
  To: gregkh, niko.mauno, dvyukov, stanley_chang, andreyknvl, tj, viro
  Cc: linux-usb, imx, jun.li

Hi,

On Tue, Nov 05, 2024 at 05:01:20PM +0800, Xu Yang wrote:
> Before commit 53a2d95df836 ("usb: core: add phy notify connect and
> disconnect"), phy initialization will be skipped even when shared hcd
> doesn't set skip_phy_initialization flag. However, the situation is
> changed after the commit. The hcd.c will initialize phy when add shared
> hcd. This behavior is unexpected for some platforms which will handle phy
> initialization by themselves. To avoid the issue, this will only check
> skip_phy_initialization flag of primary hcd since shared hcd normally
> follow primary hcd setting.
> 
> Fixes: 53a2d95df836 ("usb: core: add phy notify connect and disconnect")
> Cc: stable@vger.kernel.org
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  drivers/usb/core/hcd.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> index 500dc35e6477..0b2490347b9f 100644
> --- a/drivers/usb/core/hcd.c
> +++ b/drivers/usb/core/hcd.c
> @@ -2794,8 +2794,14 @@ int usb_add_hcd(struct usb_hcd *hcd,
>  	int retval;
>  	struct usb_device *rhdev;
>  	struct usb_hcd *shared_hcd;
> +	int skip_phy_initialization;
>  
> -	if (!hcd->skip_phy_initialization) {
> +	if (usb_hcd_is_primary_hcd(hcd))
> +		skip_phy_initialization = hcd->skip_phy_initialization;
> +	else
> +		skip_phy_initialization = hcd->primary_hcd->skip_phy_initialization;
> +
> +	if (!skip_phy_initialization) {
>  		if (usb_hcd_is_primary_hcd(hcd)) {
>  			hcd->phy_roothub = usb_phy_roothub_alloc(hcd->self.sysdev);
>  			if (IS_ERR(hcd->phy_roothub))

A gentle ping.

> -- 
> 2.34.1
> 

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

end of thread, other threads:[~2024-12-02  2:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05  9:01 [PATCH] usb: core: hcd: only check primary hcd skip_phy_initialization Xu Yang
2024-12-02  2:50 ` Xu Yang

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