ehci-tegra.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * EHCI-compliant USB host controller driver for NVIDIA Tegra SoCs
  4. *
  5. * Copyright (C) 2010 Google, Inc.
  6. * Copyright (C) 2009 - 2013 NVIDIA Corporation
  7. */
  8. #include <linux/clk.h>
  9. #include <linux/dma-mapping.h>
  10. #include <linux/err.h>
  11. #include <linux/gpio.h>
  12. #include <linux/io.h>
  13. #include <linux/irq.h>
  14. #include <linux/module.h>
  15. #include <linux/of.h>
  16. #include <linux/of_device.h>
  17. #include <linux/of_gpio.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/pm_runtime.h>
  20. #include <linux/reset.h>
  21. #include <linux/slab.h>
  22. #include <linux/usb/ehci_def.h>
  23. #include <linux/usb/tegra_usb_phy.h>
  24. #include <linux/usb.h>
  25. #include <linux/usb/hcd.h>
  26. #include <linux/usb/otg.h>
  27. #include "ehci.h"
  28. #define PORT_WAKE_BITS (PORT_WKOC_E|PORT_WKDISC_E|PORT_WKCONN_E)
  29. #define TEGRA_USB_DMA_ALIGN 32
  30. #define DRIVER_DESC "Tegra EHCI driver"
  31. #define DRV_NAME "tegra-ehci"
  32. static struct hc_driver __read_mostly tegra_ehci_hc_driver;
  33. static bool usb1_reset_attempted;
  34. struct tegra_ehci_soc_config {
  35. bool has_hostpc;
  36. };
  37. struct tegra_ehci_hcd {
  38. struct tegra_usb_phy *phy;
  39. struct clk *clk;
  40. struct reset_control *rst;
  41. int port_resuming;
  42. bool needs_double_reset;
  43. enum tegra_usb_phy_port_speed port_speed;
  44. };
  45. /*
  46. * The 1st USB controller contains some UTMI pad registers that are global for
  47. * all the controllers on the chip. Those registers are also cleared when
  48. * reset is asserted to the 1st controller. This means that the 1st controller
  49. * can only be reset when no other controlled has finished probing. So we'll
  50. * reset the 1st controller before doing any other setup on any of the
  51. * controllers, and then never again.
  52. *
  53. * Since this is a PHY issue, the Tegra PHY driver should probably be doing
  54. * the resetting of the USB controllers. But to keep compatibility with old
  55. * device trees that don't have reset phandles in the PHYs, do it here.
  56. * Those old DTs will be vulnerable to total USB breakage if the 1st EHCI
  57. * device isn't the first one to finish probing, so warn them.
  58. */
  59. static int tegra_reset_usb_controller(struct platform_device *pdev)
  60. {
  61. struct device_node *phy_np;
  62. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  63. struct tegra_ehci_hcd *tegra =
  64. (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
  65. bool has_utmi_pad_registers = false;
  66. phy_np = of_parse_phandle(pdev->dev.of_node, "nvidia,phy", 0);
  67. if (!phy_np)
  68. return -ENOENT;
  69. if (of_property_read_bool(phy_np, "nvidia,has-utmi-pad-registers"))
  70. has_utmi_pad_registers = true;
  71. if (!usb1_reset_attempted) {
  72. struct reset_control *usb1_reset;
  73. if (!has_utmi_pad_registers)
  74. usb1_reset = of_reset_control_get(phy_np, "utmi-pads");
  75. else
  76. usb1_reset = tegra->rst;
  77. if (IS_ERR(usb1_reset)) {
  78. dev_warn(&pdev->dev,
  79. "can't get utmi-pads reset from the PHY\n");
  80. dev_warn(&pdev->dev,
  81. "continuing, but please update your DT\n");
  82. } else {
  83. reset_control_assert(usb1_reset);
  84. udelay(1);
  85. reset_control_deassert(usb1_reset);
  86. if (!has_utmi_pad_registers)
  87. reset_control_put(usb1_reset);
  88. }
  89. usb1_reset_attempted = true;
  90. }
  91. if (!has_utmi_pad_registers) {
  92. reset_control_assert(tegra->rst);
  93. udelay(1);
  94. reset_control_deassert(tegra->rst);
  95. }
  96. of_node_put(phy_np);
  97. return 0;
  98. }
  99. static int tegra_ehci_internal_port_reset(
  100. struct ehci_hcd *ehci,
  101. u32 __iomem *portsc_reg
  102. )
  103. {
  104. u32 temp;
  105. unsigned long flags;
  106. int retval = 0;
  107. int i, tries;
  108. u32 saved_usbintr;
  109. spin_lock_irqsave(&ehci->lock, flags);
  110. saved_usbintr = ehci_readl(ehci, &ehci->regs->intr_enable);
  111. /* disable USB interrupt */
  112. ehci_writel(ehci, 0, &ehci->regs->intr_enable);
  113. spin_unlock_irqrestore(&ehci->lock, flags);
  114. /*
  115. * Here we have to do Port Reset at most twice for
  116. * Port Enable bit to be set.
  117. */
  118. for (i = 0; i < 2; i++) {
  119. temp = ehci_readl(ehci, portsc_reg);
  120. temp |= PORT_RESET;
  121. ehci_writel(ehci, temp, portsc_reg);
  122. mdelay(10);
  123. temp &= ~PORT_RESET;
  124. ehci_writel(ehci, temp, portsc_reg);
  125. mdelay(1);
  126. tries = 100;
  127. do {
  128. mdelay(1);
  129. /*
  130. * Up to this point, Port Enable bit is
  131. * expected to be set after 2 ms waiting.
  132. * USB1 usually takes extra 45 ms, for safety,
  133. * we take 100 ms as timeout.
  134. */
  135. temp = ehci_readl(ehci, portsc_reg);
  136. } while (!(temp & PORT_PE) && tries--);
  137. if (temp & PORT_PE)
  138. break;
  139. }
  140. if (i == 2)
  141. retval = -ETIMEDOUT;
  142. /*
  143. * Clear Connect Status Change bit if it's set.
  144. * We can't clear PORT_PEC. It will also cause PORT_PE to be cleared.
  145. */
  146. if (temp & PORT_CSC)
  147. ehci_writel(ehci, PORT_CSC, portsc_reg);
  148. /*
  149. * Write to clear any interrupt status bits that might be set
  150. * during port reset.
  151. */
  152. temp = ehci_readl(ehci, &ehci->regs->status);
  153. ehci_writel(ehci, temp, &ehci->regs->status);
  154. /* restore original interrupt enable bits */
  155. ehci_writel(ehci, saved_usbintr, &ehci->regs->intr_enable);
  156. return retval;
  157. }
  158. static int tegra_ehci_hub_control(
  159. struct usb_hcd *hcd,
  160. u16 typeReq,
  161. u16 wValue,
  162. u16 wIndex,
  163. char *buf,
  164. u16 wLength
  165. )
  166. {
  167. struct ehci_hcd *ehci = hcd_to_ehci(hcd);
  168. struct tegra_ehci_hcd *tegra = (struct tegra_ehci_hcd *)ehci->priv;
  169. u32 __iomem *status_reg;
  170. u32 temp;
  171. unsigned long flags;
  172. int retval = 0;
  173. status_reg = &ehci->regs->port_status[(wIndex & 0xff) - 1];
  174. spin_lock_irqsave(&ehci->lock, flags);
  175. if (typeReq == GetPortStatus) {
  176. temp = ehci_readl(ehci, status_reg);
  177. if (tegra->port_resuming && !(temp & PORT_SUSPEND)) {
  178. /* Resume completed, re-enable disconnect detection */
  179. tegra->port_resuming = 0;
  180. tegra_usb_phy_postresume(hcd->usb_phy);
  181. }
  182. }
  183. else if (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_SUSPEND) {
  184. temp = ehci_readl(ehci, status_reg);
  185. if ((temp & PORT_PE) == 0 || (temp & PORT_RESET) != 0) {
  186. retval = -EPIPE;
  187. goto done;
  188. }
  189. temp &= ~(PORT_RWC_BITS | PORT_WKCONN_E);
  190. temp |= PORT_WKDISC_E | PORT_WKOC_E;
  191. ehci_writel(ehci, temp | PORT_SUSPEND, status_reg);
  192. /*
  193. * If a transaction is in progress, there may be a delay in
  194. * suspending the port. Poll until the port is suspended.
  195. */
  196. if (ehci_handshake(ehci, status_reg, PORT_SUSPEND,
  197. PORT_SUSPEND, 5000))
  198. pr_err("%s: timeout waiting for SUSPEND\n", __func__);
  199. set_bit((wIndex & 0xff) - 1, &ehci->suspended_ports);
  200. goto done;
  201. }
  202. /* For USB1 port we need to issue Port Reset twice internally */
  203. if (tegra->needs_double_reset &&
  204. (typeReq == SetPortFeature && wValue == USB_PORT_FEAT_RESET)) {
  205. spin_unlock_irqrestore(&ehci->lock, flags);
  206. return tegra_ehci_internal_port_reset(ehci, status_reg);
  207. }
  208. /*
  209. * Tegra host controller will time the resume operation to clear the bit
  210. * when the port control state switches to HS or FS Idle. This behavior
  211. * is different from EHCI where the host controller driver is required
  212. * to set this bit to a zero after the resume duration is timed in the
  213. * driver.
  214. */
  215. else if (typeReq == ClearPortFeature &&
  216. wValue == USB_PORT_FEAT_SUSPEND) {
  217. temp = ehci_readl(ehci, status_reg);
  218. if ((temp & PORT_RESET) || !(temp & PORT_PE)) {
  219. retval = -EPIPE;
  220. goto done;
  221. }
  222. if (!(temp & PORT_SUSPEND))
  223. goto done;
  224. /* Disable disconnect detection during port resume */
  225. tegra_usb_phy_preresume(hcd->usb_phy);
  226. ehci->reset_done[wIndex-1] = jiffies + msecs_to_jiffies(25);
  227. temp &= ~(PORT_RWC_BITS | PORT_WAKE_BITS);
  228. /* start resume signalling */
  229. ehci_writel(ehci, temp | PORT_RESUME, status_reg);
  230. set_bit(wIndex-1, &ehci->resuming_ports);
  231. spin_unlock_irqrestore(&ehci->lock, flags);
  232. msleep(20);
  233. spin_lock_irqsave(&ehci->lock, flags);
  234. /* Poll until the controller clears RESUME and SUSPEND */
  235. if (ehci_handshake(ehci, status_reg, PORT_RESUME, 0, 2000))
  236. pr_err("%s: timeout waiting for RESUME\n", __func__);
  237. if (ehci_handshake(ehci, status_reg, PORT_SUSPEND, 0, 2000))
  238. pr_err("%s: timeout waiting for SUSPEND\n", __func__);
  239. ehci->reset_done[wIndex-1] = 0;
  240. clear_bit(wIndex-1, &ehci->resuming_ports);
  241. tegra->port_resuming = 1;
  242. goto done;
  243. }
  244. spin_unlock_irqrestore(&ehci->lock, flags);
  245. /* Handle the hub control events here */
  246. return ehci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength);
  247. done:
  248. spin_unlock_irqrestore(&ehci->lock, flags);
  249. return retval;
  250. }
  251. struct dma_aligned_buffer {
  252. void *kmalloc_ptr;
  253. void *old_xfer_buffer;
  254. u8 data[0];
  255. };
  256. static void free_dma_aligned_buffer(struct urb *urb)
  257. {
  258. struct dma_aligned_buffer *temp;
  259. size_t length;
  260. if (!(urb->transfer_flags & URB_ALIGNED_TEMP_BUFFER))
  261. return;
  262. temp = container_of(urb->transfer_buffer,
  263. struct dma_aligned_buffer, data);
  264. if (usb_urb_dir_in(urb)) {
  265. if (usb_pipeisoc(urb->pipe))
  266. length = urb->transfer_buffer_length;
  267. else
  268. length = urb->actual_length;
  269. memcpy(temp->old_xfer_buffer, temp->data, length);
  270. }
  271. urb->transfer_buffer = temp->old_xfer_buffer;
  272. kfree(temp->kmalloc_ptr);
  273. urb->transfer_flags &= ~URB_ALIGNED_TEMP_BUFFER;
  274. }
  275. static int alloc_dma_aligned_buffer(struct urb *urb, gfp_t mem_flags)
  276. {
  277. struct dma_aligned_buffer *temp, *kmalloc_ptr;
  278. size_t kmalloc_size;
  279. if (urb->num_sgs || urb->sg ||
  280. urb->transfer_buffer_length == 0 ||
  281. !((uintptr_t)urb->transfer_buffer & (TEGRA_USB_DMA_ALIGN - 1)))
  282. return 0;
  283. /* Allocate a buffer with enough padding for alignment */
  284. kmalloc_size = urb->transfer_buffer_length +
  285. sizeof(struct dma_aligned_buffer) + TEGRA_USB_DMA_ALIGN - 1;
  286. kmalloc_ptr = kmalloc(kmalloc_size, mem_flags);
  287. if (!kmalloc_ptr)
  288. return -ENOMEM;
  289. /* Position our struct dma_aligned_buffer such that data is aligned */
  290. temp = PTR_ALIGN(kmalloc_ptr + 1, TEGRA_USB_DMA_ALIGN) - 1;
  291. temp->kmalloc_ptr = kmalloc_ptr;
  292. temp->old_xfer_buffer = urb->transfer_buffer;
  293. if (usb_urb_dir_out(urb))
  294. memcpy(temp->data, urb->transfer_buffer,
  295. urb->transfer_buffer_length);
  296. urb->transfer_buffer = temp->data;
  297. urb->transfer_flags |= URB_ALIGNED_TEMP_BUFFER;
  298. return 0;
  299. }
  300. static int tegra_ehci_map_urb_for_dma(struct usb_hcd *hcd, struct urb *urb,
  301. gfp_t mem_flags)
  302. {
  303. int ret;
  304. ret = alloc_dma_aligned_buffer(urb, mem_flags);
  305. if (ret)
  306. return ret;
  307. ret = usb_hcd_map_urb_for_dma(hcd, urb, mem_flags);
  308. if (ret)
  309. free_dma_aligned_buffer(urb);
  310. return ret;
  311. }
  312. static void tegra_ehci_unmap_urb_for_dma(struct usb_hcd *hcd, struct urb *urb)
  313. {
  314. usb_hcd_unmap_urb_for_dma(hcd, urb);
  315. free_dma_aligned_buffer(urb);
  316. }
  317. static const struct tegra_ehci_soc_config tegra30_soc_config = {
  318. .has_hostpc = true,
  319. };
  320. static const struct tegra_ehci_soc_config tegra20_soc_config = {
  321. .has_hostpc = false,
  322. };
  323. static const struct of_device_id tegra_ehci_of_match[] = {
  324. { .compatible = "nvidia,tegra30-ehci", .data = &tegra30_soc_config },
  325. { .compatible = "nvidia,tegra20-ehci", .data = &tegra20_soc_config },
  326. { },
  327. };
  328. static int tegra_ehci_probe(struct platform_device *pdev)
  329. {
  330. const struct of_device_id *match;
  331. const struct tegra_ehci_soc_config *soc_config;
  332. struct resource *res;
  333. struct usb_hcd *hcd;
  334. struct ehci_hcd *ehci;
  335. struct tegra_ehci_hcd *tegra;
  336. int err = 0;
  337. int irq;
  338. struct usb_phy *u_phy;
  339. match = of_match_device(tegra_ehci_of_match, &pdev->dev);
  340. if (!match) {
  341. dev_err(&pdev->dev, "Error: No device match found\n");
  342. return -ENODEV;
  343. }
  344. soc_config = match->data;
  345. /* Right now device-tree probed devices don't get dma_mask set.
  346. * Since shared usb code relies on it, set it here for now.
  347. * Once we have dma capability bindings this can go away.
  348. */
  349. err = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
  350. if (err)
  351. return err;
  352. hcd = usb_create_hcd(&tegra_ehci_hc_driver, &pdev->dev,
  353. dev_name(&pdev->dev));
  354. if (!hcd) {
  355. dev_err(&pdev->dev, "Unable to create HCD\n");
  356. return -ENOMEM;
  357. }
  358. platform_set_drvdata(pdev, hcd);
  359. ehci = hcd_to_ehci(hcd);
  360. tegra = (struct tegra_ehci_hcd *)ehci->priv;
  361. hcd->has_tt = 1;
  362. tegra->clk = devm_clk_get(&pdev->dev, NULL);
  363. if (IS_ERR(tegra->clk)) {
  364. dev_err(&pdev->dev, "Can't get ehci clock\n");
  365. err = PTR_ERR(tegra->clk);
  366. goto cleanup_hcd_create;
  367. }
  368. tegra->rst = devm_reset_control_get(&pdev->dev, "usb");
  369. if (IS_ERR(tegra->rst)) {
  370. dev_err(&pdev->dev, "Can't get ehci reset\n");
  371. err = PTR_ERR(tegra->rst);
  372. goto cleanup_hcd_create;
  373. }
  374. err = clk_prepare_enable(tegra->clk);
  375. if (err)
  376. goto cleanup_hcd_create;
  377. err = tegra_reset_usb_controller(pdev);
  378. if (err)
  379. goto cleanup_clk_en;
  380. u_phy = devm_usb_get_phy_by_phandle(&pdev->dev, "nvidia,phy", 0);
  381. if (IS_ERR(u_phy)) {
  382. err = -EPROBE_DEFER;
  383. goto cleanup_clk_en;
  384. }
  385. hcd->usb_phy = u_phy;
  386. hcd->skip_phy_initialization = 1;
  387. tegra->needs_double_reset = of_property_read_bool(pdev->dev.of_node,
  388. "nvidia,needs-double-reset");
  389. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  390. hcd->regs = devm_ioremap_resource(&pdev->dev, res);
  391. if (IS_ERR(hcd->regs)) {
  392. err = PTR_ERR(hcd->regs);
  393. goto cleanup_clk_en;
  394. }
  395. hcd->rsrc_start = res->start;
  396. hcd->rsrc_len = resource_size(res);
  397. ehci->caps = hcd->regs + 0x100;
  398. ehci->has_hostpc = soc_config->has_hostpc;
  399. err = usb_phy_init(hcd->usb_phy);
  400. if (err) {
  401. dev_err(&pdev->dev, "Failed to initialize phy\n");
  402. goto cleanup_clk_en;
  403. }
  404. u_phy->otg = devm_kzalloc(&pdev->dev, sizeof(struct usb_otg),
  405. GFP_KERNEL);
  406. if (!u_phy->otg) {
  407. err = -ENOMEM;
  408. goto cleanup_phy;
  409. }
  410. u_phy->otg->host = hcd_to_bus(hcd);
  411. err = usb_phy_set_suspend(hcd->usb_phy, 0);
  412. if (err) {
  413. dev_err(&pdev->dev, "Failed to power on the phy\n");
  414. goto cleanup_phy;
  415. }
  416. irq = platform_get_irq(pdev, 0);
  417. if (!irq) {
  418. dev_err(&pdev->dev, "Failed to get IRQ\n");
  419. err = -ENODEV;
  420. goto cleanup_phy;
  421. }
  422. otg_set_host(u_phy->otg, &hcd->self);
  423. err = usb_add_hcd(hcd, irq, IRQF_SHARED);
  424. if (err) {
  425. dev_err(&pdev->dev, "Failed to add USB HCD\n");
  426. goto cleanup_otg_set_host;
  427. }
  428. device_wakeup_enable(hcd->self.controller);
  429. return err;
  430. cleanup_otg_set_host:
  431. otg_set_host(u_phy->otg, NULL);
  432. cleanup_phy:
  433. usb_phy_shutdown(hcd->usb_phy);
  434. cleanup_clk_en:
  435. clk_disable_unprepare(tegra->clk);
  436. cleanup_hcd_create:
  437. usb_put_hcd(hcd);
  438. return err;
  439. }
  440. static int tegra_ehci_remove(struct platform_device *pdev)
  441. {
  442. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  443. struct tegra_ehci_hcd *tegra =
  444. (struct tegra_ehci_hcd *)hcd_to_ehci(hcd)->priv;
  445. otg_set_host(hcd->usb_phy->otg, NULL);
  446. usb_phy_shutdown(hcd->usb_phy);
  447. usb_remove_hcd(hcd);
  448. clk_disable_unprepare(tegra->clk);
  449. usb_put_hcd(hcd);
  450. return 0;
  451. }
  452. static void tegra_ehci_hcd_shutdown(struct platform_device *pdev)
  453. {
  454. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  455. if (hcd->driver->shutdown)
  456. hcd->driver->shutdown(hcd);
  457. }
  458. static struct platform_driver tegra_ehci_driver = {
  459. .probe = tegra_ehci_probe,
  460. .remove = tegra_ehci_remove,
  461. .shutdown = tegra_ehci_hcd_shutdown,
  462. .driver = {
  463. .name = DRV_NAME,
  464. .of_match_table = tegra_ehci_of_match,
  465. }
  466. };
  467. static int tegra_ehci_reset(struct usb_hcd *hcd)
  468. {
  469. struct ehci_hcd *ehci = hcd_to_ehci(hcd);
  470. int retval;
  471. int txfifothresh;
  472. retval = ehci_setup(hcd);
  473. if (retval)
  474. return retval;
  475. /*
  476. * We should really pull this value out of tegra_ehci_soc_config, but
  477. * to avoid needing access to it, make use of the fact that Tegra20 is
  478. * the only one so far that needs a value of 10, and Tegra20 is the
  479. * only one which doesn't set has_hostpc.
  480. */
  481. txfifothresh = ehci->has_hostpc ? 0x10 : 10;
  482. ehci_writel(ehci, txfifothresh << 16, &ehci->regs->txfill_tuning);
  483. return 0;
  484. }
  485. static const struct ehci_driver_overrides tegra_overrides __initconst = {
  486. .extra_priv_size = sizeof(struct tegra_ehci_hcd),
  487. .reset = tegra_ehci_reset,
  488. };
  489. static int __init ehci_tegra_init(void)
  490. {
  491. if (usb_disabled())
  492. return -ENODEV;
  493. pr_info(DRV_NAME ": " DRIVER_DESC "\n");
  494. ehci_init_driver(&tegra_ehci_hc_driver, &tegra_overrides);
  495. /*
  496. * The Tegra HW has some unusual quirks, which require Tegra-specific
  497. * workarounds. We override certain hc_driver functions here to
  498. * achieve that. We explicitly do not enhance ehci_driver_overrides to
  499. * allow this more easily, since this is an unusual case, and we don't
  500. * want to encourage others to override these functions by making it
  501. * too easy.
  502. */
  503. tegra_ehci_hc_driver.map_urb_for_dma = tegra_ehci_map_urb_for_dma;
  504. tegra_ehci_hc_driver.unmap_urb_for_dma = tegra_ehci_unmap_urb_for_dma;
  505. tegra_ehci_hc_driver.hub_control = tegra_ehci_hub_control;
  506. return platform_driver_register(&tegra_ehci_driver);
  507. }
  508. module_init(ehci_tegra_init);
  509. static void __exit ehci_tegra_cleanup(void)
  510. {
  511. platform_driver_unregister(&tegra_ehci_driver);
  512. }
  513. module_exit(ehci_tegra_cleanup);
  514. MODULE_DESCRIPTION(DRIVER_DESC);
  515. MODULE_LICENSE("GPL");
  516. MODULE_ALIAS("platform:" DRV_NAME);
  517. MODULE_DEVICE_TABLE(of, tegra_ehci_of_match);