RE: [PATCH/RFC 2/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume

2017-02-21 Thread Yoshihiro Shimoda
Hi Peter,

> From: Peter Chen
> Sent: Tuesday, February 21, 2017 5:51 PM
> 
> On Mon, Feb 20, 2017 at 04:35:11PM +0900, Yoshihiro Shimoda wrote:
< snip >
> > @@ -297,6 +298,8 @@ static int ehci_platform_probe(struct platform_device 
> > *dev)
> > goto err_power;
> >
> > device_wakeup_enable(hcd->self.controller);
> > +   if (usb_of_has_companion(hcd->self.controller))
> 
> According to Alan's comments, all USB ehci platform device can be async
> device, so this API can be skipped.

I got it. I will remove this API.

> > +   device_enable_async_suspend(hcd->self.controller);
> > platform_set_drvdata(dev, hcd);
> >
> > return err;
> > @@ -370,6 +373,7 @@ static int ehci_platform_resume(struct device *dev)
> > struct usb_ehci_pdata *pdata = dev_get_platdata(dev);
> > struct platform_device *pdev = to_platform_device(dev);
> > struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
> > +   struct device *companion_dev;
> >
> > if (pdata->power_on) {
> > int err = pdata->power_on(pdev);
> > @@ -377,6 +381,10 @@ static int ehci_platform_resume(struct device *dev)
> > return err;
> > }
> >
> > +   companion_dev = usb_of_get_companion_dev(hcd->self.controller);
> 
> Maybe other EHCI controller has companion controller too, so it is ok
> for you to let it as a common API.

I got it.

> > +   if (companion_dev)
> > +   device_pm_wait_for_dev(hcd->self.controller, companion_dev);
> > +
> > ehci_resume(hcd, priv->reset_on_resume);
> > return 0;
> >  }
> 
> You can send formal patch next time.

Thank you for your review! I will send v2 patch set without RFC.

Best regards,
Yoshihiro Shimoda

> --
> 
> Best Regards,
> Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH/RFC 2/2] usb: host: ehci-platform: fix usb 1.1 device is not connected in system resume

2017-02-21 Thread Peter Chen
On Mon, Feb 20, 2017 at 04:35:11PM +0900, Yoshihiro Shimoda wrote:
> This patch fixes an issue that a usb 1.1 device is not connected in
> system resume and then the following message appeared if debug messages
> are enabled:
>   usb 2-1: Waited 2000ms for CONNECT
> 
> To resolve this issue, the EHCI controller must be resumed after its
> companion controllers. So, this patch adds such code on the driver.
> 
> Signed-off-by: Yoshihiro Shimoda 
> ---
>  drivers/usb/host/ehci-platform.c | 8 
>  1 file changed, 8 insertions(+)
> 
> diff --git a/drivers/usb/host/ehci-platform.c 
> b/drivers/usb/host/ehci-platform.c
> index a268d9e..65a7725 100644
> --- a/drivers/usb/host/ehci-platform.c
> +++ b/drivers/usb/host/ehci-platform.c
> @@ -34,6 +34,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  
>  #include "ehci.h"
>  
> @@ -297,6 +298,8 @@ static int ehci_platform_probe(struct platform_device 
> *dev)
>   goto err_power;
>  
>   device_wakeup_enable(hcd->self.controller);
> + if (usb_of_has_companion(hcd->self.controller))

According to Alan's comments, all USB ehci platform device can be async
device, so this API can be skipped.

> + device_enable_async_suspend(hcd->self.controller);
>   platform_set_drvdata(dev, hcd);
>  
>   return err;
> @@ -370,6 +373,7 @@ static int ehci_platform_resume(struct device *dev)
>   struct usb_ehci_pdata *pdata = dev_get_platdata(dev);
>   struct platform_device *pdev = to_platform_device(dev);
>   struct ehci_platform_priv *priv = hcd_to_ehci_priv(hcd);
> + struct device *companion_dev;
>  
>   if (pdata->power_on) {
>   int err = pdata->power_on(pdev);
> @@ -377,6 +381,10 @@ static int ehci_platform_resume(struct device *dev)
>   return err;
>   }
>  
> + companion_dev = usb_of_get_companion_dev(hcd->self.controller);

Maybe other EHCI controller has companion controller too, so it is ok
for you to let it as a common API.

> + if (companion_dev)
> + device_pm_wait_for_dev(hcd->self.controller, companion_dev);
> +
>   ehci_resume(hcd, priv->reset_on_resume);
>   return 0;
>  }

You can send formal patch next time.

-- 

Best Regards,
Peter Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html