diff mbox

[v7,3/4] usb: dwc3: of-simple: Add support to get resets for the device

Message ID 1500479948-29988-4-git-send-email-p.zabel@pengutronix.de (mailing list archive)
State Not Applicable, archived
Delegated to: Andy Gross
Headers show

Commit Message

Philipp Zabel July 19, 2017, 3:59 p.m. UTC
From: Vivek Gautam <vivek.gautam@codeaurora.org>

Add support to get a list of resets available for the device.
These resets must be kept de-asserted until the device is
in use.

Cc: Felipe Balbi <balbi@kernel.org>
Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
[p.zabel@pengutronix.de: switch to hidden reset control array]
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
No changes since v6.
---
 drivers/usb/dwc3/dwc3-of-simple.c | 27 +++++++++++++++++++++++++--
 1 file changed, 25 insertions(+), 2 deletions(-)

Comments

Felipe Balbi Oct. 19, 2017, 9:38 a.m. UTC | #1
Philipp Zabel <p.zabel@pengutronix.de> writes:

> From: Vivek Gautam <vivek.gautam@codeaurora.org>
>
> Add support to get a list of resets available for the device.
> These resets must be kept de-asserted until the device is
> in use.
>
> Cc: Felipe Balbi <balbi@kernel.org>
> Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> [p.zabel@pengutronix.de: switch to hidden reset control array]
> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>

now this seems like it depends on patch 1/4, right? Is the reset API
change going on v4.15?
Philipp Zabel Oct. 19, 2017, 10:45 a.m. UTC | #2
Hi Felipe,

On Thu, 2017-10-19 at 12:38 +0300, Felipe Balbi wrote:
> Philipp Zabel <p.zabel@pengutronix.de> writes:
> 
> > From: Vivek Gautam <vivek.gautam@codeaurora.org>
> > 
> > Add support to get a list of resets available for the device.
> > These resets must be kept de-asserted until the device is
> > in use.
> > 
> > Cc: Felipe Balbi <balbi@kernel.org>
> > Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> > [p.zabel@pengutronix.de: switch to hidden reset control array]
> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> 
> now this seems like it depends on patch 1/4, right? Is the reset API
> change going on v4.15?

Thank you for the reminder. Patch 1 has made it into v4.14-rc1, commit
17c82e206d2a ("reset: Add APIs to manage array of resets"). The other
patches could be picked up for v4.15 without any dependency issues.

regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi Oct. 19, 2017, 11:30 a.m. UTC | #3
Hi,

Philipp Zabel <p.zabel@pengutronix.de> writes:
> Hi Felipe,
>
> On Thu, 2017-10-19 at 12:38 +0300, Felipe Balbi wrote:
>> Philipp Zabel <p.zabel@pengutronix.de> writes:
>> 
>> > From: Vivek Gautam <vivek.gautam@codeaurora.org>
>> > 
>> > Add support to get a list of resets available for the device.
>> > These resets must be kept de-asserted until the device is
>> > in use.
>> > 
>> > Cc: Felipe Balbi <balbi@kernel.org>
>> > Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>> > [p.zabel@pengutronix.de: switch to hidden reset control array]
>> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>> 
>> now this seems like it depends on patch 1/4, right? Is the reset API
>> change going on v4.15?
>
> Thank you for the reminder. Patch 1 has made it into v4.14-rc1, commit
> 17c82e206d2a ("reset: Add APIs to manage array of resets"). The other
> patches could be picked up for v4.15 without any dependency issues.

Thanks, I'll put other dwc3 patches in my tree :-)
Felipe Balbi Oct. 19, 2017, 11:31 a.m. UTC | #4
Hi,

Philipp Zabel <p.zabel@pengutronix.de> writes:
> Hi Felipe,
>
> On Thu, 2017-10-19 at 12:38 +0300, Felipe Balbi wrote:
>> Philipp Zabel <p.zabel@pengutronix.de> writes:
>> 
>> > From: Vivek Gautam <vivek.gautam@codeaurora.org>
>> > 
>> > Add support to get a list of resets available for the device.
>> > These resets must be kept de-asserted until the device is
>> > in use.
>> > 
>> > Cc: Felipe Balbi <balbi@kernel.org>
>> > Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
>> > [p.zabel@pengutronix.de: switch to hidden reset control array]
>> > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
>> 
>> now this seems like it depends on patch 1/4, right? Is the reset API
>> change going on v4.15?
>
> Thank you for the reminder. Patch 1 has made it into v4.14-rc1, commit
> 17c82e206d2a ("reset: Add APIs to manage array of resets"). The other
> patches could be picked up for v4.15 without any dependency issues.

patch 2 applied fine. patch 3 fails to apply hunk 2.

checking file drivers/usb/dwc3/dwc3-of-simple.c
Hunk #1 succeeded at 28 (offset -1 lines).
Hunk #2 FAILED at 98.
1 out of 5 hunks FAILED


Care to rebase on my testing/next?
Philipp Zabel Oct. 19, 2017, 11:47 a.m. UTC | #5
On Thu, 2017-10-19 at 14:31 +0300, Felipe Balbi wrote:
> Hi,
> 
> Philipp Zabel <p.zabel@pengutronix.de> writes:
> > Hi Felipe,
> > 
> > On Thu, 2017-10-19 at 12:38 +0300, Felipe Balbi wrote:
> > > Philipp Zabel <p.zabel@pengutronix.de> writes:
> > > 
> > > > From: Vivek Gautam <vivek.gautam@codeaurora.org>
> > > > 
> > > > Add support to get a list of resets available for the device.
> > > > These resets must be kept de-asserted until the device is
> > > > in use.
> > > > 
> > > > Cc: Felipe Balbi <balbi@kernel.org>
> > > > Signed-off-by: Vivek Gautam <vivek.gautam@codeaurora.org>
> > > > [p.zabel@pengutronix.de: switch to hidden reset control array]
> > > > Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
> > > 
> > > now this seems like it depends on patch 1/4, right? Is the reset API
> > > change going on v4.15?
> > 
> > Thank you for the reminder. Patch 1 has made it into v4.14-rc1, commit
> > 17c82e206d2a ("reset: Add APIs to manage array of resets"). The other
> > patches could be picked up for v4.15 without any dependency issues.
> 
> patch 2 applied fine. patch 3 fails to apply hunk 2.
> 
> checking file drivers/usb/dwc3/dwc3-of-simple.c
> Hunk #1 succeeded at 28 (offset -1 lines).
> Hunk #2 FAILED at 98.
> 1 out of 5 hunks FAILED
> 
> 
> Care to rebase on my testing/next?

Thanks, I'll resend patch 3 separately.

regards
Philipp
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" 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/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
index a9bac09d3750d..23d2221bde9df 100644
--- a/drivers/usb/dwc3/dwc3-of-simple.c
+++ b/drivers/usb/dwc3/dwc3-of-simple.c
@@ -29,11 +29,13 @@ 
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include <linux/pm_runtime.h>
+#include <linux/reset.h>
 
 struct dwc3_of_simple {
 	struct device		*dev;
 	struct clk		**clks;
 	int			num_clocks;
+	struct reset_control	*resets;
 };
 
 static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count)
@@ -96,9 +98,20 @@  static int dwc3_of_simple_probe(struct platform_device *pdev)
 	platform_set_drvdata(pdev, simple);
 	simple->dev = dev;
 
+	simple->resets = of_reset_control_array_get_optional_exclusive(np);
+	if (IS_ERR(simple->resets)) {
+		ret = PTR_ERR(simple->resets);
+		dev_err(dev, "failed to get device resets, err=%d\n", ret);
+		return ret;
+	}
+
+	ret = reset_control_deassert(simple->resets);
+	if (ret)
+		goto err_resetc_put;
+
 	ret = dwc3_of_simple_clk_init(simple, of_clk_get_parent_count(np));
 	if (ret)
-		return ret;
+		goto err_resetc_assert;
 
 	ret = of_platform_populate(np, NULL, NULL, dev);
 	if (ret) {
@@ -107,7 +120,7 @@  static int dwc3_of_simple_probe(struct platform_device *pdev)
 			clk_put(simple->clks[i]);
 		}
 
-		return ret;
+		goto err_resetc_assert;
 	}
 
 	pm_runtime_set_active(dev);
@@ -115,6 +128,13 @@  static int dwc3_of_simple_probe(struct platform_device *pdev)
 	pm_runtime_get_sync(dev);
 
 	return 0;
+
+err_resetc_assert:
+	reset_control_assert(simple->resets);
+
+err_resetc_put:
+	reset_control_put(simple->resets);
+	return ret;
 }
 
 static int dwc3_of_simple_remove(struct platform_device *pdev)
@@ -130,6 +150,9 @@  static int dwc3_of_simple_remove(struct platform_device *pdev)
 		clk_put(simple->clks[i]);
 	}
 
+	reset_control_assert(simple->resets);
+	reset_control_put(simple->resets);
+
 	pm_runtime_put_sync(dev);
 	pm_runtime_disable(dev);