ohci-at91.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704
  1. /*
  2. * OHCI HCD (Host Controller Driver) for USB.
  3. *
  4. * Copyright (C) 2004 SAN People (Pty) Ltd.
  5. * Copyright (C) 2005 Thibaut VARENE <varenet@parisc-linux.org>
  6. *
  7. * AT91 Bus Glue
  8. *
  9. * Based on fragments of 2.4 driver by Rick Bronson.
  10. * Based on ohci-omap.c
  11. *
  12. * This file is licenced under the GPL.
  13. */
  14. #include <linux/clk.h>
  15. #include <linux/dma-mapping.h>
  16. #include <linux/of_platform.h>
  17. #include <linux/of_gpio.h>
  18. #include <linux/platform_device.h>
  19. #include <linux/platform_data/atmel.h>
  20. #include <linux/io.h>
  21. #include <linux/kernel.h>
  22. #include <linux/module.h>
  23. #include <linux/usb.h>
  24. #include <linux/usb/hcd.h>
  25. #include <mach/hardware.h>
  26. #include <asm/gpio.h>
  27. #include <mach/cpu.h>
  28. #include "ohci.h"
  29. #define valid_port(index) ((index) >= 0 && (index) < AT91_MAX_USBH_PORTS)
  30. #define at91_for_each_port(index) \
  31. for ((index) = 0; (index) < AT91_MAX_USBH_PORTS; (index)++)
  32. /* interface, function and usb clocks; sometimes also an AHB clock */
  33. static struct clk *iclk, *fclk, *uclk, *hclk;
  34. /* interface and function clocks; sometimes also an AHB clock */
  35. #define DRIVER_DESC "OHCI Atmel driver"
  36. static const char hcd_name[] = "ohci-atmel";
  37. static struct hc_driver __read_mostly ohci_at91_hc_driver;
  38. static int clocked;
  39. extern int usb_disabled(void);
  40. /*-------------------------------------------------------------------------*/
  41. static void at91_start_clock(void)
  42. {
  43. if (IS_ENABLED(CONFIG_COMMON_CLK)) {
  44. clk_set_rate(uclk, 48000000);
  45. clk_prepare_enable(uclk);
  46. }
  47. clk_prepare_enable(hclk);
  48. clk_prepare_enable(iclk);
  49. clk_prepare_enable(fclk);
  50. clocked = 1;
  51. }
  52. static void at91_stop_clock(void)
  53. {
  54. clk_disable_unprepare(fclk);
  55. clk_disable_unprepare(iclk);
  56. clk_disable_unprepare(hclk);
  57. if (IS_ENABLED(CONFIG_COMMON_CLK))
  58. clk_disable_unprepare(uclk);
  59. clocked = 0;
  60. }
  61. static void at91_start_hc(struct platform_device *pdev)
  62. {
  63. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  64. struct ohci_regs __iomem *regs = hcd->regs;
  65. dev_dbg(&pdev->dev, "start\n");
  66. /*
  67. * Start the USB clocks.
  68. */
  69. at91_start_clock();
  70. /*
  71. * The USB host controller must remain in reset.
  72. */
  73. writel(0, &regs->control);
  74. }
  75. static void at91_stop_hc(struct platform_device *pdev)
  76. {
  77. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  78. struct ohci_regs __iomem *regs = hcd->regs;
  79. dev_dbg(&pdev->dev, "stop\n");
  80. /*
  81. * Put the USB host controller into reset.
  82. */
  83. writel(0, &regs->control);
  84. /*
  85. * Stop the USB clocks.
  86. */
  87. at91_stop_clock();
  88. }
  89. /*-------------------------------------------------------------------------*/
  90. static void usb_hcd_at91_remove (struct usb_hcd *, struct platform_device *);
  91. /* configure so an HC device and id are always provided */
  92. /* always called with process context; sleeping is OK */
  93. /**
  94. * usb_hcd_at91_probe - initialize AT91-based HCDs
  95. * Context: !in_interrupt()
  96. *
  97. * Allocates basic resources for this USB host controller, and
  98. * then invokes the start() method for the HCD associated with it
  99. * through the hotplug entry's driver_data.
  100. */
  101. static int usb_hcd_at91_probe(const struct hc_driver *driver,
  102. struct platform_device *pdev)
  103. {
  104. struct at91_usbh_data *board;
  105. struct ohci_hcd *ohci;
  106. int retval;
  107. struct usb_hcd *hcd = NULL;
  108. struct device *dev = &pdev->dev;
  109. struct resource *res;
  110. int irq;
  111. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  112. if (!res) {
  113. dev_dbg(dev, "hcd probe: missing memory resource\n");
  114. return -ENXIO;
  115. }
  116. irq = platform_get_irq(pdev, 0);
  117. if (irq < 0) {
  118. dev_dbg(dev, "hcd probe: missing irq resource\n");
  119. return irq;
  120. }
  121. hcd = usb_create_hcd(driver, dev, "at91");
  122. if (!hcd)
  123. return -ENOMEM;
  124. hcd->rsrc_start = res->start;
  125. hcd->rsrc_len = resource_size(res);
  126. hcd->regs = devm_ioremap_resource(dev, res);
  127. if (IS_ERR(hcd->regs)) {
  128. retval = PTR_ERR(hcd->regs);
  129. goto err;
  130. }
  131. iclk = devm_clk_get(dev, "ohci_clk");
  132. if (IS_ERR(iclk)) {
  133. dev_err(dev, "failed to get ohci_clk\n");
  134. retval = PTR_ERR(iclk);
  135. goto err;
  136. }
  137. fclk = devm_clk_get(dev, "uhpck");
  138. if (IS_ERR(fclk)) {
  139. dev_err(dev, "failed to get uhpck\n");
  140. retval = PTR_ERR(fclk);
  141. goto err;
  142. }
  143. hclk = devm_clk_get(dev, "hclk");
  144. if (IS_ERR(hclk)) {
  145. dev_err(dev, "failed to get hclk\n");
  146. retval = PTR_ERR(hclk);
  147. goto err;
  148. }
  149. if (IS_ENABLED(CONFIG_COMMON_CLK)) {
  150. uclk = devm_clk_get(dev, "usb_clk");
  151. if (IS_ERR(uclk)) {
  152. dev_err(dev, "failed to get uclk\n");
  153. retval = PTR_ERR(uclk);
  154. goto err;
  155. }
  156. }
  157. board = hcd->self.controller->platform_data;
  158. ohci = hcd_to_ohci(hcd);
  159. ohci->num_ports = board->ports;
  160. at91_start_hc(pdev);
  161. retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
  162. if (retval == 0) {
  163. device_wakeup_enable(hcd->self.controller);
  164. return retval;
  165. }
  166. /* Error handling */
  167. at91_stop_hc(pdev);
  168. err:
  169. usb_put_hcd(hcd);
  170. return retval;
  171. }
  172. /* may be called with controller, bus, and devices active */
  173. /**
  174. * usb_hcd_at91_remove - shutdown processing for AT91-based HCDs
  175. * @dev: USB Host Controller being removed
  176. * Context: !in_interrupt()
  177. *
  178. * Reverses the effect of usb_hcd_at91_probe(), first invoking
  179. * the HCD's stop() method. It is always called from a thread
  180. * context, "rmmod" or something similar.
  181. *
  182. */
  183. static void usb_hcd_at91_remove(struct usb_hcd *hcd,
  184. struct platform_device *pdev)
  185. {
  186. usb_remove_hcd(hcd);
  187. at91_stop_hc(pdev);
  188. usb_put_hcd(hcd);
  189. }
  190. /*-------------------------------------------------------------------------*/
  191. static void ohci_at91_usb_set_power(struct at91_usbh_data *pdata, int port, int enable)
  192. {
  193. if (!valid_port(port))
  194. return;
  195. if (!gpio_is_valid(pdata->vbus_pin[port]))
  196. return;
  197. gpio_set_value(pdata->vbus_pin[port],
  198. pdata->vbus_pin_active_low[port] ^ enable);
  199. }
  200. static int ohci_at91_usb_get_power(struct at91_usbh_data *pdata, int port)
  201. {
  202. if (!valid_port(port))
  203. return -EINVAL;
  204. if (!gpio_is_valid(pdata->vbus_pin[port]))
  205. return -EINVAL;
  206. return gpio_get_value(pdata->vbus_pin[port]) ^
  207. pdata->vbus_pin_active_low[port];
  208. }
  209. /*
  210. * Update the status data from the hub with the over-current indicator change.
  211. */
  212. static int ohci_at91_hub_status_data(struct usb_hcd *hcd, char *buf)
  213. {
  214. struct at91_usbh_data *pdata = hcd->self.controller->platform_data;
  215. int length = ohci_hub_status_data(hcd, buf);
  216. int port;
  217. at91_for_each_port(port) {
  218. if (pdata->overcurrent_changed[port]) {
  219. if (!length)
  220. length = 1;
  221. buf[0] |= 1 << (port + 1);
  222. }
  223. }
  224. return length;
  225. }
  226. /*
  227. * Look at the control requests to the root hub and see if we need to override.
  228. */
  229. static int ohci_at91_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
  230. u16 wIndex, char *buf, u16 wLength)
  231. {
  232. struct at91_usbh_data *pdata = dev_get_platdata(hcd->self.controller);
  233. struct usb_hub_descriptor *desc;
  234. int ret = -EINVAL;
  235. u32 *data = (u32 *)buf;
  236. dev_dbg(hcd->self.controller,
  237. "ohci_at91_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n",
  238. hcd, typeReq, wValue, wIndex, buf, wLength);
  239. wIndex--;
  240. switch (typeReq) {
  241. case SetPortFeature:
  242. if (wValue == USB_PORT_FEAT_POWER) {
  243. dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n");
  244. if (valid_port(wIndex)) {
  245. ohci_at91_usb_set_power(pdata, wIndex, 1);
  246. ret = 0;
  247. }
  248. goto out;
  249. }
  250. break;
  251. case ClearPortFeature:
  252. switch (wValue) {
  253. case USB_PORT_FEAT_C_OVER_CURRENT:
  254. dev_dbg(hcd->self.controller,
  255. "ClearPortFeature: C_OVER_CURRENT\n");
  256. if (valid_port(wIndex)) {
  257. pdata->overcurrent_changed[wIndex] = 0;
  258. pdata->overcurrent_status[wIndex] = 0;
  259. }
  260. goto out;
  261. case USB_PORT_FEAT_OVER_CURRENT:
  262. dev_dbg(hcd->self.controller,
  263. "ClearPortFeature: OVER_CURRENT\n");
  264. if (valid_port(wIndex))
  265. pdata->overcurrent_status[wIndex] = 0;
  266. goto out;
  267. case USB_PORT_FEAT_POWER:
  268. dev_dbg(hcd->self.controller,
  269. "ClearPortFeature: POWER\n");
  270. if (valid_port(wIndex)) {
  271. ohci_at91_usb_set_power(pdata, wIndex, 0);
  272. return 0;
  273. }
  274. }
  275. break;
  276. }
  277. ret = ohci_hub_control(hcd, typeReq, wValue, wIndex + 1, buf, wLength);
  278. if (ret)
  279. goto out;
  280. switch (typeReq) {
  281. case GetHubDescriptor:
  282. /* update the hub's descriptor */
  283. desc = (struct usb_hub_descriptor *)buf;
  284. dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n",
  285. desc->wHubCharacteristics);
  286. /* remove the old configurations for power-switching, and
  287. * over-current protection, and insert our new configuration
  288. */
  289. desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM);
  290. desc->wHubCharacteristics |= cpu_to_le16(0x0001);
  291. if (pdata->overcurrent_supported) {
  292. desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM);
  293. desc->wHubCharacteristics |= cpu_to_le16(0x0008|0x0001);
  294. }
  295. dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n",
  296. desc->wHubCharacteristics);
  297. return ret;
  298. case GetPortStatus:
  299. /* check port status */
  300. dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex);
  301. if (valid_port(wIndex)) {
  302. if (!ohci_at91_usb_get_power(pdata, wIndex))
  303. *data &= ~cpu_to_le32(RH_PS_PPS);
  304. if (pdata->overcurrent_changed[wIndex])
  305. *data |= cpu_to_le32(RH_PS_OCIC);
  306. if (pdata->overcurrent_status[wIndex])
  307. *data |= cpu_to_le32(RH_PS_POCI);
  308. }
  309. }
  310. out:
  311. return ret;
  312. }
  313. /*-------------------------------------------------------------------------*/
  314. static irqreturn_t ohci_hcd_at91_overcurrent_irq(int irq, void *data)
  315. {
  316. struct platform_device *pdev = data;
  317. struct at91_usbh_data *pdata = dev_get_platdata(&pdev->dev);
  318. int val, gpio, port;
  319. /* From the GPIO notifying the over-current situation, find
  320. * out the corresponding port */
  321. at91_for_each_port(port) {
  322. if (gpio_is_valid(pdata->overcurrent_pin[port]) &&
  323. gpio_to_irq(pdata->overcurrent_pin[port]) == irq) {
  324. gpio = pdata->overcurrent_pin[port];
  325. break;
  326. }
  327. }
  328. if (port == AT91_MAX_USBH_PORTS) {
  329. dev_err(& pdev->dev, "overcurrent interrupt from unknown GPIO\n");
  330. return IRQ_HANDLED;
  331. }
  332. val = gpio_get_value(gpio);
  333. /* When notified of an over-current situation, disable power
  334. on the corresponding port, and mark this port in
  335. over-current. */
  336. if (!val) {
  337. ohci_at91_usb_set_power(pdata, port, 0);
  338. pdata->overcurrent_status[port] = 1;
  339. pdata->overcurrent_changed[port] = 1;
  340. }
  341. dev_dbg(& pdev->dev, "overcurrent situation %s\n",
  342. val ? "exited" : "notified");
  343. return IRQ_HANDLED;
  344. }
  345. #ifdef CONFIG_OF
  346. static const struct of_device_id at91_ohci_dt_ids[] = {
  347. { .compatible = "atmel,at91rm9200-ohci" },
  348. { /* sentinel */ }
  349. };
  350. MODULE_DEVICE_TABLE(of, at91_ohci_dt_ids);
  351. static int ohci_at91_of_init(struct platform_device *pdev)
  352. {
  353. struct device_node *np = pdev->dev.of_node;
  354. int i, gpio, ret;
  355. enum of_gpio_flags flags;
  356. struct at91_usbh_data *pdata;
  357. u32 ports;
  358. if (!np)
  359. return 0;
  360. /* Right now device-tree probed devices don't get dma_mask set.
  361. * Since shared usb code relies on it, set it here for now.
  362. * Once we have dma capability bindings this can go away.
  363. */
  364. ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
  365. if (ret)
  366. return ret;
  367. pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
  368. if (!pdata)
  369. return -ENOMEM;
  370. if (!of_property_read_u32(np, "num-ports", &ports))
  371. pdata->ports = ports;
  372. at91_for_each_port(i) {
  373. gpio = of_get_named_gpio_flags(np, "atmel,vbus-gpio", i, &flags);
  374. pdata->vbus_pin[i] = gpio;
  375. if (!gpio_is_valid(gpio))
  376. continue;
  377. pdata->vbus_pin_active_low[i] = flags & OF_GPIO_ACTIVE_LOW;
  378. }
  379. at91_for_each_port(i)
  380. pdata->overcurrent_pin[i] =
  381. of_get_named_gpio_flags(np, "atmel,oc-gpio", i, &flags);
  382. pdev->dev.platform_data = pdata;
  383. return 0;
  384. }
  385. #else
  386. static int ohci_at91_of_init(struct platform_device *pdev)
  387. {
  388. return 0;
  389. }
  390. #endif
  391. /*-------------------------------------------------------------------------*/
  392. static int ohci_hcd_at91_drv_probe(struct platform_device *pdev)
  393. {
  394. struct at91_usbh_data *pdata;
  395. int i;
  396. int gpio;
  397. int ret;
  398. ret = ohci_at91_of_init(pdev);
  399. if (ret)
  400. return ret;
  401. pdata = dev_get_platdata(&pdev->dev);
  402. if (pdata) {
  403. at91_for_each_port(i) {
  404. /*
  405. * do not configure PIO if not in relation with
  406. * real USB port on board
  407. */
  408. if (i >= pdata->ports) {
  409. pdata->vbus_pin[i] = -EINVAL;
  410. pdata->overcurrent_pin[i] = -EINVAL;
  411. break;
  412. }
  413. if (!gpio_is_valid(pdata->vbus_pin[i]))
  414. continue;
  415. gpio = pdata->vbus_pin[i];
  416. ret = gpio_request(gpio, "ohci_vbus");
  417. if (ret) {
  418. dev_err(&pdev->dev,
  419. "can't request vbus gpio %d\n", gpio);
  420. continue;
  421. }
  422. ret = gpio_direction_output(gpio,
  423. !pdata->vbus_pin_active_low[i]);
  424. if (ret) {
  425. dev_err(&pdev->dev,
  426. "can't put vbus gpio %d as output %d\n",
  427. gpio, !pdata->vbus_pin_active_low[i]);
  428. gpio_free(gpio);
  429. continue;
  430. }
  431. ohci_at91_usb_set_power(pdata, i, 1);
  432. }
  433. at91_for_each_port(i) {
  434. if (!gpio_is_valid(pdata->overcurrent_pin[i]))
  435. continue;
  436. gpio = pdata->overcurrent_pin[i];
  437. ret = gpio_request(gpio, "ohci_overcurrent");
  438. if (ret) {
  439. dev_err(&pdev->dev,
  440. "can't request overcurrent gpio %d\n",
  441. gpio);
  442. continue;
  443. }
  444. ret = gpio_direction_input(gpio);
  445. if (ret) {
  446. dev_err(&pdev->dev,
  447. "can't configure overcurrent gpio %d as input\n",
  448. gpio);
  449. gpio_free(gpio);
  450. continue;
  451. }
  452. ret = request_irq(gpio_to_irq(gpio),
  453. ohci_hcd_at91_overcurrent_irq,
  454. IRQF_SHARED, "ohci_overcurrent", pdev);
  455. if (ret) {
  456. gpio_free(gpio);
  457. dev_err(&pdev->dev,
  458. "can't get gpio IRQ for overcurrent\n");
  459. }
  460. }
  461. }
  462. device_init_wakeup(&pdev->dev, 1);
  463. return usb_hcd_at91_probe(&ohci_at91_hc_driver, pdev);
  464. }
  465. static int ohci_hcd_at91_drv_remove(struct platform_device *pdev)
  466. {
  467. struct at91_usbh_data *pdata = dev_get_platdata(&pdev->dev);
  468. int i;
  469. if (pdata) {
  470. at91_for_each_port(i) {
  471. if (!gpio_is_valid(pdata->vbus_pin[i]))
  472. continue;
  473. ohci_at91_usb_set_power(pdata, i, 0);
  474. gpio_free(pdata->vbus_pin[i]);
  475. }
  476. at91_for_each_port(i) {
  477. if (!gpio_is_valid(pdata->overcurrent_pin[i]))
  478. continue;
  479. free_irq(gpio_to_irq(pdata->overcurrent_pin[i]), pdev);
  480. gpio_free(pdata->overcurrent_pin[i]);
  481. }
  482. }
  483. device_init_wakeup(&pdev->dev, 0);
  484. usb_hcd_at91_remove(platform_get_drvdata(pdev), pdev);
  485. return 0;
  486. }
  487. #ifdef CONFIG_PM
  488. static int
  489. ohci_hcd_at91_drv_suspend(struct platform_device *pdev, pm_message_t mesg)
  490. {
  491. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  492. struct ohci_hcd *ohci = hcd_to_ohci(hcd);
  493. bool do_wakeup = device_may_wakeup(&pdev->dev);
  494. int ret;
  495. if (do_wakeup)
  496. enable_irq_wake(hcd->irq);
  497. ret = ohci_suspend(hcd, do_wakeup);
  498. if (ret) {
  499. disable_irq_wake(hcd->irq);
  500. return ret;
  501. }
  502. /*
  503. * The integrated transceivers seem unable to notice disconnect,
  504. * reconnect, or wakeup without the 48 MHz clock active. so for
  505. * correctness, always discard connection state (using reset).
  506. *
  507. * REVISIT: some boards will be able to turn VBUS off...
  508. */
  509. if (at91_suspend_entering_slow_clock()) {
  510. ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
  511. ohci->hc_control &= OHCI_CTRL_RWC;
  512. ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
  513. ohci->rh_state = OHCI_RH_HALTED;
  514. /* flush the writes */
  515. (void) ohci_readl (ohci, &ohci->regs->control);
  516. at91_stop_clock();
  517. }
  518. return ret;
  519. }
  520. static int ohci_hcd_at91_drv_resume(struct platform_device *pdev)
  521. {
  522. struct usb_hcd *hcd = platform_get_drvdata(pdev);
  523. if (device_may_wakeup(&pdev->dev))
  524. disable_irq_wake(hcd->irq);
  525. if (!clocked)
  526. at91_start_clock();
  527. ohci_resume(hcd, false);
  528. return 0;
  529. }
  530. #else
  531. #define ohci_hcd_at91_drv_suspend NULL
  532. #define ohci_hcd_at91_drv_resume NULL
  533. #endif
  534. static struct platform_driver ohci_hcd_at91_driver = {
  535. .probe = ohci_hcd_at91_drv_probe,
  536. .remove = ohci_hcd_at91_drv_remove,
  537. .shutdown = usb_hcd_platform_shutdown,
  538. .suspend = ohci_hcd_at91_drv_suspend,
  539. .resume = ohci_hcd_at91_drv_resume,
  540. .driver = {
  541. .name = "at91_ohci",
  542. .owner = THIS_MODULE,
  543. .of_match_table = of_match_ptr(at91_ohci_dt_ids),
  544. },
  545. };
  546. static int __init ohci_at91_init(void)
  547. {
  548. if (usb_disabled())
  549. return -ENODEV;
  550. pr_info("%s: " DRIVER_DESC "\n", hcd_name);
  551. ohci_init_driver(&ohci_at91_hc_driver, NULL);
  552. /*
  553. * The Atmel HW has some unusual quirks, which require Atmel-specific
  554. * workarounds. We override certain hc_driver functions here to
  555. * achieve that. We explicitly do not enhance ohci_driver_overrides to
  556. * allow this more easily, since this is an unusual case, and we don't
  557. * want to encourage others to override these functions by making it
  558. * too easy.
  559. */
  560. ohci_at91_hc_driver.hub_status_data = ohci_at91_hub_status_data;
  561. ohci_at91_hc_driver.hub_control = ohci_at91_hub_control;
  562. return platform_driver_register(&ohci_hcd_at91_driver);
  563. }
  564. module_init(ohci_at91_init);
  565. static void __exit ohci_at91_cleanup(void)
  566. {
  567. platform_driver_unregister(&ohci_hcd_at91_driver);
  568. }
  569. module_exit(ohci_at91_cleanup);
  570. MODULE_DESCRIPTION(DRIVER_DESC);
  571. MODULE_LICENSE("GPL");
  572. MODULE_ALIAS("platform:at91_ohci");