diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 13:03:52 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-05-08 13:03:52 -0400 |
commit | 132d68d37d33f1d0b9c1f507c8b4d64c27ecec8a (patch) | |
tree | b3c05972e5579e1574873fe745fb1358c62a269c /drivers/usb/dwc3/dwc3-of-simple.c | |
parent | 80f232121b69cc69a31ccb2b38c1665d770b0710 (diff) | |
parent | 3515468a87a47781f6af818773650513ff14656a (diff) |
Merge tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB/PHY updates from Greg KH:
"Here is the big set of USB and PHY driver patches for 5.2-rc1
There is the usual set of:
- USB gadget updates
- PHY driver updates and additions
- USB serial driver updates and fixes
- typec updates and new chips supported
- mtu3 driver updates
- xhci driver updates
- other tiny driver updates
Nothing really interesting, just constant forward progress.
All of these have been in linux-next for a while with no reported
issues. The usb-gadget and usb-serial trees were merged a bit "late",
but both of them had been in linux-next before they got merged here
last Friday"
* tag 'usb-5.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (206 commits)
USB: serial: f81232: implement break control
USB: serial: f81232: add high baud rate support
USB: serial: f81232: clear overrun flag
USB: serial: f81232: fix interrupt worker not stop
usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA
usb: dwc3: Fix default lpm_nyet_threshold value
usb: dwc3: debug: Print GET_STATUS(device) tracepoint
usb: dwc3: Do core validation early on probe
usb: dwc3: gadget: Set lpm_capable
usb: gadget: atmel: tie wake lock to running clock
usb: gadget: atmel: support USB suspend
usb: gadget: atmel_usba_udc: simplify setting of interrupt-enabled mask
dwc2: gadget: Fix completed transfer size calculation in DDMA
usb: dwc2: Set lpm mode parameters depend on HW configuration
usb: dwc2: Fix channel disable flow
usb: dwc2: Set actual frame number for completed ISOC transfer
usb: gadget: do not use __constant_cpu_to_le16
usb: dwc2: gadget: Increase descriptors count for ISOC's
usb: introduce usb_ep_type_string() function
usb: dwc3: move synchronize_irq() out of the spinlock protected block
...
Diffstat (limited to 'drivers/usb/dwc3/dwc3-of-simple.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-of-simple.c | 95 |
1 files changed, 17 insertions, 78 deletions
diff --git a/drivers/usb/dwc3/dwc3-of-simple.c b/drivers/usb/dwc3/dwc3-of-simple.c index 4c2771c5e727..c4da82dd15c7 100644 --- a/drivers/usb/dwc3/dwc3-of-simple.c +++ b/drivers/usb/dwc3/dwc3-of-simple.c | |||
@@ -24,59 +24,13 @@ | |||
24 | 24 | ||
25 | struct dwc3_of_simple { | 25 | struct dwc3_of_simple { |
26 | struct device *dev; | 26 | struct device *dev; |
27 | struct clk **clks; | 27 | struct clk_bulk_data *clks; |
28 | int num_clocks; | 28 | int num_clocks; |
29 | struct reset_control *resets; | 29 | struct reset_control *resets; |
30 | bool pulse_resets; | 30 | bool pulse_resets; |
31 | bool need_reset; | 31 | bool need_reset; |
32 | }; | 32 | }; |
33 | 33 | ||
34 | static int dwc3_of_simple_clk_init(struct dwc3_of_simple *simple, int count) | ||
35 | { | ||
36 | struct device *dev = simple->dev; | ||
37 | struct device_node *np = dev->of_node; | ||
38 | int i; | ||
39 | |||
40 | simple->num_clocks = count; | ||
41 | |||
42 | if (!count) | ||
43 | return 0; | ||
44 | |||
45 | simple->clks = devm_kcalloc(dev, simple->num_clocks, | ||
46 | sizeof(struct clk *), GFP_KERNEL); | ||
47 | if (!simple->clks) | ||
48 | return -ENOMEM; | ||
49 | |||
50 | for (i = 0; i < simple->num_clocks; i++) { | ||
51 | struct clk *clk; | ||
52 | int ret; | ||
53 | |||
54 | clk = of_clk_get(np, i); | ||
55 | if (IS_ERR(clk)) { | ||
56 | while (--i >= 0) { | ||
57 | clk_disable_unprepare(simple->clks[i]); | ||
58 | clk_put(simple->clks[i]); | ||
59 | } | ||
60 | return PTR_ERR(clk); | ||
61 | } | ||
62 | |||
63 | ret = clk_prepare_enable(clk); | ||
64 | if (ret < 0) { | ||
65 | while (--i >= 0) { | ||
66 | clk_disable_unprepare(simple->clks[i]); | ||
67 | clk_put(simple->clks[i]); | ||
68 | } | ||
69 | clk_put(clk); | ||
70 | |||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | simple->clks[i] = clk; | ||
75 | } | ||
76 | |||
77 | return 0; | ||
78 | } | ||
79 | |||
80 | static int dwc3_of_simple_probe(struct platform_device *pdev) | 34 | static int dwc3_of_simple_probe(struct platform_device *pdev) |
81 | { | 35 | { |
82 | struct dwc3_of_simple *simple; | 36 | struct dwc3_of_simple *simple; |
@@ -84,7 +38,6 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) | |||
84 | struct device_node *np = dev->of_node; | 38 | struct device_node *np = dev->of_node; |
85 | 39 | ||
86 | int ret; | 40 | int ret; |
87 | int i; | ||
88 | bool shared_resets = false; | 41 | bool shared_resets = false; |
89 | 42 | ||
90 | simple = devm_kzalloc(dev, sizeof(*simple), GFP_KERNEL); | 43 | simple = devm_kzalloc(dev, sizeof(*simple), GFP_KERNEL); |
@@ -124,20 +77,18 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) | |||
124 | goto err_resetc_put; | 77 | goto err_resetc_put; |
125 | } | 78 | } |
126 | 79 | ||
127 | ret = dwc3_of_simple_clk_init(simple, of_count_phandle_with_args(np, | 80 | ret = clk_bulk_get_all(simple->dev, &simple->clks); |
128 | "clocks", "#clock-cells")); | 81 | if (ret < 0) |
82 | goto err_resetc_assert; | ||
83 | |||
84 | simple->num_clocks = ret; | ||
85 | ret = clk_bulk_prepare_enable(simple->num_clocks, simple->clks); | ||
129 | if (ret) | 86 | if (ret) |
130 | goto err_resetc_assert; | 87 | goto err_resetc_assert; |
131 | 88 | ||
132 | ret = of_platform_populate(np, NULL, NULL, dev); | 89 | ret = of_platform_populate(np, NULL, NULL, dev); |
133 | if (ret) { | 90 | if (ret) |
134 | for (i = 0; i < simple->num_clocks; i++) { | 91 | goto err_clk_put; |
135 | clk_disable_unprepare(simple->clks[i]); | ||
136 | clk_put(simple->clks[i]); | ||
137 | } | ||
138 | |||
139 | goto err_resetc_assert; | ||
140 | } | ||
141 | 92 | ||
142 | pm_runtime_set_active(dev); | 93 | pm_runtime_set_active(dev); |
143 | pm_runtime_enable(dev); | 94 | pm_runtime_enable(dev); |
@@ -145,6 +96,10 @@ static int dwc3_of_simple_probe(struct platform_device *pdev) | |||
145 | 96 | ||
146 | return 0; | 97 | return 0; |
147 | 98 | ||
99 | err_clk_put: | ||
100 | clk_bulk_disable_unprepare(simple->num_clocks, simple->clks); | ||
101 | clk_bulk_put_all(simple->num_clocks, simple->clks); | ||
102 | |||
148 | err_resetc_assert: | 103 | err_resetc_assert: |
149 | if (!simple->pulse_resets) | 104 | if (!simple->pulse_resets) |
150 | reset_control_assert(simple->resets); | 105 | reset_control_assert(simple->resets); |
@@ -158,14 +113,11 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) | |||
158 | { | 113 | { |
159 | struct dwc3_of_simple *simple = platform_get_drvdata(pdev); | 114 | struct dwc3_of_simple *simple = platform_get_drvdata(pdev); |
160 | struct device *dev = &pdev->dev; | 115 | struct device *dev = &pdev->dev; |
161 | int i; | ||
162 | 116 | ||
163 | of_platform_depopulate(dev); | 117 | of_platform_depopulate(dev); |
164 | 118 | ||
165 | for (i = 0; i < simple->num_clocks; i++) { | 119 | clk_bulk_disable_unprepare(simple->num_clocks, simple->clks); |
166 | clk_disable_unprepare(simple->clks[i]); | 120 | clk_bulk_put_all(simple->num_clocks, simple->clks); |
167 | clk_put(simple->clks[i]); | ||
168 | } | ||
169 | simple->num_clocks = 0; | 121 | simple->num_clocks = 0; |
170 | 122 | ||
171 | if (!simple->pulse_resets) | 123 | if (!simple->pulse_resets) |
@@ -183,10 +135,8 @@ static int dwc3_of_simple_remove(struct platform_device *pdev) | |||
183 | static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev) | 135 | static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev) |
184 | { | 136 | { |
185 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); | 137 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); |
186 | int i; | ||
187 | 138 | ||
188 | for (i = 0; i < simple->num_clocks; i++) | 139 | clk_bulk_disable(simple->num_clocks, simple->clks); |
189 | clk_disable(simple->clks[i]); | ||
190 | 140 | ||
191 | return 0; | 141 | return 0; |
192 | } | 142 | } |
@@ -194,19 +144,8 @@ static int __maybe_unused dwc3_of_simple_runtime_suspend(struct device *dev) | |||
194 | static int __maybe_unused dwc3_of_simple_runtime_resume(struct device *dev) | 144 | static int __maybe_unused dwc3_of_simple_runtime_resume(struct device *dev) |
195 | { | 145 | { |
196 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); | 146 | struct dwc3_of_simple *simple = dev_get_drvdata(dev); |
197 | int ret; | ||
198 | int i; | ||
199 | |||
200 | for (i = 0; i < simple->num_clocks; i++) { | ||
201 | ret = clk_enable(simple->clks[i]); | ||
202 | if (ret < 0) { | ||
203 | while (--i >= 0) | ||
204 | clk_disable(simple->clks[i]); | ||
205 | return ret; | ||
206 | } | ||
207 | } | ||
208 | 147 | ||
209 | return 0; | 148 | return clk_bulk_enable(simple->num_clocks, simple->clks); |
210 | } | 149 | } |
211 | 150 | ||
212 | static int __maybe_unused dwc3_of_simple_suspend(struct device *dev) | 151 | static int __maybe_unused dwc3_of_simple_suspend(struct device *dev) |