lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 20 Aug 2015 05:37:12 +0000
From:	Ramneek Mehresh <ramneek.mehresh@...escale.com>
To:	Alan Stern <stern@...land.harvard.edu>
CC:	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"balbi@...com" <balbi@...com>,
	"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	Li Leo <LeoLi@...escale.com>
Subject: RE: [PATCH 3/8][v3]usb:fsl:otg: Add support to add/remove usb host
 driver



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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ