diff mbox

[3/3] usb: renesas_usbhs: Use devm_usb_get_phy_by_phandle()

Message ID 1467029359-6812-4-git-send-email-yoshihiro.shimoda.uh@renesas.com
State Rejected, archived
Headers show

Commit Message

Yoshihiro Shimoda June 27, 2016, 12:09 p.m. UTC
This patch uses devm_usb_get_phy_by_phandle() instead of usb_get_phy()
for device tree environment. This change is not compabile with the
previous code, but it is no problem because nobody calls usb_bind_phy()
for this driver now.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 3 ++-
 drivers/usb/renesas_usbhs/mod_gadget.c                  | 7 ++++++-
 2 files changed, 8 insertions(+), 2 deletions(-)

Comments

Rob Herring June 28, 2016, 8:57 p.m. UTC | #1
On Mon, Jun 27, 2016 at 09:09:19PM +0900, Yoshihiro Shimoda wrote:
> This patch uses devm_usb_get_phy_by_phandle() instead of usb_get_phy()
> for device tree environment. This change is not compabile with the
> previous code, but it is no problem because nobody calls usb_bind_phy()
> for this driver now.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 3 ++-
>  drivers/usb/renesas_usbhs/mod_gadget.c                  | 7 ++++++-
>  2 files changed, 8 insertions(+), 2 deletions(-)
> 
> diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> index b604056..a419aea 100644
> --- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> +++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> @@ -24,8 +24,9 @@ Optional properties:
>    - renesas,buswait: Integer to use BUSWAIT register
>    - renesas,enable-gpio: A gpio specifier to check GPIO determining if USB
>  			 function should be enabled
> -  - phys: phandle + phy specifier pair
> +  - phys: phandle of *Generic PHY* + phy specifier pair
>    - phy-names: must be "usb"
> +  - usb-phy: phandle of usb phy

No. The binding should not change based on which kernel subsystem 
handles this. The USB-PHY code should learn to parse 'phys' if you want 
to use that subsystem.

>    - dmas: Must contain a list of references to DMA specifiers.
>    - dma-names : named "ch%d", where %d is the channel number ranging from zero
>                  to the number of channels (DnFIFOs) minus one.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Yoshihiro Shimoda June 30, 2016, 8:44 a.m. UTC | #2
Hi,

> From: Rob Herring
> Sent: Wednesday, June 29, 2016 5:57 AM
> 
> On Mon, Jun 27, 2016 at 09:09:19PM +0900, Yoshihiro Shimoda wrote:
> > This patch uses devm_usb_get_phy_by_phandle() instead of usb_get_phy()
> > for device tree environment. This change is not compabile with the
> > previous code, but it is no problem because nobody calls usb_bind_phy()
> > for this driver now.
> >
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> > ---
> >  Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 3 ++-
> >  drivers/usb/renesas_usbhs/mod_gadget.c                  | 7 ++++++-
> >  2 files changed, 8 insertions(+), 2 deletions(-)
> >
> > diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> > index b604056..a419aea 100644
> > --- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> > +++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
> > @@ -24,8 +24,9 @@ Optional properties:
> >    - renesas,buswait: Integer to use BUSWAIT register
> >    - renesas,enable-gpio: A gpio specifier to check GPIO determining if USB
> >  			 function should be enabled
> > -  - phys: phandle + phy specifier pair
> > +  - phys: phandle of *Generic PHY* + phy specifier pair
> >    - phy-names: must be "usb"
> > +  - usb-phy: phandle of usb phy
> 
> No. The binding should not change based on which kernel subsystem
> handles this. The USB-PHY code should learn to parse 'phys' if you want
> to use that subsystem.

Thank you for the review.

The "phys" is for Generic PHY even if this patch is applied.
So, I think that I should make a patch to revise the explanation at first?

I would to write overview of renesas_usbhs driver and a question below:

< phys >
 - This is a generic phy property.
 - The renesas_usbhs driver will use it to turn on/off the PHY 
 - Almost all platforms use this generic phy instance.

< usb-phy >
 - This is a USB-PHY property.
 - The renesas_usbhs driver will use it to call an OTG related function.
   (otg_set_peripheral)
 - The renesas_usbhs driver will NOT use it to turn the power on/off.
 - Some platforms don't use this USB-PHY instance.
  - In other words, some platforms use both a generic phy and USB-PHY.
   - Is it not suitable from the device tree point of view?

Best regards,
Yoshihiro Shimoda


> >    - dmas: Must contain a list of references to DMA specifiers.
> >    - dma-names : named "ch%d", where %d is the channel number ranging from zero
> >                  to the number of channels (DnFIFOs) minus one.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
index b604056..a419aea 100644
--- a/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
+++ b/Documentation/devicetree/bindings/usb/renesas_usbhs.txt
@@ -24,8 +24,9 @@  Optional properties:
   - renesas,buswait: Integer to use BUSWAIT register
   - renesas,enable-gpio: A gpio specifier to check GPIO determining if USB
 			 function should be enabled
-  - phys: phandle + phy specifier pair
+  - phys: phandle of *Generic PHY* + phy specifier pair
   - phy-names: must be "usb"
+  - usb-phy: phandle of usb phy
   - dmas: Must contain a list of references to DMA specifiers.
   - dma-names : named "ch%d", where %d is the channel number ranging from zero
                 to the number of channels (DnFIFOs) minus one.
diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 6e60297..ba1da69 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -1071,7 +1071,12 @@  int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
 		goto usbhs_mod_gadget_probe_err_gpriv;
 	}
 
-	gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
+	gpriv->transceiver = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
+	if (PTR_ERR(gpriv->transceiver) == -EPROBE_DEFER) {
+		ret = -EPROBE_DEFER;
+		goto err_add_udc;
+	}
+
 	dev_info(dev, "%stransceiver found\n",
 		 !IS_ERR_OR_NULL(gpriv->transceiver) ? "" : "no ");