public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Antoine Ténart" <antoine.tenart@free-electrons.com>
To: Vivek Gautam <gautam.vivek@samsung.com>
Cc: "Antoine Ténart" <antoine.tenart@free-electrons.com>,
	"Felipe Balbi" <balbi@ti.com>,
	"Greg KH" <gregkh@linuxfoundation.org>,
	Peter.Chen@freescale.com, kishon <kishon@ti.com>,
	"Alan Stern" <stern@rowland.harvard.edu>,
	alexandre.belloni@free-electrons.com,
	"Thomas Petazzoni" <thomas.petazzoni@free-electrons.com>,
	"zhiming Xu" <zmxu@marvell.com>,
	jszhang@marvell.com,
	"Linux USB Mailing List" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Sergei Shtylyov" <sergei.shtylyov@cogentembedded.com>,
	"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>
Subject: Re: [PATCH 3/4] usb: add support to the PHY framework for HCD
Date: Tue, 15 Jul 2014 11:09:42 +0200	[thread overview]
Message-ID: <20140715090942.GC1011@kwain> (raw)
In-Reply-To: <CAFp+6iELkaXOQiM0=JzUj=YZGqfMjOPFt+-dnEs4=Q3EzyBJBQ@mail.gmail.com>

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

  reply	other threads:[~2014-07-15  9:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-09 10:17 [PATCH 0/4] usb: add support for the generic PHY framework Antoine Ténart
2014-07-09 10:17 ` [PATCH 1/4] usb: move the OTG state from the USB PHY to the OTG structure Antoine Ténart
2014-07-10 13:40   ` Felipe Balbi
2014-07-10 13:47     ` Antoine Ténart
2014-07-16 15:02       ` Felipe Balbi
2014-07-15 11:27   ` Peter Chen
2014-07-22 21:33   ` Bin Liu
2014-07-23  7:08     ` Antoine Ténart
2014-07-09 10:17 ` [PATCH 2/4] usb: add support to the PHY framework for OTG Antoine Ténart
2014-07-10 13:41   ` Felipe Balbi
2014-07-09 10:17 ` [PATCH 3/4] usb: add support to the PHY framework for HCD Antoine Ténart
2014-07-09 14:41   ` Alan Stern
2014-07-09 15:08     ` Antoine Ténart
2014-07-14  9:08   ` Vivek Gautam
2014-07-15  9:09     ` Antoine Ténart [this message]
2014-07-09 10:17 ` [PATCH 4/4] usb: chipidea: add support to the PHY framework for ChipIdea Antoine Ténart
2014-07-10 13:42   ` Felipe Balbi
2014-07-10 13:51     ` Antoine Ténart
2014-07-10 13:56       ` Felipe Balbi
2014-07-10 14:01         ` Antoine Ténart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140715090942.GC1011@kwain \
    --to=antoine.tenart@free-electrons.com \
    --cc=Peter.Chen@freescale.com \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=balbi@ti.com \
    --cc=gautam.vivek@samsung.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jszhang@marvell.com \
    --cc=kishon@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sergei.shtylyov@cogentembedded.com \
    --cc=stern@rowland.harvard.edu \
    --cc=thomas.petazzoni@free-electrons.com \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    --cc=zmxu@marvell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox