devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/3] usb: renesas_usbhs: some modifications
@ 2016-06-27 12:09 Yoshihiro Shimoda
  2016-06-27 12:09 ` [PATCH 1/3] usb: renesas_usbhs: Fix a condition about a log of "transceiver found" Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2016-06-27 12:09 UTC (permalink / raw)
  To: balbi, robh+dt, mark.rutland
  Cc: gregkh, linux-usb, linux-renesas-soc, devicetree, Yoshihiro Shimoda

This patch set is based on the latest Felipe's testing/next branch
(commit id = 1d23d16a88e6c8143b07339435ba061b131ebb8c) and the following
fixed patch set:
 http://thread.gmane.org/gmane.linux.kernel.stable/181504


Yoshihiro Shimoda (3):
  usb: renesas_usbhs: Fix a condition about a log of "transceiver found"
  usb: renesas_usbhs: show error code when probe failed
  usb: renesas_usbhs: Use devm_usb_get_phy_by_phandle()

 Documentation/devicetree/bindings/usb/renesas_usbhs.txt | 3 ++-
 drivers/usb/renesas_usbhs/common.c                      | 2 +-
 drivers/usb/renesas_usbhs/mod_gadget.c                  | 9 +++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/3] usb: renesas_usbhs: Fix a condition about a log of "transceiver found"
  2016-06-27 12:09 [PATCH 0/3] usb: renesas_usbhs: some modifications Yoshihiro Shimoda
@ 2016-06-27 12:09 ` Yoshihiro Shimoda
  2016-06-27 12:09 ` [PATCH 2/3] usb: renesas_usbhs: show error code when probe failed Yoshihiro Shimoda
       [not found] ` <1467029359-6812-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2016-06-27 12:09 UTC (permalink / raw)
  To: balbi, robh+dt, mark.rutland
  Cc: gregkh, linux-usb, linux-renesas-soc, devicetree,
	Yoshihiro Shimoda, stable

This driver should use IS_ERR_OR_NULL() macro for the log. Otherwize,
this driver outputs "transceiver found" even if the gprov->transceiver
has an error from usb_get_phy().

Fixes: b5a2875 ("usb: renesas_usbhs: Allow an OTG PHY driver to provide VBUS")
Cc: <stable@vger.kernel.org> # v4.3+
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/renesas_usbhs/mod_gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c b/drivers/usb/renesas_usbhs/mod_gadget.c
index 50f3363..6e60297 100644
--- a/drivers/usb/renesas_usbhs/mod_gadget.c
+++ b/drivers/usb/renesas_usbhs/mod_gadget.c
@@ -1073,7 +1073,7 @@ int usbhs_mod_gadget_probe(struct usbhs_priv *priv)
 
 	gpriv->transceiver = usb_get_phy(USB_PHY_TYPE_UNDEFINED);
 	dev_info(dev, "%stransceiver found\n",
-		 gpriv->transceiver ? "" : "no ");
+		 !IS_ERR_OR_NULL(gpriv->transceiver) ? "" : "no ");
 
 	/*
 	 * CAUTION
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/3] usb: renesas_usbhs: show error code when probe failed
  2016-06-27 12:09 [PATCH 0/3] usb: renesas_usbhs: some modifications Yoshihiro Shimoda
  2016-06-27 12:09 ` [PATCH 1/3] usb: renesas_usbhs: Fix a condition about a log of "transceiver found" Yoshihiro Shimoda
@ 2016-06-27 12:09 ` Yoshihiro Shimoda
       [not found] ` <1467029359-6812-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  2 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2016-06-27 12:09 UTC (permalink / raw)
  To: balbi, robh+dt, mark.rutland
  Cc: gregkh, linux-usb, linux-renesas-soc, devicetree, Yoshihiro Shimoda

To know why the driver probing failed, this patch shows error code.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/usb/renesas_usbhs/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/renesas_usbhs/common.c b/drivers/usb/renesas_usbhs/common.c
index baeb7d2..8fbbc2d 100644
--- a/drivers/usb/renesas_usbhs/common.c
+++ b/drivers/usb/renesas_usbhs/common.c
@@ -697,7 +697,7 @@ probe_end_fifo_exit:
 probe_end_pipe_exit:
 	usbhs_pipe_remove(priv);
 
-	dev_info(&pdev->dev, "probe failed\n");
+	dev_info(&pdev->dev, "probe failed (%d)\n", ret);
 
 	return ret;
 }
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/3] usb: renesas_usbhs: Use devm_usb_get_phy_by_phandle()
       [not found] ` <1467029359-6812-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2016-06-27 12:09   ` Yoshihiro Shimoda
       [not found]     ` <1467029359-6812-4-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
  0 siblings, 1 reply; 6+ messages in thread
From: Yoshihiro Shimoda @ 2016-06-27 12:09 UTC (permalink / raw)
  To: balbi-DgEjT+Ai2ygdnm+yROfE0A, robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	mark.rutland-5wv7dgnIgG8
  Cc: gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Yoshihiro Shimoda

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-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
---
 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
   - 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 ");
 
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 3/3] usb: renesas_usbhs: Use devm_usb_get_phy_by_phandle()
       [not found]     ` <1467029359-6812-4-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
@ 2016-06-28 20:57       ` Rob Herring
  2016-06-30  8:44         ` Yoshihiro Shimoda
  0 siblings, 1 reply; 6+ messages in thread
From: Rob Herring @ 2016-06-28 20:57 UTC (permalink / raw)
  To: Yoshihiro Shimoda
  Cc: balbi-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

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-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> ---
>  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-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH 3/3] usb: renesas_usbhs: Use devm_usb_get_phy_by_phandle()
  2016-06-28 20:57       ` Rob Herring
@ 2016-06-30  8:44         ` Yoshihiro Shimoda
  0 siblings, 0 replies; 6+ messages in thread
From: Yoshihiro Shimoda @ 2016-06-30  8:44 UTC (permalink / raw)
  To: Rob Herring
  Cc: balbi-DgEjT+Ai2ygdnm+yROfE0A, mark.rutland-5wv7dgnIgG8,
	gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r,
	linux-usb-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

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-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
> > ---
> >  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 linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2016-06-30  8:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-27 12:09 [PATCH 0/3] usb: renesas_usbhs: some modifications Yoshihiro Shimoda
2016-06-27 12:09 ` [PATCH 1/3] usb: renesas_usbhs: Fix a condition about a log of "transceiver found" Yoshihiro Shimoda
2016-06-27 12:09 ` [PATCH 2/3] usb: renesas_usbhs: show error code when probe failed Yoshihiro Shimoda
     [not found] ` <1467029359-6812-1-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2016-06-27 12:09   ` [PATCH 3/3] usb: renesas_usbhs: Use devm_usb_get_phy_by_phandle() Yoshihiro Shimoda
     [not found]     ` <1467029359-6812-4-git-send-email-yoshihiro.shimoda.uh-zM6kxYcvzFBBDgjK7y7TUQ@public.gmane.org>
2016-06-28 20:57       ` Rob Herring
2016-06-30  8:44         ` Yoshihiro Shimoda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).