ohci-hcd.c 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219
  1. /*
  2. * OHCI HCD (Host Controller Driver) for USB.
  3. *
  4. * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
  5. * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
  6. *
  7. * [ Initialisation is based on Linus' ]
  8. * [ uhci code and gregs ohci fragments ]
  9. * [ (C) Copyright 1999 Linus Torvalds ]
  10. * [ (C) Copyright 1999 Gregory P. Smith]
  11. *
  12. *
  13. * OHCI is the main "non-Intel/VIA" standard for USB 1.1 host controller
  14. * interfaces (though some non-x86 Intel chips use it). It supports
  15. * smarter hardware than UHCI. A download link for the spec available
  16. * through the http://www.usb.org website.
  17. *
  18. * This file is licenced under the GPL.
  19. */
  20. #include <linux/module.h>
  21. #include <linux/moduleparam.h>
  22. #include <linux/pci.h>
  23. #include <linux/kernel.h>
  24. #include <linux/delay.h>
  25. #include <linux/ioport.h>
  26. #include <linux/sched.h>
  27. #include <linux/slab.h>
  28. #include <linux/errno.h>
  29. #include <linux/init.h>
  30. #include <linux/timer.h>
  31. #include <linux/list.h>
  32. #include <linux/usb.h>
  33. #include <linux/usb/otg.h>
  34. #include <linux/dma-mapping.h>
  35. #include <linux/dmapool.h>
  36. #include <linux/reboot.h>
  37. #include <linux/workqueue.h>
  38. #include <linux/debugfs.h>
  39. #include <asm/io.h>
  40. #include <asm/irq.h>
  41. #include <asm/system.h>
  42. #include <asm/unaligned.h>
  43. #include <asm/byteorder.h>
  44. #include "../core/hcd.h"
  45. #define DRIVER_VERSION "2006 August 04"
  46. #define DRIVER_AUTHOR "Roman Weissgaerber, David Brownell"
  47. #define DRIVER_DESC "USB 1.1 'Open' Host Controller (OHCI) Driver"
  48. /*-------------------------------------------------------------------------*/
  49. #undef OHCI_VERBOSE_DEBUG /* not always helpful */
  50. /* For initializing controller (mask in an HCFS mode too) */
  51. #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
  52. #define OHCI_INTR_INIT \
  53. (OHCI_INTR_MIE | OHCI_INTR_RHSC | OHCI_INTR_UE \
  54. | OHCI_INTR_RD | OHCI_INTR_WDH)
  55. #ifdef __hppa__
  56. /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
  57. #define IR_DISABLE
  58. #endif
  59. #ifdef CONFIG_ARCH_OMAP
  60. /* OMAP doesn't support IR (no SMM; not needed) */
  61. #define IR_DISABLE
  62. #endif
  63. /*-------------------------------------------------------------------------*/
  64. static const char hcd_name [] = "ohci_hcd";
  65. #define STATECHANGE_DELAY msecs_to_jiffies(300)
  66. #include "ohci.h"
  67. static void ohci_dump (struct ohci_hcd *ohci, int verbose);
  68. static int ohci_init (struct ohci_hcd *ohci);
  69. static void ohci_stop (struct usb_hcd *hcd);
  70. #if defined(CONFIG_PM) || defined(CONFIG_PCI)
  71. static int ohci_restart (struct ohci_hcd *ohci);
  72. #endif
  73. #ifdef CONFIG_PCI
  74. static void quirk_amd_pll(int state);
  75. static void amd_iso_dev_put(void);
  76. #else
  77. static inline void quirk_amd_pll(int state)
  78. {
  79. return;
  80. }
  81. static inline void amd_iso_dev_put(void)
  82. {
  83. return;
  84. }
  85. #endif
  86. #include "ohci-hub.c"
  87. #include "ohci-dbg.c"
  88. #include "ohci-mem.c"
  89. #include "ohci-q.c"
  90. /*
  91. * On architectures with edge-triggered interrupts we must never return
  92. * IRQ_NONE.
  93. */
  94. #if defined(CONFIG_SA1111) /* ... or other edge-triggered systems */
  95. #define IRQ_NOTMINE IRQ_HANDLED
  96. #else
  97. #define IRQ_NOTMINE IRQ_NONE
  98. #endif
  99. /* Some boards misreport power switching/overcurrent */
  100. static int distrust_firmware = 1;
  101. module_param (distrust_firmware, bool, 0);
  102. MODULE_PARM_DESC (distrust_firmware,
  103. "true to distrust firmware power/overcurrent setup");
  104. /* Some boards leave IR set wrongly, since they fail BIOS/SMM handshakes */
  105. static int no_handshake = 0;
  106. module_param (no_handshake, bool, 0);
  107. MODULE_PARM_DESC (no_handshake, "true (not default) disables BIOS handshake");
  108. /*-------------------------------------------------------------------------*/
  109. /*
  110. * queue up an urb for anything except the root hub
  111. */
  112. static int ohci_urb_enqueue (
  113. struct usb_hcd *hcd,
  114. struct urb *urb,
  115. gfp_t mem_flags
  116. ) {
  117. struct ohci_hcd *ohci = hcd_to_ohci (hcd);
  118. struct ed *ed;
  119. urb_priv_t *urb_priv;
  120. unsigned int pipe = urb->pipe;
  121. int i, size = 0;
  122. unsigned long flags;
  123. int retval = 0;
  124. #ifdef OHCI_VERBOSE_DEBUG
  125. urb_print(urb, "SUB", usb_pipein(pipe), -EINPROGRESS);
  126. #endif
  127. /* every endpoint has a ed, locate and maybe (re)initialize it */
  128. if (! (ed = ed_get (ohci, urb->ep, urb->dev, pipe, urb->interval)))
  129. return -ENOMEM;
  130. /* for the private part of the URB we need the number of TDs (size) */
  131. switch (ed->type) {
  132. case PIPE_CONTROL:
  133. /* td_submit_urb() doesn't yet handle these */
  134. if (urb->transfer_buffer_length > 4096)
  135. return -EMSGSIZE;
  136. /* 1 TD for setup, 1 for ACK, plus ... */
  137. size = 2;
  138. /* FALLTHROUGH */
  139. // case PIPE_INTERRUPT:
  140. // case PIPE_BULK:
  141. default:
  142. /* one TD for every 4096 Bytes (can be upto 8K) */
  143. size += urb->transfer_buffer_length / 4096;
  144. /* ... and for any remaining bytes ... */
  145. if ((urb->transfer_buffer_length % 4096) != 0)
  146. size++;
  147. /* ... and maybe a zero length packet to wrap it up */
  148. if (size == 0)
  149. size++;
  150. else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
  151. && (urb->transfer_buffer_length
  152. % usb_maxpacket (urb->dev, pipe,
  153. usb_pipeout (pipe))) == 0)
  154. size++;
  155. break;
  156. case PIPE_ISOCHRONOUS: /* number of packets from URB */
  157. size = urb->number_of_packets;
  158. break;
  159. }
  160. /* allocate the private part of the URB */
  161. urb_priv = kzalloc (sizeof (urb_priv_t) + size * sizeof (struct td *),
  162. mem_flags);
  163. if (!urb_priv)
  164. return -ENOMEM;
  165. INIT_LIST_HEAD (&urb_priv->pending);
  166. urb_priv->length = size;
  167. urb_priv->ed = ed;
  168. /* allocate the TDs (deferring hash chain updates) */
  169. for (i = 0; i < size; i++) {
  170. urb_priv->td [i] = td_alloc (ohci, mem_flags);
  171. if (!urb_priv->td [i]) {
  172. urb_priv->length = i;
  173. urb_free_priv (ohci, urb_priv);
  174. return -ENOMEM;
  175. }
  176. }
  177. spin_lock_irqsave (&ohci->lock, flags);
  178. /* don't submit to a dead HC */
  179. if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
  180. retval = -ENODEV;
  181. goto fail;
  182. }
  183. if (!HC_IS_RUNNING(hcd->state)) {
  184. retval = -ENODEV;
  185. goto fail;
  186. }
  187. retval = usb_hcd_link_urb_to_ep(hcd, urb);
  188. if (retval)
  189. goto fail;
  190. /* schedule the ed if needed */
  191. if (ed->state == ED_IDLE) {
  192. retval = ed_schedule (ohci, ed);
  193. if (retval < 0) {
  194. usb_hcd_unlink_urb_from_ep(hcd, urb);
  195. goto fail;
  196. }
  197. if (ed->type == PIPE_ISOCHRONOUS) {
  198. u16 frame = ohci_frame_no(ohci);
  199. /* delay a few frames before the first TD */
  200. frame += max_t (u16, 8, ed->interval);
  201. frame &= ~(ed->interval - 1);
  202. frame |= ed->branch;
  203. urb->start_frame = frame;
  204. /* yes, only URB_ISO_ASAP is supported, and
  205. * urb->start_frame is never used as input.
  206. */
  207. }
  208. } else if (ed->type == PIPE_ISOCHRONOUS)
  209. urb->start_frame = ed->last_iso + ed->interval;
  210. /* fill the TDs and link them to the ed; and
  211. * enable that part of the schedule, if needed
  212. * and update count of queued periodic urbs
  213. */
  214. urb->hcpriv = urb_priv;
  215. td_submit_urb (ohci, urb);
  216. fail:
  217. if (retval)
  218. urb_free_priv (ohci, urb_priv);
  219. spin_unlock_irqrestore (&ohci->lock, flags);
  220. return retval;
  221. }
  222. /*
  223. * decouple the URB from the HC queues (TDs, urb_priv).
  224. * reporting is always done
  225. * asynchronously, and we might be dealing with an urb that's
  226. * partially transferred, or an ED with other urbs being unlinked.
  227. */
  228. static int ohci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
  229. {
  230. struct ohci_hcd *ohci = hcd_to_ohci (hcd);
  231. unsigned long flags;
  232. int rc;
  233. #ifdef OHCI_VERBOSE_DEBUG
  234. urb_print(urb, "UNLINK", 1, status);
  235. #endif
  236. spin_lock_irqsave (&ohci->lock, flags);
  237. rc = usb_hcd_check_unlink_urb(hcd, urb, status);
  238. if (rc) {
  239. ; /* Do nothing */
  240. } else if (HC_IS_RUNNING(hcd->state)) {
  241. urb_priv_t *urb_priv;
  242. /* Unless an IRQ completed the unlink while it was being
  243. * handed to us, flag it for unlink and giveback, and force
  244. * some upcoming INTR_SF to call finish_unlinks()
  245. */
  246. urb_priv = urb->hcpriv;
  247. if (urb_priv) {
  248. if (urb_priv->ed->state == ED_OPER)
  249. start_ed_unlink (ohci, urb_priv->ed);
  250. }
  251. } else {
  252. /*
  253. * with HC dead, we won't respect hc queue pointers
  254. * any more ... just clean up every urb's memory.
  255. */
  256. if (urb->hcpriv)
  257. finish_urb(ohci, urb, status);
  258. }
  259. spin_unlock_irqrestore (&ohci->lock, flags);
  260. return rc;
  261. }
  262. /*-------------------------------------------------------------------------*/
  263. /* frees config/altsetting state for endpoints,
  264. * including ED memory, dummy TD, and bulk/intr data toggle
  265. */
  266. static void
  267. ohci_endpoint_disable (struct usb_hcd *hcd, struct usb_host_endpoint *ep)
  268. {
  269. struct ohci_hcd *ohci = hcd_to_ohci (hcd);
  270. unsigned long flags;
  271. struct ed *ed = ep->hcpriv;
  272. unsigned limit = 1000;
  273. /* ASSERT: any requests/urbs are being unlinked */
  274. /* ASSERT: nobody can be submitting urbs for this any more */
  275. if (!ed)
  276. return;
  277. rescan:
  278. spin_lock_irqsave (&ohci->lock, flags);
  279. if (!HC_IS_RUNNING (hcd->state)) {
  280. sanitize:
  281. ed->state = ED_IDLE;
  282. if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT)
  283. ohci->eds_scheduled--;
  284. finish_unlinks (ohci, 0);
  285. }
  286. switch (ed->state) {
  287. case ED_UNLINK: /* wait for hw to finish? */
  288. /* major IRQ delivery trouble loses INTR_SF too... */
  289. if (limit-- == 0) {
  290. ohci_warn(ohci, "ED unlink timeout\n");
  291. if (quirk_zfmicro(ohci)) {
  292. ohci_warn(ohci, "Attempting ZF TD recovery\n");
  293. ohci->ed_to_check = ed;
  294. ohci->zf_delay = 2;
  295. }
  296. goto sanitize;
  297. }
  298. spin_unlock_irqrestore (&ohci->lock, flags);
  299. schedule_timeout_uninterruptible(1);
  300. goto rescan;
  301. case ED_IDLE: /* fully unlinked */
  302. if (list_empty (&ed->td_list)) {
  303. td_free (ohci, ed->dummy);
  304. ed_free (ohci, ed);
  305. break;
  306. }
  307. /* else FALL THROUGH */
  308. default:
  309. /* caller was supposed to have unlinked any requests;
  310. * that's not our job. can't recover; must leak ed.
  311. */
  312. ohci_err (ohci, "leak ed %p (#%02x) state %d%s\n",
  313. ed, ep->desc.bEndpointAddress, ed->state,
  314. list_empty (&ed->td_list) ? "" : " (has tds)");
  315. td_free (ohci, ed->dummy);
  316. break;
  317. }
  318. ep->hcpriv = NULL;
  319. spin_unlock_irqrestore (&ohci->lock, flags);
  320. return;
  321. }
  322. static int ohci_get_frame (struct usb_hcd *hcd)
  323. {
  324. struct ohci_hcd *ohci = hcd_to_ohci (hcd);
  325. return ohci_frame_no(ohci);
  326. }
  327. static void ohci_usb_reset (struct ohci_hcd *ohci)
  328. {
  329. ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
  330. ohci->hc_control &= OHCI_CTRL_RWC;
  331. ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
  332. }
  333. /* ohci_shutdown forcibly disables IRQs and DMA, helping kexec and
  334. * other cases where the next software may expect clean state from the
  335. * "firmware". this is bus-neutral, unlike shutdown() methods.
  336. */
  337. static void
  338. ohci_shutdown (struct usb_hcd *hcd)
  339. {
  340. struct ohci_hcd *ohci;
  341. ohci = hcd_to_ohci (hcd);
  342. ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
  343. ohci_usb_reset (ohci);
  344. /* flush the writes */
  345. (void) ohci_readl (ohci, &ohci->regs->control);
  346. }
  347. static int check_ed(struct ohci_hcd *ohci, struct ed *ed)
  348. {
  349. return (hc32_to_cpu(ohci, ed->hwINFO) & ED_IN) != 0
  350. && (hc32_to_cpu(ohci, ed->hwHeadP) & TD_MASK)
  351. == (hc32_to_cpu(ohci, ed->hwTailP) & TD_MASK)
  352. && !list_empty(&ed->td_list);
  353. }
  354. /* ZF Micro watchdog timer callback. The ZF Micro chipset sometimes completes
  355. * an interrupt TD but neglects to add it to the donelist. On systems with
  356. * this chipset, we need to periodically check the state of the queues to look
  357. * for such "lost" TDs.
  358. */
  359. static void unlink_watchdog_func(unsigned long _ohci)
  360. {
  361. unsigned long flags;
  362. unsigned max;
  363. unsigned seen_count = 0;
  364. unsigned i;
  365. struct ed **seen = NULL;
  366. struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci;
  367. spin_lock_irqsave(&ohci->lock, flags);
  368. max = ohci->eds_scheduled;
  369. if (!max)
  370. goto done;
  371. if (ohci->ed_to_check)
  372. goto out;
  373. seen = kcalloc(max, sizeof *seen, GFP_ATOMIC);
  374. if (!seen)
  375. goto out;
  376. for (i = 0; i < NUM_INTS; i++) {
  377. struct ed *ed = ohci->periodic[i];
  378. while (ed) {
  379. unsigned temp;
  380. /* scan this branch of the periodic schedule tree */
  381. for (temp = 0; temp < seen_count; temp++) {
  382. if (seen[temp] == ed) {
  383. /* we've checked it and what's after */
  384. ed = NULL;
  385. break;
  386. }
  387. }
  388. if (!ed)
  389. break;
  390. seen[seen_count++] = ed;
  391. if (!check_ed(ohci, ed)) {
  392. ed = ed->ed_next;
  393. continue;
  394. }
  395. /* HC's TD list is empty, but HCD sees at least one
  396. * TD that's not been sent through the donelist.
  397. */
  398. ohci->ed_to_check = ed;
  399. ohci->zf_delay = 2;
  400. /* The HC may wait until the next frame to report the
  401. * TD as done through the donelist and INTR_WDH. (We
  402. * just *assume* it's not a multi-TD interrupt URB;
  403. * those could defer the IRQ more than one frame, using
  404. * DI...) Check again after the next INTR_SF.
  405. */
  406. ohci_writel(ohci, OHCI_INTR_SF,
  407. &ohci->regs->intrstatus);
  408. ohci_writel(ohci, OHCI_INTR_SF,
  409. &ohci->regs->intrenable);
  410. /* flush those writes */
  411. (void) ohci_readl(ohci, &ohci->regs->control);
  412. goto out;
  413. }
  414. }
  415. out:
  416. kfree(seen);
  417. if (ohci->eds_scheduled)
  418. mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
  419. done:
  420. spin_unlock_irqrestore(&ohci->lock, flags);
  421. }
  422. /*-------------------------------------------------------------------------*
  423. * HC functions
  424. *-------------------------------------------------------------------------*/
  425. /* init memory, and kick BIOS/SMM off */
  426. static int ohci_init (struct ohci_hcd *ohci)
  427. {
  428. int ret;
  429. struct usb_hcd *hcd = ohci_to_hcd(ohci);
  430. if (distrust_firmware)
  431. ohci->flags |= OHCI_QUIRK_HUB_POWER;
  432. disable (ohci);
  433. ohci->regs = hcd->regs;
  434. /* REVISIT this BIOS handshake is now moved into PCI "quirks", and
  435. * was never needed for most non-PCI systems ... remove the code?
  436. */
  437. #ifndef IR_DISABLE
  438. /* SMM owns the HC? not for long! */
  439. if (!no_handshake && ohci_readl (ohci,
  440. &ohci->regs->control) & OHCI_CTRL_IR) {
  441. u32 temp;
  442. ohci_dbg (ohci, "USB HC TakeOver from BIOS/SMM\n");
  443. /* this timeout is arbitrary. we make it long, so systems
  444. * depending on usb keyboards may be usable even if the
  445. * BIOS/SMM code seems pretty broken.
  446. */
  447. temp = 500; /* arbitrary: five seconds */
  448. ohci_writel (ohci, OHCI_INTR_OC, &ohci->regs->intrenable);
  449. ohci_writel (ohci, OHCI_OCR, &ohci->regs->cmdstatus);
  450. while (ohci_readl (ohci, &ohci->regs->control) & OHCI_CTRL_IR) {
  451. msleep (10);
  452. if (--temp == 0) {
  453. ohci_err (ohci, "USB HC takeover failed!"
  454. " (BIOS/SMM bug)\n");
  455. return -EBUSY;
  456. }
  457. }
  458. ohci_usb_reset (ohci);
  459. }
  460. #endif
  461. /* Disable HC interrupts */
  462. ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
  463. /* flush the writes, and save key bits like RWC */
  464. if (ohci_readl (ohci, &ohci->regs->control) & OHCI_CTRL_RWC)
  465. ohci->hc_control |= OHCI_CTRL_RWC;
  466. /* Read the number of ports unless overridden */
  467. if (ohci->num_ports == 0)
  468. ohci->num_ports = roothub_a(ohci) & RH_A_NDP;
  469. if (ohci->hcca)
  470. return 0;
  471. ohci->hcca = dma_alloc_coherent (hcd->self.controller,
  472. sizeof *ohci->hcca, &ohci->hcca_dma, 0);
  473. if (!ohci->hcca)
  474. return -ENOMEM;
  475. if ((ret = ohci_mem_init (ohci)) < 0)
  476. ohci_stop (hcd);
  477. else {
  478. create_debug_files (ohci);
  479. }
  480. return ret;
  481. }
  482. /*-------------------------------------------------------------------------*/
  483. /* Start an OHCI controller, set the BUS operational
  484. * resets USB and controller
  485. * enable interrupts
  486. */
  487. static int ohci_run (struct ohci_hcd *ohci)
  488. {
  489. u32 mask, temp;
  490. int first = ohci->fminterval == 0;
  491. struct usb_hcd *hcd = ohci_to_hcd(ohci);
  492. disable (ohci);
  493. /* boot firmware should have set this up (5.1.1.3.1) */
  494. if (first) {
  495. temp = ohci_readl (ohci, &ohci->regs->fminterval);
  496. ohci->fminterval = temp & 0x3fff;
  497. if (ohci->fminterval != FI)
  498. ohci_dbg (ohci, "fminterval delta %d\n",
  499. ohci->fminterval - FI);
  500. ohci->fminterval |= FSMP (ohci->fminterval) << 16;
  501. /* also: power/overcurrent flags in roothub.a */
  502. }
  503. /* Reset USB nearly "by the book". RemoteWakeupConnected was
  504. * saved if boot firmware (BIOS/SMM/...) told us it's connected,
  505. * or if bus glue did the same (e.g. for PCI add-in cards with
  506. * PCI PM support).
  507. */
  508. if ((ohci->hc_control & OHCI_CTRL_RWC) != 0
  509. && !device_may_wakeup(hcd->self.controller))
  510. device_init_wakeup(hcd->self.controller, 1);
  511. switch (ohci->hc_control & OHCI_CTRL_HCFS) {
  512. case OHCI_USB_OPER:
  513. temp = 0;
  514. break;
  515. case OHCI_USB_SUSPEND:
  516. case OHCI_USB_RESUME:
  517. ohci->hc_control &= OHCI_CTRL_RWC;
  518. ohci->hc_control |= OHCI_USB_RESUME;
  519. temp = 10 /* msec wait */;
  520. break;
  521. // case OHCI_USB_RESET:
  522. default:
  523. ohci->hc_control &= OHCI_CTRL_RWC;
  524. ohci->hc_control |= OHCI_USB_RESET;
  525. temp = 50 /* msec wait */;
  526. break;
  527. }
  528. ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
  529. // flush the writes
  530. (void) ohci_readl (ohci, &ohci->regs->control);
  531. msleep(temp);
  532. memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
  533. /* 2msec timelimit here means no irqs/preempt */
  534. spin_lock_irq (&ohci->lock);
  535. retry:
  536. /* HC Reset requires max 10 us delay */
  537. ohci_writel (ohci, OHCI_HCR, &ohci->regs->cmdstatus);
  538. temp = 30; /* ... allow extra time */
  539. while ((ohci_readl (ohci, &ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
  540. if (--temp == 0) {
  541. spin_unlock_irq (&ohci->lock);
  542. ohci_err (ohci, "USB HC reset timed out!\n");
  543. return -1;
  544. }
  545. udelay (1);
  546. }
  547. /* now we're in the SUSPEND state ... must go OPERATIONAL
  548. * within 2msec else HC enters RESUME
  549. *
  550. * ... but some hardware won't init fmInterval "by the book"
  551. * (SiS, OPTi ...), so reset again instead. SiS doesn't need
  552. * this if we write fmInterval after we're OPERATIONAL.
  553. * Unclear about ALi, ServerWorks, and others ... this could
  554. * easily be a longstanding bug in chip init on Linux.
  555. */
  556. if (ohci->flags & OHCI_QUIRK_INITRESET) {
  557. ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
  558. // flush those writes
  559. (void) ohci_readl (ohci, &ohci->regs->control);
  560. }
  561. /* Tell the controller where the control and bulk lists are
  562. * The lists are empty now. */
  563. ohci_writel (ohci, 0, &ohci->regs->ed_controlhead);
  564. ohci_writel (ohci, 0, &ohci->regs->ed_bulkhead);
  565. /* a reset clears this */
  566. ohci_writel (ohci, (u32) ohci->hcca_dma, &ohci->regs->hcca);
  567. periodic_reinit (ohci);
  568. /* some OHCI implementations are finicky about how they init.
  569. * bogus values here mean not even enumeration could work.
  570. */
  571. if ((ohci_readl (ohci, &ohci->regs->fminterval) & 0x3fff0000) == 0
  572. || !ohci_readl (ohci, &ohci->regs->periodicstart)) {
  573. if (!(ohci->flags & OHCI_QUIRK_INITRESET)) {
  574. ohci->flags |= OHCI_QUIRK_INITRESET;
  575. ohci_dbg (ohci, "enabling initreset quirk\n");
  576. goto retry;
  577. }
  578. spin_unlock_irq (&ohci->lock);
  579. ohci_err (ohci, "init err (%08x %04x)\n",
  580. ohci_readl (ohci, &ohci->regs->fminterval),
  581. ohci_readl (ohci, &ohci->regs->periodicstart));
  582. return -EOVERFLOW;
  583. }
  584. /* use rhsc irqs after khubd is fully initialized */
  585. hcd->poll_rh = 1;
  586. hcd->uses_new_polling = 1;
  587. /* start controller operations */
  588. ohci->hc_control &= OHCI_CTRL_RWC;
  589. ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER;
  590. ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
  591. hcd->state = HC_STATE_RUNNING;
  592. /* wake on ConnectStatusChange, matching external hubs */
  593. ohci_writel (ohci, RH_HS_DRWE, &ohci->regs->roothub.status);
  594. /* Choose the interrupts we care about now, others later on demand */
  595. mask = OHCI_INTR_INIT;
  596. ohci_writel (ohci, ~0, &ohci->regs->intrstatus);
  597. ohci_writel (ohci, mask, &ohci->regs->intrenable);
  598. /* handle root hub init quirks ... */
  599. temp = roothub_a (ohci);
  600. temp &= ~(RH_A_PSM | RH_A_OCPM);
  601. if (ohci->flags & OHCI_QUIRK_SUPERIO) {
  602. /* NSC 87560 and maybe others */
  603. temp |= RH_A_NOCP;
  604. temp &= ~(RH_A_POTPGT | RH_A_NPS);
  605. ohci_writel (ohci, temp, &ohci->regs->roothub.a);
  606. } else if ((ohci->flags & OHCI_QUIRK_AMD756) ||
  607. (ohci->flags & OHCI_QUIRK_HUB_POWER)) {
  608. /* hub power always on; required for AMD-756 and some
  609. * Mac platforms. ganged overcurrent reporting, if any.
  610. */
  611. temp |= RH_A_NPS;
  612. ohci_writel (ohci, temp, &ohci->regs->roothub.a);
  613. }
  614. ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status);
  615. ohci_writel (ohci, (temp & RH_A_NPS) ? 0 : RH_B_PPCM,
  616. &ohci->regs->roothub.b);
  617. // flush those writes
  618. (void) ohci_readl (ohci, &ohci->regs->control);
  619. ohci->next_statechange = jiffies + STATECHANGE_DELAY;
  620. spin_unlock_irq (&ohci->lock);
  621. // POTPGT delay is bits 24-31, in 2 ms units.
  622. mdelay ((temp >> 23) & 0x1fe);
  623. hcd->state = HC_STATE_RUNNING;
  624. if (quirk_zfmicro(ohci)) {
  625. /* Create timer to watch for bad queue state on ZF Micro */
  626. setup_timer(&ohci->unlink_watchdog, unlink_watchdog_func,
  627. (unsigned long) ohci);
  628. ohci->eds_scheduled = 0;
  629. ohci->ed_to_check = NULL;
  630. }
  631. ohci_dump (ohci, 1);
  632. return 0;
  633. }
  634. /*-------------------------------------------------------------------------*/
  635. /* an interrupt happens */
  636. static irqreturn_t ohci_irq (struct usb_hcd *hcd)
  637. {
  638. struct ohci_hcd *ohci = hcd_to_ohci (hcd);
  639. struct ohci_regs __iomem *regs = ohci->regs;
  640. int ints;
  641. /* Read interrupt status (and flush pending writes). We ignore the
  642. * optimization of checking the LSB of hcca->done_head; it doesn't
  643. * work on all systems (edge triggering for OHCI can be a factor).
  644. */
  645. ints = ohci_readl(ohci, &regs->intrstatus);
  646. /* Check for an all 1's result which is a typical consequence
  647. * of dead, unclocked, or unplugged (CardBus...) devices
  648. */
  649. if (ints == ~(u32)0) {
  650. disable (ohci);
  651. ohci_dbg (ohci, "device removed!\n");
  652. return IRQ_HANDLED;
  653. }
  654. /* We only care about interrupts that are enabled */
  655. ints &= ohci_readl(ohci, &regs->intrenable);
  656. /* interrupt for some other device? */
  657. if (ints == 0)
  658. return IRQ_NOTMINE;
  659. if (ints & OHCI_INTR_UE) {
  660. // e.g. due to PCI Master/Target Abort
  661. if (quirk_nec(ohci)) {
  662. /* Workaround for a silicon bug in some NEC chips used
  663. * in Apple's PowerBooks. Adapted from Darwin code.
  664. */
  665. ohci_err (ohci, "OHCI Unrecoverable Error, scheduling NEC chip restart\n");
  666. ohci_writel (ohci, OHCI_INTR_UE, &regs->intrdisable);
  667. schedule_work (&ohci->nec_work);
  668. } else {
  669. disable (ohci);
  670. ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
  671. }
  672. ohci_dump (ohci, 1);
  673. ohci_usb_reset (ohci);
  674. }
  675. if (ints & OHCI_INTR_RHSC) {
  676. ohci_vdbg(ohci, "rhsc\n");
  677. ohci->next_statechange = jiffies + STATECHANGE_DELAY;
  678. ohci_writel(ohci, OHCI_INTR_RD | OHCI_INTR_RHSC,
  679. &regs->intrstatus);
  680. /* NOTE: Vendors didn't always make the same implementation
  681. * choices for RHSC. Many followed the spec; RHSC triggers
  682. * on an edge, like setting and maybe clearing a port status
  683. * change bit. With others it's level-triggered, active
  684. * until khubd clears all the port status change bits. We'll
  685. * always disable it here and rely on polling until khubd
  686. * re-enables it.
  687. */
  688. ohci_writel(ohci, OHCI_INTR_RHSC, &regs->intrdisable);
  689. usb_hcd_poll_rh_status(hcd);
  690. }
  691. /* For connect and disconnect events, we expect the controller
  692. * to turn on RHSC along with RD. But for remote wakeup events
  693. * this might not happen.
  694. */
  695. else if (ints & OHCI_INTR_RD) {
  696. ohci_vdbg(ohci, "resume detect\n");
  697. ohci_writel(ohci, OHCI_INTR_RD, &regs->intrstatus);
  698. hcd->poll_rh = 1;
  699. if (ohci->autostop) {
  700. spin_lock (&ohci->lock);
  701. ohci_rh_resume (ohci);
  702. spin_unlock (&ohci->lock);
  703. } else
  704. usb_hcd_resume_root_hub(hcd);
  705. }
  706. if (ints & OHCI_INTR_WDH) {
  707. spin_lock (&ohci->lock);
  708. dl_done_list (ohci);
  709. spin_unlock (&ohci->lock);
  710. }
  711. if (quirk_zfmicro(ohci) && (ints & OHCI_INTR_SF)) {
  712. spin_lock(&ohci->lock);
  713. if (ohci->ed_to_check) {
  714. struct ed *ed = ohci->ed_to_check;
  715. if (check_ed(ohci, ed)) {
  716. /* HC thinks the TD list is empty; HCD knows
  717. * at least one TD is outstanding
  718. */
  719. if (--ohci->zf_delay == 0) {
  720. struct td *td = list_entry(
  721. ed->td_list.next,
  722. struct td, td_list);
  723. ohci_warn(ohci,
  724. "Reclaiming orphan TD %p\n",
  725. td);
  726. takeback_td(ohci, td);
  727. ohci->ed_to_check = NULL;
  728. }
  729. } else
  730. ohci->ed_to_check = NULL;
  731. }
  732. spin_unlock(&ohci->lock);
  733. }
  734. /* could track INTR_SO to reduce available PCI/... bandwidth */
  735. /* handle any pending URB/ED unlinks, leaving INTR_SF enabled
  736. * when there's still unlinking to be done (next frame).
  737. */
  738. spin_lock (&ohci->lock);
  739. if (ohci->ed_rm_list)
  740. finish_unlinks (ohci, ohci_frame_no(ohci));
  741. if ((ints & OHCI_INTR_SF) != 0
  742. && !ohci->ed_rm_list
  743. && !ohci->ed_to_check
  744. && HC_IS_RUNNING(hcd->state))
  745. ohci_writel (ohci, OHCI_INTR_SF, &regs->intrdisable);
  746. spin_unlock (&ohci->lock);
  747. if (HC_IS_RUNNING(hcd->state)) {
  748. ohci_writel (ohci, ints, &regs->intrstatus);
  749. ohci_writel (ohci, OHCI_INTR_MIE, &regs->intrenable);
  750. // flush those writes
  751. (void) ohci_readl (ohci, &ohci->regs->control);
  752. }
  753. return IRQ_HANDLED;
  754. }
  755. /*-------------------------------------------------------------------------*/
  756. static void ohci_stop (struct usb_hcd *hcd)
  757. {
  758. struct ohci_hcd *ohci = hcd_to_ohci (hcd);
  759. ohci_dump (ohci, 1);
  760. flush_scheduled_work();
  761. ohci_usb_reset (ohci);
  762. ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
  763. free_irq(hcd->irq, hcd);
  764. hcd->irq = -1;
  765. if (quirk_zfmicro(ohci))
  766. del_timer(&ohci->unlink_watchdog);
  767. if (quirk_amdiso(ohci))
  768. amd_iso_dev_put();
  769. remove_debug_files (ohci);
  770. ohci_mem_cleanup (ohci);
  771. if (ohci->hcca) {
  772. dma_free_coherent (hcd->self.controller,
  773. sizeof *ohci->hcca,
  774. ohci->hcca, ohci->hcca_dma);
  775. ohci->hcca = NULL;
  776. ohci->hcca_dma = 0;
  777. }
  778. }
  779. /*-------------------------------------------------------------------------*/
  780. #if defined(CONFIG_PM) || defined(CONFIG_PCI)
  781. /* must not be called from interrupt context */
  782. static int ohci_restart (struct ohci_hcd *ohci)
  783. {
  784. int temp;
  785. int i;
  786. struct urb_priv *priv;
  787. spin_lock_irq(&ohci->lock);
  788. disable (ohci);
  789. /* Recycle any "live" eds/tds (and urbs). */
  790. if (!list_empty (&ohci->pending))
  791. ohci_dbg(ohci, "abort schedule...\n");
  792. list_for_each_entry (priv, &ohci->pending, pending) {
  793. struct urb *urb = priv->td[0]->urb;
  794. struct ed *ed = priv->ed;
  795. switch (ed->state) {
  796. case ED_OPER:
  797. ed->state = ED_UNLINK;
  798. ed->hwINFO |= cpu_to_hc32(ohci, ED_DEQUEUE);
  799. ed_deschedule (ohci, ed);
  800. ed->ed_next = ohci->ed_rm_list;
  801. ed->ed_prev = NULL;
  802. ohci->ed_rm_list = ed;
  803. /* FALLTHROUGH */
  804. case ED_UNLINK:
  805. break;
  806. default:
  807. ohci_dbg(ohci, "bogus ed %p state %d\n",
  808. ed, ed->state);
  809. }
  810. if (!urb->unlinked)
  811. urb->unlinked = -ESHUTDOWN;
  812. }
  813. finish_unlinks (ohci, 0);
  814. spin_unlock_irq(&ohci->lock);
  815. /* paranoia, in case that didn't work: */
  816. /* empty the interrupt branches */
  817. for (i = 0; i < NUM_INTS; i++) ohci->load [i] = 0;
  818. for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0;
  819. /* no EDs to remove */
  820. ohci->ed_rm_list = NULL;
  821. /* empty control and bulk lists */
  822. ohci->ed_controltail = NULL;
  823. ohci->ed_bulktail = NULL;
  824. if ((temp = ohci_run (ohci)) < 0) {
  825. ohci_err (ohci, "can't restart, %d\n", temp);
  826. return temp;
  827. }
  828. ohci_dbg(ohci, "restart complete\n");
  829. return 0;
  830. }
  831. #endif
  832. /*-------------------------------------------------------------------------*/
  833. #define DRIVER_INFO DRIVER_VERSION " " DRIVER_DESC
  834. MODULE_AUTHOR (DRIVER_AUTHOR);
  835. MODULE_DESCRIPTION (DRIVER_INFO);
  836. MODULE_LICENSE ("GPL");
  837. #ifdef CONFIG_PCI
  838. #include "ohci-pci.c"
  839. #define PCI_DRIVER ohci_pci_driver
  840. #endif
  841. #if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_SA1111)
  842. #include "ohci-sa1111.c"
  843. #define SA1111_DRIVER ohci_hcd_sa1111_driver
  844. #endif
  845. #ifdef CONFIG_ARCH_S3C2410
  846. #include "ohci-s3c2410.c"
  847. #define PLATFORM_DRIVER ohci_hcd_s3c2410_driver
  848. #endif
  849. #ifdef CONFIG_ARCH_OMAP
  850. #include "ohci-omap.c"
  851. #define PLATFORM_DRIVER ohci_hcd_omap_driver
  852. #endif
  853. #ifdef CONFIG_ARCH_LH7A404
  854. #include "ohci-lh7a404.c"
  855. #define PLATFORM_DRIVER ohci_hcd_lh7a404_driver
  856. #endif
  857. #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
  858. #include "ohci-pxa27x.c"
  859. #define PLATFORM_DRIVER ohci_hcd_pxa27x_driver
  860. #endif
  861. #ifdef CONFIG_ARCH_EP93XX
  862. #include "ohci-ep93xx.c"
  863. #define PLATFORM_DRIVER ohci_hcd_ep93xx_driver
  864. #endif
  865. #ifdef CONFIG_SOC_AU1X00
  866. #include "ohci-au1xxx.c"
  867. #define PLATFORM_DRIVER ohci_hcd_au1xxx_driver
  868. #endif
  869. #ifdef CONFIG_PNX8550
  870. #include "ohci-pnx8550.c"
  871. #define PLATFORM_DRIVER ohci_hcd_pnx8550_driver
  872. #endif
  873. #ifdef CONFIG_USB_OHCI_HCD_PPC_SOC
  874. #include "ohci-ppc-soc.c"
  875. #define PLATFORM_DRIVER ohci_hcd_ppc_soc_driver
  876. #endif
  877. #ifdef CONFIG_ARCH_AT91
  878. #include "ohci-at91.c"
  879. #define PLATFORM_DRIVER ohci_hcd_at91_driver
  880. #endif
  881. #ifdef CONFIG_ARCH_PNX4008
  882. #include "ohci-pnx4008.c"
  883. #define PLATFORM_DRIVER usb_hcd_pnx4008_driver
  884. #endif
  885. #if defined(CONFIG_CPU_SUBTYPE_SH7720) || \
  886. defined(CONFIG_CPU_SUBTYPE_SH7721) || \
  887. defined(CONFIG_CPU_SUBTYPE_SH7763)
  888. #include "ohci-sh.c"
  889. #define PLATFORM_DRIVER ohci_hcd_sh_driver
  890. #endif
  891. #ifdef CONFIG_USB_OHCI_HCD_PPC_OF
  892. #include "ohci-ppc-of.c"
  893. #define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver
  894. #endif
  895. #ifdef CONFIG_PPC_PS3
  896. #include "ohci-ps3.c"
  897. #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
  898. #endif
  899. #ifdef CONFIG_USB_OHCI_HCD_SSB
  900. #include "ohci-ssb.c"
  901. #define SSB_OHCI_DRIVER ssb_ohci_driver
  902. #endif
  903. #ifdef CONFIG_MFD_SM501
  904. #include "ohci-sm501.c"
  905. #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver
  906. #endif
  907. #if !defined(PCI_DRIVER) && \
  908. !defined(PLATFORM_DRIVER) && \
  909. !defined(OF_PLATFORM_DRIVER) && \
  910. !defined(SA1111_DRIVER) && \
  911. !defined(PS3_SYSTEM_BUS_DRIVER) && \
  912. !defined(SM501_OHCI_DRIVER) && \
  913. !defined(SSB_OHCI_DRIVER)
  914. #error "missing bus glue for ohci-hcd"
  915. #endif
  916. static int __init ohci_hcd_mod_init(void)
  917. {
  918. int retval = 0;
  919. if (usb_disabled())
  920. return -ENODEV;
  921. printk (KERN_DEBUG "%s: " DRIVER_INFO "\n", hcd_name);
  922. pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
  923. sizeof (struct ed), sizeof (struct td));
  924. #ifdef DEBUG
  925. ohci_debug_root = debugfs_create_dir("ohci", NULL);
  926. if (!ohci_debug_root) {
  927. retval = -ENOENT;
  928. goto error_debug;
  929. }
  930. #endif
  931. #ifdef PS3_SYSTEM_BUS_DRIVER
  932. retval = ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER);
  933. if (retval < 0)
  934. goto error_ps3;
  935. #endif
  936. #ifdef PLATFORM_DRIVER
  937. retval = platform_driver_register(&PLATFORM_DRIVER);
  938. if (retval < 0)
  939. goto error_platform;
  940. #endif
  941. #ifdef OF_PLATFORM_DRIVER
  942. retval = of_register_platform_driver(&OF_PLATFORM_DRIVER);
  943. if (retval < 0)
  944. goto error_of_platform;
  945. #endif
  946. #ifdef SA1111_DRIVER
  947. retval = sa1111_driver_register(&SA1111_DRIVER);
  948. if (retval < 0)
  949. goto error_sa1111;
  950. #endif
  951. #ifdef PCI_DRIVER
  952. retval = pci_register_driver(&PCI_DRIVER);
  953. if (retval < 0)
  954. goto error_pci;
  955. #endif
  956. #ifdef SSB_OHCI_DRIVER
  957. retval = ssb_driver_register(&SSB_OHCI_DRIVER);
  958. if (retval)
  959. goto error_ssb;
  960. #endif
  961. #ifdef SM501_OHCI_DRIVER
  962. retval = platform_driver_register(&SM501_OHCI_DRIVER);
  963. if (retval < 0)
  964. goto error_sm501;
  965. #endif
  966. return retval;
  967. /* Error path */
  968. #ifdef SM501_OHCI_DRIVER
  969. error_sm501:
  970. #endif
  971. #ifdef SSB_OHCI_DRIVER
  972. error_ssb:
  973. #endif
  974. #ifdef PCI_DRIVER
  975. pci_unregister_driver(&PCI_DRIVER);
  976. error_pci:
  977. #endif
  978. #ifdef SA1111_DRIVER
  979. sa1111_driver_unregister(&SA1111_DRIVER);
  980. error_sa1111:
  981. #endif
  982. #ifdef OF_PLATFORM_DRIVER
  983. of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
  984. error_of_platform:
  985. #endif
  986. #ifdef PLATFORM_DRIVER
  987. platform_driver_unregister(&PLATFORM_DRIVER);
  988. error_platform:
  989. #endif
  990. #ifdef PS3_SYSTEM_BUS_DRIVER
  991. ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
  992. error_ps3:
  993. #endif
  994. #ifdef DEBUG
  995. debugfs_remove(ohci_debug_root);
  996. ohci_debug_root = NULL;
  997. error_debug:
  998. #endif
  999. return retval;
  1000. }
  1001. module_init(ohci_hcd_mod_init);
  1002. static void __exit ohci_hcd_mod_exit(void)
  1003. {
  1004. #ifdef SM501_OHCI_DRIVER
  1005. platform_driver_unregister(&SM501_OHCI_DRIVER);
  1006. #endif
  1007. #ifdef SSB_OHCI_DRIVER
  1008. ssb_driver_unregister(&SSB_OHCI_DRIVER);
  1009. #endif
  1010. #ifdef PCI_DRIVER
  1011. pci_unregister_driver(&PCI_DRIVER);
  1012. #endif
  1013. #ifdef SA1111_DRIVER
  1014. sa1111_driver_unregister(&SA1111_DRIVER);
  1015. #endif
  1016. #ifdef OF_PLATFORM_DRIVER
  1017. of_unregister_platform_driver(&OF_PLATFORM_DRIVER);
  1018. #endif
  1019. #ifdef PLATFORM_DRIVER
  1020. platform_driver_unregister(&PLATFORM_DRIVER);
  1021. #endif
  1022. #ifdef PS3_SYSTEM_BUS_DRIVER
  1023. ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
  1024. #endif
  1025. #ifdef DEBUG
  1026. debugfs_remove(ohci_debug_root);
  1027. #endif
  1028. }
  1029. module_exit(ohci_hcd_mod_exit);