All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property
@ 2016-04-13 22:44 dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
       [not found] ` <1460587442-21136-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx @ 2016-04-13 22:44 UTC (permalink / raw)
  To: johnyoun-HKixBCOQz3hWk0Htik3J/w
  Cc: dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Dinh Nguyen, Rob Herring,
	Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala

From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>

Document the optional 'resets' and 'reset-names' property for the DWC2 usb
core.

Signed-off-by: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
---
Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
Cc: Ian Campbell <ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>
Cc: Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/Documentation/devicetree/bindings/usb/dwc2.txt b/Documentation/devicetree/bindings/usb/dwc2.txt
index 20a68bf..c9ccea6 100644
--- a/Documentation/devicetree/bindings/usb/dwc2.txt
+++ b/Documentation/devicetree/bindings/usb/dwc2.txt
@@ -27,6 +27,9 @@ Refer to phy/phy-bindings.txt for generic phy consumer properties
 - g-rx-fifo-size: size of rx fifo size in gadget mode.
 - g-np-tx-fifo-size: size of non-periodic tx fifo size in gadget mode.
 - g-tx-fifo-size: size of periodic tx fifo per endpoint (except ep0) in gadget mode.
+- resets: list of phandle and reset specifier pairs. The should be one entry for
+  softreset line of the USB IP.
+- reset-names: Should be "dwc2".
 
 Example:
 
-- 
2.6.2

--
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] 7+ messages in thread

* [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
       [not found] ` <1460587442-21136-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
@ 2016-04-13 22:44   ` dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
       [not found]     ` <1460587442-21136-2-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
  2016-04-14 16:40   ` [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property Rob Herring
  1 sibling, 1 reply; 7+ messages in thread
From: dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx @ 2016-04-13 22:44 UTC (permalink / raw)
  To: johnyoun-HKixBCOQz3hWk0Htik3J/w
  Cc: dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Dinh Nguyen

From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>

Allow for platforms that have a reset controller driver in place to bring
the USB IP out of reset.

Signed-off-by: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
---
v4: use dev_dbg() if not a -EPROBE_DEFER
v3: fix compile error
v2: move to lowlevel_hw_init()
---
 drivers/usb/dwc2/core.h     |  1 +
 drivers/usb/dwc2/platform.c | 15 +++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
index 3c58d63..f748132 100644
--- a/drivers/usb/dwc2/core.h
+++ b/drivers/usb/dwc2/core.h
@@ -837,6 +837,7 @@ struct dwc2_hsotg {
 	void *priv;
 	int     irq;
 	struct clk *clk;
+	struct reset_control *reset;
 
 	unsigned int queuing_high_bandwidth:1;
 	unsigned int srp_success:1;
diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
index 88629be..5e89af1 100644
--- a/drivers/usb/dwc2/platform.c
+++ b/drivers/usb/dwc2/platform.c
@@ -45,6 +45,7 @@
 #include <linux/platform_device.h>
 #include <linux/phy/phy.h>
 #include <linux/platform_data/s3c-hsotg.h>
+#include <linux/reset.h>
 
 #include <linux/usb/of.h>
 
@@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
 {
 	int i, ret;
 
+	hsotg->reset = devm_reset_control_get(hsotg->dev, "dwc2");
+	if (IS_ERR(hsotg->reset)) {
+		if (PTR_ERR(hsotg->reset) == -EPROBE_DEFER)
+			return -EPROBE_DEFER;
+		dev_dbg(hsotg->dev, "Could not get reset control.\n");
+		hsotg->reset = NULL;
+	}
+
+	if(hsotg->reset)
+		reset_control_deassert(hsotg->reset);
+
 	/* Set default UTMI width */
 	hsotg->phyif = GUSBCFG_PHYIF16;
 
@@ -434,6 +446,9 @@ static int dwc2_driver_remove(struct platform_device *dev)
 	if (hsotg->ll_hw_enabled)
 		dwc2_lowlevel_hw_disable(hsotg);
 
+	if (hsotg->reset)
+		reset_control_assert(hsotg->reset);
+
 	return 0;
 }
 
-- 
2.6.2

--
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] 7+ messages in thread

* Re: [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
       [not found]     ` <1460587442-21136-2-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
@ 2016-04-14  2:04       ` Arnd Bergmann
       [not found]         ` <201604140404.32087.arnd-r2nGTMty4D4@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2016-04-14  2:04 UTC (permalink / raw)
  To: dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
  Cc: johnyoun-HKixBCOQz3hWk0Htik3J/w,
	dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On Thursday 14 April 2016, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org wrote:
> @@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>  {
>         int i, ret;
>  
> +       hsotg->reset = devm_reset_control_get(hsotg->dev, "dwc2");
> +       if (IS_ERR(hsotg->reset)) {
> +               if (PTR_ERR(hsotg->reset) == -EPROBE_DEFER)
> +                       return -EPROBE_DEFER;
> +               dev_dbg(hsotg->dev, "Could not get reset control.\n");
> +               hsotg->reset = NULL;
> +       }
> +
> +       if(hsotg->reset)
> +               reset_control_deassert(hsotg->reset);


The error handling seems a bit odd here. If there is a failure to get the
reset control and it's actually needed, I would argue the init function should
not continue. Conversely, if there was no reset line specified in the
device, why even print a message about it?

	Arnd
--
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] 7+ messages in thread

* Re: [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property
       [not found] ` <1460587442-21136-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
  2016-04-13 22:44   ` [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2 dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
@ 2016-04-14 16:40   ` Rob Herring
  2016-06-03 15:39     ` Dinh Nguyen
  1 sibling, 1 reply; 7+ messages in thread
From: Rob Herring @ 2016-04-14 16:40 UTC (permalink / raw)
  To: dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
  Cc: johnyoun-HKixBCOQz3hWk0Htik3J/w,
	dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala

On Wed, Apr 13, 2016 at 05:44:01PM -0500, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org wrote:
> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
> 
> Document the optional 'resets' and 'reset-names' property for the DWC2 usb
> core.
> 
> Signed-off-by: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
> ---
> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
> Cc: Ian Campbell <ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>
> Cc: Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
> ---
>  Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++
>  1 file changed, 3 insertions(+)

Acked-by: Rob Herring <rob-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
--
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] 7+ messages in thread

* Re: [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
       [not found]         ` <201604140404.32087.arnd-r2nGTMty4D4@public.gmane.org>
@ 2016-04-14 18:23           ` John Youn
       [not found]             ` <570FE01C.3090109-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 7+ messages in thread
From: John Youn @ 2016-04-14 18:23 UTC (permalink / raw)
  To: Arnd Bergmann, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
  Cc: John.Youn-HKixBCOQz3hWk0Htik3J/w,
	dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On 4/13/2016 7:04 PM, Arnd Bergmann wrote:
> On Thursday 14 April 2016, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org wrote:
>> @@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>>  {
>>         int i, ret;
>>  
>> +       hsotg->reset = devm_reset_control_get(hsotg->dev, "dwc2");
>> +       if (IS_ERR(hsotg->reset)) {
>> +               if (PTR_ERR(hsotg->reset) == -EPROBE_DEFER)
>> +                       return -EPROBE_DEFER;
>> +               dev_dbg(hsotg->dev, "Could not get reset control.\n");
>> +               hsotg->reset = NULL;
>> +       }
>> +
>> +       if(hsotg->reset)
>> +               reset_control_deassert(hsotg->reset);
> 
> 
> The error handling seems a bit odd here. If there is a failure to get the
> reset control and it's actually needed, I would argue the init function should
> not continue. Conversely, if there was no reset line specified in the
> device, why even print a message about it?

Yes it's optional. I think this needs to be checked like the PHY's are
checked in the same function. That is, by checking for specific error
codes that indicate a reset control is not specified and continue only
in that case. All other errors should be returned.

Dinh, care to make these changes?

As for the message, it's only purpose is to aid debugging.

John
--
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] 7+ messages in thread

* Re: [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
       [not found]             ` <570FE01C.3090109-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
@ 2016-04-14 20:46               ` Dinh Nguyen
  0 siblings, 0 replies; 7+ messages in thread
From: Dinh Nguyen @ 2016-04-14 20:46 UTC (permalink / raw)
  To: John Youn, Arnd Bergmann
  Cc: dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA

On 04/14/2016 01:23 PM, John Youn wrote:
> On 4/13/2016 7:04 PM, Arnd Bergmann wrote:
>> On Thursday 14 April 2016, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org wrote:
>>> @@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg)
>>>  {
>>>         int i, ret;
>>>  
>>> +       hsotg->reset = devm_reset_control_get(hsotg->dev, "dwc2");
>>> +       if (IS_ERR(hsotg->reset)) {
>>> +               if (PTR_ERR(hsotg->reset) == -EPROBE_DEFER)
>>> +                       return -EPROBE_DEFER;
>>> +               dev_dbg(hsotg->dev, "Could not get reset control.\n");
>>> +               hsotg->reset = NULL;
>>> +       }
>>> +
>>> +       if(hsotg->reset)
>>> +               reset_control_deassert(hsotg->reset);
>>
>>
>> The error handling seems a bit odd here. If there is a failure to get the
>> reset control and it's actually needed, I would argue the init function should
>> not continue. Conversely, if there was no reset line specified in the
>> device, why even print a message about it?
> 
> Yes it's optional. I think this needs to be checked like the PHY's are
> checked in the same function. That is, by checking for specific error
> codes that indicate a reset control is not specified and continue only
> in that case. All other errors should be returned.
> 
> Dinh, care to make these changes?

Sure, I can make the change.

Dinh
--
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] 7+ messages in thread

* Re: [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property
  2016-04-14 16:40   ` [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property Rob Herring
@ 2016-06-03 15:39     ` Dinh Nguyen
  0 siblings, 0 replies; 7+ messages in thread
From: Dinh Nguyen @ 2016-06-03 15:39 UTC (permalink / raw)
  To: Rob Herring
  Cc: johnyoun-HKixBCOQz3hWk0Htik3J/w,
	dinh.linux-Re5JQEeQqe8AvxtiuMwx3w, balbi-DgEjT+Ai2ygdnm+yROfE0A,
	stefan.wahren-eS4NqCHxEME, linux-usb-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala

Hi Rob,

On 04/14/2016 11:40 AM, Rob Herring wrote:
> On Wed, Apr 13, 2016 at 05:44:01PM -0500, dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org wrote:
>> From: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
>>
>> Document the optional 'resets' and 'reset-names' property for the DWC2 usb
>> core.
>>
>> Signed-off-by: Dinh Nguyen <dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
>> ---
>> Cc: Rob Herring <robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
>> Cc: Pawel Moll <pawel.moll-5wv7dgnIgG8@public.gmane.org>
>> Cc: Mark Rutland <mark.rutland-5wv7dgnIgG8@public.gmane.org>
>> Cc: Ian Campbell <ijc+devicetree-KcIKpvwj1kUDXYZnReoRVg@public.gmane.org>
>> Cc: Kumar Gala <galak-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
>> ---
>>  Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++
>>  1 file changed, 3 insertions(+)
> 
> Acked-by: Rob Herring <rob-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
> 

Can you please apply this to your tree?

Thanks,
Dinh
--
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] 7+ messages in thread

end of thread, other threads:[~2016-06-03 15:39 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-13 22:44 [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
     [not found] ` <1460587442-21136-1-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2016-04-13 22:44   ` [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2 dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
     [not found]     ` <1460587442-21136-2-git-send-email-dinguyen-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2016-04-14  2:04       ` Arnd Bergmann
     [not found]         ` <201604140404.32087.arnd-r2nGTMty4D4@public.gmane.org>
2016-04-14 18:23           ` John Youn
     [not found]             ` <570FE01C.3090109-HKixBCOQz3hWk0Htik3J/w@public.gmane.org>
2016-04-14 20:46               ` Dinh Nguyen
2016-04-14 16:40   ` [PATCH 1/2] Documentation: dt-bindings: dwc2: add the resets and reset-names property Rob Herring
2016-06-03 15:39     ` Dinh Nguyen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.