blob: 8c627c9a51305c7ec80ccb315483449cb1e52360 [file] [log] [blame]
Felipe Balbi72246da2011-08-19 18:10:58 +03001/**
2 * core.c - DesignWare USB3 DRD Controller Core file
3 *
4 * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
Felipe Balbi72246da2011-08-19 18:10:58 +03005 *
6 * Authors: Felipe Balbi <balbi@ti.com>,
7 * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
8 *
Felipe Balbi5945f782013-06-30 14:15:11 +03009 * This program is free software: you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 of
11 * the License as published by the Free Software Foundation.
Felipe Balbi72246da2011-08-19 18:10:58 +030012 *
Felipe Balbi5945f782013-06-30 14:15:11 +030013 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Felipe Balbi72246da2011-08-19 18:10:58 +030017 *
Felipe Balbi5945f782013-06-30 14:15:11 +030018 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
Felipe Balbi72246da2011-08-19 18:10:58 +030020 */
21
Felipe Balbia72e6582011-09-05 13:37:28 +030022#include <linux/module.h>
Felipe Balbi72246da2011-08-19 18:10:58 +030023#include <linux/kernel.h>
24#include <linux/slab.h>
25#include <linux/spinlock.h>
26#include <linux/platform_device.h>
27#include <linux/pm_runtime.h>
28#include <linux/interrupt.h>
29#include <linux/ioport.h>
30#include <linux/io.h>
31#include <linux/list.h>
32#include <linux/delay.h>
33#include <linux/dma-mapping.h>
Felipe Balbi457e84b2012-01-18 18:04:09 +020034#include <linux/of.h>
Felipe Balbi72246da2011-08-19 18:10:58 +030035
36#include <linux/usb/ch9.h>
37#include <linux/usb/gadget.h>
Felipe Balbif7e846f2013-06-30 14:29:51 +030038#include <linux/usb/of.h>
Ruchika Kharwara45c82b82013-07-06 07:52:49 -050039#include <linux/usb/otg.h>
Felipe Balbi72246da2011-08-19 18:10:58 +030040
Felipe Balbi6462cbd2013-06-30 14:19:33 +030041#include "platform_data.h"
Felipe Balbi72246da2011-08-19 18:10:58 +030042#include "core.h"
43#include "gadget.h"
44#include "io.h"
45
46#include "debug.h"
47
Felipe Balbi8300dd22011-10-18 13:54:01 +030048/* -------------------------------------------------------------------------- */
49
Sebastian Andrzej Siewior3140e8c2011-10-31 22:25:40 +010050void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
51{
52 u32 reg;
53
54 reg = dwc3_readl(dwc->regs, DWC3_GCTL);
55 reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));
56 reg |= DWC3_GCTL_PRTCAPDIR(mode);
57 dwc3_writel(dwc->regs, DWC3_GCTL, reg);
58}
Felipe Balbi8300dd22011-10-18 13:54:01 +030059
Felipe Balbi72246da2011-08-19 18:10:58 +030060/**
61 * dwc3_core_soft_reset - Issues core soft reset and PHY reset
62 * @dwc: pointer to our context structure
63 */
64static void dwc3_core_soft_reset(struct dwc3 *dwc)
65{
66 u32 reg;
67
68 /* Before Resetting PHY, put Core in Reset */
69 reg = dwc3_readl(dwc->regs, DWC3_GCTL);
70 reg |= DWC3_GCTL_CORESOFTRESET;
71 dwc3_writel(dwc->regs, DWC3_GCTL, reg);
72
73 /* Assert USB3 PHY reset */
74 reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
75 reg |= DWC3_GUSB3PIPECTL_PHYSOFTRST;
76 dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
77
78 /* Assert USB2 PHY reset */
79 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
80 reg |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
81 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
82
Felipe Balbi51e1e7b2012-07-19 14:09:48 +030083 usb_phy_init(dwc->usb2_phy);
84 usb_phy_init(dwc->usb3_phy);
Felipe Balbi72246da2011-08-19 18:10:58 +030085 mdelay(100);
86
87 /* Clear USB3 PHY reset */
88 reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
89 reg &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST;
90 dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
91
92 /* Clear USB2 PHY reset */
93 reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
94 reg &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST;
95 dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
96
Pratyush Anand45627ac2012-06-21 17:44:28 +053097 mdelay(100);
98
Felipe Balbi72246da2011-08-19 18:10:58 +030099 /* After PHYs are stable we can take Core out of reset state */
100 reg = dwc3_readl(dwc->regs, DWC3_GCTL);
101 reg &= ~DWC3_GCTL_CORESOFTRESET;
102 dwc3_writel(dwc->regs, DWC3_GCTL, reg);
103}
104
105/**
106 * dwc3_free_one_event_buffer - Frees one event buffer
107 * @dwc: Pointer to our controller context structure
108 * @evt: Pointer to event buffer to be freed
109 */
110static void dwc3_free_one_event_buffer(struct dwc3 *dwc,
111 struct dwc3_event_buffer *evt)
112{
113 dma_free_coherent(dwc->dev, evt->length, evt->buf, evt->dma);
Felipe Balbi72246da2011-08-19 18:10:58 +0300114}
115
116/**
Paul Zimmerman1d046792012-02-15 18:56:56 -0800117 * dwc3_alloc_one_event_buffer - Allocates one event buffer structure
Felipe Balbi72246da2011-08-19 18:10:58 +0300118 * @dwc: Pointer to our controller context structure
119 * @length: size of the event buffer
120 *
Paul Zimmerman1d046792012-02-15 18:56:56 -0800121 * Returns a pointer to the allocated event buffer structure on success
Felipe Balbi72246da2011-08-19 18:10:58 +0300122 * otherwise ERR_PTR(errno).
123 */
Felipe Balbi67d0b502013-02-22 16:31:07 +0200124static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
125 unsigned length)
Felipe Balbi72246da2011-08-19 18:10:58 +0300126{
127 struct dwc3_event_buffer *evt;
128
Felipe Balbi380f0d22012-10-11 13:48:36 +0300129 evt = devm_kzalloc(dwc->dev, sizeof(*evt), GFP_KERNEL);
Felipe Balbi72246da2011-08-19 18:10:58 +0300130 if (!evt)
131 return ERR_PTR(-ENOMEM);
132
133 evt->dwc = dwc;
134 evt->length = length;
135 evt->buf = dma_alloc_coherent(dwc->dev, length,
136 &evt->dma, GFP_KERNEL);
Felipe Balbie32672f2012-11-08 15:26:41 +0200137 if (!evt->buf)
Felipe Balbi72246da2011-08-19 18:10:58 +0300138 return ERR_PTR(-ENOMEM);
Felipe Balbi72246da2011-08-19 18:10:58 +0300139
140 return evt;
141}
142
143/**
144 * dwc3_free_event_buffers - frees all allocated event buffers
145 * @dwc: Pointer to our controller context structure
146 */
147static void dwc3_free_event_buffers(struct dwc3 *dwc)
148{
149 struct dwc3_event_buffer *evt;
150 int i;
151
Felipe Balbi9f622b22011-10-12 10:31:04 +0300152 for (i = 0; i < dwc->num_event_buffers; i++) {
Felipe Balbi72246da2011-08-19 18:10:58 +0300153 evt = dwc->ev_buffs[i];
Anton Tikhomirov64b6c8a2012-03-06 17:05:15 +0900154 if (evt)
Felipe Balbi72246da2011-08-19 18:10:58 +0300155 dwc3_free_one_event_buffer(dwc, evt);
Felipe Balbi72246da2011-08-19 18:10:58 +0300156 }
157}
158
159/**
160 * dwc3_alloc_event_buffers - Allocates @num event buffers of size @length
Paul Zimmerman1d046792012-02-15 18:56:56 -0800161 * @dwc: pointer to our controller context structure
Felipe Balbi72246da2011-08-19 18:10:58 +0300162 * @length: size of event buffer
163 *
Paul Zimmerman1d046792012-02-15 18:56:56 -0800164 * Returns 0 on success otherwise negative errno. In the error case, dwc
Felipe Balbi72246da2011-08-19 18:10:58 +0300165 * may contain some buffers allocated but not all which were requested.
166 */
Bill Pemberton41ac7b32012-11-19 13:21:48 -0500167static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length)
Felipe Balbi72246da2011-08-19 18:10:58 +0300168{
Felipe Balbi9f622b22011-10-12 10:31:04 +0300169 int num;
Felipe Balbi72246da2011-08-19 18:10:58 +0300170 int i;
171
Felipe Balbi9f622b22011-10-12 10:31:04 +0300172 num = DWC3_NUM_INT(dwc->hwparams.hwparams1);
173 dwc->num_event_buffers = num;
174
Felipe Balbi380f0d22012-10-11 13:48:36 +0300175 dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs) * num,
176 GFP_KERNEL);
Felipe Balbi457d3f22011-10-24 12:03:13 +0300177 if (!dwc->ev_buffs) {
178 dev_err(dwc->dev, "can't allocate event buffers array\n");
179 return -ENOMEM;
180 }
181
Felipe Balbi72246da2011-08-19 18:10:58 +0300182 for (i = 0; i < num; i++) {
183 struct dwc3_event_buffer *evt;
184
185 evt = dwc3_alloc_one_event_buffer(dwc, length);
186 if (IS_ERR(evt)) {
187 dev_err(dwc->dev, "can't allocate event buffer\n");
188 return PTR_ERR(evt);
189 }
190 dwc->ev_buffs[i] = evt;
191 }
192
193 return 0;
194}
195
196/**
197 * dwc3_event_buffers_setup - setup our allocated event buffers
Paul Zimmerman1d046792012-02-15 18:56:56 -0800198 * @dwc: pointer to our controller context structure
Felipe Balbi72246da2011-08-19 18:10:58 +0300199 *
200 * Returns 0 on success otherwise negative errno.
201 */
Paul Zimmerman7acd85e2012-04-27 14:28:02 +0300202static int dwc3_event_buffers_setup(struct dwc3 *dwc)
Felipe Balbi72246da2011-08-19 18:10:58 +0300203{
204 struct dwc3_event_buffer *evt;
205 int n;
206
Felipe Balbi9f622b22011-10-12 10:31:04 +0300207 for (n = 0; n < dwc->num_event_buffers; n++) {
Felipe Balbi72246da2011-08-19 18:10:58 +0300208 evt = dwc->ev_buffs[n];
209 dev_dbg(dwc->dev, "Event buf %p dma %08llx length %d\n",
210 evt->buf, (unsigned long long) evt->dma,
211 evt->length);
212
Paul Zimmerman7acd85e2012-04-27 14:28:02 +0300213 evt->lpos = 0;
214
Felipe Balbi72246da2011-08-19 18:10:58 +0300215 dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(n),
216 lower_32_bits(evt->dma));
217 dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(n),
218 upper_32_bits(evt->dma));
219 dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(n),
Felipe Balbi68d6a012013-06-12 21:09:26 +0300220 DWC3_GEVNTSIZ_SIZE(evt->length));
Felipe Balbi72246da2011-08-19 18:10:58 +0300221 dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(n), 0);
222 }
223
224 return 0;
225}
226
227static void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
228{
229 struct dwc3_event_buffer *evt;
230 int n;
231
Felipe Balbi9f622b22011-10-12 10:31:04 +0300232 for (n = 0; n < dwc->num_event_buffers; n++) {
Felipe Balbi72246da2011-08-19 18:10:58 +0300233 evt = dwc->ev_buffs[n];
Paul Zimmerman7acd85e2012-04-27 14:28:02 +0300234
235 evt->lpos = 0;
236
Felipe Balbi72246da2011-08-19 18:10:58 +0300237 dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(n), 0);
238 dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(n), 0);
Felipe Balbi68d6a012013-06-12 21:09:26 +0300239 dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(n), DWC3_GEVNTSIZ_INTMASK
240 | DWC3_GEVNTSIZ_SIZE(0));
Felipe Balbi72246da2011-08-19 18:10:58 +0300241 dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(n), 0);
242 }
243}
244
Felipe Balbi0ffcaf32013-12-19 13:04:28 -0600245static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc)
246{
247 if (!dwc->has_hibernation)
248 return 0;
249
250 if (!dwc->nr_scratch)
251 return 0;
252
253 dwc->scratchbuf = kmalloc_array(dwc->nr_scratch,
254 DWC3_SCRATCHBUF_SIZE, GFP_KERNEL);
255 if (!dwc->scratchbuf)
256 return -ENOMEM;
257
258 return 0;
259}
260
261static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
262{
263 dma_addr_t scratch_addr;
264 u32 param;
265 int ret;
266
267 if (!dwc->has_hibernation)
268 return 0;
269
270 if (!dwc->nr_scratch)
271 return 0;
272
273 /* should never fall here */
274 if (!WARN_ON(dwc->scratchbuf))
275 return 0;
276
277 scratch_addr = dma_map_single(dwc->dev, dwc->scratchbuf,
278 dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE,
279 DMA_BIDIRECTIONAL);
280 if (dma_mapping_error(dwc->dev, scratch_addr)) {
281 dev_err(dwc->dev, "failed to map scratch buffer\n");
282 ret = -EFAULT;
283 goto err0;
284 }
285
286 dwc->scratch_addr = scratch_addr;
287
288 param = lower_32_bits(scratch_addr);
289
290 ret = dwc3_send_gadget_generic_command(dwc,
291 DWC3_DGCMD_SET_SCRATCHPAD_ADDR_LO, param);
292 if (ret < 0)
293 goto err1;
294
295 param = upper_32_bits(scratch_addr);
296
297 ret = dwc3_send_gadget_generic_command(dwc,
298 DWC3_DGCMD_SET_SCRATCHPAD_ADDR_HI, param);
299 if (ret < 0)
300 goto err1;
301
302 return 0;
303
304err1:
305 dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch *
306 DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
307
308err0:
309 return ret;
310}
311
312static void dwc3_free_scratch_buffers(struct dwc3 *dwc)
313{
314 if (!dwc->has_hibernation)
315 return;
316
317 if (!dwc->nr_scratch)
318 return;
319
320 /* should never fall here */
321 if (!WARN_ON(dwc->scratchbuf))
322 return;
323
324 dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch *
325 DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
326 kfree(dwc->scratchbuf);
327}
328
Felipe Balbi789451f62011-05-05 15:53:10 +0300329static void dwc3_core_num_eps(struct dwc3 *dwc)
330{
331 struct dwc3_hwparams *parms = &dwc->hwparams;
332
333 dwc->num_in_eps = DWC3_NUM_IN_EPS(parms);
334 dwc->num_out_eps = DWC3_NUM_EPS(parms) - dwc->num_in_eps;
335
336 dev_vdbg(dwc->dev, "found %d IN and %d OUT endpoints\n",
337 dwc->num_in_eps, dwc->num_out_eps);
338}
339
Bill Pemberton41ac7b32012-11-19 13:21:48 -0500340static void dwc3_cache_hwparams(struct dwc3 *dwc)
Felipe Balbi26ceca92011-09-30 10:58:49 +0300341{
342 struct dwc3_hwparams *parms = &dwc->hwparams;
343
344 parms->hwparams0 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS0);
345 parms->hwparams1 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS1);
346 parms->hwparams2 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS2);
347 parms->hwparams3 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS3);
348 parms->hwparams4 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS4);
349 parms->hwparams5 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS5);
350 parms->hwparams6 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS6);
351 parms->hwparams7 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS7);
352 parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8);
353}
354
Felipe Balbi72246da2011-08-19 18:10:58 +0300355/**
356 * dwc3_core_init - Low-level initialization of DWC3 Core
357 * @dwc: Pointer to our controller context structure
358 *
359 * Returns 0 on success otherwise negative errno.
360 */
Bill Pemberton41ac7b32012-11-19 13:21:48 -0500361static int dwc3_core_init(struct dwc3 *dwc)
Felipe Balbi72246da2011-08-19 18:10:58 +0300362{
363 unsigned long timeout;
Felipe Balbi0ffcaf32013-12-19 13:04:28 -0600364 u32 hwparams4 = dwc->hwparams.hwparams4;
Felipe Balbi72246da2011-08-19 18:10:58 +0300365 u32 reg;
366 int ret;
367
Sebastian Andrzej Siewior7650bd72011-08-29 13:56:36 +0200368 reg = dwc3_readl(dwc->regs, DWC3_GSNPSID);
369 /* This should read as U3 followed by revision number */
370 if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) {
371 dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
372 ret = -ENODEV;
373 goto err0;
374 }
Felipe Balbi248b1222011-12-14 21:59:30 +0200375 dwc->revision = reg;
Sebastian Andrzej Siewior7650bd72011-08-29 13:56:36 +0200376
Felipe Balbi72246da2011-08-19 18:10:58 +0300377 /* issue device SoftReset too */
378 timeout = jiffies + msecs_to_jiffies(500);
379 dwc3_writel(dwc->regs, DWC3_DCTL, DWC3_DCTL_CSFTRST);
380 do {
381 reg = dwc3_readl(dwc->regs, DWC3_DCTL);
382 if (!(reg & DWC3_DCTL_CSFTRST))
383 break;
384
385 if (time_after(jiffies, timeout)) {
386 dev_err(dwc->dev, "Reset Timed Out\n");
387 ret = -ETIMEDOUT;
388 goto err0;
389 }
390
391 cpu_relax();
392 } while (true);
393
Pratyush Anand58a0f232012-06-21 17:44:29 +0530394 dwc3_core_soft_reset(dwc);
395
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100396 reg = dwc3_readl(dwc->regs, DWC3_GCTL);
Paul Zimmerman3e87c422012-02-24 17:32:13 -0800397 reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100398 reg &= ~DWC3_GCTL_DISSCRAMBLE;
399
Sebastian Andrzej Siewior164d7732011-11-24 11:22:05 +0100400 switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100401 case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
Felipe Balbi32a4a132014-02-25 14:00:13 -0600402 /**
403 * WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
404 * issue which would cause xHCI compliance tests to fail.
405 *
406 * Because of that we cannot enable clock gating on such
407 * configurations.
408 *
409 * Refers to:
410 *
411 * STAR#9000588375: Clock Gating, SOF Issues when ref_clk-Based
412 * SOF/ITP Mode Used
413 */
414 if ((dwc->dr_mode == USB_DR_MODE_HOST ||
415 dwc->dr_mode == USB_DR_MODE_OTG) &&
416 (dwc->revision >= DWC3_REVISION_210A &&
417 dwc->revision <= DWC3_REVISION_250A))
418 reg |= DWC3_GCTL_DSBLCLKGTNG | DWC3_GCTL_SOFITPSYNC;
419 else
420 reg &= ~DWC3_GCTL_DSBLCLKGTNG;
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100421 break;
Felipe Balbi0ffcaf32013-12-19 13:04:28 -0600422 case DWC3_GHWPARAMS1_EN_PWROPT_HIB:
423 /* enable hibernation here */
424 dwc->nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4);
425 break;
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100426 default:
427 dev_dbg(dwc->dev, "No power optimization available\n");
428 }
429
430 /*
431 * WORKAROUND: DWC3 revisions <1.90a have a bug
Paul Zimmerman1d046792012-02-15 18:56:56 -0800432 * where the device can fail to connect at SuperSpeed
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100433 * and falls back to high-speed mode which causes
Paul Zimmerman1d046792012-02-15 18:56:56 -0800434 * the device to enter a Connect/Disconnect loop
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100435 */
436 if (dwc->revision < DWC3_REVISION_190A)
437 reg |= DWC3_GCTL_U2RSTECN;
438
Felipe Balbi789451f62011-05-05 15:53:10 +0300439 dwc3_core_num_eps(dwc);
440
Sebastian Andrzej Siewior4878a022011-10-31 22:25:41 +0100441 dwc3_writel(dwc->regs, DWC3_GCTL, reg);
442
Felipe Balbi0ffcaf32013-12-19 13:04:28 -0600443 ret = dwc3_alloc_scratch_buffers(dwc);
444 if (ret)
445 goto err1;
446
447 ret = dwc3_setup_scratch_buffers(dwc);
448 if (ret)
449 goto err2;
450
Felipe Balbi72246da2011-08-19 18:10:58 +0300451 return 0;
452
Felipe Balbi0ffcaf32013-12-19 13:04:28 -0600453err2:
454 dwc3_free_scratch_buffers(dwc);
455
456err1:
457 usb_phy_shutdown(dwc->usb2_phy);
458 usb_phy_shutdown(dwc->usb3_phy);
459
Felipe Balbi72246da2011-08-19 18:10:58 +0300460err0:
461 return ret;
462}
463
464static void dwc3_core_exit(struct dwc3 *dwc)
465{
Felipe Balbi0ffcaf32013-12-19 13:04:28 -0600466 dwc3_free_scratch_buffers(dwc);
Vivek Gautam01b8daf2012-10-13 19:20:18 +0530467 usb_phy_shutdown(dwc->usb2_phy);
468 usb_phy_shutdown(dwc->usb3_phy);
Felipe Balbi72246da2011-08-19 18:10:58 +0300469}
470
471#define DWC3_ALIGN_MASK (16 - 1)
472
Bill Pemberton41ac7b32012-11-19 13:21:48 -0500473static int dwc3_probe(struct platform_device *pdev)
Felipe Balbi72246da2011-08-19 18:10:58 +0300474{
Felipe Balbi941ea362013-07-31 09:21:25 +0300475 struct device *dev = &pdev->dev;
476 struct dwc3_platform_data *pdata = dev_get_platdata(dev);
477 struct device_node *node = dev->of_node;
Felipe Balbi72246da2011-08-19 18:10:58 +0300478 struct resource *res;
479 struct dwc3 *dwc;
Felipe Balbi0949e992011-10-12 10:44:56 +0300480
Felipe Balbi72246da2011-08-19 18:10:58 +0300481 int ret = -ENOMEM;
Felipe Balbi0949e992011-10-12 10:44:56 +0300482
483 void __iomem *regs;
Felipe Balbi72246da2011-08-19 18:10:58 +0300484 void *mem;
485
Chanho Park802ca852012-02-15 18:27:55 +0900486 mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
Felipe Balbi72246da2011-08-19 18:10:58 +0300487 if (!mem) {
Chanho Park802ca852012-02-15 18:27:55 +0900488 dev_err(dev, "not enough memory\n");
489 return -ENOMEM;
Felipe Balbi72246da2011-08-19 18:10:58 +0300490 }
491 dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1);
492 dwc->mem = mem;
493
Ido Shayevitz51249dc2012-04-24 14:18:39 +0300494 res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
Felipe Balbi72246da2011-08-19 18:10:58 +0300495 if (!res) {
Ido Shayevitz51249dc2012-04-24 14:18:39 +0300496 dev_err(dev, "missing IRQ\n");
Chanho Park802ca852012-02-15 18:27:55 +0900497 return -ENODEV;
Felipe Balbi72246da2011-08-19 18:10:58 +0300498 }
Kishon Vijay Abraham I066618b2012-08-21 14:56:16 +0530499 dwc->xhci_resources[1].start = res->start;
500 dwc->xhci_resources[1].end = res->end;
501 dwc->xhci_resources[1].flags = res->flags;
502 dwc->xhci_resources[1].name = res->name;
Felipe Balbi72246da2011-08-19 18:10:58 +0300503
Ido Shayevitz51249dc2012-04-24 14:18:39 +0300504 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
505 if (!res) {
506 dev_err(dev, "missing memory resource\n");
507 return -ENODEV;
508 }
Felipe Balbi72246da2011-08-19 18:10:58 +0300509
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530510 if (node) {
Felipe Balbif7e846f2013-06-30 14:29:51 +0300511 dwc->maximum_speed = of_usb_get_maximum_speed(node);
512
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530513 dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
514 dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
Felipe Balbi6462cbd2013-06-30 14:19:33 +0300515
516 dwc->needs_fifo_resize = of_property_read_bool(node, "tx-fifo-resize");
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500517 dwc->dr_mode = of_usb_get_dr_mode(node);
Felipe Balbibb674902013-08-14 13:21:23 -0500518 } else if (pdata) {
Felipe Balbif7e846f2013-06-30 14:29:51 +0300519 dwc->maximum_speed = pdata->maximum_speed;
520
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530521 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
522 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
Felipe Balbi6462cbd2013-06-30 14:19:33 +0300523
524 dwc->needs_fifo_resize = pdata->tx_fifo_resize;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500525 dwc->dr_mode = pdata->dr_mode;
Felipe Balbibb674902013-08-14 13:21:23 -0500526 } else {
527 dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
528 dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530529 }
530
Felipe Balbif7e846f2013-06-30 14:29:51 +0300531 /* default to superspeed if no maximum_speed passed */
532 if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
533 dwc->maximum_speed = USB_SPEED_SUPER;
534
Felipe Balbid105e7f2013-03-15 10:52:08 +0200535 if (IS_ERR(dwc->usb2_phy)) {
536 ret = PTR_ERR(dwc->usb2_phy);
537
538 /*
539 * if -ENXIO is returned, it means PHY layer wasn't
540 * enabled, so it makes no sense to return -EPROBE_DEFER
541 * in that case, since no PHY driver will ever probe.
542 */
543 if (ret == -ENXIO)
544 return ret;
545
Felipe Balbi51e1e7b2012-07-19 14:09:48 +0300546 dev_err(dev, "no usb2 phy configured\n");
547 return -EPROBE_DEFER;
548 }
549
Felipe Balbid105e7f2013-03-15 10:52:08 +0200550 if (IS_ERR(dwc->usb3_phy)) {
Ruchika Kharwar315955d72013-07-04 00:59:34 -0500551 ret = PTR_ERR(dwc->usb3_phy);
Felipe Balbid105e7f2013-03-15 10:52:08 +0200552
553 /*
554 * if -ENXIO is returned, it means PHY layer wasn't
555 * enabled, so it makes no sense to return -EPROBE_DEFER
556 * in that case, since no PHY driver will ever probe.
557 */
558 if (ret == -ENXIO)
559 return ret;
560
Felipe Balbi51e1e7b2012-07-19 14:09:48 +0300561 dev_err(dev, "no usb3 phy configured\n");
562 return -EPROBE_DEFER;
563 }
564
Ivan T. Ivanov2e112342013-07-29 10:27:02 +0300565 dwc->xhci_resources[0].start = res->start;
566 dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
567 DWC3_XHCI_REGS_END;
568 dwc->xhci_resources[0].flags = res->flags;
569 dwc->xhci_resources[0].name = res->name;
570
571 res->start += DWC3_GLOBALS_REGS_START;
572
573 /*
574 * Request memory region but exclude xHCI regs,
575 * since it will be requested by the xhci-plat driver.
576 */
577 regs = devm_ioremap_resource(dev, res);
578 if (IS_ERR(regs))
579 return PTR_ERR(regs);
580
Felipe Balbi72246da2011-08-19 18:10:58 +0300581 spin_lock_init(&dwc->lock);
582 platform_set_drvdata(pdev, dwc);
583
584 dwc->regs = regs;
585 dwc->regs_size = resource_size(res);
Chanho Park802ca852012-02-15 18:27:55 +0900586 dwc->dev = dev;
Felipe Balbi72246da2011-08-19 18:10:58 +0300587
Kishon Vijay Abraham Iddff14f2013-03-07 18:51:43 +0530588 dev->dma_mask = dev->parent->dma_mask;
589 dev->dma_parms = dev->parent->dma_parms;
590 dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
591
Chanho Park802ca852012-02-15 18:27:55 +0900592 pm_runtime_enable(dev);
593 pm_runtime_get_sync(dev);
594 pm_runtime_forbid(dev);
Felipe Balbi72246da2011-08-19 18:10:58 +0300595
Kishon Vijay Abraham I4fd24482012-11-16 12:07:54 +0530596 dwc3_cache_hwparams(dwc);
597
Felipe Balbi39214262012-10-11 13:54:36 +0300598 ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
599 if (ret) {
600 dev_err(dwc->dev, "failed to allocate event buffers\n");
601 ret = -ENOMEM;
602 goto err0;
603 }
604
Felipe Balbi32a4a132014-02-25 14:00:13 -0600605 if (IS_ENABLED(CONFIG_USB_DWC3_HOST))
606 dwc->dr_mode = USB_DR_MODE_HOST;
607 else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
608 dwc->dr_mode = USB_DR_MODE_PERIPHERAL;
609
610 if (dwc->dr_mode == USB_DR_MODE_UNKNOWN)
611 dwc->dr_mode = USB_DR_MODE_OTG;
612
Felipe Balbi72246da2011-08-19 18:10:58 +0300613 ret = dwc3_core_init(dwc);
614 if (ret) {
Chanho Park802ca852012-02-15 18:27:55 +0900615 dev_err(dev, "failed to initialize core\n");
Felipe Balbi39214262012-10-11 13:54:36 +0300616 goto err0;
Felipe Balbi72246da2011-08-19 18:10:58 +0300617 }
618
Kishon Vijay Abraham I3088f102013-11-25 15:31:21 +0530619 usb_phy_set_suspend(dwc->usb2_phy, 0);
620 usb_phy_set_suspend(dwc->usb3_phy, 0);
621
Felipe Balbif122d332013-02-08 15:15:11 +0200622 ret = dwc3_event_buffers_setup(dwc);
623 if (ret) {
624 dev_err(dwc->dev, "failed to setup event buffers\n");
625 goto err1;
626 }
627
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500628 switch (dwc->dr_mode) {
629 case USB_DR_MODE_PERIPHERAL:
Sebastian Andrzej Siewior3140e8c2011-10-31 22:25:40 +0100630 dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
Felipe Balbi72246da2011-08-19 18:10:58 +0300631 ret = dwc3_gadget_init(dwc);
632 if (ret) {
Chanho Park802ca852012-02-15 18:27:55 +0900633 dev_err(dev, "failed to initialize gadget\n");
Felipe Balbif122d332013-02-08 15:15:11 +0200634 goto err2;
Felipe Balbi72246da2011-08-19 18:10:58 +0300635 }
Felipe Balbi0949e992011-10-12 10:44:56 +0300636 break;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500637 case USB_DR_MODE_HOST:
Sebastian Andrzej Siewior3140e8c2011-10-31 22:25:40 +0100638 dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
Felipe Balbid07e8812011-10-12 14:08:26 +0300639 ret = dwc3_host_init(dwc);
640 if (ret) {
Chanho Park802ca852012-02-15 18:27:55 +0900641 dev_err(dev, "failed to initialize host\n");
Felipe Balbif122d332013-02-08 15:15:11 +0200642 goto err2;
Felipe Balbid07e8812011-10-12 14:08:26 +0300643 }
644 break;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500645 case USB_DR_MODE_OTG:
Sebastian Andrzej Siewior3140e8c2011-10-31 22:25:40 +0100646 dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
Felipe Balbid07e8812011-10-12 14:08:26 +0300647 ret = dwc3_host_init(dwc);
648 if (ret) {
Chanho Park802ca852012-02-15 18:27:55 +0900649 dev_err(dev, "failed to initialize host\n");
Felipe Balbif122d332013-02-08 15:15:11 +0200650 goto err2;
Felipe Balbid07e8812011-10-12 14:08:26 +0300651 }
652
653 ret = dwc3_gadget_init(dwc);
654 if (ret) {
Chanho Park802ca852012-02-15 18:27:55 +0900655 dev_err(dev, "failed to initialize gadget\n");
Felipe Balbif122d332013-02-08 15:15:11 +0200656 goto err2;
Felipe Balbid07e8812011-10-12 14:08:26 +0300657 }
658 break;
Felipe Balbi0949e992011-10-12 10:44:56 +0300659 default:
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500660 dev_err(dev, "Unsupported mode of operation %d\n", dwc->dr_mode);
Felipe Balbif122d332013-02-08 15:15:11 +0200661 goto err2;
Felipe Balbi72246da2011-08-19 18:10:58 +0300662 }
663
664 ret = dwc3_debugfs_init(dwc);
665 if (ret) {
Chanho Park802ca852012-02-15 18:27:55 +0900666 dev_err(dev, "failed to initialize debugfs\n");
Felipe Balbif122d332013-02-08 15:15:11 +0200667 goto err3;
Felipe Balbi72246da2011-08-19 18:10:58 +0300668 }
669
Chanho Park802ca852012-02-15 18:27:55 +0900670 pm_runtime_allow(dev);
Felipe Balbi72246da2011-08-19 18:10:58 +0300671
672 return 0;
673
Felipe Balbif122d332013-02-08 15:15:11 +0200674err3:
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500675 switch (dwc->dr_mode) {
676 case USB_DR_MODE_PERIPHERAL:
Felipe Balbi72246da2011-08-19 18:10:58 +0300677 dwc3_gadget_exit(dwc);
Felipe Balbi0949e992011-10-12 10:44:56 +0300678 break;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500679 case USB_DR_MODE_HOST:
Felipe Balbid07e8812011-10-12 14:08:26 +0300680 dwc3_host_exit(dwc);
681 break;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500682 case USB_DR_MODE_OTG:
Felipe Balbid07e8812011-10-12 14:08:26 +0300683 dwc3_host_exit(dwc);
684 dwc3_gadget_exit(dwc);
685 break;
Felipe Balbi0949e992011-10-12 10:44:56 +0300686 default:
687 /* do nothing */
688 break;
689 }
Felipe Balbi72246da2011-08-19 18:10:58 +0300690
Felipe Balbif122d332013-02-08 15:15:11 +0200691err2:
692 dwc3_event_buffers_cleanup(dwc);
693
Chanho Park802ca852012-02-15 18:27:55 +0900694err1:
Kishon Vijay Abraham I501fae52013-11-25 15:31:22 +0530695 usb_phy_set_suspend(dwc->usb2_phy, 1);
696 usb_phy_set_suspend(dwc->usb3_phy, 1);
Felipe Balbi72246da2011-08-19 18:10:58 +0300697 dwc3_core_exit(dwc);
698
Felipe Balbi39214262012-10-11 13:54:36 +0300699err0:
700 dwc3_free_event_buffers(dwc);
701
Felipe Balbi72246da2011-08-19 18:10:58 +0300702 return ret;
703}
704
Bill Pembertonfb4e98a2012-11-19 13:26:20 -0500705static int dwc3_remove(struct platform_device *pdev)
Felipe Balbi72246da2011-08-19 18:10:58 +0300706{
Felipe Balbi72246da2011-08-19 18:10:58 +0300707 struct dwc3 *dwc = platform_get_drvdata(pdev);
Felipe Balbi72246da2011-08-19 18:10:58 +0300708
Kishon Vijay Abraham I8ba007a2013-01-25 08:30:54 +0530709 usb_phy_set_suspend(dwc->usb2_phy, 1);
710 usb_phy_set_suspend(dwc->usb3_phy, 1);
711
Felipe Balbi16b972a2013-10-11 08:34:28 -0500712 pm_runtime_put_sync(&pdev->dev);
Felipe Balbi72246da2011-08-19 18:10:58 +0300713 pm_runtime_disable(&pdev->dev);
714
715 dwc3_debugfs_exit(dwc);
716
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500717 switch (dwc->dr_mode) {
718 case USB_DR_MODE_PERIPHERAL:
Felipe Balbi72246da2011-08-19 18:10:58 +0300719 dwc3_gadget_exit(dwc);
Felipe Balbi0949e992011-10-12 10:44:56 +0300720 break;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500721 case USB_DR_MODE_HOST:
Felipe Balbid07e8812011-10-12 14:08:26 +0300722 dwc3_host_exit(dwc);
723 break;
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500724 case USB_DR_MODE_OTG:
Felipe Balbid07e8812011-10-12 14:08:26 +0300725 dwc3_host_exit(dwc);
726 dwc3_gadget_exit(dwc);
727 break;
Felipe Balbi0949e992011-10-12 10:44:56 +0300728 default:
729 /* do nothing */
730 break;
731 }
Felipe Balbi72246da2011-08-19 18:10:58 +0300732
Felipe Balbif122d332013-02-08 15:15:11 +0200733 dwc3_event_buffers_cleanup(dwc);
Felipe Balbid9b43302013-02-08 15:14:16 +0200734 dwc3_free_event_buffers(dwc);
Felipe Balbi72246da2011-08-19 18:10:58 +0300735 dwc3_core_exit(dwc);
Felipe Balbi72246da2011-08-19 18:10:58 +0300736
737 return 0;
738}
739
Jingoo Han19fda7c2013-03-26 01:52:48 +0000740#ifdef CONFIG_PM_SLEEP
Felipe Balbi7415f172012-04-30 14:56:33 +0300741static int dwc3_prepare(struct device *dev)
742{
743 struct dwc3 *dwc = dev_get_drvdata(dev);
744 unsigned long flags;
745
746 spin_lock_irqsave(&dwc->lock, flags);
747
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500748 switch (dwc->dr_mode) {
749 case USB_DR_MODE_PERIPHERAL:
750 case USB_DR_MODE_OTG:
Felipe Balbi7415f172012-04-30 14:56:33 +0300751 dwc3_gadget_prepare(dwc);
752 /* FALLTHROUGH */
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500753 case USB_DR_MODE_HOST:
Felipe Balbi7415f172012-04-30 14:56:33 +0300754 default:
755 dwc3_event_buffers_cleanup(dwc);
756 break;
757 }
758
759 spin_unlock_irqrestore(&dwc->lock, flags);
760
761 return 0;
762}
763
764static void dwc3_complete(struct device *dev)
765{
766 struct dwc3 *dwc = dev_get_drvdata(dev);
767 unsigned long flags;
768
769 spin_lock_irqsave(&dwc->lock, flags);
770
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500771 switch (dwc->dr_mode) {
772 case USB_DR_MODE_PERIPHERAL:
773 case USB_DR_MODE_OTG:
Felipe Balbi7415f172012-04-30 14:56:33 +0300774 dwc3_gadget_complete(dwc);
775 /* FALLTHROUGH */
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500776 case USB_DR_MODE_HOST:
Felipe Balbi7415f172012-04-30 14:56:33 +0300777 default:
778 dwc3_event_buffers_setup(dwc);
779 break;
780 }
781
782 spin_unlock_irqrestore(&dwc->lock, flags);
783}
784
785static int dwc3_suspend(struct device *dev)
786{
787 struct dwc3 *dwc = dev_get_drvdata(dev);
788 unsigned long flags;
789
790 spin_lock_irqsave(&dwc->lock, flags);
791
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500792 switch (dwc->dr_mode) {
793 case USB_DR_MODE_PERIPHERAL:
794 case USB_DR_MODE_OTG:
Felipe Balbi7415f172012-04-30 14:56:33 +0300795 dwc3_gadget_suspend(dwc);
796 /* FALLTHROUGH */
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500797 case USB_DR_MODE_HOST:
Felipe Balbi7415f172012-04-30 14:56:33 +0300798 default:
799 /* do nothing */
800 break;
801 }
802
803 dwc->gctl = dwc3_readl(dwc->regs, DWC3_GCTL);
804 spin_unlock_irqrestore(&dwc->lock, flags);
805
806 usb_phy_shutdown(dwc->usb3_phy);
807 usb_phy_shutdown(dwc->usb2_phy);
808
809 return 0;
810}
811
812static int dwc3_resume(struct device *dev)
813{
814 struct dwc3 *dwc = dev_get_drvdata(dev);
815 unsigned long flags;
816
817 usb_phy_init(dwc->usb3_phy);
818 usb_phy_init(dwc->usb2_phy);
Felipe Balbi7415f172012-04-30 14:56:33 +0300819
820 spin_lock_irqsave(&dwc->lock, flags);
821
822 dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl);
823
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500824 switch (dwc->dr_mode) {
825 case USB_DR_MODE_PERIPHERAL:
826 case USB_DR_MODE_OTG:
Felipe Balbi7415f172012-04-30 14:56:33 +0300827 dwc3_gadget_resume(dwc);
828 /* FALLTHROUGH */
Ruchika Kharwara45c82b82013-07-06 07:52:49 -0500829 case USB_DR_MODE_HOST:
Felipe Balbi7415f172012-04-30 14:56:33 +0300830 default:
831 /* do nothing */
832 break;
833 }
834
835 spin_unlock_irqrestore(&dwc->lock, flags);
836
837 pm_runtime_disable(dev);
838 pm_runtime_set_active(dev);
839 pm_runtime_enable(dev);
840
841 return 0;
842}
843
844static const struct dev_pm_ops dwc3_dev_pm_ops = {
845 .prepare = dwc3_prepare,
846 .complete = dwc3_complete,
847
848 SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
849};
850
851#define DWC3_PM_OPS &(dwc3_dev_pm_ops)
852#else
853#define DWC3_PM_OPS NULL
854#endif
855
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530856#ifdef CONFIG_OF
857static const struct of_device_id of_dwc3_match[] = {
858 {
Felipe Balbi22a5aa12013-07-02 21:20:24 +0300859 .compatible = "snps,dwc3"
860 },
861 {
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530862 .compatible = "synopsys,dwc3"
863 },
864 { },
865};
866MODULE_DEVICE_TABLE(of, of_dwc3_match);
867#endif
868
Felipe Balbi72246da2011-08-19 18:10:58 +0300869static struct platform_driver dwc3_driver = {
870 .probe = dwc3_probe,
Bill Pemberton76904172012-11-19 13:21:08 -0500871 .remove = dwc3_remove,
Felipe Balbi72246da2011-08-19 18:10:58 +0300872 .driver = {
873 .name = "dwc3",
Kishon Vijay Abraham I5088b6f2013-01-25 16:36:53 +0530874 .of_match_table = of_match_ptr(of_dwc3_match),
Felipe Balbi7415f172012-04-30 14:56:33 +0300875 .pm = DWC3_PM_OPS,
Felipe Balbi72246da2011-08-19 18:10:58 +0300876 },
Felipe Balbi72246da2011-08-19 18:10:58 +0300877};
878
Tobias Klauserb1116dc2012-02-28 12:57:20 +0100879module_platform_driver(dwc3_driver);
880
Sebastian Andrzej Siewior7ae4fc42011-10-19 19:39:50 +0200881MODULE_ALIAS("platform:dwc3");
Felipe Balbi72246da2011-08-19 18:10:58 +0300882MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
Felipe Balbi5945f782013-06-30 14:15:11 +0300883MODULE_LICENSE("GPL v2");
Felipe Balbi72246da2011-08-19 18:10:58 +0300884MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");