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]
Message-ID: <20140715090942.GC1011@kwain>
Date:	Tue, 15 Jul 2014 11:09:42 +0200
From:	Antoine Ténart 
	<antoine.tenart@...e-electrons.com>
To:	Vivek Gautam <gautam.vivek@...sung.com>
Cc:	Antoine Ténart 
	<antoine.tenart@...e-electrons.com>, Felipe Balbi <balbi@...com>,
	Greg KH <gregkh@...uxfoundation.org>, Peter.Chen@...escale.com,
	kishon <kishon@...com>, Alan Stern <stern@...land.harvard.edu>,
	alexandre.belloni@...e-electrons.com,
	Thomas Petazzoni <thomas.petazzoni@...e-electrons.com>,
	zhiming Xu <zmxu@...vell.com>, jszhang@...vell.com,
	Linux USB Mailing List <linux-usb@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	Sergei Shtylyov <sergei.shtylyov@...entembedded.com>,
	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>
Subject: Re: [PATCH 3/4] usb: add support to the PHY framework for HCD

Hi Vivek,

On Mon, Jul 14, 2014 at 02:38:03PM +0530, Vivek Gautam wrote:
> On Wed, Jul 9, 2014 at 3:47 PM, Antoine Ténart
> <antoine.tenart@...e-electrons.com> wrote:
> > diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
> > index bec31e2efb88..b985af5b167c 100644
> > --- a/drivers/usb/core/hcd.c
> > +++ b/drivers/usb/core/hcd.c
> > @@ -42,6 +42,7 @@
> >  #include <linux/pm_runtime.h>
> >  #include <linux/types.h>
> >
> > +#include <linux/phy/phy.h>
> >  #include <linux/usb.h>
> >  #include <linux/usb/hcd.h>
> >  #include <linux/usb/phy.h>
> > @@ -2631,21 +2632,35 @@ int usb_add_hcd(struct usb_hcd *hcd,
> >         int retval;
> >         struct usb_device *rhdev;
> >
> > -       if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->phy) {
> > -               struct usb_phy *phy = usb_get_phy_dev(hcd->self.controller, 0);
> > +       if (IS_ENABLED(CONFIG_USB_PHY) && !hcd->phy && !hcd->usb_phy) {
> > +               struct phy *phy = of_phy_get(hcd->self.controller->of_node, 0);
> >
> > -               if (IS_ERR(phy)) {
> > -                       retval = PTR_ERR(phy);
> > -                       if (retval == -EPROBE_DEFER)
> > -                               return retval;
> > -               } else {
> > -                       retval = usb_phy_init(phy);
> > +               if (!IS_ERR(phy)) {
> > +                       retval = phy_init(hcd->phy);
> >                         if (retval) {
> > -                               usb_put_phy(phy);
> > +                               phy_exit(hcd->phy);
> >                                 return retval;
> >                         }
> > +                       retval = phy_power_on(hcd->phy);
> >                         hcd->phy = phy;
> >                         hcd->remove_phy = 1;
> > +               } else {
> > +                       struct usb_phy *phy =
> > +                               usb_get_phy_dev(hcd->self.controller, 0);
> > +
> > +                       if (IS_ERR(phy)) {
> > +                               retval = PTR_ERR(phy);
> > +                               if (retval == -EPROBE_DEFER)
> > +                                       return retval;
> > +                       } else {
> > +                               retval = usb_phy_init(phy);
> > +                               if (retval) {
> > +                                       usb_put_phy(phy);
> > +                                       return retval;
> > +                               }
> > +                               hcd->usb_phy = phy;
> > +                               hcd->remove_phy = 1;
> > +                       }
> >                 }
> >         }
> 
> Just a note here:
> There had already been a patch for adding the generic phy support in
> usb/core/hcd.c in 3.16 cycle by
> Sergei and Yoshihiro [1], though structurally a bit different, was not
> picked since there wasn't any user of the patch
> till then. Do you mind modifying on top of that patch
> 
> [1] https://www.mail-archive.com/linux-usb@vger.kernel.org/msg43471.html

Sure, I'll rework my series taking in account this patch. I'll cook a v2
for later today.

Thanks!

Antoine

-- 
Antoine Ténart, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
--
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