d5ff868291a599340b898a84b86169395d91fde4
[openwrt/openwrt.git] / target / linux / ipq806x / patches-4.9 / 0074-ipq806x-usb-Control-USB-master-reset.patch
1 From a86bda9f8a7965f0cedd347a9c04800eb9f41ea3 Mon Sep 17 00:00:00 2001
2 From: Vasudevan Murugesan <vmuruges@codeaurora.org>
3 Date: Tue, 21 Jul 2015 10:22:38 +0530
4 Subject: ipq806x: usb: Control USB master reset
5
6 During removal of the glue layer(dwc3-of-simple),
7 USB master reset is set to active and during insertion
8 it is de-activated.
9
10 Change-Id: I537dc810f6cb2a46664ee674840145066432b957
11 Signed-off-by: Vasudevan Murugesan <vmuruges@codeaurora.org>
12 (cherry picked from commit 4611e13580a216812f85f0801b95442d02eeb836)
13 ---
14 drivers/usb/dwc3/dwc3-of-simple.c | 22 ++++++++++++++++++++++
15 1 file changed, 12 insertions(+)
16
17 (limited to 'drivers/usb/dwc3/dwc3-of-simple.c')
18
19 diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c
20 index f9e92ef..49bf556 100644
21 --- a/drivers/usb/dwc3/dwc3-of-simple.c
22 +++ b/drivers/usb/dwc3/dwc3-of-simple.c
23 @@ -26,6 +26,7 @@
24 #include <linux/dma-mapping.h>
25 #include <linux/clk.h>
26 #include <linux/clk-provider.h>
27 +#include <linux/reset.h>
28 #include <linux/of.h>
29 #include <linux/of_platform.h>
30 #include <linux/pm_runtime.h>
31 @@ -34,6 +35,8 @@ struct dwc3_of_simple {
32 struct device *dev;
33 struct clk **clks;
34 int num_clocks;
35 + struct reset_control *mstr_rst_30_0;
36 + struct reset_control *mstr_rst_30_1;
37 };
38
39 static int dwc3_of_simple_probe(struct platform_device *pdev)
40 @@ -89,6 +92,20 @@ static int dwc3_of_simple_probe(struct platform_device *pdev)
41 simple->clks[i] = clk;
42 }
43
44 + simple->mstr_rst_30_0 = devm_reset_control_get(dev, "usb30_0_mstr_rst");
45 +
46 + if (!IS_ERR(simple->mstr_rst_30_0))
47 + reset_control_deassert(simple->mstr_rst_30_0);
48 + else
49 + dev_dbg(simple->dev, "cannot get handle for USB PHY 0 master reset control\n");
50 +
51 + simple->mstr_rst_30_1 = devm_reset_control_get(dev, "usb30_1_mstr_rst");
52 +
53 + if (!IS_ERR(simple->mstr_rst_30_1))
54 + reset_control_deassert(simple->mstr_rst_30_1);
55 + else
56 + dev_dbg(simple->dev, "cannot get handle for USB PHY 1 master reset control\n");
57 +
58 ret = of_platform_populate(np, NULL, NULL, dev);
59 if (ret) {
60 for (i = 0; i < simple->num_clocks; i++) {
61 @@ -117,6 +134,12 @@ static int dwc3_of_simple_remove(struct platform_device *pdev)
62 clk_put(simple->clks[i]);
63 }
64
65 + if (!IS_ERR(simple->mstr_rst_30_0))
66 + reset_control_assert(simple->mstr_rst_30_0);
67 +
68 + if (!IS_ERR(simple->mstr_rst_30_1))
69 + reset_control_assert(simple->mstr_rst_30_1);
70 +
71 of_platform_depopulate(dev);
72
73 pm_runtime_put_sync(dev);
74 --
75 cgit v1.1