ohci-hcd.c 31 KB

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