Documentation: dt-bindings: dwc2: add the resets and reset-names property
Subsystems (3)
PATCH 1/2 Documentation: dt-bindings: dwc2: add the resets and reset-names property
From: Dinh Nguyen <[email protected]>
Document the optional 'resets' and 'reset-names' property for the DWC2 usb core.
---
Cc: Rob Herring <[email protected]>
Cc: Pawel Moll <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Kumar Gala <[email protected]>
--- Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++ 1 file changed, 3 insertions(+)
Documentation/devicetree/bindings/usb/dwc2.txt +3 -0
@@ -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:
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v3 2/2 usb: dwc2: Add reset control to dwc2
In reply to a message not in the archiveFrom: Dinh Nguyen <[email protected]>
Allow for platforms that have a reset controller driver in place to bring the USB IP out of reset.
---
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(+)
drivers/usb/dwc2/core.h +1 -0
@@ -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;
drivers/usb/dwc2/platform.c +15 -0
@@ -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 ; }
Signature · 6 lines
2.6.2 -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
In reply to a message not in the archiveQuoted 4 lines · On Thursday 14 April 2016, [email protected]…
drivers/usb/dwc2/platform.c +0
-0@@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) {int i, ret;
drivers/usb/dwc2/platform.c static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) · line 350
Quoted 10 lines
drivers/usb/dwc2/platform.c +10
-0+ 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Rob Herring
Acked-byQuoted 12 lines · On Wed, Apr 13, 2016 at 05:44:01PM -0500…
From: Dinh Nguyen <[email protected]>
Document the optional 'resets' and 'reset-names' property for the DWC2 usb core.
Signed-off-by Dinh Nguyen <[email protected]>---
Cc: Rob Herring <[email protected]>
Cc: Pawel Moll <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Kumar Gala <[email protected]>
Quoted 3 lines
--- Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++ 1 file changed, 3 insertions(+)
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
In reply to a message not in the archiveQuoted 5 lines · Arnd Bergmann
Quoted 4 lines · On Thursday 14 April 2016, [email protected]…
drivers/usb/dwc2/platform.c +0
-0@@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) {int i, ret;
Quoted 16 lines
drivers/usb/dwc2/platform.c static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) · line 350
Quoted 10 lines
drivers/usb/dwc2/platform.c +10
-0+ 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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCHv3 2/2] usb: dwc2: Add reset control to dwc2
In reply to a message not in the archiveQuoted 23 lines · John Youn
Quoted 5 lines · Arnd Bergmann
Quoted 4 lines · On Thursday 14 April 2016, [email protected]…
drivers/usb/dwc2/platform.c +0
-0@@ -337,6 +338,17 @@ static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) {int i, ret;Quoted 16 lines
drivers/usb/dwc2/platform.c static int dwc2_lowlevel_hw_init(struct dwc2_hsotg *hsotg) · line 350
Quoted 10 lines
drivers/usb/dwc2/platform.c +10
-0+ 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?
Quoted 6 lines
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Rob,
Quoted 17 lines · Rob Herring
Quoted 12 lines · On Wed, Apr 13, 2016 at 05:44:01PM -0500…
From: Dinh Nguyen <[email protected]>
Document the optional 'resets' and 'reset-names' property for the DWC2 usb core.
Signed-off-by Dinh Nguyen <[email protected]>---
Cc: Rob Herring <[email protected]>
Cc: Pawel Moll <[email protected]>
Cc: Mark Rutland <[email protected]>
Cc: Ian Campbell <[email protected]>
Cc: Kumar Gala <[email protected]>Quoted 3 lines
--- Documentation/devicetree/bindings/usb/dwc2.txt | 3 +++ 1 file changed, 3 insertions(+)
Quoted 2 lines
Acked-by Rob Herring <[email protected]>
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 [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html