Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1210154 > unrolled thread

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

Started byRamneek Mehresh <ramneek.mehresh@freescale.com>
First post2015-08-20 07:40 +0200
Last post2015-08-24 16:40 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host  driver Ramneek Mehresh <ramneek.mehresh@freescale.com> - 2015-08-20 07:40 +0200
    RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host  driver Alan Stern <stern@rowland.harvard.edu> - 2015-08-20 16:20 +0200
      RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host  driver Ramneek Mehresh <ramneek.mehresh@freescale.com> - 2015-08-24 08:20 +0200
        RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host  driver Alan Stern <stern@rowland.harvard.edu> - 2015-08-24 16:40 +0200

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

FromRamneek Mehresh <ramneek.mehresh@freescale.com>
Date2015-08-20 07:40 +0200
SubjectRE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host driver
Message-ID<pZqJY-3Q7-23@gated-at.bofh.it>

> -----Original Message-----
> From: Alan Stern [mailto:stern@rowland.harvard.edu]
> Sent: Friday, August 14, 2015 12:17 AM
> To: Mehresh Ramneek-B31383 <ramneek.mehresh@freescale.com>
> Cc: linux-kernel@vger.kernel.org; balbi@ti.com;
> gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; Li Yang-Leo-R58472
> <LeoLi@freescale.com>
> 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@freescale.com>
> > Signed-off-by: Ramneek Mehresh <ramneek.mehresh@freescale.com>
> > ---
> > 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-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1210521

FromAlan Stern <stern@rowland.harvard.edu>
Date2015-08-20 16:20 +0200
Message-ID<pZyRc-7lc-17@gated-at.bofh.it>
In reply to#1210154
On Thu, 20 Aug 2015, Ramneek Mehresh wrote:

> > > --- 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

What I meant was, can you keep the "u32 usb_ctrl;" line but get rid of
the "#ifdef CONFIG_PM" and "#endif" lines?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1211826

FromRamneek Mehresh <ramneek.mehresh@freescale.com>
Date2015-08-24 08:20 +0200
Message-ID<q0TgR-7Oj-5@gated-at.bofh.it>
In reply to#1210521

> -----Original Message-----
> From: Alan Stern [mailto:stern@rowland.harvard.edu]
> Sent: Thursday, August 20, 2015 7:40 PM
> To: Mehresh Ramneek-B31383 <ramneek.mehresh@freescale.com>
> Cc: linux-kernel@vger.kernel.org; balbi@ti.com;
> gregkh@linuxfoundation.org; linux-usb@vger.kernel.org; Li Yang-Leo-R58472
> <LeoLi@freescale.com>
> Subject: RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb
> host driver
> 
> On Thu, 20 Aug 2015, Ramneek Mehresh wrote:
> 
> > > > --- 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
> 
> What I meant was, can you keep the "u32 usb_ctrl;" line but get rid of
> the "#ifdef CONFIG_PM" and "#endif" lines?
> 
> Alan Stern
I do understand that. However, USB suspend/resume functionality work in context of
PM. Only in this context, we need to save/restore usb controller register
for deep-sleep functionality. If you see usage of this in ehci-fsl.c file, it's used in 
ehci_fsl_drv_suspend() under CONFIG_PM to save USB CNTL register.
If I remove CONFIG_PM from struct ehci_fsl{}, I'll need to change the entire driver
also to make suspend and resume functionalities compile by default.
   
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1212256

FromAlan Stern <stern@rowland.harvard.edu>
Date2015-08-24 16:40 +0200
Message-ID<q114K-23E-15@gated-at.bofh.it>
In reply to#1211826
On Mon, 24 Aug 2015, Ramneek Mehresh wrote:

> > On Thu, 20 Aug 2015, Ramneek Mehresh wrote:
> > 
> > > > > --- 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
> > 
> > What I meant was, can you keep the "u32 usb_ctrl;" line but get rid of
> > the "#ifdef CONFIG_PM" and "#endif" lines?
> > 
> > Alan Stern
> I do understand that.

It doesn't sound like you do.

>  However, USB suspend/resume functionality work in context of
> PM. Only in this context, we need to save/restore usb controller register
> for deep-sleep functionality. If you see usage of this in ehci-fsl.c file, it's used in 
> ehci_fsl_drv_suspend() under CONFIG_PM to save USB CNTL register.

Yes, I know.

> If I remove CONFIG_PM from struct ehci_fsl{}, I'll need to change the entire driver
> also to make suspend and resume functionalities compile by default.

Why?  Suppose you remove the "#ifdef CONFIG_PM" and "#endif" lines but 
leave everything else the same.  Won't the driver still work?

If CONFIG_PM is enabled then everything will be exactly the same as it 
is now.  If CONFIG_PM isn't enabled then you will have an extra 
usb_ctrl field in the ehci_fsl structure.  It will never get used for 
anything but the driver should still work.  Right?

Alan Stern

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web