ohci-at91.c 16 KB

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