2 * OHCI HCD (Host Controller Driver) for USB.
4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
7 * [ Initialisation is based on Linus' ]
8 * [ uhci code and gregs ahcd fragments ]
9 * [ (C) Copyright 1999 Linus Torvalds ]
10 * [ (C) Copyright 1999 Gregory P. Smith]
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.
18 * This file is licenced under the GPL.
21 #include <linux/module.h>
22 #include <linux/moduleparam.h>
23 #include <linux/pci.h>
24 #include <linux/kernel.h>
25 #include <linux/delay.h>
26 #include <linux/ioport.h>
27 #include <linux/sched.h>
28 #include <linux/slab.h>
29 #include <linux/errno.h>
30 #include <linux/init.h>
31 #include <linux/timer.h>
32 #include <linux/list.h>
33 #include <linux/usb.h>
34 #include <linux/usb/otg.h>
35 #include <linux/dma-mapping.h>
36 #include <linux/dmapool.h>
37 #include <linux/reboot.h>
41 #include <asm/system.h>
42 #include <asm/unaligned.h>
43 #include <asm/byteorder.h>
45 #include "../core/hcd.h"
46 #include "../core/hub.h"
48 #define DRIVER_VERSION "v0.10"
49 #define DRIVER_AUTHOR "Gabor Juhos <juhosg at openwrt.org>"
50 #define DRIVER_DESC "ADMtek USB 1.1 Host Controller Driver"
52 /*-------------------------------------------------------------------------*/
54 #undef ADMHC_VERBOSE_DEBUG /* not always helpful */
56 /* For initializing controller (mask in an HCFS mode too) */
57 #define OHCI_CONTROL_INIT OHCI_CTRL_CBSR
59 #define ADMHC_INTR_INIT \
60 ( ADMHC_INTR_MIE | ADMHC_INTR_INSM | ADMHC_INTR_FATI \
61 | ADMHC_INTR_RESI | ADMHC_INTR_TDC | ADMHC_INTR_BABI )
63 /*-------------------------------------------------------------------------*/
65 static const char hcd_name [] = "admhc-hcd";
67 #define STATECHANGE_DELAY msecs_to_jiffies(300)
71 static void admhc_dump(struct admhcd *ahcd, int verbose);
72 static int admhc_init(struct admhcd *ahcd);
73 static void admhc_stop(struct usb_hcd *hcd);
75 #include "adm5120-dbg.c"
76 #include "adm5120-mem.c"
77 #include "adm5120-pm.c"
78 #include "adm5120-hub.c"
79 #include "adm5120-q.c"
81 /*-------------------------------------------------------------------------*/
84 * queue up an urb for anything except the root hub
86 static int admhc_urb_enqueue(struct usb_hcd *hcd, struct usb_host_endpoint *ep,
87 struct urb *urb, gfp_t mem_flags)
89 struct admhcd *ahcd = hcd_to_admhcd(hcd);
91 struct urb_priv *urb_priv;
92 unsigned int pipe = urb->pipe;
97 #ifdef ADMHC_VERBOSE_DEBUG
98 spin_lock_irqsave(&ahcd->lock, flags);
99 urb_print(ahcd, urb, "ENQEUE", usb_pipein(pipe));
100 spin_unlock_irqrestore(&ahcd->lock, flags);
103 /* every endpoint has an ed, locate and maybe (re)initialize it */
104 ed = ed_get(ahcd, ep, urb->dev, pipe, urb->interval);
108 /* for the private part of the URB we need the number of TDs */
111 if (urb->transfer_buffer_length > TD_DATALEN_MAX)
112 /* td_submit_urb() doesn't yet handle these */
115 /* 1 TD for setup, 1 for ACK, plus ... */
119 /* one TD for every 4096 Bytes (can be upto 8K) */
120 td_cnt += urb->transfer_buffer_length / TD_DATALEN_MAX;
121 /* ... and for any remaining bytes ... */
122 if ((urb->transfer_buffer_length % TD_DATALEN_MAX) != 0)
124 /* ... and maybe a zero length packet to wrap it up */
127 else if ((urb->transfer_flags & URB_ZERO_PACKET) != 0
128 && (urb->transfer_buffer_length
129 % usb_maxpacket(urb->dev, pipe,
130 usb_pipeout (pipe))) == 0)
135 * for Interrupt IN/OUT transactions, each ED contains
137 * TODO: check transfer_buffer_length?
141 case PIPE_ISOCHRONOUS:
142 /* number of packets from URB */
143 td_cnt = urb->number_of_packets;
147 admhc_err(ahcd, "bad EP type %d", ed->type);
151 urb_priv = urb_priv_alloc(ahcd, td_cnt, mem_flags);
157 spin_lock_irqsave(&ahcd->lock, flags);
158 /* don't submit to a dead HC */
159 if (!test_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags)) {
163 if (!HC_IS_RUNNING(hcd->state)) {
168 /* in case of unlink-during-submit */
169 spin_lock(&urb->lock);
170 if (urb->status != -EINPROGRESS) {
171 spin_unlock(&urb->lock);
172 urb->hcpriv = urb_priv;
173 finish_urb(ahcd, urb);
178 /* schedule the ed if needed */
179 if (ed->state == ED_IDLE) {
180 ret = ed_schedule(ahcd, ed);
184 if (ed->type == PIPE_ISOCHRONOUS) {
185 u16 frame = admhc_frame_no(ahcd);
187 /* delay a few frames before the first TD */
188 frame += max_t (u16, 8, ed->interval);
189 frame &= ~(ed->interval - 1);
191 urb->start_frame = frame;
193 /* yes, only URB_ISO_ASAP is supported, and
194 * urb->start_frame is never used as input.
197 } else if (ed->type == PIPE_ISOCHRONOUS)
198 urb->start_frame = ed->last_iso + ed->interval;
200 /* fill the TDs and link them to the ed; and
201 * enable that part of the schedule, if needed
202 * and update count of queued periodic urbs
204 urb->hcpriv = urb_priv;
205 td_submit_urb(ahcd, urb);
207 #ifdef ADMHC_VERBOSE_DEBUG
208 admhc_dump_ed(ahcd, "admhc_urb_enqueue", urb_priv->ed, 1);
211 spin_unlock(&urb->lock);
214 urb_priv_free(ahcd, urb_priv);
216 spin_unlock_irqrestore(&ahcd->lock, flags);
221 * decouple the URB from the HC queues (TDs, urb_priv); it's
222 * already marked using urb->status. reporting is always done
223 * asynchronously, and we might be dealing with an urb that's
224 * partially transferred, or an ED with other urbs being unlinked.
226 static int admhc_urb_dequeue(struct usb_hcd *hcd, struct urb *urb)
228 struct admhcd *ahcd = hcd_to_admhcd(hcd);
231 #ifdef ADMHC_VERBOSE_DEBUG
232 urb_print(ahcd, urb, "DEQUEUE", 1);
235 spin_lock_irqsave(&ahcd->lock, flags);
236 if (HC_IS_RUNNING(hcd->state)) {
237 struct urb_priv *urb_priv;
239 /* Unless an IRQ completed the unlink while it was being
240 * handed to us, flag it for unlink and giveback, and force
241 * some upcoming INTR_SF to call finish_unlinks()
243 urb_priv = urb->hcpriv;
245 if (urb_priv->ed->state == ED_OPER)
246 start_ed_unlink(ahcd, urb_priv->ed);
250 * with HC dead, we won't respect hc queue pointers
251 * any more ... just clean up every urb's memory.
254 finish_urb(ahcd, urb);
256 spin_unlock_irqrestore(&ahcd->lock, flags);
261 /*-------------------------------------------------------------------------*/
263 /* frees config/altsetting state for endpoints,
264 * including ED memory, dummy TD, and bulk/intr data toggle
267 static void admhc_endpoint_disable(struct usb_hcd *hcd,
268 struct usb_host_endpoint *ep)
270 struct admhcd *ahcd = hcd_to_admhcd(hcd);
272 struct ed *ed = ep->hcpriv;
273 unsigned limit = 1000;
275 /* ASSERT: any requests/urbs are being unlinked */
276 /* ASSERT: nobody can be submitting urbs for this any more */
281 #ifdef ADMHC_VERBOSE_DEBUG
282 spin_lock_irqsave(&ahcd->lock, flags);
283 admhc_dump_ed(ahcd, "EP-DISABLE", ed, 1);
284 spin_unlock_irqrestore(&ahcd->lock, flags);
288 spin_lock_irqsave(&ahcd->lock, flags);
290 if (!HC_IS_RUNNING(hcd->state)) {
293 finish_unlinks(ahcd, 0);
297 case ED_UNLINK: /* wait for hw to finish? */
298 /* major IRQ delivery trouble loses INTR_SOFI too... */
300 admhc_warn(ahcd, "IRQ INTR_SOFI lossage\n");
303 spin_unlock_irqrestore(&ahcd->lock, flags);
304 schedule_timeout_uninterruptible(1);
306 case ED_IDLE: /* fully unlinked */
307 if (list_empty(&ed->td_list)) {
308 td_free (ahcd, ed->dummy);
312 /* else FALL THROUGH */
314 /* caller was supposed to have unlinked any requests;
315 * that's not our job. can't recover; must leak ed.
317 admhc_err(ahcd, "leak ed %p (#%02x) state %d%s\n",
318 ed, ep->desc.bEndpointAddress, ed->state,
319 list_empty(&ed->td_list) ? "" : " (has tds)");
320 td_free(ahcd, ed->dummy);
326 spin_unlock_irqrestore(&ahcd->lock, flags);
330 static int admhc_get_frame_number(struct usb_hcd *hcd)
332 struct admhcd *ahcd = hcd_to_admhcd(hcd);
334 return admhc_frame_no(ahcd);
337 static void admhc_usb_reset(struct admhcd *ahcd)
340 ahcd->hc_control = admhc_readl(ahcd, &ahcd->regs->control);
341 ahcd->hc_control &= OHCI_CTRL_RWC;
342 admhc_writel(ahcd, ahcd->hc_control, &ahcd->regs->control);
345 ahcd->host_control = ADMHC_BUSS_RESET;
346 admhc_writel(ahcd, ahcd->host_control ,&ahcd->regs->host_control);
350 /* admhc_shutdown forcibly disables IRQs and DMA, helping kexec and
351 * other cases where the next software may expect clean state from the
352 * "firmware". this is bus-neutral, unlike shutdown() methods.
355 admhc_shutdown(struct usb_hcd *hcd)
359 ahcd = hcd_to_admhcd(hcd);
360 admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
361 admhc_dma_disable(ahcd);
362 admhc_usb_reset(ahcd);
363 /* flush the writes */
364 admhc_writel_flush(ahcd);
367 /*-------------------------------------------------------------------------*
369 *-------------------------------------------------------------------------*/
371 static void admhc_eds_cleanup(struct admhcd *ahcd)
373 if (ahcd->ed_tails[PIPE_INTERRUPT]) {
374 ed_free(ahcd, ahcd->ed_tails[PIPE_INTERRUPT]);
375 ahcd->ed_tails[PIPE_INTERRUPT] = NULL;
378 if (ahcd->ed_tails[PIPE_ISOCHRONOUS]) {
379 ed_free(ahcd, ahcd->ed_tails[PIPE_ISOCHRONOUS]);
380 ahcd->ed_tails[PIPE_ISOCHRONOUS] = NULL;
383 if (ahcd->ed_tails[PIPE_CONTROL]) {
384 ed_free(ahcd, ahcd->ed_tails[PIPE_CONTROL]);
385 ahcd->ed_tails[PIPE_CONTROL] = NULL;
388 if (ahcd->ed_tails[PIPE_BULK]) {
389 ed_free(ahcd, ahcd->ed_tails[PIPE_BULK]);
390 ahcd->ed_tails[PIPE_BULK] = NULL;
393 ahcd->ed_head = NULL;
396 #define ED_DUMMY_INFO (ED_SPEED_FULL | ED_SKIP)
398 static int admhc_eds_init(struct admhcd *ahcd)
402 ed = ed_create(ahcd, PIPE_INTERRUPT, ED_DUMMY_INFO);
406 ahcd->ed_tails[PIPE_INTERRUPT] = ed;
408 ed = ed_create(ahcd, PIPE_ISOCHRONOUS, ED_DUMMY_INFO);
412 ahcd->ed_tails[PIPE_ISOCHRONOUS] = ed;
413 ed->ed_prev = ahcd->ed_tails[PIPE_INTERRUPT];
414 ahcd->ed_tails[PIPE_INTERRUPT]->ed_next = ed;
415 ahcd->ed_tails[PIPE_INTERRUPT]->hwNextED = cpu_to_hc32(ahcd, ed->dma);
417 ed = ed_create(ahcd, PIPE_CONTROL, ED_DUMMY_INFO);
421 ahcd->ed_tails[PIPE_CONTROL] = ed;
422 ed->ed_prev = ahcd->ed_tails[PIPE_ISOCHRONOUS];
423 ahcd->ed_tails[PIPE_ISOCHRONOUS]->ed_next = ed;
424 ahcd->ed_tails[PIPE_ISOCHRONOUS]->hwNextED = cpu_to_hc32(ahcd, ed->dma);
426 ed = ed_create(ahcd, PIPE_BULK, ED_DUMMY_INFO);
430 ahcd->ed_tails[PIPE_BULK] = ed;
431 ed->ed_prev = ahcd->ed_tails[PIPE_CONTROL];
432 ahcd->ed_tails[PIPE_CONTROL]->ed_next = ed;
433 ahcd->ed_tails[PIPE_CONTROL]->hwNextED = cpu_to_hc32(ahcd, ed->dma);
435 ahcd->ed_head = ahcd->ed_tails[PIPE_INTERRUPT];
437 #ifdef ADMHC_VERBOSE_DEBUG
438 admhc_dump_ed(ahcd, "ed intr", ahcd->ed_tails[PIPE_INTERRUPT], 1);
439 admhc_dump_ed(ahcd, "ed isoc", ahcd->ed_tails[PIPE_ISOCHRONOUS], 1);
440 admhc_dump_ed(ahcd, "ed ctrl", ahcd->ed_tails[PIPE_CONTROL], 1);
441 admhc_dump_ed(ahcd, "ed bulk", ahcd->ed_tails[PIPE_BULK], 1);
447 admhc_eds_cleanup(ahcd);
451 /* init memory, and kick BIOS/SMM off */
453 static int admhc_init(struct admhcd *ahcd)
455 struct usb_hcd *hcd = admhcd_to_hcd(ahcd);
459 ahcd->regs = hcd->regs;
461 /* Disable HC interrupts */
462 admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
464 /* Read the number of ports unless overridden */
465 if (ahcd->num_ports == 0)
466 ahcd->num_ports = admhc_read_rhdesc(ahcd) & ADMHC_RH_NUMP;
468 ret = admhc_mem_init(ahcd);
472 /* init dummy endpoints */
473 ret = admhc_eds_init(ahcd);
477 create_debug_files(ahcd);
486 /*-------------------------------------------------------------------------*/
488 /* Start an OHCI controller, set the BUS operational
489 * resets USB and controller
492 static int admhc_run(struct admhcd *ahcd)
495 int first = ahcd->fminterval == 0;
496 struct usb_hcd *hcd = admhcd_to_hcd(ahcd);
500 /* boot firmware should have set this up (5.1.1.3.1) */
502 temp = admhc_readl(ahcd, &ahcd->regs->fminterval);
503 ahcd->fminterval = temp & ADMHC_SFI_FI_MASK;
504 if (ahcd->fminterval != FI)
505 admhc_dbg(ahcd, "fminterval delta %d\n",
506 ahcd->fminterval - FI);
508 (FSLDP(ahcd->fminterval) << ADMHC_SFI_FSLDP_SHIFT);
509 /* also: power/overcurrent flags in rhdesc */
512 #if 0 /* TODO: not applicable */
513 /* Reset USB nearly "by the book". RemoteWakeupConnected was
514 * saved if boot firmware (BIOS/SMM/...) told us it's connected,
515 * or if bus glue did the same (e.g. for PCI add-in cards with
518 if ((ahcd->hc_control & OHCI_CTRL_RWC) != 0
519 && !device_may_wakeup(hcd->self.controller))
520 device_init_wakeup(hcd->self.controller, 1);
523 switch (ahcd->host_control & ADMHC_HC_BUSS) {
524 case ADMHC_BUSS_OPER:
527 case ADMHC_BUSS_SUSPEND:
529 case ADMHC_BUSS_RESUME:
530 ahcd->host_control = ADMHC_BUSS_RESUME;
531 temp = 10 /* msec wait */;
533 /* case ADMHC_BUSS_RESET: */
535 ahcd->host_control = ADMHC_BUSS_RESET;
536 temp = 50 /* msec wait */;
539 admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
541 /* flush the writes */
542 admhc_writel_flush(ahcd);
545 temp = admhc_read_rhdesc(ahcd);
546 if (!(temp & ADMHC_RH_NPS)) {
547 /* power down each port */
548 for (temp = 0; temp < ahcd->num_ports; temp++)
549 admhc_write_portstatus(ahcd, temp, ADMHC_PS_CPP);
551 /* flush those writes */
552 admhc_writel_flush(ahcd);
554 /* 2msec timelimit here means no irqs/preempt */
555 spin_lock_irq(&ahcd->lock);
557 admhc_writel(ahcd, ADMHC_CTRL_SR, &ahcd->regs->gencontrol);
558 temp = 30; /* ... allow extra time */
559 while ((admhc_readl(ahcd, &ahcd->regs->gencontrol) & ADMHC_CTRL_SR) != 0) {
561 spin_unlock_irq(&ahcd->lock);
562 admhc_err(ahcd, "USB HC reset timed out!\n");
568 /* enable HOST mode, before access any host specific register */
569 admhc_writel(ahcd, ADMHC_CTRL_UHFE, &ahcd->regs->gencontrol);
571 /* Tell the controller where the descriptor list is */
572 admhc_writel(ahcd, (u32)ahcd->ed_head->dma, &ahcd->regs->hosthead);
574 periodic_reinit(ahcd);
576 /* use rhsc irqs after khubd is fully initialized */
578 hcd->uses_new_polling = 1;
581 /* wake on ConnectStatusChange, matching external hubs */
582 admhc_writel(ahcd, RH_HS_DRWE, &ahcd->regs->roothub.status);
584 /* FIXME roothub_write_status (ahcd, ADMHC_RH_DRWE); */
587 /* Choose the interrupts we care about now, others later on demand */
588 admhc_intr_ack(ahcd, ~0);
589 admhc_intr_enable(ahcd, ADMHC_INTR_INIT);
591 admhc_writel(ahcd, ADMHC_RH_NPS | ADMHC_RH_LPSC, &ahcd->regs->rhdesc);
593 /* flush those writes */
594 admhc_writel_flush(ahcd);
596 /* start controller operations */
597 ahcd->host_control = ADMHC_BUSS_OPER;
598 admhc_writel(ahcd, ahcd->host_control, &ahcd->regs->host_control);
601 while ((admhc_readl(ahcd, &ahcd->regs->host_control)
602 & ADMHC_HC_BUSS) != ADMHC_BUSS_OPER) {
604 spin_unlock_irq(&ahcd->lock);
605 admhc_err(ahcd, "unable to setup operational mode!\n");
611 hcd->state = HC_STATE_RUNNING;
613 ahcd->next_statechange = jiffies + STATECHANGE_DELAY;
616 /* FIXME: enabling DMA is always failed here for an unknown reason */
617 admhc_dma_enable(ahcd);
620 while ((admhc_readl(ahcd, &ahcd->regs->host_control)
621 & ADMHC_HC_DMAE) != ADMHC_HC_DMAE) {
623 spin_unlock_irq(&ahcd->lock);
624 admhc_err(ahcd, "unable to enable DMA!\n");
633 spin_unlock_irq(&ahcd->lock);
635 mdelay(ADMHC_POTPGT);
640 /*-------------------------------------------------------------------------*/
642 /* an interrupt happens */
644 static irqreturn_t admhc_irq(struct usb_hcd *hcd)
646 struct admhcd *ahcd = hcd_to_admhcd(hcd);
647 struct admhcd_regs __iomem *regs = ahcd->regs;
650 ints = admhc_readl(ahcd, ®s->int_status);
651 if ((ints & ADMHC_INTR_INTA) == 0) {
652 /* no unmasked interrupt status is set */
656 ints &= admhc_readl(ahcd, ®s->int_enable);
658 if (ints & ADMHC_INTR_FATI) {
659 /* e.g. due to PCI Master/Target Abort */
661 admhc_err(ahcd, "Fatal Error, controller disabled\n");
663 admhc_usb_reset(ahcd);
666 if (ints & ADMHC_INTR_BABI) {
667 admhc_intr_disable(ahcd, ADMHC_INTR_BABI);
668 admhc_intr_ack(ahcd, ADMHC_INTR_BABI);
669 admhc_err(ahcd, "Babble Detected\n");
672 if (ints & ADMHC_INTR_INSM) {
673 admhc_vdbg(ahcd, "Root Hub Status Change\n");
674 ahcd->next_statechange = jiffies + STATECHANGE_DELAY;
675 admhc_intr_ack(ahcd, ADMHC_INTR_RESI | ADMHC_INTR_INSM);
677 /* NOTE: Vendors didn't always make the same implementation
678 * choices for RHSC. Many followed the spec; RHSC triggers
679 * on an edge, like setting and maybe clearing a port status
680 * change bit. With others it's level-triggered, active
681 * until khubd clears all the port status change bits. We'll
682 * always disable it here and rely on polling until khubd
685 admhc_intr_disable(ahcd, ADMHC_INTR_INSM);
686 usb_hcd_poll_rh_status(hcd);
687 } else if (ints & ADMHC_INTR_RESI) {
688 /* For connect and disconnect events, we expect the controller
689 * to turn on RHSC along with RD. But for remote wakeup events
690 * this might not happen.
692 admhc_vdbg(ahcd, "Resume Detect\n");
693 admhc_intr_ack(ahcd, ADMHC_INTR_RESI);
695 if (ahcd->autostop) {
696 spin_lock(&ahcd->lock);
697 admhc_rh_resume(ahcd);
698 spin_unlock(&ahcd->lock);
700 usb_hcd_resume_root_hub(hcd);
703 if (ints & ADMHC_INTR_TDC) {
704 admhc_vdbg(ahcd, "Transfer Descriptor Complete\n");
705 admhc_intr_ack(ahcd, ADMHC_INTR_TDC);
706 if (HC_IS_RUNNING(hcd->state))
707 admhc_intr_disable(ahcd, ADMHC_INTR_TDC);
708 spin_lock(&ahcd->lock);
709 admhc_td_complete(ahcd);
710 spin_unlock(&ahcd->lock);
711 if (HC_IS_RUNNING(hcd->state))
712 admhc_intr_enable(ahcd, ADMHC_INTR_TDC);
715 if (ints & ADMHC_INTR_SO) {
716 /* could track INTR_SO to reduce available PCI/... bandwidth */
717 admhc_vdbg(ahcd, "Schedule Overrun\n");
721 spin_lock(&ahcd->lock);
722 if (ahcd->ed_rm_list)
723 finish_unlinks(ahcd, admhc_frame_no(ahcd));
725 if ((ints & ADMHC_INTR_SOFI) != 0 && !ahcd->ed_rm_list
726 && HC_IS_RUNNING(hcd->state))
727 admhc_intr_disable(ahcd, ADMHC_INTR_SOFI);
728 spin_unlock(&ahcd->lock);
730 if (ints & ADMHC_INTR_SOFI) {
731 admhc_vdbg(ahcd, "Start Of Frame\n");
732 spin_lock(&ahcd->lock);
734 /* handle any pending ED removes */
735 finish_unlinks(ahcd, admhc_frameno(ahcd));
737 /* leaving INTR_SOFI enabled when there's still unlinking
738 * to be done in the (next frame).
740 if ((ahcd->ed_rm_list == NULL) ||
741 HC_IS_RUNNING(hcd->state) == 0)
743 * disable INTR_SOFI if there are no unlinking to be
744 * done (in the next frame)
746 admhc_intr_disable(ahcd, ADMHC_INTR_SOFI);
748 spin_unlock(&ahcd->lock);
752 if (HC_IS_RUNNING(hcd->state)) {
753 admhc_intr_ack(ahcd, ints);
754 admhc_intr_enable(ahcd, ADMHC_INTR_MIE);
755 admhc_writel_flush(ahcd);
761 /*-------------------------------------------------------------------------*/
763 static void admhc_stop(struct usb_hcd *hcd)
765 struct admhcd *ahcd = hcd_to_admhcd(hcd);
769 flush_scheduled_work();
771 admhc_usb_reset(ahcd);
772 admhc_intr_disable(ahcd, ADMHC_INTR_MIE);
774 free_irq(hcd->irq, hcd);
777 remove_debug_files(ahcd);
778 admhc_eds_cleanup(ahcd);
779 admhc_mem_cleanup(ahcd);
782 /*-------------------------------------------------------------------------*/
784 #ifdef CONFIG_MIPS_ADM5120
785 #include "adm5120-drv.c"
786 #define PLATFORM_DRIVER usb_hcd_adm5120_driver
789 #if !defined(PLATFORM_DRIVER)
790 #error "missing bus glue for admhc-hcd"
793 #define DRIVER_INFO DRIVER_DESC " " DRIVER_VERSION
795 static int __init admhc_hcd_mod_init(void)
802 pr_info("%s: " DRIVER_INFO "\n", hcd_name);
803 pr_info("%s: block sizes: ed %Zd td %Zd\n", hcd_name,
804 sizeof (struct ed), sizeof (struct td));
806 #ifdef PLATFORM_DRIVER
807 ret = platform_driver_register(&PLATFORM_DRIVER);
814 #ifdef PLATFORM_DRIVER
815 platform_driver_unregister(&PLATFORM_DRIVER);
820 module_init(admhc_hcd_mod_init);
822 static void __exit admhc_hcd_mod_exit(void)
824 platform_driver_unregister(&PLATFORM_DRIVER);
826 module_exit(admhc_hcd_mod_exit);
828 MODULE_AUTHOR(DRIVER_AUTHOR);
829 MODULE_DESCRIPTION(DRIVER_INFO);
830 MODULE_LICENSE("GPL");