RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Alan Stern [mailto:stern@xxxxxxxxxxxxxxxxxxx]
> Sent: Friday, August 14, 2015 12:17 AM
> To: Mehresh Ramneek-B31383 <ramneek.mehresh@xxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; balbi@xxxxxx;
> gregkh@xxxxxxxxxxxxxxxxxxx; linux-usb@xxxxxxxxxxxxxxx; Li Yang-Leo-R58472
> <LeoLi@xxxxxxxxxxxxx>
> Subject: Re: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb
> host driver
> 
> On Thu, 13 Aug 2015, Ramneek Mehresh wrote:
> 
> > Add workqueue to add/remove host driver (outside
> > interrupt context) upon each id change.
> >
> > Signed-off-by: Li Yang <leoli@xxxxxxxxxxxxx>
> > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@xxxxxxxxxxxxx>
> > ---
> > Changes for v3:
> >         - removed CONFIG_FSL_USB2_OTG and
> CONFIG_FSL_USB2_OTG_MODULE
> >           macros
> >         - removed call to usb_hcd_resume_root_hub(hcd) from
> >           ehci_fsl_drv_resume()
> >
> >  drivers/usb/host/ehci-fsl.c | 71 ++++++++++++++++++++++++++++++++-
> ------------
> >  drivers/usb/host/ehci-fsl.h | 18 ++++++++++++
> >  2 files changed, 69 insertions(+), 20 deletions(-)
> 
> 
> >  static int ehci_fsl_drv_suspend(struct device *dev)
> >  {
> >  	struct usb_hcd *hcd = dev_get_drvdata(dev);
> > -	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
> >  	void __iomem *non_ehci = hcd->regs;
> > +	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
> > +	struct usb_bus host = hcd->self;
> 
> I just noticed this line.  It does not look right at all; it does a
> structure copy instead of copying a pointer.
my bad...will change to struct usb_bus *host = &hcd->self;
> 
> >
> >  	if (of_device_is_compatible(dev->parent->of_node,
> >  				    "fsl,mpc5121-usb2-dr")) {
> >  		return ehci_fsl_mpc512x_drv_suspend(dev);
> >  	}
> >
> > +	if (host.is_otg) {
> > +		/* remove hcd */
> > +		ehci_fsl->hcd_add = 0;
> > +		schedule_work(&ehci_fsl->change_hcd_work);
> > +		host.is_otg = 0;
> 
> And here you turn off the flag in the local copy of the structure,
> which accomplishes nothing.
> 
agree...will change to host->is_otg = 0;
> > +		return 0;
> > +	}
> > +
> >  	ehci_prepare_ports_for_controller_suspend(hcd_to_ehci(hcd),
> >  			device_may_wakeup(dev));
> >  	if (!fsl_deep_sleep())
> > @@ -557,15 +579,24 @@ static int ehci_fsl_drv_suspend(struct device
> *dev)
> >  static int ehci_fsl_drv_resume(struct device *dev)
> >  {
> >  	struct usb_hcd *hcd = dev_get_drvdata(dev);
> > -	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
> >  	struct ehci_hcd *ehci = hcd_to_ehci(hcd);
> >  	void __iomem *non_ehci = hcd->regs;
> > +	struct ehci_fsl *ehci_fsl = hcd_to_ehci_fsl(hcd);
> > +	struct usb_bus host = hcd->self;
> 
> Same here.
agree
> 
> > --- a/drivers/usb/host/ehci-fsl.h
> > +++ b/drivers/usb/host/ehci-fsl.h
> > @@ -63,4 +63,22 @@
> >  #define UTMI_PHY_EN             (1<<9)
> >  #define ULPI_PHY_CLK_SEL        (1<<10)
> >  #define PHY_CLK_VALID		(1<<17)
> > +
> > +struct ehci_fsl {
> > +#ifdef CONFIG_PM
> > +	/* Saved USB PHY settings, need to restore after deep sleep. */
> > +	u32 usb_ctrl;
> > +#endif
> 
> Do you need this #ifdef?
> 
Yes, this is required for deep-sleep support...we need to save/restore controller
registers during deep-sleep when usb controller power is shut-off. Don't need this
during normal usb operation...saving/restoring usb controller registers in non deep-sleep
scenario will add unnecessary delays
> Alan Stern

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



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux