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 (dwc->hsphy_interface &&
  365. !strncmp(dwc->hsphy_interface, "utmi", 4)) {
  366. reg &= ~DWC3_GUSB2PHYCFG_ULPI_UTMI;
  367. break;
  368. } else if (dwc->hsphy_interface &&
  369. !strncmp(dwc->hsphy_interface, "ulpi", 4)) {
  370. reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI;
  371. dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
  372. } else {
  373. /* Relying on default value. */
  374. if (!(reg & DWC3_GUSB2PHYCFG_ULPI_UTMI))
  375. break;
  376. }
  377. /* FALLTHROUGH */
  378. case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
  379. /* Making sure the interface and PHY are operational */
  380. ret = dwc3_soft_reset(dwc);
  381. if (ret)
  382. return ret;
  383. udelay(1);
  384. ret = dwc3_ulpi_init(dwc);
  385. if (ret)
  386. return ret;
  387. /* FALLTHROUGH */
  388. default:
  389. break;
  390. }
  391. /*
  392. * Above 1.94a, it is recommended to set DWC3_GUSB2PHYCFG_SUSPHY to
  393. * '0' during coreConsultant configuration. So default value will
  394. * be '0' when the core is reset. Application needs to set it to
  395. * '1' after the core initialization is completed.
  396. */
  397. if (dwc->revision > DWC3_REVISION_194A)
  398. reg |= DWC3_GUSB2PHYCFG_SUSPHY;
  399. if (dwc->dis_u2_susphy_quirk)
  400. reg &= ~DWC3_GUSB2PHYCFG_SUSPHY;
  401. dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
  402. return 0;
  403. }
  404. /**
  405. * dwc3_core_init - Low-level initialization of DWC3 Core
  406. * @dwc: Pointer to our controller context structure
  407. *
  408. * Returns 0 on success otherwise negative errno.
  409. */
  410. static int dwc3_core_init(struct dwc3 *dwc)
  411. {
  412. u32 hwparams4 = dwc->hwparams.hwparams4;
  413. u32 reg;
  414. int ret;
  415. reg = dwc3_readl(dwc->regs, DWC3_GSNPSID);
  416. /* This should read as U3 followed by revision number */
  417. if ((reg & DWC3_GSNPSID_MASK) != 0x55330000) {
  418. dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n");
  419. ret = -ENODEV;
  420. goto err0;
  421. }
  422. dwc->revision = reg;
  423. /*
  424. * Write Linux Version Code to our GUID register so it's easy to figure
  425. * out which kernel version a bug was found.
  426. */
  427. dwc3_writel(dwc->regs, DWC3_GUID, LINUX_VERSION_CODE);
  428. /* Handle USB2.0-only core configuration */
  429. if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
  430. DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
  431. if (dwc->maximum_speed == USB_SPEED_SUPER)
  432. dwc->maximum_speed = USB_SPEED_HIGH;
  433. }
  434. /* issue device SoftReset too */
  435. ret = dwc3_soft_reset(dwc);
  436. if (ret)
  437. goto err0;
  438. ret = dwc3_core_soft_reset(dwc);
  439. if (ret)
  440. goto err0;
  441. reg = dwc3_readl(dwc->regs, DWC3_GCTL);
  442. reg &= ~DWC3_GCTL_SCALEDOWN_MASK;
  443. switch (DWC3_GHWPARAMS1_EN_PWROPT(dwc->hwparams.hwparams1)) {
  444. case DWC3_GHWPARAMS1_EN_PWROPT_CLK:
  445. /**
  446. * WORKAROUND: DWC3 revisions between 2.10a and 2.50a have an
  447. * issue which would cause xHCI compliance tests to fail.
  448. *
  449. * Because of that we cannot enable clock gating on such
  450. * configurations.
  451. *
  452. * Refers to:
  453. *
  454. * STAR#9000588375: Clock Gating, SOF Issues when ref_clk-Based
  455. * SOF/ITP Mode Used
  456. */
  457. if ((dwc->dr_mode == USB_DR_MODE_HOST ||
  458. dwc->dr_mode == USB_DR_MODE_OTG) &&
  459. (dwc->revision >= DWC3_REVISION_210A &&
  460. dwc->revision <= DWC3_REVISION_250A))
  461. reg |= DWC3_GCTL_DSBLCLKGTNG | DWC3_GCTL_SOFITPSYNC;
  462. else
  463. reg &= ~DWC3_GCTL_DSBLCLKGTNG;
  464. break;
  465. case DWC3_GHWPARAMS1_EN_PWROPT_HIB:
  466. /* enable hibernation here */
  467. dwc->nr_scratch = DWC3_GHWPARAMS4_HIBER_SCRATCHBUFS(hwparams4);
  468. /*
  469. * REVISIT Enabling this bit so that host-mode hibernation
  470. * will work. Device-mode hibernation is not yet implemented.
  471. */
  472. reg |= DWC3_GCTL_GBLHIBERNATIONEN;
  473. break;
  474. default:
  475. dev_dbg(dwc->dev, "No power optimization available\n");
  476. }
  477. /* check if current dwc3 is on simulation board */
  478. if (dwc->hwparams.hwparams6 & DWC3_GHWPARAMS6_EN_FPGA) {
  479. dev_dbg(dwc->dev, "it is on FPGA board\n");
  480. dwc->is_fpga = true;
  481. }
  482. WARN_ONCE(dwc->disable_scramble_quirk && !dwc->is_fpga,
  483. "disable_scramble cannot be used on non-FPGA builds\n");
  484. if (dwc->disable_scramble_quirk && dwc->is_fpga)
  485. reg |= DWC3_GCTL_DISSCRAMBLE;
  486. else
  487. reg &= ~DWC3_GCTL_DISSCRAMBLE;
  488. if (dwc->u2exit_lfps_quirk)
  489. reg |= DWC3_GCTL_U2EXIT_LFPS;
  490. /*
  491. * WORKAROUND: DWC3 revisions <1.90a have a bug
  492. * where the device can fail to connect at SuperSpeed
  493. * and falls back to high-speed mode which causes
  494. * the device to enter a Connect/Disconnect loop
  495. */
  496. if (dwc->revision < DWC3_REVISION_190A)
  497. reg |= DWC3_GCTL_U2RSTECN;
  498. dwc3_core_num_eps(dwc);
  499. dwc3_writel(dwc->regs, DWC3_GCTL, reg);
  500. ret = dwc3_alloc_scratch_buffers(dwc);
  501. if (ret)
  502. goto err1;
  503. ret = dwc3_setup_scratch_buffers(dwc);
  504. if (ret)
  505. goto err2;
  506. return 0;
  507. err2:
  508. dwc3_free_scratch_buffers(dwc);
  509. err1:
  510. usb_phy_shutdown(dwc->usb2_phy);
  511. usb_phy_shutdown(dwc->usb3_phy);
  512. phy_exit(dwc->usb2_generic_phy);
  513. phy_exit(dwc->usb3_generic_phy);
  514. err0:
  515. return ret;
  516. }
  517. static void dwc3_core_exit(struct dwc3 *dwc)
  518. {
  519. dwc3_free_scratch_buffers(dwc);
  520. usb_phy_shutdown(dwc->usb2_phy);
  521. usb_phy_shutdown(dwc->usb3_phy);
  522. phy_exit(dwc->usb2_generic_phy);
  523. phy_exit(dwc->usb3_generic_phy);
  524. }
  525. static int dwc3_core_get_phy(struct dwc3 *dwc)
  526. {
  527. struct device *dev = dwc->dev;
  528. struct device_node *node = dev->of_node;
  529. int ret;
  530. if (node) {
  531. dwc->usb2_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 0);
  532. dwc->usb3_phy = devm_usb_get_phy_by_phandle(dev, "usb-phy", 1);
  533. } else {
  534. dwc->usb2_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB2);
  535. dwc->usb3_phy = devm_usb_get_phy(dev, USB_PHY_TYPE_USB3);
  536. }
  537. if (IS_ERR(dwc->usb2_phy)) {
  538. ret = PTR_ERR(dwc->usb2_phy);
  539. if (ret == -ENXIO || ret == -ENODEV) {
  540. dwc->usb2_phy = NULL;
  541. } else if (ret == -EPROBE_DEFER) {
  542. return ret;
  543. } else {
  544. dev_err(dev, "no usb2 phy configured\n");
  545. return ret;
  546. }
  547. }
  548. if (IS_ERR(dwc->usb3_phy)) {
  549. ret = PTR_ERR(dwc->usb3_phy);
  550. if (ret == -ENXIO || ret == -ENODEV) {
  551. dwc->usb3_phy = NULL;
  552. } else if (ret == -EPROBE_DEFER) {
  553. return ret;
  554. } else {
  555. dev_err(dev, "no usb3 phy configured\n");
  556. return ret;
  557. }
  558. }
  559. dwc->usb2_generic_phy = devm_phy_get(dev, "usb2-phy");
  560. if (IS_ERR(dwc->usb2_generic_phy)) {
  561. ret = PTR_ERR(dwc->usb2_generic_phy);
  562. if (ret == -ENOSYS || ret == -ENODEV) {
  563. dwc->usb2_generic_phy = NULL;
  564. } else if (ret == -EPROBE_DEFER) {
  565. return ret;
  566. } else {
  567. dev_err(dev, "no usb2 phy configured\n");
  568. return ret;
  569. }
  570. }
  571. dwc->usb3_generic_phy = devm_phy_get(dev, "usb3-phy");
  572. if (IS_ERR(dwc->usb3_generic_phy)) {
  573. ret = PTR_ERR(dwc->usb3_generic_phy);
  574. if (ret == -ENOSYS || ret == -ENODEV) {
  575. dwc->usb3_generic_phy = NULL;
  576. } else if (ret == -EPROBE_DEFER) {
  577. return ret;
  578. } else {
  579. dev_err(dev, "no usb3 phy configured\n");
  580. return ret;
  581. }
  582. }
  583. return 0;
  584. }
  585. static int dwc3_core_init_mode(struct dwc3 *dwc)
  586. {
  587. struct device *dev = dwc->dev;
  588. int ret;
  589. switch (dwc->dr_mode) {
  590. case USB_DR_MODE_PERIPHERAL:
  591. dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_DEVICE);
  592. ret = dwc3_gadget_init(dwc);
  593. if (ret) {
  594. dev_err(dev, "failed to initialize gadget\n");
  595. return ret;
  596. }
  597. break;
  598. case USB_DR_MODE_HOST:
  599. dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_HOST);
  600. ret = dwc3_host_init(dwc);
  601. if (ret) {
  602. dev_err(dev, "failed to initialize host\n");
  603. return ret;
  604. }
  605. break;
  606. case USB_DR_MODE_OTG:
  607. dwc3_set_mode(dwc, DWC3_GCTL_PRTCAP_OTG);
  608. ret = dwc3_host_init(dwc);
  609. if (ret) {
  610. dev_err(dev, "failed to initialize host\n");
  611. return ret;
  612. }
  613. ret = dwc3_gadget_init(dwc);
  614. if (ret) {
  615. dev_err(dev, "failed to initialize gadget\n");
  616. return ret;
  617. }
  618. break;
  619. default:
  620. dev_err(dev, "Unsupported mode of operation %d\n", dwc->dr_mode);
  621. return -EINVAL;
  622. }
  623. return 0;
  624. }
  625. static void dwc3_core_exit_mode(struct dwc3 *dwc)
  626. {
  627. switch (dwc->dr_mode) {
  628. case USB_DR_MODE_PERIPHERAL:
  629. dwc3_gadget_exit(dwc);
  630. break;
  631. case USB_DR_MODE_HOST:
  632. dwc3_host_exit(dwc);
  633. break;
  634. case USB_DR_MODE_OTG:
  635. dwc3_host_exit(dwc);
  636. dwc3_gadget_exit(dwc);
  637. break;
  638. default:
  639. /* do nothing */
  640. break;
  641. }
  642. }
  643. #define DWC3_ALIGN_MASK (16 - 1)
  644. static int dwc3_probe(struct platform_device *pdev)
  645. {
  646. struct device *dev = &pdev->dev;
  647. struct dwc3_platform_data *pdata = dev_get_platdata(dev);
  648. struct device_node *node = dev->of_node;
  649. struct resource *res;
  650. struct dwc3 *dwc;
  651. u8 lpm_nyet_threshold;
  652. u8 tx_de_emphasis;
  653. u8 hird_threshold;
  654. int ret;
  655. void __iomem *regs;
  656. void *mem;
  657. mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
  658. if (!mem)
  659. return -ENOMEM;
  660. dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1);
  661. dwc->mem = mem;
  662. dwc->dev = dev;
  663. res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
  664. if (!res) {
  665. dev_err(dev, "missing IRQ\n");
  666. return -ENODEV;
  667. }
  668. dwc->xhci_resources[1].start = res->start;
  669. dwc->xhci_resources[1].end = res->end;
  670. dwc->xhci_resources[1].flags = res->flags;
  671. dwc->xhci_resources[1].name = res->name;
  672. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  673. if (!res) {
  674. dev_err(dev, "missing memory resource\n");
  675. return -ENODEV;
  676. }
  677. dwc->xhci_resources[0].start = res->start;
  678. dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
  679. DWC3_XHCI_REGS_END;
  680. dwc->xhci_resources[0].flags = res->flags;
  681. dwc->xhci_resources[0].name = res->name;
  682. res->start += DWC3_GLOBALS_REGS_START;
  683. /*
  684. * Request memory region but exclude xHCI regs,
  685. * since it will be requested by the xhci-plat driver.
  686. */
  687. regs = devm_ioremap_resource(dev, res);
  688. if (IS_ERR(regs)) {
  689. ret = PTR_ERR(regs);
  690. goto err0;
  691. }
  692. dwc->regs = regs;
  693. dwc->regs_size = resource_size(res);
  694. /* default to highest possible threshold */
  695. lpm_nyet_threshold = 0xff;
  696. /* default to -3.5dB de-emphasis */
  697. tx_de_emphasis = 1;
  698. /*
  699. * default to assert utmi_sleep_n and use maximum allowed HIRD
  700. * threshold value of 0b1100
  701. */
  702. hird_threshold = 12;
  703. if (node) {
  704. dwc->maximum_speed = of_usb_get_maximum_speed(node);
  705. dwc->has_lpm_erratum = of_property_read_bool(node,
  706. "snps,has-lpm-erratum");
  707. of_property_read_u8(node, "snps,lpm-nyet-threshold",
  708. &lpm_nyet_threshold);
  709. dwc->is_utmi_l1_suspend = of_property_read_bool(node,
  710. "snps,is-utmi-l1-suspend");
  711. of_property_read_u8(node, "snps,hird-threshold",
  712. &hird_threshold);
  713. dwc->usb3_lpm_capable = of_property_read_bool(node,
  714. "snps,usb3_lpm_capable");
  715. dwc->needs_fifo_resize = of_property_read_bool(node,
  716. "tx-fifo-resize");
  717. dwc->dr_mode = of_usb_get_dr_mode(node);
  718. dwc->disable_scramble_quirk = of_property_read_bool(node,
  719. "snps,disable_scramble_quirk");
  720. dwc->u2exit_lfps_quirk = of_property_read_bool(node,
  721. "snps,u2exit_lfps_quirk");
  722. dwc->u2ss_inp3_quirk = of_property_read_bool(node,
  723. "snps,u2ss_inp3_quirk");
  724. dwc->req_p1p2p3_quirk = of_property_read_bool(node,
  725. "snps,req_p1p2p3_quirk");
  726. dwc->del_p1p2p3_quirk = of_property_read_bool(node,
  727. "snps,del_p1p2p3_quirk");
  728. dwc->del_phy_power_chg_quirk = of_property_read_bool(node,
  729. "snps,del_phy_power_chg_quirk");
  730. dwc->lfps_filter_quirk = of_property_read_bool(node,
  731. "snps,lfps_filter_quirk");
  732. dwc->rx_detect_poll_quirk = of_property_read_bool(node,
  733. "snps,rx_detect_poll_quirk");
  734. dwc->dis_u3_susphy_quirk = of_property_read_bool(node,
  735. "snps,dis_u3_susphy_quirk");
  736. dwc->dis_u2_susphy_quirk = of_property_read_bool(node,
  737. "snps,dis_u2_susphy_quirk");
  738. dwc->tx_de_emphasis_quirk = of_property_read_bool(node,
  739. "snps,tx_de_emphasis_quirk");
  740. of_property_read_u8(node, "snps,tx_de_emphasis",
  741. &tx_de_emphasis);
  742. of_property_read_string(node, "snps,hsphy_interface",
  743. &dwc->hsphy_interface);
  744. } else if (pdata) {
  745. dwc->maximum_speed = pdata->maximum_speed;
  746. dwc->has_lpm_erratum = pdata->has_lpm_erratum;
  747. if (pdata->lpm_nyet_threshold)
  748. lpm_nyet_threshold = pdata->lpm_nyet_threshold;
  749. dwc->is_utmi_l1_suspend = pdata->is_utmi_l1_suspend;
  750. if (pdata->hird_threshold)
  751. hird_threshold = pdata->hird_threshold;
  752. dwc->needs_fifo_resize = pdata->tx_fifo_resize;
  753. dwc->usb3_lpm_capable = pdata->usb3_lpm_capable;
  754. dwc->dr_mode = pdata->dr_mode;
  755. dwc->disable_scramble_quirk = pdata->disable_scramble_quirk;
  756. dwc->u2exit_lfps_quirk = pdata->u2exit_lfps_quirk;
  757. dwc->u2ss_inp3_quirk = pdata->u2ss_inp3_quirk;
  758. dwc->req_p1p2p3_quirk = pdata->req_p1p2p3_quirk;
  759. dwc->del_p1p2p3_quirk = pdata->del_p1p2p3_quirk;
  760. dwc->del_phy_power_chg_quirk = pdata->del_phy_power_chg_quirk;
  761. dwc->lfps_filter_quirk = pdata->lfps_filter_quirk;
  762. dwc->rx_detect_poll_quirk = pdata->rx_detect_poll_quirk;
  763. dwc->dis_u3_susphy_quirk = pdata->dis_u3_susphy_quirk;
  764. dwc->dis_u2_susphy_quirk = pdata->dis_u2_susphy_quirk;
  765. dwc->tx_de_emphasis_quirk = pdata->tx_de_emphasis_quirk;
  766. if (pdata->tx_de_emphasis)
  767. tx_de_emphasis = pdata->tx_de_emphasis;
  768. dwc->hsphy_interface = pdata->hsphy_interface;
  769. }
  770. /* default to superspeed if no maximum_speed passed */
  771. if (dwc->maximum_speed == USB_SPEED_UNKNOWN)
  772. dwc->maximum_speed = USB_SPEED_SUPER;
  773. dwc->lpm_nyet_threshold = lpm_nyet_threshold;
  774. dwc->tx_de_emphasis = tx_de_emphasis;
  775. dwc->hird_threshold = hird_threshold
  776. | (dwc->is_utmi_l1_suspend << 4);
  777. platform_set_drvdata(pdev, dwc);
  778. dwc3_cache_hwparams(dwc);
  779. ret = dwc3_phy_setup(dwc);
  780. if (ret)
  781. goto err0;
  782. ret = dwc3_core_get_phy(dwc);
  783. if (ret)
  784. goto err0;
  785. spin_lock_init(&dwc->lock);
  786. if (!dev->dma_mask) {
  787. dev->dma_mask = dev->parent->dma_mask;
  788. dev->dma_parms = dev->parent->dma_parms;
  789. dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
  790. }
  791. pm_runtime_enable(dev);
  792. pm_runtime_get_sync(dev);
  793. pm_runtime_forbid(dev);
  794. ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
  795. if (ret) {
  796. dev_err(dwc->dev, "failed to allocate event buffers\n");
  797. ret = -ENOMEM;
  798. goto err1;
  799. }
  800. if (IS_ENABLED(CONFIG_USB_DWC3_HOST))
  801. dwc->dr_mode = USB_DR_MODE_HOST;
  802. else if (IS_ENABLED(CONFIG_USB_DWC3_GADGET))
  803. dwc->dr_mode = USB_DR_MODE_PERIPHERAL;
  804. if (dwc->dr_mode == USB_DR_MODE_UNKNOWN)
  805. dwc->dr_mode = USB_DR_MODE_OTG;
  806. ret = dwc3_core_init(dwc);
  807. if (ret) {
  808. dev_err(dev, "failed to initialize core\n");
  809. goto err1;
  810. }
  811. usb_phy_set_suspend(dwc->usb2_phy, 0);
  812. usb_phy_set_suspend(dwc->usb3_phy, 0);
  813. ret = phy_power_on(dwc->usb2_generic_phy);
  814. if (ret < 0)
  815. goto err2;
  816. ret = phy_power_on(dwc->usb3_generic_phy);
  817. if (ret < 0)
  818. goto err3;
  819. ret = dwc3_event_buffers_setup(dwc);
  820. if (ret) {
  821. dev_err(dwc->dev, "failed to setup event buffers\n");
  822. goto err4;
  823. }
  824. ret = dwc3_core_init_mode(dwc);
  825. if (ret)
  826. goto err5;
  827. ret = dwc3_debugfs_init(dwc);
  828. if (ret) {
  829. dev_err(dev, "failed to initialize debugfs\n");
  830. goto err6;
  831. }
  832. pm_runtime_allow(dev);
  833. return 0;
  834. err6:
  835. dwc3_core_exit_mode(dwc);
  836. err5:
  837. dwc3_event_buffers_cleanup(dwc);
  838. err4:
  839. phy_power_off(dwc->usb3_generic_phy);
  840. err3:
  841. phy_power_off(dwc->usb2_generic_phy);
  842. err2:
  843. usb_phy_set_suspend(dwc->usb2_phy, 1);
  844. usb_phy_set_suspend(dwc->usb3_phy, 1);
  845. dwc3_core_exit(dwc);
  846. err1:
  847. dwc3_free_event_buffers(dwc);
  848. dwc3_ulpi_exit(dwc);
  849. err0:
  850. /*
  851. * restore res->start back to its original value so that, in case the
  852. * probe is deferred, we don't end up getting error in request the
  853. * memory region the next time probe is called.
  854. */
  855. res->start -= DWC3_GLOBALS_REGS_START;
  856. return ret;
  857. }
  858. static int dwc3_remove(struct platform_device *pdev)
  859. {
  860. struct dwc3 *dwc = platform_get_drvdata(pdev);
  861. struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  862. /*
  863. * restore res->start back to its original value so that, in case the
  864. * probe is deferred, we don't end up getting error in request the
  865. * memory region the next time probe is called.
  866. */
  867. res->start -= DWC3_GLOBALS_REGS_START;
  868. dwc3_debugfs_exit(dwc);
  869. dwc3_core_exit_mode(dwc);
  870. dwc3_event_buffers_cleanup(dwc);
  871. dwc3_free_event_buffers(dwc);
  872. usb_phy_set_suspend(dwc->usb2_phy, 1);
  873. usb_phy_set_suspend(dwc->usb3_phy, 1);
  874. phy_power_off(dwc->usb2_generic_phy);
  875. phy_power_off(dwc->usb3_generic_phy);
  876. dwc3_core_exit(dwc);
  877. dwc3_ulpi_exit(dwc);
  878. pm_runtime_put_sync(&pdev->dev);
  879. pm_runtime_disable(&pdev->dev);
  880. return 0;
  881. }
  882. #ifdef CONFIG_PM_SLEEP
  883. static int dwc3_suspend(struct device *dev)
  884. {
  885. struct dwc3 *dwc = dev_get_drvdata(dev);
  886. unsigned long flags;
  887. spin_lock_irqsave(&dwc->lock, flags);
  888. switch (dwc->dr_mode) {
  889. case USB_DR_MODE_PERIPHERAL:
  890. case USB_DR_MODE_OTG:
  891. dwc3_gadget_suspend(dwc);
  892. /* FALLTHROUGH */
  893. case USB_DR_MODE_HOST:
  894. default:
  895. dwc3_event_buffers_cleanup(dwc);
  896. break;
  897. }
  898. dwc->gctl = dwc3_readl(dwc->regs, DWC3_GCTL);
  899. spin_unlock_irqrestore(&dwc->lock, flags);
  900. usb_phy_shutdown(dwc->usb3_phy);
  901. usb_phy_shutdown(dwc->usb2_phy);
  902. phy_exit(dwc->usb2_generic_phy);
  903. phy_exit(dwc->usb3_generic_phy);
  904. return 0;
  905. }
  906. static int dwc3_resume(struct device *dev)
  907. {
  908. struct dwc3 *dwc = dev_get_drvdata(dev);
  909. unsigned long flags;
  910. int ret;
  911. usb_phy_init(dwc->usb3_phy);
  912. usb_phy_init(dwc->usb2_phy);
  913. ret = phy_init(dwc->usb2_generic_phy);
  914. if (ret < 0)
  915. return ret;
  916. ret = phy_init(dwc->usb3_generic_phy);
  917. if (ret < 0)
  918. goto err_usb2phy_init;
  919. spin_lock_irqsave(&dwc->lock, flags);
  920. dwc3_event_buffers_setup(dwc);
  921. dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl);
  922. switch (dwc->dr_mode) {
  923. case USB_DR_MODE_PERIPHERAL:
  924. case USB_DR_MODE_OTG:
  925. dwc3_gadget_resume(dwc);
  926. /* FALLTHROUGH */
  927. case USB_DR_MODE_HOST:
  928. default:
  929. /* do nothing */
  930. break;
  931. }
  932. spin_unlock_irqrestore(&dwc->lock, flags);
  933. pm_runtime_disable(dev);
  934. pm_runtime_set_active(dev);
  935. pm_runtime_enable(dev);
  936. return 0;
  937. err_usb2phy_init:
  938. phy_exit(dwc->usb2_generic_phy);
  939. return ret;
  940. }
  941. static const struct dev_pm_ops dwc3_dev_pm_ops = {
  942. SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
  943. };
  944. #define DWC3_PM_OPS &(dwc3_dev_pm_ops)
  945. #else
  946. #define DWC3_PM_OPS NULL
  947. #endif
  948. #ifdef CONFIG_OF
  949. static const struct of_device_id of_dwc3_match[] = {
  950. {
  951. .compatible = "snps,dwc3"
  952. },
  953. {
  954. .compatible = "synopsys,dwc3"
  955. },
  956. { },
  957. };
  958. MODULE_DEVICE_TABLE(of, of_dwc3_match);
  959. #endif
  960. #ifdef CONFIG_ACPI
  961. #define ACPI_ID_INTEL_BSW "808622B7"
  962. static const struct acpi_device_id dwc3_acpi_match[] = {
  963. { ACPI_ID_INTEL_BSW, 0 },
  964. { },
  965. };
  966. MODULE_DEVICE_TABLE(acpi, dwc3_acpi_match);
  967. #endif
  968. static struct platform_driver dwc3_driver = {
  969. .probe = dwc3_probe,
  970. .remove = dwc3_remove,
  971. .driver = {
  972. .name = "dwc3",
  973. .of_match_table = of_match_ptr(of_dwc3_match),
  974. .acpi_match_table = ACPI_PTR(dwc3_acpi_match),
  975. .pm = DWC3_PM_OPS,
  976. },
  977. };
  978. module_platform_driver(dwc3_driver);
  979. MODULE_ALIAS("platform:dwc3");
  980. MODULE_AUTHOR("Felipe Balbi <balbi@ti.com>");
  981. MODULE_LICENSE("GPL v2");
  982. MODULE_DESCRIPTION("DesignWare USB3 DRD Controller Driver");