core.c 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192
  1. /**
  2. * core.c - DesignWare USB3 DRD Controller Core file
  3. *
  4. * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
  5. *
  6. * Authors: Felipe Balbi <balbi@ti.com>,
  7. * Sebastian Andrzej Siewior <bigeasy@linutronix.de>
  8. *
  9. * 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.
  12. *
  13. * 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.
  17. *
  18. * 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/>.
  20. */
  21. #include <linux/version.h>
  22. #include <linux/module.h>
  23. #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>
  34. #include <linux/of.h>
  35. #include <linux/acpi.h>
  36. #include <linux/usb/ch9.h>
  37. #include <linux/usb/gadget.h>
  38. #include <linux/usb/of.h>
  39. #include <linux/usb/otg.h>
  40. #include "platform_data.h"
  41. #include "core.h"
  42. #include "gadget.h"
  43. #include "io.h"
  44. #include "debug.h"
  45. /* -------------------------------------------------------------------------- */
  46. void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
  47. {
  48. u32 reg;
  49. reg = dwc3_readl(dwc->regs, DWC3_GCTL);
  50. reg &= ~(DWC3_GCTL_PRTCAPDIR(DWC3_GCTL_PRTCAP_OTG));
  51. reg |= DWC3_GCTL_PRTCAPDIR(mode);
  52. dwc3_writel(dwc->regs, DWC3_GCTL, reg);
  53. }
  54. /**
  55. * dwc3_core_soft_reset - Issues core soft reset and PHY reset
  56. * @dwc: pointer to our context structure
  57. */
  58. static int dwc3_core_soft_reset(struct dwc3 *dwc)
  59. {
  60. u32 reg;
  61. int ret;
  62. /* Before Resetting PHY, put Core in Reset */
  63. reg = dwc3_readl(dwc->regs, DWC3_GCTL);
  64. reg |= DWC3_GCTL_CORESOFTRESET;
  65. dwc3_writel(dwc->regs, DWC3_GCTL, reg);
  66. /* Assert USB3 PHY reset */
  67. reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
  68. reg |= DWC3_GUSB3PIPECTL_PHYSOFTRST;
  69. dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
  70. /* Assert USB2 PHY reset */
  71. reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
  72. reg |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
  73. dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
  74. usb_phy_init(dwc->usb2_phy);
  75. usb_phy_init(dwc->usb3_phy);
  76. ret = phy_init(dwc->usb2_generic_phy);
  77. if (ret < 0)
  78. return ret;
  79. ret = phy_init(dwc->usb3_generic_phy);
  80. if (ret < 0) {
  81. phy_exit(dwc->usb2_generic_phy);
  82. return ret;
  83. }
  84. mdelay(100);
  85. /* Clear USB3 PHY reset */
  86. reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
  87. reg &= ~DWC3_GUSB3PIPECTL_PHYSOFTRST;
  88. dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
  89. /* Clear USB2 PHY reset */
  90. reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
  91. reg &= ~DWC3_GUSB2PHYCFG_PHYSOFTRST;
  92. dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
  93. mdelay(100);
  94. /* After PHYs are stable we can take Core out of reset state */
  95. reg = dwc3_readl(dwc->regs, DWC3_GCTL);
  96. reg &= ~DWC3_GCTL_CORESOFTRESET;
  97. dwc3_writel(dwc->regs, DWC3_GCTL, reg);
  98. return 0;
  99. }
  100. /**
  101. * dwc3_soft_reset - Issue soft reset
  102. * @dwc: Pointer to our controller context structure
  103. */
  104. static int dwc3_soft_reset(struct dwc3 *dwc)
  105. {
  106. unsigned long timeout;
  107. u32 reg;
  108. timeout = jiffies + msecs_to_jiffies(500);
  109. dwc3_writel(dwc->regs, DWC3_DCTL, DWC3_DCTL_CSFTRST);
  110. do {
  111. reg = dwc3_readl(dwc->regs, DWC3_DCTL);
  112. if (!(reg & DWC3_DCTL_CSFTRST))
  113. break;
  114. if (time_after(jiffies, timeout)) {
  115. dev_err(dwc->dev, "Reset Timed Out\n");
  116. return -ETIMEDOUT;
  117. }
  118. cpu_relax();
  119. } while (true);
  120. return 0;
  121. }
  122. /**
  123. * dwc3_free_one_event_buffer - Frees one event buffer
  124. * @dwc: Pointer to our controller context structure
  125. * @evt: Pointer to event buffer to be freed
  126. */
  127. static void dwc3_free_one_event_buffer(struct dwc3 *dwc,
  128. struct dwc3_event_buffer *evt)
  129. {
  130. dma_free_coherent(dwc->dev, evt->length, evt->buf, evt->dma);
  131. }
  132. /**
  133. * dwc3_alloc_one_event_buffer - Allocates one event buffer structure
  134. * @dwc: Pointer to our controller context structure
  135. * @length: size of the event buffer
  136. *
  137. * Returns a pointer to the allocated event buffer structure on success
  138. * otherwise ERR_PTR(errno).
  139. */
  140. static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
  141. unsigned length)
  142. {
  143. struct dwc3_event_buffer *evt;
  144. evt = devm_kzalloc(dwc->dev, sizeof(*evt), GFP_KERNEL);
  145. if (!evt)
  146. return ERR_PTR(-ENOMEM);
  147. evt->dwc = dwc;
  148. evt->length = length;
  149. evt->buf = dma_alloc_coherent(dwc->dev, length,
  150. &evt->dma, GFP_KERNEL);
  151. if (!evt->buf)
  152. return ERR_PTR(-ENOMEM);
  153. return evt;
  154. }
  155. /**
  156. * dwc3_free_event_buffers - frees all allocated event buffers
  157. * @dwc: Pointer to our controller context structure
  158. */
  159. static void dwc3_free_event_buffers(struct dwc3 *dwc)
  160. {
  161. struct dwc3_event_buffer *evt;
  162. int i;
  163. for (i = 0; i < dwc->num_event_buffers; i++) {
  164. evt = dwc->ev_buffs[i];
  165. if (evt)
  166. dwc3_free_one_event_buffer(dwc, evt);
  167. }
  168. }
  169. /**
  170. * dwc3_alloc_event_buffers - Allocates @num event buffers of size @length
  171. * @dwc: pointer to our controller context structure
  172. * @length: size of event buffer
  173. *
  174. * Returns 0 on success otherwise negative errno. In the error case, dwc
  175. * may contain some buffers allocated but not all which were requested.
  176. */
  177. static int dwc3_alloc_event_buffers(struct dwc3 *dwc, unsigned length)
  178. {
  179. int num;
  180. int i;
  181. num = DWC3_NUM_INT(dwc->hwparams.hwparams1);
  182. dwc->num_event_buffers = num;
  183. dwc->ev_buffs = devm_kzalloc(dwc->dev, sizeof(*dwc->ev_buffs) * num,
  184. GFP_KERNEL);
  185. if (!dwc->ev_buffs)
  186. return -ENOMEM;
  187. for (i = 0; i < num; i++) {
  188. struct dwc3_event_buffer *evt;
  189. evt = dwc3_alloc_one_event_buffer(dwc, length);
  190. if (IS_ERR(evt)) {
  191. dev_err(dwc->dev, "can't allocate event buffer\n");
  192. return PTR_ERR(evt);
  193. }
  194. dwc->ev_buffs[i] = evt;
  195. }
  196. return 0;
  197. }
  198. /**
  199. * dwc3_event_buffers_setup - setup our allocated event buffers
  200. * @dwc: pointer to our controller context structure
  201. *
  202. * Returns 0 on success otherwise negative errno.
  203. */
  204. static int dwc3_event_buffers_setup(struct dwc3 *dwc)
  205. {
  206. struct dwc3_event_buffer *evt;
  207. int n;
  208. for (n = 0; n < dwc->num_event_buffers; n++) {
  209. evt = dwc->ev_buffs[n];
  210. dev_dbg(dwc->dev, "Event buf %p dma %08llx length %d\n",
  211. evt->buf, (unsigned long long) evt->dma,
  212. evt->length);
  213. evt->lpos = 0;
  214. dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(n),
  215. lower_32_bits(evt->dma));
  216. dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(n),
  217. upper_32_bits(evt->dma));
  218. dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(n),
  219. DWC3_GEVNTSIZ_SIZE(evt->length));
  220. dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(n), 0);
  221. }
  222. return 0;
  223. }
  224. static void dwc3_event_buffers_cleanup(struct dwc3 *dwc)
  225. {
  226. struct dwc3_event_buffer *evt;
  227. int n;
  228. for (n = 0; n < dwc->num_event_buffers; n++) {
  229. evt = dwc->ev_buffs[n];
  230. evt->lpos = 0;
  231. dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(n), 0);
  232. dwc3_writel(dwc->regs, DWC3_GEVNTADRHI(n), 0);
  233. dwc3_writel(dwc->regs, DWC3_GEVNTSIZ(n), DWC3_GEVNTSIZ_INTMASK
  234. | DWC3_GEVNTSIZ_SIZE(0));
  235. dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(n), 0);
  236. }
  237. }
  238. static int dwc3_alloc_scratch_buffers(struct dwc3 *dwc)
  239. {
  240. if (!dwc->has_hibernation)
  241. return 0;
  242. if (!dwc->nr_scratch)
  243. return 0;
  244. dwc->scratchbuf = kmalloc_array(dwc->nr_scratch,
  245. DWC3_SCRATCHBUF_SIZE, GFP_KERNEL);
  246. if (!dwc->scratchbuf)
  247. return -ENOMEM;
  248. return 0;
  249. }
  250. static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
  251. {
  252. dma_addr_t scratch_addr;
  253. u32 param;
  254. int ret;
  255. if (!dwc->has_hibernation)
  256. return 0;
  257. if (!dwc->nr_scratch)
  258. return 0;
  259. /* should never fall here */
  260. if (!WARN_ON(dwc->scratchbuf))
  261. return 0;
  262. scratch_addr = dma_map_single(dwc->dev, dwc->scratchbuf,
  263. dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE,
  264. DMA_BIDIRECTIONAL);
  265. if (dma_mapping_error(dwc->dev, scratch_addr)) {
  266. dev_err(dwc->dev, "failed to map scratch buffer\n");
  267. ret = -EFAULT;
  268. goto err0;
  269. }
  270. dwc->scratch_addr = scratch_addr;
  271. param = lower_32_bits(scratch_addr);
  272. ret = dwc3_send_gadget_generic_command(dwc,
  273. DWC3_DGCMD_SET_SCRATCHPAD_ADDR_LO, param);
  274. if (ret < 0)
  275. goto err1;
  276. param = upper_32_bits(scratch_addr);
  277. ret = dwc3_send_gadget_generic_command(dwc,
  278. DWC3_DGCMD_SET_SCRATCHPAD_ADDR_HI, param);
  279. if (ret < 0)
  280. goto err1;
  281. return 0;
  282. err1:
  283. dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch *
  284. DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
  285. err0:
  286. return ret;
  287. }
  288. static void dwc3_free_scratch_buffers(struct dwc3 *dwc)
  289. {
  290. if (!dwc->has_hibernation)
  291. return;
  292. if (!dwc->nr_scratch)
  293. return;
  294. /* should never fall here */
  295. if (!WARN_ON(dwc->scratchbuf))
  296. return;
  297. dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch *
  298. DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
  299. kfree(dwc->scratchbuf);
  300. }
  301. static void dwc3_core_num_eps(struct dwc3 *dwc)
  302. {
  303. struct dwc3_hwparams *parms = &dwc->hwparams;
  304. dwc->num_in_eps = DWC3_NUM_IN_EPS(parms);
  305. dwc->num_out_eps = DWC3_NUM_EPS(parms) - dwc->num_in_eps;
  306. dwc3_trace(trace_dwc3_core, "found %d IN and %d OUT endpoints",
  307. dwc->num_in_eps, dwc->num_out_eps);
  308. }
  309. static void dwc3_cache_hwparams(struct dwc3 *dwc)
  310. {
  311. struct dwc3_hwparams *parms = &dwc->hwparams;
  312. parms->hwparams0 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS0);
  313. parms->hwparams1 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS1);
  314. parms->hwparams2 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS2);
  315. parms->hwparams3 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS3);
  316. parms->hwparams4 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS4);
  317. parms->hwparams5 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS5);
  318. parms->hwparams6 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS6);
  319. parms->hwparams7 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS7);
  320. parms->hwparams8 = dwc3_readl(dwc->regs, DWC3_GHWPARAMS8);
  321. }
  322. /**
  323. * dwc3_phy_setup - Configure USB PHY Interface of DWC3 Core
  324. * @dwc: Pointer to our controller context structure
  325. *
  326. * Returns 0 on success. The USB PHY interfaces are configured but not
  327. * initialized. The PHY interfaces and the PHYs get initialized together with
  328. * the core in dwc3_core_init.
  329. */
  330. static int dwc3_phy_setup(struct dwc3 *dwc)
  331. {
  332. u32 reg;
  333. int ret;
  334. reg = dwc3_readl(dwc->regs, DWC3_GUSB3PIPECTL(0));
  335. /*
  336. * Above 1.94a, it is recommended to set DWC3_GUSB3PIPECTL_SUSPHY
  337. * to '0' during coreConsultant configuration. So default value
  338. * will be '0' when the core is reset. Application needs to set it
  339. * to '1' after the core initialization is completed.
  340. */
  341. if (dwc->revision > DWC3_REVISION_194A)
  342. reg |= DWC3_GUSB3PIPECTL_SUSPHY;
  343. if (dwc->u2ss_inp3_quirk)
  344. reg |= DWC3_GUSB3PIPECTL_U2SSINP3OK;
  345. if (dwc->req_p1p2p3_quirk)
  346. reg |= DWC3_GUSB3PIPECTL_REQP1P2P3;
  347. if (dwc->del_p1p2p3_quirk)
  348. reg |= DWC3_GUSB3PIPECTL_DEP1P2P3_EN;
  349. if (dwc->del_phy_power_chg_quirk)
  350. reg |= DWC3_GUSB3PIPECTL_DEPOCHANGE;
  351. if (dwc->lfps_filter_quirk)
  352. reg |= DWC3_GUSB3PIPECTL_LFPSFILT;
  353. if (dwc->rx_detect_poll_quirk)
  354. reg |= DWC3_GUSB3PIPECTL_RX_DETOPOLL;
  355. if (dwc->tx_de_emphasis_quirk)
  356. reg |= DWC3_GUSB3PIPECTL_TX_DEEPH(dwc->tx_de_emphasis);
  357. if (dwc->dis_u3_susphy_quirk)
  358. reg &= ~DWC3_GUSB3PIPECTL_SUSPHY;
  359. dwc3_writel(dwc->regs, DWC3_GUSB3PIPECTL(0), reg);
  360. reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
  361. /* Select the HS PHY interface */
  362. switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) {
  363. case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI:
  364. if (!strncmp(dwc->hsphy_interface, "utmi", 4)) {
  365. reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI;
  366. break;
  367. } else if (!strncmp(dwc->hsphy_interface, "ulpi", 4)) {
  368. reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI;
  369. dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
  370. } else {
  371. dev_warn(dwc->dev, "HSPHY Interface not defined\n");
  372. /* Relying on default value. */
  373. if (!(reg & DWC3_GUSB2PHYCFG_ULPI_UTMI))
  374. break;
  375. }
  376. /* FALLTHROUGH */
  377. case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
  378. /* Making sure the interface and PHY are operational */
  379. ret = dwc3_soft_reset(dwc);
  380. if (ret)
  381. return ret;
  382. udelay(1);
  383. ret = dwc3_ulpi_init(dwc);
  384. if (ret)
  385. return ret;
  386. /* FALLTHROUGH */
  387. default:
  388. break;
  389. }
  390. /*
  391. * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
  392. * '0' during coreConsultant configuration. So default value will
  393. * be '0' when the core is reset. Application needs to set it to
  394. * '1' after the core initialization is completed.
  395. */
  396. if (dwc->revision > DWC3_REVISION_194A)
  397. reg |= DWC3_GUSB2PHYCFG_SUSPHY;
  398. if (dwc->dis_u2_susphy_quirk)
  399. reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
  400. dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
  401. return 0;
  402. }
  403. /**
  404. * dwc3_core_init - Low-level initialization of DWC3 Core
  405. * @dwc: Pointer to our controller context structure
  406. *
  407. * Returns 0 on success otherwise negative errno.
  408. */
  409. static int dwc3_core_init(struct dwc3 *dwc)
  410. {
  411. u32 hwparams4 = dwc->hwparams.hwparams4;
  412. u32 reg;
  413. int ret;
  414. reg = dwc3_readl(dwc->regs, DWC3_GSNPSID);
  415. /* This should read as U3 followed by revision number */
  416. if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) {
  417. dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
  418. ret = -ENODEV;
  419. goto err0;
  420. }
  421. dwc->revision = reg;
  422. /*
  423. * Write Linux Version Code to our GUID register so it's easy to figure
  424. * out which kernel version a bug was found.
  425. */
  426. dwc3_writel(dwc->regs, DWC3_GUID, LINUX_VERSION_CODE);
  427. /* Handle USB2.0-only core configuration */
  428. if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
  429. DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
  430. if (dwc->maximum_speed == USB_SPEED_SUPER)
  431. dwc->maximum_speed = USB_SPEED_HIGH;
  432. }
  433. /* issue device SoftReset too */
  434. ret = dwc3_soft_reset(dwc);
  435. if (ret)
  436. goto err0;
  437. ret = dwc3_core_soft_reset(dwc);
  438. if (ret)
  439. goto err0;
  440. reg = dwc3_readl(dwc->regs, DWC3_GCTL);
  441. reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
  442. switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
  443. case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
  444. /**
  445. * WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
  446. * issue which would cause xHCI compliance tests to fail.
  447. *
  448. * Because of that we cannot enable clock gating on such
  449. * configurations.
  450. *
  451. * Refers to:
  452. *
  453. * STAR#9000588375: Clock Gating, SOF Issues when ref_clk-Based
  454. * SOF/ITP Mode Used
  455. */
  456. if ((dwc->dr_mode == USB_DR_MODE_HOST ||
  457. dwc->dr_mode == USB_DR_MODE_OTG) &&
  458. (dwc->revision >= DWC3_REVISION_210A &&
  459. dwc->revision <= DWC3_REVISION_250A))
  460. reg |= DWC3_GCTL_DSBLCLKGTNG | DWC3_GCTL_SOFITPSYNC;
  461. else
  462. reg &= ~DWC3_GCTL_DSBLCLKGTNG;
  463. break;
  464. case DWC3_GHWPARAMS1_EN_PWROPT_HIB:
  465. /* enable hibernation here */
  466. dwc->nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4);
  467. /*
  468. * REVISIT Enabling this bit so that host-mode hibernation
  469. * will work. Device-mode hibernation is not yet implemented.
  470. */
  471. reg |= DWC3_GCTL_GBLHIBERNATIONEN;
  472. break;
  473. default:
  474. dev_dbg(dwc->dev, "No power optimization available\n");
  475. }
  476. /* check if current dwc3 is on simulation board */
  477. if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) {
  478. dev_dbg(dwc->dev, "it is on FPGA board\n");
  479. dwc->is_fpga = true;
  480. }
  481. WARN_ONCE(dwc->disable_scramble_quirk && !dwc->is_fpga,
  482. "disable_scramble cannot be used on non-FPGA builds\n");
  483. if (dwc->disable_scramble_quirk && dwc->is_fpga)
  484. reg |= DWC3_GCTL_DISSCRAMBLE;
  485. else
  486. reg &= ~DWC3_GCTL_DISSCRAMBLE;
  487. if (dwc->u2exit_lfps_quirk)
  488. reg |= DWC3_GCTL_U2EXIT_LFPS;
  489. /*
  490. * WORKAROUND: DWC3 revisions <1.90a have a bug
  491. * where the device can fail to connect at SuperSpeed
  492. * and falls back to high-speed mode which causes
  493. * the device to enter a Connect/Disconnect loop
  494. */
  495. if (dwc->revision < DWC3_REVISION_190A)
  496. reg |= DWC3_GCTL_U2RSTECN;
  497. dwc3_core_num_eps(dwc);
  498. dwc3_writel(dwc->regs, DWC3_GCTL, reg);
  499. ret = dwc3_alloc_scratch_buffers(dwc);
  500. if (ret)
  501. goto err1;
  502. ret = dwc3_setup_scratch_buffers(dwc);
  503. if (ret)
  504. goto err2;
  505. return 0;
  506. err2:
  507. dwc3_free_scratch_buffers(dwc);
  508. err1:
  509. usb_phy_shutdown(dwc->usb2_phy);
  510. usb_phy_shutdown(dwc->usb3_phy);
  511. phy_exit(dwc->usb2_generic_phy);
  512. phy_exit(dwc->usb3_generic_phy);
  513. err0:
  514. return ret;
  515. }
  516. static void dwc3_core_exit(struct dwc3 *dwc)
  517. {
  518. dwc3_free_scratch_buffers(dwc);
  519. usb_phy_shutdown(dwc->usb2_phy);
  520. usb_phy_shutdown(dwc->usb3_phy);
  521. phy_exit(dwc->usb2_generic_phy);
  522. phy_exit(dwc->usb3_generic_phy);
  523. }
  524. static int dwc3_core_get_phy(struct dwc3 *dwc)
  525. {
  526. struct device *dev = dwc->dev;
  527. struct device_node *node = dev->of_node;
  528. int ret;
  529. if (node) {
  530. dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
  531. dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
  532. } else {
  533. dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
  534. dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
  535. }
  536. if (IS_ERR(dwc->usb2_phy)) {
  537. ret = PTR_ERR(dwc->usb2_phy);
  538. if (ret == -ENXIO || ret == -ENODEV) {
  539. dwc->usb2_phy = NULL;
  540. } else if (ret == -EPROBE_DEFER) {
  541. return ret;
  542. } else {
  543. dev_err(dev, "no usb2 phy configured\n");
  544. return ret;
  545. }
  546. }
  547. if (IS_ERR(dwc->usb3_phy)) {
  548. ret = PTR_ERR(dwc->usb3_phy);
  549. if (ret == -ENXIO || ret == -ENODEV) {
  550. dwc->usb3_phy = NULL;
  551. } else if (ret == -EPROBE_DEFER) {
  552. return ret;
  553. } else {
  554. dev_err(dev, "no usb3 phy configured\n");
  555. return ret;
  556. }
  557. }
  558. dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy");
  559. if (IS_ERR(dwc->usb2_generic_phy)) {
  560. ret = PTR_ERR(dwc->usb2_generic_phy);
  561. if (ret == -ENOSYS || ret == -ENODEV) {
  562. dwc->usb2_generic_phy = NULL;
  563. } else if (ret == -EPROBE_DEFER) {
  564. return ret;
  565. } else {
  566. dev_err(dev, "no usb2 phy configured\n");
  567. return ret;
  568. }
  569. }
  570. dwc->usb3_generic_phy = devm_phy_get(dev, "usb3-phy");
  571. if (IS_ERR(dwc->usb3_generic_phy)) {
  572. ret = PTR_ERR(dwc->usb3_generic_phy);
  573. if (ret == -ENOSYS || ret == -ENODEV) {
  574. dwc->usb3_generic_phy = NULL;
  575. } else if (ret == -EPROBE_DEFER) {
  576. return ret;
  577. } else {
  578. dev_err(dev, "no usb3 phy configured\n");
  579. return ret;
  580. }
  581. }
  582. return 0;
  583. }
  584. static int dwc3_core_init_mode(struct dwc3 *dwc)
  585. {
  586. struct device *dev = dwc->dev;
  587. int ret;
  588. switch (dwc->dr_mode) {
  589. case USB_DR_MODE_PERIPHERAL:
  590. dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
  591. ret = dwc3_gadget_init(dwc);
  592. if (ret) {
  593. dev_err(dev, "failed to initialize gadget\n");
  594. return ret;
  595. }
  596. break;
  597. case USB_DR_MODE_HOST:
  598. dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
  599. ret = dwc3_host_init(dwc);
  600. if (ret) {
  601. dev_err(dev, "failed to initialize host\n");
  602. return ret;
  603. }
  604. break;
  605. case USB_DR_MODE_OTG:
  606. dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
  607. ret = dwc3_host_init(dwc);
  608. if (ret) {
  609. dev_err(dev, "failed to initialize host\n");
  610. return ret;
  611. }
  612. ret = dwc3_gadget_init(dwc);
  613. if (ret) {
  614. dev_err(dev, "failed to initialize gadget\n");
  615. return ret;
  616. }
  617. break;
  618. default:
  619. dev_err(dev, "Unsupported mode of operation %d\n", dwc->dr_mode);
  620. return -EINVAL;
  621. }
  622. return 0;
  623. }
  624. static void dwc3_core_exit_mode(struct dwc3 *dwc)
  625. {
  626. switch (dwc->dr_mode) {
  627. case USB_DR_MODE_PERIPHERAL:
  628. dwc3_gadget_exit(dwc);
  629. break;
  630. case USB_DR_MODE_HOST:
  631. dwc3_host_exit(dwc);
  632. break;
  633. case USB_DR_MODE_OTG:
  634. dwc3_host_exit(dwc);
  635. dwc3_gadget_exit(dwc);
  636. break;
  637. default:
  638. /* do nothing */
  639. break;
  640. }
  641. }
  642. #define DWC3_ALIGN_MASK (16 - 1)
  643. static int dwc3_probe(struct platform_device *pdev)
  644. {
  645. struct device *dev = &pdev->dev;
  646. struct dwc3_platform_data *pdata = dev_get_platdata(dev);
  647. struct device_node *node = dev->of_node;
  648. struct resource *res;
  649. struct dwc3 *dwc;
  650. u8 lpm_nyet_threshold;
  651. u8 tx_de_emphasis;
  652. u8 hird_threshold;
  653. int ret;
  654. void __iomem *regs;
  655. void *mem;
  656. mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
  657. if (!mem)
  658. return -ENOMEM;
  659. dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1);
  660. dwc->mem = mem;
  661. dwc->dev = dev;
  662. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  663. if (!res) {
  664. dev_err(dev, "missing IRQ\n");
  665. return -ENODEV;
  666. }
  667. dwc->xhci_resources[1].start = res->start;
  668. dwc->xhci_resources[1].end = res->end;
  669. dwc->xhci_resources[1].flags = res->flags;
  670. dwc->xhci_resources[1].name = res->name;
  671. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  672. if (!res) {
  673. dev_err(dev, "missing memory resource\n");
  674. return -ENODEV;
  675. }
  676. dwc->xhci_resources[0].start = res->start;
  677. dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
  678. DWC3_XHCI_REGS_END;
  679. dwc->xhci_resources[0].flags = res->flags;
  680. dwc->xhci_resources[0].name = res->name;
  681. res->start += DWC3_GLOBALS_REGS_START;
  682. /*
  683. * Request memory region but exclude xHCI regs,
  684. * since it will be requested by the xhci-plat driver.
  685. */
  686. regs = devm_ioremap_resource(dev, res);
  687. if (IS_ERR(regs)) {
  688. ret = PTR_ERR(regs);
  689. goto err0;
  690. }
  691. dwc->regs = regs;
  692. dwc->regs_size = resource_size(res);
  693. /* default to highest possible threshold */
  694. lpm_nyet_threshold = 0xff;
  695. /* default to -3.5dB de-emphasis */
  696. tx_de_emphasis = 1;
  697. /*
  698. * default to assert utmi_sleep_n and use maximum allowed HIRD
  699. * threshold value of 0b1100
  700. */
  701. hird_threshold = 12;
  702. if (node) {
  703. dwc->maximum_speed = of_usb_get_maximum_speed(node);
  704. dwc->has_lpm_erratum = of_property_read_bool(node,
  705. "snps,has-lpm-erratum");
  706. of_property_read_u8(node, "snps,lpm-nyet-threshold",
  707. &lpm_nyet_threshold);
  708. dwc->is_utmi_l1_suspend = of_property_read_bool(node,
  709. "snps,is-utmi-l1-suspend");
  710. of_property_read_u8(node, "snps,hird-threshold",
  711. &hird_threshold);
  712. dwc->usb3_lpm_capable = of_property_read_bool(node,
  713. "snps,usb3_lpm_capable");
  714. dwc->needs_fifo_resize = of_property_read_bool(node,
  715. "tx-fifo-resize");
  716. dwc->dr_mode = of_usb_get_dr_mode(node);
  717. dwc->disable_scramble_quirk = of_property_read_bool(node,
  718. "snps,disable_scramble_quirk");
  719. dwc->u2exit_lfps_quirk = of_property_read_bool(node,
  720. "snps,u2exit_lfps_quirk");
  721. dwc->u2ss_inp3_quirk = of_property_read_bool(node,
  722. "snps,u2ss_inp3_quirk");
  723. dwc->req_p1p2p3_quirk = of_property_read_bool(node,
  724. "snps,req_p1p2p3_quirk");
  725. dwc->del_p1p2p3_quirk = of_property_read_bool(node,
  726. "snps,del_p1p2p3_quirk");
  727. dwc->del_phy_power_chg_quirk = of_property_read_bool(node,
  728. "snps,del_phy_power_chg_quirk");
  729. dwc->lfps_filter_quirk = of_property_read_bool(node,
  730. "snps,lfps_filter_quirk");
  731. dwc->rx_detect_poll_quirk = of_property_read_bool(node,
  732. "snps,rx_detect_poll_quirk");
  733. dwc->dis_u3_susphy_quirk = of_property_read_bool(node,
  734. "snps,dis_u3_susphy_quirk");
  735. dwc->dis_u2_susphy_quirk = of_property_read_bool(node,
  736. "snps,dis_u2_susphy_quirk");
  737. dwc->tx_de_emphasis_quirk = of_property_read_bool(node,
  738. "snps,tx_de_emphasis_quirk");
  739. of_property_read_u8(node, "snps,tx_de_emphasis",
  740. &tx_de_emphasis);
  741. of_property_read_string(node, "snps,hsphy_interface",
  742. &dwc->hsphy_interface);
  743. } else if (pdata) {
  744. dwc->maximum_speed = pdata->maximum_speed;
  745. dwc->has_lpm_erratum = pdata->has_lpm_erratum;
  746. if (pdata->lpm_nyet_threshold)
  747. lpm_nyet_threshold = pdata->lpm_nyet_threshold;
  748. dwc->is_utmi_l1_suspend = pdata->is_utmi_l1_suspend;
  749. if (pdata->hird_threshold)
  750. hird_threshold = pdata->hird_threshold;
  751. dwc->needs_fifo_resize = pdata->tx_fifo_resize;
  752. dwc->usb3_lpm_capable = pdata->usb3_lpm_capable;
  753. dwc->dr_mode = pdata->dr_mode;
  754. dwc->disable_scramble_quirk = pdata->disable_scramble_quirk;
  755. dwc->u2exit_lfps_quirk = pdata->u2exit_lfps_quirk;
  756. dwc->u2ss_inp3_quirk = pdata->u2ss_inp3_quirk;
  757. dwc->req_p1p2p3_quirk = pdata->req_p1p2p3_quirk;
  758. dwc->del_p1p2p3_quirk = pdata->del_p1p2p3_quirk;
  759. dwc->del_phy_power_chg_quirk = pdata->del_phy_power_chg_quirk;
  760. dwc->lfps_filter_quirk = pdata->lfps_filter_quirk;
  761. dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk;
  762. dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk;
  763. dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk;
  764. dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;
  765. if (pdata->tx_de_emphasis)
  766. tx_de_emphasis = pdata->tx_de_emphasis;
  767. dwc->hsphy_interface = pdata->hsphy_interface;
  768. }
  769. /* default to superspeed if no maximum_speed passed */
  770. if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
  771. dwc->maximum_speed = USB_SPEED_SUPER;
  772. dwc->lpm_nyet_threshold = lpm_nyet_threshold;
  773. dwc->tx_de_emphasis = tx_de_emphasis;
  774. dwc->hird_threshold = hird_threshold
  775. | (dwc->is_utmi_l1_suspend << 4);
  776. platform_set_drvdata(pdev, dwc);
  777. dwc3_cache_hwparams(dwc);
  778. ret = dwc3_phy_setup(dwc);
  779. if (ret)
  780. goto err0;
  781. ret = dwc3_core_get_phy(dwc);
  782. if (ret)
  783. goto err0;
  784. spin_lock_init(&dwc->lock);
  785. if (!dev->dma_mask) {
  786. dev->dma_mask = dev->parent->dma_mask;
  787. dev->dma_parms = dev->parent->dma_parms;
  788. dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
  789. }
  790. pm_runtime_enable(dev);
  791. pm_runtime_get_sync(dev);
  792. pm_runtime_forbid(dev);
  793. ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
  794. if (ret) {
  795. dev_err(dwc->dev, "failed to allocate event buffers\n");
  796. ret = -ENOMEM;
  797. goto err1;
  798. }
  799. if (IS_ENABLED(CONFIG_USB_DWC3_HOST))
  800. dwc->dr_mode = USB_DR_MODE_HOST;
  801. else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
  802. dwc->dr_mode = USB_DR_MODE_PERIPHERAL;
  803. if (dwc->dr_mode == USB_DR_MODE_UNKNOWN)
  804. dwc->dr_mode = USB_DR_MODE_OTG;
  805. ret = dwc3_core_init(dwc);
  806. if (ret) {
  807. dev_err(dev, "failed to initialize core\n");
  808. goto err1;
  809. }
  810. usb_phy_set_suspend(dwc->usb2_phy, 0);
  811. usb_phy_set_suspend(dwc->usb3_phy, 0);
  812. ret = phy_power_on(dwc->usb2_generic_phy);
  813. if (ret < 0)
  814. goto err2;
  815. ret = phy_power_on(dwc->usb3_generic_phy);
  816. if (ret < 0)
  817. goto err3;
  818. ret = dwc3_event_buffers_setup(dwc);
  819. if (ret) {
  820. dev_err(dwc->dev, "failed to setup event buffers\n");
  821. goto err4;
  822. }
  823. ret = dwc3_core_init_mode(dwc);
  824. if (ret)
  825. goto err5;
  826. ret = dwc3_debugfs_init(dwc);
  827. if (ret) {
  828. dev_err(dev, "failed to initialize debugfs\n");
  829. goto err6;
  830. }
  831. pm_runtime_allow(dev);
  832. return 0;
  833. err6:
  834. dwc3_core_exit_mode(dwc);
  835. err5:
  836. dwc3_event_buffers_cleanup(dwc);
  837. err4:
  838. phy_power_off(dwc->usb3_generic_phy);
  839. err3:
  840. phy_power_off(dwc->usb2_generic_phy);
  841. err2:
  842. usb_phy_set_suspend(dwc->usb2_phy, 1);
  843. usb_phy_set_suspend(dwc->usb3_phy, 1);
  844. dwc3_core_exit(dwc);
  845. err1:
  846. dwc3_free_event_buffers(dwc);
  847. dwc3_ulpi_exit(dwc);
  848. err0:
  849. /*
  850. * restore res->start back to its original value so that, in case the
  851. * probe is deferred, we don't end up getting error in request the
  852. * memory region the next time probe is called.
  853. */
  854. res->start -= DWC3_GLOBALS_REGS_START;
  855. return ret;
  856. }
  857. static int dwc3_remove(struct platform_device *pdev)
  858. {
  859. struct dwc3 *dwc = platform_get_drvdata(pdev);
  860. struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  861. /*
  862. * restore res->start back to its original value so that, in case the
  863. * probe is deferred, we don't end up getting error in request the
  864. * memory region the next time probe is called.
  865. */
  866. res->start -= DWC3_GLOBALS_REGS_START;
  867. dwc3_debugfs_exit(dwc);
  868. dwc3_core_exit_mode(dwc);
  869. dwc3_event_buffers_cleanup(dwc);
  870. dwc3_free_event_buffers(dwc);
  871. usb_phy_set_suspend(dwc->usb2_phy, 1);
  872. usb_phy_set_suspend(dwc->usb3_phy, 1);
  873. phy_power_off(dwc->usb2_generic_phy);
  874. phy_power_off(dwc->usb3_generic_phy);
  875. dwc3_core_exit(dwc);
  876. dwc3_ulpi_exit(dwc);
  877. pm_runtime_put_sync(&pdev->dev);
  878. pm_runtime_disable(&pdev->dev);
  879. return 0;
  880. }
  881. #ifdef CONFIG_PM_SLEEP
  882. static int dwc3_suspend(struct device *dev)
  883. {
  884. struct dwc3 *dwc = dev_get_drvdata(dev);
  885. unsigned long flags;
  886. spin_lock_irqsave(&dwc->lock, flags);
  887. switch (dwc->dr_mode) {
  888. case USB_DR_MODE_PERIPHERAL:
  889. case USB_DR_MODE_OTG:
  890. dwc3_gadget_suspend(dwc);
  891. /* FALLTHROUGH */
  892. case USB_DR_MODE_HOST:
  893. default:
  894. dwc3_event_buffers_cleanup(dwc);
  895. break;
  896. }
  897. dwc->gctl = dwc3_readl(dwc->regs, DWC3_GCTL);
  898. spin_unlock_irqrestore(&dwc->lock, flags);
  899. usb_phy_shutdown(dwc->usb3_phy);
  900. usb_phy_shutdown(dwc->usb2_phy);
  901. phy_exit(dwc->usb2_generic_phy);
  902. phy_exit(dwc->usb3_generic_phy);
  903. return 0;
  904. }
  905. static int dwc3_resume(struct device *dev)
  906. {
  907. struct dwc3 *dwc = dev_get_drvdata(dev);
  908. unsigned long flags;
  909. int ret;
  910. usb_phy_init(dwc->usb3_phy);
  911. usb_phy_init(dwc->usb2_phy);
  912. ret = phy_init(dwc->usb2_generic_phy);
  913. if (ret < 0)
  914. return ret;
  915. ret = phy_init(dwc->usb3_generic_phy);
  916. if (ret < 0)
  917. goto err_usb2phy_init;
  918. spin_lock_irqsave(&dwc->lock, flags);
  919. dwc3_event_buffers_setup(dwc);
  920. dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl);
  921. switch (dwc->dr_mode) {
  922. case USB_DR_MODE_PERIPHERAL:
  923. case USB_DR_MODE_OTG:
  924. dwc3_gadget_resume(dwc);
  925. /* FALLTHROUGH */
  926. case USB_DR_MODE_HOST:
  927. default:
  928. /* do nothing */
  929. break;
  930. }
  931. spin_unlock_irqrestore(&dwc->lock, flags);
  932. pm_runtime_disable(dev);
  933. pm_runtime_set_active(dev);
  934. pm_runtime_enable(dev);
  935. return 0;
  936. err_usb2phy_init:
  937. phy_exit(dwc->usb2_generic_phy);
  938. return ret;
  939. }
  940. static const struct dev_pm_ops dwc3_dev_pm_ops = {
  941. SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
  942. };
  943. #define DWC3_PM_OPS &(dwc3_dev_pm_ops)
  944. #else
  945. #define DWC3_PM_OPS NULL
  946. #endif
  947. #ifdef CONFIG_OF
  948. static const struct of_device_id of_dwc3_match[] = {
  949. {
  950. .compatible = "snps,dwc3"
  951. },
  952. {
  953. .compatible = "synopsys,dwc3"
  954. },
  955. { },
  956. };
  957. MODULE_DEVICE_TABLE(of, of_dwc3_match);
  958. #endif
  959. #ifdef CONFIG_ACPI
  960. #define ACPI_ID_INTEL_BSW "808622B7"
  961. static const struct acpi_device_id dwc3_acpi_match[] = {
  962. { ACPI_ID_INTEL_BSW, 0 },
  963. { },
  964. };
  965. MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
  966. #endif
  967. static struct platform_driver dwc3_driver = {
  968. .probe = dwc3_probe,
  969. .remove = dwc3_remove,
  970. .driver = {
  971. .name = "dwc3",
  972. .of_match_table = of_match_ptr(of_dwc3_match),
  973. .acpi_match_table = ACPI_PTR(dwc3_acpi_match),
  974. .pm = DWC3_PM_OPS,
  975. },
  976. };
  977. module_platform_driver(dwc3_driver);
  978. MODULE_ALIAS("platform:dwc3");
  979. MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
  980. MODULE_LICENSE("GPL v2");
  981. MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");