2 * Open Host Controller Interface (OHCI) driver for USB.
4 * Maintainer: Alan Stern <stern@rowland.harvard.edu>
6 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
7 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
9 * [ Initialisation is based on Linus' ]
10 * [ uhci code and gregs ohci fragments ]
11 * [ (C) Copyright 1999 Linus Torvalds ]
12 * [ (C) Copyright 1999 Gregory P. Smith]
15 * OHCI is the main "non-Intel/VIA" standard for USB 1.1 host controller
16 * interfaces (though some non-x86 Intel chips use it). It supports
17 * smarter hardware than UHCI. A download link for the spec available
18 * through the http://www.usb.org website.
20 * This file is licenced under the GPL.
23 #include <linux/module.h>
24 #include <linux/moduleparam.h>
25 #include <linux/pci.h>
26 #include <linux/kernel.h>
27 #include <linux/delay.h>
28 #include <linux/ioport.h>
29 #include <linux/sched.h>
30 #include <linux/slab.h>
31 #include <linux/errno.h>
32 #include <linux/init.h>
33 #include <linux/timer.h>
34 #include <linux/list.h>
35 #include <linux/usb.h>
36 #include <linux/usb/otg.h>
37 #include <linux/usb/hcd.h>
38 #include <linux/dma-mapping.h>
39 #include <linux/dmapool.h>
40 #include <linux/workqueue.h>
41 #include <linux/debugfs.h>
45 #include <asm/unaligned.h>
46 #include <asm/byteorder.h>
49 #define DRIVER_AUTHOR "Roman Weissgaerber, David Brownell"
50 #define DRIVER_DESC "USB 1.1 'Open' Host Controller (OHCI) Driver"
52 /*-------------------------------------------------------------------------*/
54 #undef OHCI_VERBOSE_DEBUG /* not always helpful */
56 /* For initializing controller (mask in an HCFS mode too) */
57 #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
58 #define OHCI_INTR_INIT \
59 (OHCI_INTR_MIE | OHCI_INTR_RHSC | OHCI_INTR_UE \
60 | OHCI_INTR_RD | OHCI_INTR_WDH)
63 /* On PA-RISC, PDC can leave IR set incorrectly; ignore it there. */
67 #ifdef CONFIG_ARCH_OMAP
68 /* OMAP doesn't support IR (no SMM; not needed) */
72 /*-------------------------------------------------------------------------*/
74 static const char hcd_name
[] = "ohci_hcd";
76 #define STATECHANGE_DELAY msecs_to_jiffies(300)
79 #include "pci-quirks.h"
81 static void ohci_dump(struct ohci_hcd
*ohci
);
82 static void ohci_stop(struct usb_hcd
*hcd
);
91 * On architectures with edge-triggered interrupts we must never return
94 #if defined(CONFIG_SA1111) /* ... or other edge-triggered systems */
95 #define IRQ_NOTMINE IRQ_HANDLED
97 #define IRQ_NOTMINE IRQ_NONE
101 /* Some boards misreport power switching/overcurrent */
102 static bool distrust_firmware
= 1;
103 module_param (distrust_firmware
, bool, 0);
104 MODULE_PARM_DESC (distrust_firmware
,
105 "true to distrust firmware power/overcurrent setup");
107 /* Some boards leave IR set wrongly, since they fail BIOS/SMM handshakes */
108 static bool no_handshake
= 0;
109 module_param (no_handshake
, bool, 0);
110 MODULE_PARM_DESC (no_handshake
, "true (not default) disables BIOS handshake");
112 /*-------------------------------------------------------------------------*/
115 * queue up an urb for anything except the root hub
117 static int ohci_urb_enqueue (
122 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
124 urb_priv_t
*urb_priv
;
125 unsigned int pipe
= urb
->pipe
;
130 #ifdef OHCI_VERBOSE_DEBUG
131 urb_print(urb
, "SUB", usb_pipein(pipe
), -EINPROGRESS
);
134 /* every endpoint has a ed, locate and maybe (re)initialize it */
135 if (! (ed
= ed_get (ohci
, urb
->ep
, urb
->dev
, pipe
, urb
->interval
)))
138 /* for the private part of the URB we need the number of TDs (size) */
141 /* td_submit_urb() doesn't yet handle these */
142 if (urb
->transfer_buffer_length
> 4096)
145 /* 1 TD for setup, 1 for ACK, plus ... */
148 // case PIPE_INTERRUPT:
151 /* one TD for every 4096 Bytes (can be up to 8K) */
152 size
+= urb
->transfer_buffer_length
/ 4096;
153 /* ... and for any remaining bytes ... */
154 if ((urb
->transfer_buffer_length
% 4096) != 0)
156 /* ... and maybe a zero length packet to wrap it up */
159 else if ((urb
->transfer_flags
& URB_ZERO_PACKET
) != 0
160 && (urb
->transfer_buffer_length
161 % usb_maxpacket (urb
->dev
, pipe
,
162 usb_pipeout (pipe
))) == 0)
165 case PIPE_ISOCHRONOUS
: /* number of packets from URB */
166 size
= urb
->number_of_packets
;
170 /* allocate the private part of the URB */
171 urb_priv
= kzalloc (sizeof (urb_priv_t
) + size
* sizeof (struct td
*),
175 INIT_LIST_HEAD (&urb_priv
->pending
);
176 urb_priv
->length
= size
;
179 /* allocate the TDs (deferring hash chain updates) */
180 for (i
= 0; i
< size
; i
++) {
181 urb_priv
->td
[i
] = td_alloc (ohci
, mem_flags
);
182 if (!urb_priv
->td
[i
]) {
183 urb_priv
->length
= i
;
184 urb_free_priv (ohci
, urb_priv
);
189 spin_lock_irqsave (&ohci
->lock
, flags
);
191 /* don't submit to a dead HC */
192 if (!HCD_HW_ACCESSIBLE(hcd
)) {
196 if (ohci
->rh_state
!= OHCI_RH_RUNNING
) {
200 retval
= usb_hcd_link_urb_to_ep(hcd
, urb
);
204 /* schedule the ed if needed */
205 if (ed
->state
== ED_IDLE
) {
206 retval
= ed_schedule (ohci
, ed
);
208 usb_hcd_unlink_urb_from_ep(hcd
, urb
);
211 if (ed
->type
== PIPE_ISOCHRONOUS
) {
212 u16 frame
= ohci_frame_no(ohci
);
214 /* delay a few frames before the first TD */
215 frame
+= max_t (u16
, 8, ed
->interval
);
216 frame
&= ~(ed
->interval
- 1);
218 urb
->start_frame
= frame
;
219 ed
->last_iso
= frame
+ ed
->interval
* (size
- 1);
221 } else if (ed
->type
== PIPE_ISOCHRONOUS
) {
222 u16 next
= ohci_frame_no(ohci
) + 1;
223 u16 frame
= ed
->last_iso
+ ed
->interval
;
224 u16 length
= ed
->interval
* (size
- 1);
226 /* Behind the scheduling threshold? */
227 if (unlikely(tick_before(frame
, next
))) {
229 /* URB_ISO_ASAP: Round up to the first available slot */
230 if (urb
->transfer_flags
& URB_ISO_ASAP
) {
231 frame
+= (next
- frame
+ ed
->interval
- 1) &
235 * Not ASAP: Use the next slot in the stream,
240 * Some OHCI hardware doesn't handle late TDs
241 * correctly. After retiring them it proceeds
242 * to the next ED instead of the next TD.
243 * Therefore we have to omit the late TDs
246 urb_priv
->td_cnt
= DIV_ROUND_UP(
247 (u16
) (next
- frame
),
249 if (urb_priv
->td_cnt
>= urb_priv
->length
) {
250 ++urb_priv
->td_cnt
; /* Mark it */
251 ohci_dbg(ohci
, "iso underrun %p (%u+%u < %u)\n",
257 urb
->start_frame
= frame
;
258 ed
->last_iso
= frame
+ length
;
261 /* fill the TDs and link them to the ed; and
262 * enable that part of the schedule, if needed
263 * and update count of queued periodic urbs
265 urb
->hcpriv
= urb_priv
;
266 td_submit_urb (ohci
, urb
);
270 urb_free_priv (ohci
, urb_priv
);
271 spin_unlock_irqrestore (&ohci
->lock
, flags
);
276 * decouple the URB from the HC queues (TDs, urb_priv).
277 * reporting is always done
278 * asynchronously, and we might be dealing with an urb that's
279 * partially transferred, or an ED with other urbs being unlinked.
281 static int ohci_urb_dequeue(struct usb_hcd
*hcd
, struct urb
*urb
, int status
)
283 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
287 #ifdef OHCI_VERBOSE_DEBUG
288 urb_print(urb
, "UNLINK", 1, status
);
291 spin_lock_irqsave (&ohci
->lock
, flags
);
292 rc
= usb_hcd_check_unlink_urb(hcd
, urb
, status
);
295 } else if (ohci
->rh_state
== OHCI_RH_RUNNING
) {
296 urb_priv_t
*urb_priv
;
298 /* Unless an IRQ completed the unlink while it was being
299 * handed to us, flag it for unlink and giveback, and force
300 * some upcoming INTR_SF to call finish_unlinks()
302 urb_priv
= urb
->hcpriv
;
304 if (urb_priv
->ed
->state
== ED_OPER
)
305 start_ed_unlink (ohci
, urb_priv
->ed
);
309 * with HC dead, we won't respect hc queue pointers
310 * any more ... just clean up every urb's memory.
313 finish_urb(ohci
, urb
, status
);
315 spin_unlock_irqrestore (&ohci
->lock
, flags
);
319 /*-------------------------------------------------------------------------*/
321 /* frees config/altsetting state for endpoints,
322 * including ED memory, dummy TD, and bulk/intr data toggle
326 ohci_endpoint_disable (struct usb_hcd
*hcd
, struct usb_host_endpoint
*ep
)
328 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
330 struct ed
*ed
= ep
->hcpriv
;
331 unsigned limit
= 1000;
333 /* ASSERT: any requests/urbs are being unlinked */
334 /* ASSERT: nobody can be submitting urbs for this any more */
340 spin_lock_irqsave (&ohci
->lock
, flags
);
342 if (ohci
->rh_state
!= OHCI_RH_RUNNING
) {
345 if (quirk_zfmicro(ohci
) && ed
->type
== PIPE_INTERRUPT
)
346 ohci
->eds_scheduled
--;
347 finish_unlinks (ohci
, 0);
351 case ED_UNLINK
: /* wait for hw to finish? */
352 /* major IRQ delivery trouble loses INTR_SF too... */
354 ohci_warn(ohci
, "ED unlink timeout\n");
355 if (quirk_zfmicro(ohci
)) {
356 ohci_warn(ohci
, "Attempting ZF TD recovery\n");
357 ohci
->ed_to_check
= ed
;
362 spin_unlock_irqrestore (&ohci
->lock
, flags
);
363 schedule_timeout_uninterruptible(1);
365 case ED_IDLE
: /* fully unlinked */
366 if (list_empty (&ed
->td_list
)) {
367 td_free (ohci
, ed
->dummy
);
371 /* else FALL THROUGH */
373 /* caller was supposed to have unlinked any requests;
374 * that's not our job. can't recover; must leak ed.
376 ohci_err (ohci
, "leak ed %p (#%02x) state %d%s\n",
377 ed
, ep
->desc
.bEndpointAddress
, ed
->state
,
378 list_empty (&ed
->td_list
) ? "" : " (has tds)");
379 td_free (ohci
, ed
->dummy
);
383 spin_unlock_irqrestore (&ohci
->lock
, flags
);
386 static int ohci_get_frame (struct usb_hcd
*hcd
)
388 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
390 return ohci_frame_no(ohci
);
393 static void ohci_usb_reset (struct ohci_hcd
*ohci
)
395 ohci
->hc_control
= ohci_readl (ohci
, &ohci
->regs
->control
);
396 ohci
->hc_control
&= OHCI_CTRL_RWC
;
397 ohci_writel (ohci
, ohci
->hc_control
, &ohci
->regs
->control
);
398 ohci
->rh_state
= OHCI_RH_HALTED
;
401 /* ohci_shutdown forcibly disables IRQs and DMA, helping kexec and
402 * other cases where the next software may expect clean state from the
403 * "firmware". this is bus-neutral, unlike shutdown() methods.
406 ohci_shutdown (struct usb_hcd
*hcd
)
408 struct ohci_hcd
*ohci
;
410 ohci
= hcd_to_ohci (hcd
);
411 ohci_writel(ohci
, (u32
) ~0, &ohci
->regs
->intrdisable
);
413 /* Software reset, after which the controller goes into SUSPEND */
414 ohci_writel(ohci
, OHCI_HCR
, &ohci
->regs
->cmdstatus
);
415 ohci_readl(ohci
, &ohci
->regs
->cmdstatus
); /* flush the writes */
418 ohci_writel(ohci
, ohci
->fminterval
, &ohci
->regs
->fminterval
);
421 static int check_ed(struct ohci_hcd
*ohci
, struct ed
*ed
)
423 return (hc32_to_cpu(ohci
, ed
->hwINFO
) & ED_IN
) != 0
424 && (hc32_to_cpu(ohci
, ed
->hwHeadP
) & TD_MASK
)
425 == (hc32_to_cpu(ohci
, ed
->hwTailP
) & TD_MASK
)
426 && !list_empty(&ed
->td_list
);
429 /* ZF Micro watchdog timer callback. The ZF Micro chipset sometimes completes
430 * an interrupt TD but neglects to add it to the donelist. On systems with
431 * this chipset, we need to periodically check the state of the queues to look
432 * for such "lost" TDs.
434 static void unlink_watchdog_func(unsigned long _ohci
)
438 unsigned seen_count
= 0;
440 struct ed
**seen
= NULL
;
441 struct ohci_hcd
*ohci
= (struct ohci_hcd
*) _ohci
;
443 spin_lock_irqsave(&ohci
->lock
, flags
);
444 max
= ohci
->eds_scheduled
;
448 if (ohci
->ed_to_check
)
451 seen
= kcalloc(max
, sizeof *seen
, GFP_ATOMIC
);
455 for (i
= 0; i
< NUM_INTS
; i
++) {
456 struct ed
*ed
= ohci
->periodic
[i
];
461 /* scan this branch of the periodic schedule tree */
462 for (temp
= 0; temp
< seen_count
; temp
++) {
463 if (seen
[temp
] == ed
) {
464 /* we've checked it and what's after */
471 seen
[seen_count
++] = ed
;
472 if (!check_ed(ohci
, ed
)) {
477 /* HC's TD list is empty, but HCD sees at least one
478 * TD that's not been sent through the donelist.
480 ohci
->ed_to_check
= ed
;
483 /* The HC may wait until the next frame to report the
484 * TD as done through the donelist and INTR_WDH. (We
485 * just *assume* it's not a multi-TD interrupt URB;
486 * those could defer the IRQ more than one frame, using
487 * DI...) Check again after the next INTR_SF.
489 ohci_writel(ohci
, OHCI_INTR_SF
,
490 &ohci
->regs
->intrstatus
);
491 ohci_writel(ohci
, OHCI_INTR_SF
,
492 &ohci
->regs
->intrenable
);
494 /* flush those writes */
495 (void) ohci_readl(ohci
, &ohci
->regs
->control
);
502 if (ohci
->eds_scheduled
)
503 mod_timer(&ohci
->unlink_watchdog
, round_jiffies(jiffies
+ HZ
));
505 spin_unlock_irqrestore(&ohci
->lock
, flags
);
508 /*-------------------------------------------------------------------------*
510 *-------------------------------------------------------------------------*/
512 /* init memory, and kick BIOS/SMM off */
514 static int ohci_init (struct ohci_hcd
*ohci
)
517 struct usb_hcd
*hcd
= ohci_to_hcd(ohci
);
519 if (distrust_firmware
)
520 ohci
->flags
|= OHCI_QUIRK_HUB_POWER
;
522 ohci
->rh_state
= OHCI_RH_HALTED
;
523 ohci
->regs
= hcd
->regs
;
525 /* REVISIT this BIOS handshake is now moved into PCI "quirks", and
526 * was never needed for most non-PCI systems ... remove the code?
530 /* SMM owns the HC? not for long! */
531 if (!no_handshake
&& ohci_readl (ohci
,
532 &ohci
->regs
->control
) & OHCI_CTRL_IR
) {
535 ohci_dbg (ohci
, "USB HC TakeOver from BIOS/SMM\n");
537 /* this timeout is arbitrary. we make it long, so systems
538 * depending on usb keyboards may be usable even if the
539 * BIOS/SMM code seems pretty broken.
541 temp
= 500; /* arbitrary: five seconds */
543 ohci_writel (ohci
, OHCI_INTR_OC
, &ohci
->regs
->intrenable
);
544 ohci_writel (ohci
, OHCI_OCR
, &ohci
->regs
->cmdstatus
);
545 while (ohci_readl (ohci
, &ohci
->regs
->control
) & OHCI_CTRL_IR
) {
548 ohci_err (ohci
, "USB HC takeover failed!"
549 " (BIOS/SMM bug)\n");
553 ohci_usb_reset (ohci
);
557 /* Disable HC interrupts */
558 ohci_writel (ohci
, OHCI_INTR_MIE
, &ohci
->regs
->intrdisable
);
560 /* flush the writes, and save key bits like RWC */
561 if (ohci_readl (ohci
, &ohci
->regs
->control
) & OHCI_CTRL_RWC
)
562 ohci
->hc_control
|= OHCI_CTRL_RWC
;
564 /* Read the number of ports unless overridden */
565 if (ohci
->num_ports
== 0)
566 ohci
->num_ports
= roothub_a(ohci
) & RH_A_NDP
;
571 ohci
->hcca
= dma_alloc_coherent (hcd
->self
.controller
,
572 sizeof *ohci
->hcca
, &ohci
->hcca_dma
, 0);
576 if ((ret
= ohci_mem_init (ohci
)) < 0)
579 create_debug_files (ohci
);
585 /*-------------------------------------------------------------------------*/
587 /* Start an OHCI controller, set the BUS operational
588 * resets USB and controller
591 static int ohci_run (struct ohci_hcd
*ohci
)
594 int first
= ohci
->fminterval
== 0;
595 struct usb_hcd
*hcd
= ohci_to_hcd(ohci
);
597 ohci
->rh_state
= OHCI_RH_HALTED
;
599 /* boot firmware should have set this up (5.1.1.3.1) */
602 val
= ohci_readl (ohci
, &ohci
->regs
->fminterval
);
603 ohci
->fminterval
= val
& 0x3fff;
604 if (ohci
->fminterval
!= FI
)
605 ohci_dbg (ohci
, "fminterval delta %d\n",
606 ohci
->fminterval
- FI
);
607 ohci
->fminterval
|= FSMP (ohci
->fminterval
) << 16;
608 /* also: power/overcurrent flags in roothub.a */
611 /* Reset USB nearly "by the book". RemoteWakeupConnected has
612 * to be checked in case boot firmware (BIOS/SMM/...) has set up
613 * wakeup in a way the bus isn't aware of (e.g., legacy PCI PM).
614 * If the bus glue detected wakeup capability then it should
615 * already be enabled; if so we'll just enable it again.
617 if ((ohci
->hc_control
& OHCI_CTRL_RWC
) != 0)
618 device_set_wakeup_capable(hcd
->self
.controller
, 1);
620 switch (ohci
->hc_control
& OHCI_CTRL_HCFS
) {
624 case OHCI_USB_SUSPEND
:
625 case OHCI_USB_RESUME
:
626 ohci
->hc_control
&= OHCI_CTRL_RWC
;
627 ohci
->hc_control
|= OHCI_USB_RESUME
;
628 val
= 10 /* msec wait */;
630 // case OHCI_USB_RESET:
632 ohci
->hc_control
&= OHCI_CTRL_RWC
;
633 ohci
->hc_control
|= OHCI_USB_RESET
;
634 val
= 50 /* msec wait */;
637 ohci_writel (ohci
, ohci
->hc_control
, &ohci
->regs
->control
);
639 (void) ohci_readl (ohci
, &ohci
->regs
->control
);
642 memset (ohci
->hcca
, 0, sizeof (struct ohci_hcca
));
644 /* 2msec timelimit here means no irqs/preempt */
645 spin_lock_irq (&ohci
->lock
);
648 /* HC Reset requires max 10 us delay */
649 ohci_writel (ohci
, OHCI_HCR
, &ohci
->regs
->cmdstatus
);
650 val
= 30; /* ... allow extra time */
651 while ((ohci_readl (ohci
, &ohci
->regs
->cmdstatus
) & OHCI_HCR
) != 0) {
653 spin_unlock_irq (&ohci
->lock
);
654 ohci_err (ohci
, "USB HC reset timed out!\n");
660 /* now we're in the SUSPEND state ... must go OPERATIONAL
661 * within 2msec else HC enters RESUME
663 * ... but some hardware won't init fmInterval "by the book"
664 * (SiS, OPTi ...), so reset again instead. SiS doesn't need
665 * this if we write fmInterval after we're OPERATIONAL.
666 * Unclear about ALi, ServerWorks, and others ... this could
667 * easily be a longstanding bug in chip init on Linux.
669 if (ohci
->flags
& OHCI_QUIRK_INITRESET
) {
670 ohci_writel (ohci
, ohci
->hc_control
, &ohci
->regs
->control
);
671 // flush those writes
672 (void) ohci_readl (ohci
, &ohci
->regs
->control
);
675 /* Tell the controller where the control and bulk lists are
676 * The lists are empty now. */
677 ohci_writel (ohci
, 0, &ohci
->regs
->ed_controlhead
);
678 ohci_writel (ohci
, 0, &ohci
->regs
->ed_bulkhead
);
680 /* a reset clears this */
681 ohci_writel (ohci
, (u32
) ohci
->hcca_dma
, &ohci
->regs
->hcca
);
683 periodic_reinit (ohci
);
685 /* some OHCI implementations are finicky about how they init.
686 * bogus values here mean not even enumeration could work.
688 if ((ohci_readl (ohci
, &ohci
->regs
->fminterval
) & 0x3fff0000) == 0
689 || !ohci_readl (ohci
, &ohci
->regs
->periodicstart
)) {
690 if (!(ohci
->flags
& OHCI_QUIRK_INITRESET
)) {
691 ohci
->flags
|= OHCI_QUIRK_INITRESET
;
692 ohci_dbg (ohci
, "enabling initreset quirk\n");
695 spin_unlock_irq (&ohci
->lock
);
696 ohci_err (ohci
, "init err (%08x %04x)\n",
697 ohci_readl (ohci
, &ohci
->regs
->fminterval
),
698 ohci_readl (ohci
, &ohci
->regs
->periodicstart
));
702 /* use rhsc irqs after khubd is fully initialized */
703 set_bit(HCD_FLAG_POLL_RH
, &hcd
->flags
);
704 hcd
->uses_new_polling
= 1;
706 /* start controller operations */
707 ohci
->hc_control
&= OHCI_CTRL_RWC
;
708 ohci
->hc_control
|= OHCI_CONTROL_INIT
| OHCI_USB_OPER
;
709 ohci_writel (ohci
, ohci
->hc_control
, &ohci
->regs
->control
);
710 ohci
->rh_state
= OHCI_RH_RUNNING
;
712 /* wake on ConnectStatusChange, matching external hubs */
713 ohci_writel (ohci
, RH_HS_DRWE
, &ohci
->regs
->roothub
.status
);
715 /* Choose the interrupts we care about now, others later on demand */
716 mask
= OHCI_INTR_INIT
;
717 ohci_writel (ohci
, ~0, &ohci
->regs
->intrstatus
);
718 ohci_writel (ohci
, mask
, &ohci
->regs
->intrenable
);
720 /* handle root hub init quirks ... */
721 val
= roothub_a (ohci
);
722 val
&= ~(RH_A_PSM
| RH_A_OCPM
);
723 if (ohci
->flags
& OHCI_QUIRK_SUPERIO
) {
724 /* NSC 87560 and maybe others */
726 val
&= ~(RH_A_POTPGT
| RH_A_NPS
);
727 ohci_writel (ohci
, val
, &ohci
->regs
->roothub
.a
);
728 } else if ((ohci
->flags
& OHCI_QUIRK_AMD756
) ||
729 (ohci
->flags
& OHCI_QUIRK_HUB_POWER
)) {
730 /* hub power always on; required for AMD-756 and some
731 * Mac platforms. ganged overcurrent reporting, if any.
734 ohci_writel (ohci
, val
, &ohci
->regs
->roothub
.a
);
736 ohci_writel (ohci
, RH_HS_LPSC
, &ohci
->regs
->roothub
.status
);
737 ohci_writel (ohci
, (val
& RH_A_NPS
) ? 0 : RH_B_PPCM
,
738 &ohci
->regs
->roothub
.b
);
739 // flush those writes
740 (void) ohci_readl (ohci
, &ohci
->regs
->control
);
742 ohci
->next_statechange
= jiffies
+ STATECHANGE_DELAY
;
743 spin_unlock_irq (&ohci
->lock
);
745 // POTPGT delay is bits 24-31, in 2 ms units.
746 mdelay ((val
>> 23) & 0x1fe);
748 if (quirk_zfmicro(ohci
)) {
749 /* Create timer to watch for bad queue state on ZF Micro */
750 setup_timer(&ohci
->unlink_watchdog
, unlink_watchdog_func
,
751 (unsigned long) ohci
);
753 ohci
->eds_scheduled
= 0;
754 ohci
->ed_to_check
= NULL
;
762 /* ohci_setup routine for generic controller initialization */
764 int ohci_setup(struct usb_hcd
*hcd
)
766 struct ohci_hcd
*ohci
= hcd_to_ohci(hcd
);
770 return ohci_init(ohci
);
772 EXPORT_SYMBOL_GPL(ohci_setup
);
774 /* ohci_start routine for generic controller start of all OHCI bus glue */
775 static int ohci_start(struct usb_hcd
*hcd
)
777 struct ohci_hcd
*ohci
= hcd_to_ohci(hcd
);
780 ret
= ohci_run(ohci
);
782 ohci_err(ohci
, "can't start\n");
788 /*-------------------------------------------------------------------------*/
790 /* an interrupt happens */
792 static irqreturn_t
ohci_irq (struct usb_hcd
*hcd
)
794 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
795 struct ohci_regs __iomem
*regs
= ohci
->regs
;
798 /* Read interrupt status (and flush pending writes). We ignore the
799 * optimization of checking the LSB of hcca->done_head; it doesn't
800 * work on all systems (edge triggering for OHCI can be a factor).
802 ints
= ohci_readl(ohci
, ®s
->intrstatus
);
804 /* Check for an all 1's result which is a typical consequence
805 * of dead, unclocked, or unplugged (CardBus...) devices
807 if (ints
== ~(u32
)0) {
808 ohci
->rh_state
= OHCI_RH_HALTED
;
809 ohci_dbg (ohci
, "device removed!\n");
814 /* We only care about interrupts that are enabled */
815 ints
&= ohci_readl(ohci
, ®s
->intrenable
);
817 /* interrupt for some other device? */
818 if (ints
== 0 || unlikely(ohci
->rh_state
== OHCI_RH_HALTED
))
821 if (ints
& OHCI_INTR_UE
) {
822 // e.g. due to PCI Master/Target Abort
823 if (quirk_nec(ohci
)) {
824 /* Workaround for a silicon bug in some NEC chips used
825 * in Apple's PowerBooks. Adapted from Darwin code.
827 ohci_err (ohci
, "OHCI Unrecoverable Error, scheduling NEC chip restart\n");
829 ohci_writel (ohci
, OHCI_INTR_UE
, ®s
->intrdisable
);
831 schedule_work (&ohci
->nec_work
);
833 ohci_err (ohci
, "OHCI Unrecoverable Error, disabled\n");
834 ohci
->rh_state
= OHCI_RH_HALTED
;
839 ohci_usb_reset (ohci
);
842 if (ints
& OHCI_INTR_RHSC
) {
843 ohci_vdbg(ohci
, "rhsc\n");
844 ohci
->next_statechange
= jiffies
+ STATECHANGE_DELAY
;
845 ohci_writel(ohci
, OHCI_INTR_RD
| OHCI_INTR_RHSC
,
848 /* NOTE: Vendors didn't always make the same implementation
849 * choices for RHSC. Many followed the spec; RHSC triggers
850 * on an edge, like setting and maybe clearing a port status
851 * change bit. With others it's level-triggered, active
852 * until khubd clears all the port status change bits. We'll
853 * always disable it here and rely on polling until khubd
856 ohci_writel(ohci
, OHCI_INTR_RHSC
, ®s
->intrdisable
);
857 usb_hcd_poll_rh_status(hcd
);
860 /* For connect and disconnect events, we expect the controller
861 * to turn on RHSC along with RD. But for remote wakeup events
862 * this might not happen.
864 else if (ints
& OHCI_INTR_RD
) {
865 ohci_vdbg(ohci
, "resume detect\n");
866 ohci_writel(ohci
, OHCI_INTR_RD
, ®s
->intrstatus
);
867 set_bit(HCD_FLAG_POLL_RH
, &hcd
->flags
);
868 if (ohci
->autostop
) {
869 spin_lock (&ohci
->lock
);
870 ohci_rh_resume (ohci
);
871 spin_unlock (&ohci
->lock
);
873 usb_hcd_resume_root_hub(hcd
);
876 if (ints
& OHCI_INTR_WDH
) {
877 spin_lock (&ohci
->lock
);
879 spin_unlock (&ohci
->lock
);
882 if (quirk_zfmicro(ohci
) && (ints
& OHCI_INTR_SF
)) {
883 spin_lock(&ohci
->lock
);
884 if (ohci
->ed_to_check
) {
885 struct ed
*ed
= ohci
->ed_to_check
;
887 if (check_ed(ohci
, ed
)) {
888 /* HC thinks the TD list is empty; HCD knows
889 * at least one TD is outstanding
891 if (--ohci
->zf_delay
== 0) {
892 struct td
*td
= list_entry(
896 "Reclaiming orphan TD %p\n",
898 takeback_td(ohci
, td
);
899 ohci
->ed_to_check
= NULL
;
902 ohci
->ed_to_check
= NULL
;
904 spin_unlock(&ohci
->lock
);
907 /* could track INTR_SO to reduce available PCI/... bandwidth */
909 /* handle any pending URB/ED unlinks, leaving INTR_SF enabled
910 * when there's still unlinking to be done (next frame).
912 spin_lock (&ohci
->lock
);
913 if (ohci
->ed_rm_list
)
914 finish_unlinks (ohci
, ohci_frame_no(ohci
));
915 if ((ints
& OHCI_INTR_SF
) != 0
917 && !ohci
->ed_to_check
918 && ohci
->rh_state
== OHCI_RH_RUNNING
)
919 ohci_writel (ohci
, OHCI_INTR_SF
, ®s
->intrdisable
);
920 spin_unlock (&ohci
->lock
);
922 if (ohci
->rh_state
== OHCI_RH_RUNNING
) {
923 ohci_writel (ohci
, ints
, ®s
->intrstatus
);
924 ohci_writel (ohci
, OHCI_INTR_MIE
, ®s
->intrenable
);
925 // flush those writes
926 (void) ohci_readl (ohci
, &ohci
->regs
->control
);
932 /*-------------------------------------------------------------------------*/
934 static void ohci_stop (struct usb_hcd
*hcd
)
936 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
941 flush_work(&ohci
->nec_work
);
943 ohci_writel (ohci
, OHCI_INTR_MIE
, &ohci
->regs
->intrdisable
);
944 ohci_usb_reset(ohci
);
945 free_irq(hcd
->irq
, hcd
);
948 if (quirk_zfmicro(ohci
))
949 del_timer(&ohci
->unlink_watchdog
);
950 if (quirk_amdiso(ohci
))
953 remove_debug_files (ohci
);
954 ohci_mem_cleanup (ohci
);
956 dma_free_coherent (hcd
->self
.controller
,
958 ohci
->hcca
, ohci
->hcca_dma
);
964 /*-------------------------------------------------------------------------*/
966 #if defined(CONFIG_PM) || defined(CONFIG_PCI)
968 /* must not be called from interrupt context */
969 int ohci_restart(struct ohci_hcd
*ohci
)
973 struct urb_priv
*priv
;
976 spin_lock_irq(&ohci
->lock
);
977 ohci
->rh_state
= OHCI_RH_HALTED
;
979 /* Recycle any "live" eds/tds (and urbs). */
980 if (!list_empty (&ohci
->pending
))
981 ohci_dbg(ohci
, "abort schedule...\n");
982 list_for_each_entry (priv
, &ohci
->pending
, pending
) {
983 struct urb
*urb
= priv
->td
[0]->urb
;
984 struct ed
*ed
= priv
->ed
;
988 ed
->state
= ED_UNLINK
;
989 ed
->hwINFO
|= cpu_to_hc32(ohci
, ED_DEQUEUE
);
990 ed_deschedule (ohci
, ed
);
992 ed
->ed_next
= ohci
->ed_rm_list
;
994 ohci
->ed_rm_list
= ed
;
999 ohci_dbg(ohci
, "bogus ed %p state %d\n",
1004 urb
->unlinked
= -ESHUTDOWN
;
1006 finish_unlinks (ohci
, 0);
1007 spin_unlock_irq(&ohci
->lock
);
1009 /* paranoia, in case that didn't work: */
1011 /* empty the interrupt branches */
1012 for (i
= 0; i
< NUM_INTS
; i
++) ohci
->load
[i
] = 0;
1013 for (i
= 0; i
< NUM_INTS
; i
++) ohci
->hcca
->int_table
[i
] = 0;
1015 /* no EDs to remove */
1016 ohci
->ed_rm_list
= NULL
;
1018 /* empty control and bulk lists */
1019 ohci
->ed_controltail
= NULL
;
1020 ohci
->ed_bulktail
= NULL
;
1022 if ((temp
= ohci_run (ohci
)) < 0) {
1023 ohci_err (ohci
, "can't restart, %d\n", temp
);
1026 ohci_dbg(ohci
, "restart complete\n");
1029 EXPORT_SYMBOL_GPL(ohci_restart
);
1035 int ohci_suspend(struct usb_hcd
*hcd
, bool do_wakeup
)
1037 struct ohci_hcd
*ohci
= hcd_to_ohci (hcd
);
1038 unsigned long flags
;
1040 /* Disable irq emission and mark HW unaccessible. Use
1041 * the spinlock to properly synchronize with possible pending
1042 * RH suspend or resume activity.
1044 spin_lock_irqsave (&ohci
->lock
, flags
);
1045 ohci_writel(ohci
, OHCI_INTR_MIE
, &ohci
->regs
->intrdisable
);
1046 (void)ohci_readl(ohci
, &ohci
->regs
->intrdisable
);
1048 clear_bit(HCD_FLAG_HW_ACCESSIBLE
, &hcd
->flags
);
1049 spin_unlock_irqrestore (&ohci
->lock
, flags
);
1053 EXPORT_SYMBOL_GPL(ohci_suspend
);
1056 int ohci_resume(struct usb_hcd
*hcd
, bool hibernated
)
1058 struct ohci_hcd
*ohci
= hcd_to_ohci(hcd
);
1060 bool need_reinit
= false;
1062 set_bit(HCD_FLAG_HW_ACCESSIBLE
, &hcd
->flags
);
1064 /* Make sure resume from hibernation re-enumerates everything */
1066 ohci_usb_reset(ohci
);
1068 /* See if the controller is already running or has been reset */
1069 ohci
->hc_control
= ohci_readl(ohci
, &ohci
->regs
->control
);
1070 if (ohci
->hc_control
& (OHCI_CTRL_IR
| OHCI_SCHED_ENABLES
)) {
1073 switch (ohci
->hc_control
& OHCI_CTRL_HCFS
) {
1075 case OHCI_USB_RESET
:
1080 /* If needed, reinitialize and suspend the root hub */
1082 spin_lock_irq(&ohci
->lock
);
1083 ohci_rh_resume(ohci
);
1084 ohci_rh_suspend(ohci
, 0);
1085 spin_unlock_irq(&ohci
->lock
);
1088 /* Normally just turn on port power and enable interrupts */
1090 ohci_dbg(ohci
, "powerup ports\n");
1091 for (port
= 0; port
< ohci
->num_ports
; port
++)
1092 ohci_writel(ohci
, RH_PS_PPS
,
1093 &ohci
->regs
->roothub
.portstatus
[port
]);
1095 ohci_writel(ohci
, OHCI_INTR_MIE
, &ohci
->regs
->intrenable
);
1096 ohci_readl(ohci
, &ohci
->regs
->intrenable
);
1100 usb_hcd_resume_root_hub(hcd
);
1104 EXPORT_SYMBOL_GPL(ohci_resume
);
1108 /*-------------------------------------------------------------------------*/
1111 * Generic structure: This gets copied for platform drivers so that
1112 * individual entries can be overridden as needed.
1115 static const struct hc_driver ohci_hc_driver
= {
1116 .description
= hcd_name
,
1117 .product_desc
= "OHCI Host Controller",
1118 .hcd_priv_size
= sizeof(struct ohci_hcd
),
1121 * generic hardware linkage
1124 .flags
= HCD_MEMORY
| HCD_USB11
,
1127 * basic lifecycle operations
1129 .reset
= ohci_setup
,
1130 .start
= ohci_start
,
1132 .shutdown
= ohci_shutdown
,
1135 * managing i/o requests and associated device resources
1137 .urb_enqueue
= ohci_urb_enqueue
,
1138 .urb_dequeue
= ohci_urb_dequeue
,
1139 .endpoint_disable
= ohci_endpoint_disable
,
1142 * scheduling support
1144 .get_frame_number
= ohci_get_frame
,
1149 .hub_status_data
= ohci_hub_status_data
,
1150 .hub_control
= ohci_hub_control
,
1152 .bus_suspend
= ohci_bus_suspend
,
1153 .bus_resume
= ohci_bus_resume
,
1155 .start_port_reset
= ohci_start_port_reset
,
1158 void ohci_init_driver(struct hc_driver
*drv
,
1159 const struct ohci_driver_overrides
*over
)
1161 /* Copy the generic table to drv and then apply the overrides */
1162 *drv
= ohci_hc_driver
;
1164 drv
->product_desc
= over
->product_desc
;
1165 drv
->hcd_priv_size
+= over
->extra_priv_size
;
1167 drv
->reset
= over
->reset
;
1169 EXPORT_SYMBOL_GPL(ohci_init_driver
);
1171 /*-------------------------------------------------------------------------*/
1173 MODULE_AUTHOR (DRIVER_AUTHOR
);
1174 MODULE_DESCRIPTION(DRIVER_DESC
);
1175 MODULE_LICENSE ("GPL");
1177 #if defined(CONFIG_ARCH_SA1100) && defined(CONFIG_SA1111)
1178 #include "ohci-sa1111.c"
1179 #define SA1111_DRIVER ohci_hcd_sa1111_driver
1182 #if defined(CONFIG_ARCH_S3C24XX) || defined(CONFIG_ARCH_S3C64XX)
1183 #include "ohci-s3c2410.c"
1184 #define S3C2410_PLATFORM_DRIVER ohci_hcd_s3c2410_driver
1187 #ifdef CONFIG_USB_OHCI_EXYNOS
1188 #include "ohci-exynos.c"
1189 #define EXYNOS_PLATFORM_DRIVER exynos_ohci_driver
1192 #ifdef CONFIG_USB_OHCI_HCD_OMAP1
1193 #include "ohci-omap.c"
1194 #define OMAP1_PLATFORM_DRIVER ohci_hcd_omap_driver
1197 #ifdef CONFIG_USB_OHCI_HCD_OMAP3
1198 #include "ohci-omap3.c"
1199 #define OMAP3_PLATFORM_DRIVER ohci_hcd_omap3_driver
1202 #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
1203 #include "ohci-pxa27x.c"
1204 #define PLATFORM_DRIVER ohci_hcd_pxa27x_driver
1207 #ifdef CONFIG_ARCH_EP93XX
1208 #include "ohci-ep93xx.c"
1209 #define EP93XX_PLATFORM_DRIVER ohci_hcd_ep93xx_driver
1212 #ifdef CONFIG_ARCH_AT91
1213 #include "ohci-at91.c"
1214 #define AT91_PLATFORM_DRIVER ohci_hcd_at91_driver
1217 #ifdef CONFIG_ARCH_LPC32XX
1218 #include "ohci-nxp.c"
1219 #define NXP_PLATFORM_DRIVER usb_hcd_nxp_driver
1222 #ifdef CONFIG_ARCH_DAVINCI_DA8XX
1223 #include "ohci-da8xx.c"
1224 #define DAVINCI_PLATFORM_DRIVER ohci_hcd_da8xx_driver
1227 #ifdef CONFIG_USB_OHCI_HCD_PPC_OF
1228 #include "ohci-ppc-of.c"
1229 #define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver
1232 #ifdef CONFIG_PLAT_SPEAR
1233 #include "ohci-spear.c"
1234 #define SPEAR_PLATFORM_DRIVER spear_ohci_hcd_driver
1237 #ifdef CONFIG_PPC_PS3
1238 #include "ohci-ps3.c"
1239 #define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
1242 #ifdef CONFIG_MFD_SM501
1243 #include "ohci-sm501.c"
1244 #define SM501_OHCI_DRIVER ohci_hcd_sm501_driver
1247 #ifdef CONFIG_MFD_TC6393XB
1248 #include "ohci-tmio.c"
1249 #define TMIO_OHCI_DRIVER ohci_hcd_tmio_driver
1252 #ifdef CONFIG_MACH_JZ4740
1253 #include "ohci-jz4740.c"
1254 #define PLATFORM_DRIVER ohci_hcd_jz4740_driver
1257 #ifdef CONFIG_USB_OCTEON_OHCI
1258 #include "ohci-octeon.c"
1259 #define PLATFORM_DRIVER ohci_octeon_driver
1262 #ifdef CONFIG_TILE_USB
1263 #include "ohci-tilegx.c"
1264 #define PLATFORM_DRIVER ohci_hcd_tilegx_driver
1267 static int __init
ohci_hcd_mod_init(void)
1274 printk(KERN_INFO
"%s: " DRIVER_DESC
"\n", hcd_name
);
1275 pr_debug ("%s: block sizes: ed %Zd td %Zd\n", hcd_name
,
1276 sizeof (struct ed
), sizeof (struct td
));
1277 set_bit(USB_OHCI_LOADED
, &usb_hcds_loaded
);
1280 ohci_debug_root
= debugfs_create_dir("ohci", usb_debug_root
);
1281 if (!ohci_debug_root
) {
1287 #ifdef PS3_SYSTEM_BUS_DRIVER
1288 retval
= ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER
);
1293 #ifdef PLATFORM_DRIVER
1294 retval
= platform_driver_register(&PLATFORM_DRIVER
);
1296 goto error_platform
;
1299 #ifdef OMAP1_PLATFORM_DRIVER
1300 retval
= platform_driver_register(&OMAP1_PLATFORM_DRIVER
);
1302 goto error_omap1_platform
;
1305 #ifdef OMAP3_PLATFORM_DRIVER
1306 retval
= platform_driver_register(&OMAP3_PLATFORM_DRIVER
);
1308 goto error_omap3_platform
;
1311 #ifdef OF_PLATFORM_DRIVER
1312 retval
= platform_driver_register(&OF_PLATFORM_DRIVER
);
1314 goto error_of_platform
;
1317 #ifdef SA1111_DRIVER
1318 retval
= sa1111_driver_register(&SA1111_DRIVER
);
1323 #ifdef SM501_OHCI_DRIVER
1324 retval
= platform_driver_register(&SM501_OHCI_DRIVER
);
1329 #ifdef TMIO_OHCI_DRIVER
1330 retval
= platform_driver_register(&TMIO_OHCI_DRIVER
);
1335 #ifdef S3C2410_PLATFORM_DRIVER
1336 retval
= platform_driver_register(&S3C2410_PLATFORM_DRIVER
);
1341 #ifdef EXYNOS_PLATFORM_DRIVER
1342 retval
= platform_driver_register(&EXYNOS_PLATFORM_DRIVER
);
1347 #ifdef EP93XX_PLATFORM_DRIVER
1348 retval
= platform_driver_register(&EP93XX_PLATFORM_DRIVER
);
1353 #ifdef AT91_PLATFORM_DRIVER
1354 retval
= platform_driver_register(&AT91_PLATFORM_DRIVER
);
1359 #ifdef NXP_PLATFORM_DRIVER
1360 retval
= platform_driver_register(&NXP_PLATFORM_DRIVER
);
1365 #ifdef DAVINCI_PLATFORM_DRIVER
1366 retval
= platform_driver_register(&DAVINCI_PLATFORM_DRIVER
);
1371 #ifdef SPEAR_PLATFORM_DRIVER
1372 retval
= platform_driver_register(&SPEAR_PLATFORM_DRIVER
);
1380 #ifdef SPEAR_PLATFORM_DRIVER
1381 platform_driver_unregister(&SPEAR_PLATFORM_DRIVER
);
1384 #ifdef DAVINCI_PLATFORM_DRIVER
1385 platform_driver_unregister(&DAVINCI_PLATFORM_DRIVER
);
1388 #ifdef NXP_PLATFORM_DRIVER
1389 platform_driver_unregister(&NXP_PLATFORM_DRIVER
);
1392 #ifdef AT91_PLATFORM_DRIVER
1393 platform_driver_unregister(&AT91_PLATFORM_DRIVER
);
1396 #ifdef EP93XX_PLATFORM_DRIVER
1397 platform_driver_unregister(&EP93XX_PLATFORM_DRIVER
);
1400 #ifdef EXYNOS_PLATFORM_DRIVER
1401 platform_driver_unregister(&EXYNOS_PLATFORM_DRIVER
);
1404 #ifdef S3C2410_PLATFORM_DRIVER
1405 platform_driver_unregister(&S3C2410_PLATFORM_DRIVER
);
1408 #ifdef TMIO_OHCI_DRIVER
1409 platform_driver_unregister(&TMIO_OHCI_DRIVER
);
1412 #ifdef SM501_OHCI_DRIVER
1413 platform_driver_unregister(&SM501_OHCI_DRIVER
);
1416 #ifdef SA1111_DRIVER
1417 sa1111_driver_unregister(&SA1111_DRIVER
);
1420 #ifdef OF_PLATFORM_DRIVER
1421 platform_driver_unregister(&OF_PLATFORM_DRIVER
);
1424 #ifdef OMAP3_PLATFORM_DRIVER
1425 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER
);
1426 error_omap3_platform
:
1428 #ifdef OMAP1_PLATFORM_DRIVER
1429 platform_driver_unregister(&OMAP1_PLATFORM_DRIVER
);
1430 error_omap1_platform
:
1432 #ifdef PLATFORM_DRIVER
1433 platform_driver_unregister(&PLATFORM_DRIVER
);
1436 #ifdef PS3_SYSTEM_BUS_DRIVER
1437 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER
);
1441 debugfs_remove(ohci_debug_root
);
1442 ohci_debug_root
= NULL
;
1446 clear_bit(USB_OHCI_LOADED
, &usb_hcds_loaded
);
1449 module_init(ohci_hcd_mod_init
);
1451 static void __exit
ohci_hcd_mod_exit(void)
1453 #ifdef SPEAR_PLATFORM_DRIVER
1454 platform_driver_unregister(&SPEAR_PLATFORM_DRIVER
);
1456 #ifdef DAVINCI_PLATFORM_DRIVER
1457 platform_driver_unregister(&DAVINCI_PLATFORM_DRIVER
);
1459 #ifdef NXP_PLATFORM_DRIVER
1460 platform_driver_unregister(&NXP_PLATFORM_DRIVER
);
1462 #ifdef AT91_PLATFORM_DRIVER
1463 platform_driver_unregister(&AT91_PLATFORM_DRIVER
);
1465 #ifdef EP93XX_PLATFORM_DRIVER
1466 platform_driver_unregister(&EP93XX_PLATFORM_DRIVER
);
1468 #ifdef EXYNOS_PLATFORM_DRIVER
1469 platform_driver_unregister(&EXYNOS_PLATFORM_DRIVER
);
1471 #ifdef S3C2410_PLATFORM_DRIVER
1472 platform_driver_unregister(&S3C2410_PLATFORM_DRIVER
);
1474 #ifdef TMIO_OHCI_DRIVER
1475 platform_driver_unregister(&TMIO_OHCI_DRIVER
);
1477 #ifdef SM501_OHCI_DRIVER
1478 platform_driver_unregister(&SM501_OHCI_DRIVER
);
1480 #ifdef SA1111_DRIVER
1481 sa1111_driver_unregister(&SA1111_DRIVER
);
1483 #ifdef OF_PLATFORM_DRIVER
1484 platform_driver_unregister(&OF_PLATFORM_DRIVER
);
1486 #ifdef OMAP3_PLATFORM_DRIVER
1487 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER
);
1489 #ifdef OMAP1_PLATFORM_DRIVER
1490 platform_driver_unregister(&OMAP1_PLATFORM_DRIVER
);
1492 #ifdef PLATFORM_DRIVER
1493 platform_driver_unregister(&PLATFORM_DRIVER
);
1495 #ifdef PS3_SYSTEM_BUS_DRIVER
1496 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER
);
1499 debugfs_remove(ohci_debug_root
);
1501 clear_bit(USB_OHCI_LOADED
, &usb_hcds_loaded
);
1503 module_exit(ohci_hcd_mod_exit
);