ehci-tegra.c 17 KB

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