• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/linux/linux-2.6.36/drivers/usb/host/

Lines Matching refs:ohci

8  * [ uhci code and gregs ohci fragments ]
77 #include "ohci.h"
79 static void ohci_dump (struct ohci_hcd *ohci, int verbose);
80 static int ohci_init (struct ohci_hcd *ohci);
84 static int ohci_restart (struct ohci_hcd *ohci);
90 static void sb800_prefetch(struct ohci_hcd *ohci, int on);
100 static inline void sb800_prefetch(struct ohci_hcd *ohci, int on)
107 #include "ohci-hub.c"
108 #include "ohci-dbg.c"
109 #include "ohci-mem.c"
110 #include "ohci-q.c"
145 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
158 if (! (ed = ed_get (ohci, urb->ep, urb->dev, pipe, urb->interval)))
204 urb_priv->td [i] = td_alloc (ohci, mem_flags);
207 urb_free_priv (ohci, urb_priv);
212 spin_lock_irqsave (&ohci->lock, flags);
229 retval = ed_schedule (ohci, ed);
235 u16 frame = ohci_frame_no(ohci);
255 td_submit_urb (ohci, urb);
259 urb_free_priv (ohci, urb_priv);
260 spin_unlock_irqrestore (&ohci->lock, flags);
272 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
280 spin_lock_irqsave (&ohci->lock, flags);
294 start_ed_unlink (ohci, urb_priv->ed);
302 finish_urb(ohci, urb, status);
304 spin_unlock_irqrestore (&ohci->lock, flags);
317 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
329 spin_lock_irqsave (&ohci->lock, flags);
334 if (quirk_zfmicro(ohci) && ed->type == PIPE_INTERRUPT)
335 ohci->eds_scheduled--;
336 finish_unlinks (ohci, 0);
343 ohci_warn(ohci, "ED unlink timeout\n");
344 if (quirk_zfmicro(ohci)) {
345 ohci_warn(ohci, "Attempting ZF TD recovery\n");
346 ohci->ed_to_check = ed;
347 ohci->zf_delay = 2;
351 spin_unlock_irqrestore (&ohci->lock, flags);
356 td_free (ohci, ed->dummy);
357 ed_free (ohci, ed);
365 ohci_err (ohci, "leak ed %p (#%02x) state %d%s\n",
368 td_free (ohci, ed->dummy);
372 spin_unlock_irqrestore (&ohci->lock, flags);
378 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
380 return ohci_frame_no(ohci);
383 static void ohci_usb_reset (struct ohci_hcd *ohci)
385 ohci->hc_control = ohci_readl (ohci, &ohci->regs->control);
386 ohci->hc_control &= OHCI_CTRL_RWC;
387 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
397 struct ohci_hcd *ohci;
399 ohci = hcd_to_ohci (hcd);
400 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
401 ohci_usb_reset (ohci);
403 (void) ohci_readl (ohci, &ohci->regs->control);
406 static int check_ed(struct ohci_hcd *ohci, struct ed *ed)
408 return (hc32_to_cpu(ohci, ed->hwINFO) & ED_IN) != 0
409 && (hc32_to_cpu(ohci, ed->hwHeadP) & TD_MASK)
410 == (hc32_to_cpu(ohci, ed->hwTailP) & TD_MASK)
426 struct ohci_hcd *ohci = (struct ohci_hcd *) _ohci;
428 spin_lock_irqsave(&ohci->lock, flags);
429 max = ohci->eds_scheduled;
433 if (ohci->ed_to_check)
441 struct ed *ed = ohci->periodic[i];
457 if (!check_ed(ohci, ed)) {
465 ohci->ed_to_check = ed;
466 ohci->zf_delay = 2;
474 ohci_writel(ohci, OHCI_INTR_SF,
475 &ohci->regs->intrstatus);
476 ohci_writel(ohci, OHCI_INTR_SF,
477 &ohci->regs->intrenable);
480 (void) ohci_readl(ohci, &ohci->regs->control);
487 if (ohci->eds_scheduled)
488 mod_timer(&ohci->unlink_watchdog, round_jiffies(jiffies + HZ));
490 spin_unlock_irqrestore(&ohci->lock, flags);
499 static int ohci_init (struct ohci_hcd *ohci)
502 struct usb_hcd *hcd = ohci_to_hcd(ohci);
505 ohci->flags |= OHCI_QUIRK_HUB_POWER;
507 disable (ohci);
508 ohci->regs = hcd->regs;
516 if (!no_handshake && ohci_readl (ohci,
517 &ohci->regs->control) & OHCI_CTRL_IR) {
520 ohci_dbg (ohci, "USB HC TakeOver from BIOS/SMM\n");
528 ohci_writel (ohci, OHCI_INTR_OC, &ohci->regs->intrenable);
529 ohci_writel (ohci, OHCI_OCR, &ohci->regs->cmdstatus);
530 while (ohci_readl (ohci, &ohci->regs->control) & OHCI_CTRL_IR) {
533 ohci_err (ohci, "USB HC takeover failed!"
538 ohci_usb_reset (ohci);
543 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
546 if (ohci_readl (ohci, &ohci->regs->control) & OHCI_CTRL_RWC)
547 ohci->hc_control |= OHCI_CTRL_RWC;
550 if (ohci->num_ports == 0)
551 ohci->num_ports = roothub_a(ohci) & RH_A_NDP;
553 if (ohci->hcca)
556 ohci->hcca = dma_alloc_coherent (hcd->self.controller,
557 sizeof *ohci->hcca, &ohci->hcca_dma, 0);
558 if (!ohci->hcca)
561 if ((ret = ohci_mem_init (ohci)) < 0)
564 create_debug_files (ohci);
576 static int ohci_run (struct ohci_hcd *ohci)
579 int first = ohci->fminterval == 0;
580 struct usb_hcd *hcd = ohci_to_hcd(ohci);
582 disable (ohci);
587 val = ohci_readl (ohci, &ohci->regs->fminterval);
588 ohci->fminterval = val & 0x3fff;
589 if (ohci->fminterval != FI)
590 ohci_dbg (ohci, "fminterval delta %d\n",
591 ohci->fminterval - FI);
592 ohci->fminterval |= FSMP (ohci->fminterval) << 16;
602 if ((ohci->hc_control & OHCI_CTRL_RWC) != 0)
605 switch (ohci->hc_control & OHCI_CTRL_HCFS) {
611 ohci->hc_control &= OHCI_CTRL_RWC;
612 ohci->hc_control |= OHCI_USB_RESUME;
617 ohci->hc_control &= OHCI_CTRL_RWC;
618 ohci->hc_control |= OHCI_USB_RESET;
622 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
624 (void) ohci_readl (ohci, &ohci->regs->control);
627 memset (ohci->hcca, 0, sizeof (struct ohci_hcca));
630 spin_lock_irq (&ohci->lock);
634 ohci_writel (ohci, OHCI_HCR, &ohci->regs->cmdstatus);
636 while ((ohci_readl (ohci, &ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
638 spin_unlock_irq (&ohci->lock);
639 ohci_err (ohci, "USB HC reset timed out!\n");
654 if (ohci->flags & OHCI_QUIRK_INITRESET) {
655 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
657 (void) ohci_readl (ohci, &ohci->regs->control);
662 ohci_writel (ohci, 0, &ohci->regs->ed_controlhead);
663 ohci_writel (ohci, 0, &ohci->regs->ed_bulkhead);
666 ohci_writel (ohci, (u32) ohci->hcca_dma, &ohci->regs->hcca);
668 periodic_reinit (ohci);
673 if ((ohci_readl (ohci, &ohci->regs->fminterval) & 0x3fff0000) == 0
674 || !ohci_readl (ohci, &ohci->regs->periodicstart)) {
675 if (!(ohci->flags & OHCI_QUIRK_INITRESET)) {
676 ohci->flags |= OHCI_QUIRK_INITRESET;
677 ohci_dbg (ohci, "enabling initreset quirk\n");
680 spin_unlock_irq (&ohci->lock);
681 ohci_err (ohci, "init err (%08x %04x)\n",
682 ohci_readl (ohci, &ohci->regs->fminterval),
683 ohci_readl (ohci, &ohci->regs->periodicstart));
692 ohci->hc_control &= OHCI_CTRL_RWC;
693 ohci->hc_control |= OHCI_CONTROL_INIT | OHCI_USB_OPER;
694 ohci_writel (ohci, ohci->hc_control, &ohci->regs->control);
698 ohci_writel (ohci, RH_HS_DRWE, &ohci->regs->roothub.status);
702 ohci_writel (ohci, ~0, &ohci->regs->intrstatus);
703 ohci_writel (ohci, mask, &ohci->regs->intrenable);
706 val = roothub_a (ohci);
708 if (ohci->flags & OHCI_QUIRK_SUPERIO) {
712 ohci_writel (ohci, val, &ohci->regs->roothub.a);
713 } else if ((ohci->flags & OHCI_QUIRK_AMD756) ||
714 (ohci->flags & OHCI_QUIRK_HUB_POWER)) {
719 ohci_writel (ohci, val, &ohci->regs->roothub.a);
721 ohci_writel (ohci, RH_HS_LPSC, &ohci->regs->roothub.status);
722 ohci_writel (ohci, (val & RH_A_NPS) ? 0 : RH_B_PPCM,
723 &ohci->regs->roothub.b);
725 (void) ohci_readl (ohci, &ohci->regs->control);
727 ohci->next_statechange = jiffies + STATECHANGE_DELAY;
728 spin_unlock_irq (&ohci->lock);
734 if (quirk_zfmicro(ohci)) {
736 setup_timer(&ohci->unlink_watchdog, unlink_watchdog_func,
737 (unsigned long) ohci);
739 ohci->eds_scheduled = 0;
740 ohci->ed_to_check = NULL;
743 ohci_dump (ohci, 1);
754 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
755 struct ohci_regs __iomem *regs = ohci->regs;
762 ints = ohci_readl(ohci, &regs->intrstatus);
768 disable (ohci);
769 ohci_dbg (ohci, "device removed!\n");
774 ints &= ohci_readl(ohci, &regs->intrenable);
782 if (quirk_nec(ohci)) {
783 ohci_err (ohci, "OHCI Unrecoverable Error, scheduling NEC chip restart\n");
785 ohci_writel (ohci, OHCI_INTR_UE, &regs->intrdisable);
787 schedule_work (&ohci->nec_work);
789 disable (ohci);
790 ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
793 ohci_dump (ohci, 1);
794 ohci_usb_reset (ohci);
798 ohci_vdbg(ohci, "rhsc\n");
799 ohci->next_statechange = jiffies + STATECHANGE_DELAY;
800 ohci_writel(ohci, OHCI_INTR_RD | OHCI_INTR_RHSC,
811 ohci_writel(ohci, OHCI_INTR_RHSC, &regs->intrdisable);
820 ohci_vdbg(ohci, "resume detect\n");
821 ohci_writel(ohci, OHCI_INTR_RD, &regs->intrstatus);
823 if (ohci->autostop) {
824 spin_lock (&ohci->lock);
825 ohci_rh_resume (ohci);
826 spin_unlock (&ohci->lock);
832 spin_lock (&ohci->lock);
833 dl_done_list (ohci);
834 spin_unlock (&ohci->lock);
837 if (quirk_zfmicro(ohci) && (ints & OHCI_INTR_SF)) {
838 spin_lock(&ohci->lock);
839 if (ohci->ed_to_check) {
840 struct ed *ed = ohci->ed_to_check;
842 if (check_ed(ohci, ed)) {
846 if (--ohci->zf_delay == 0) {
850 ohci_warn(ohci,
853 takeback_td(ohci, td);
854 ohci->ed_to_check = NULL;
857 ohci->ed_to_check = NULL;
859 spin_unlock(&ohci->lock);
867 spin_lock (&ohci->lock);
868 if (ohci->ed_rm_list)
869 finish_unlinks (ohci, ohci_frame_no(ohci));
871 && !ohci->ed_rm_list
872 && !ohci->ed_to_check
874 ohci_writel (ohci, OHCI_INTR_SF, &regs->intrdisable);
875 spin_unlock (&ohci->lock);
878 ohci_writel (ohci, ints, &regs->intrstatus);
879 ohci_writel (ohci, OHCI_INTR_MIE, &regs->intrenable);
881 (void) ohci_readl (ohci, &ohci->regs->control);
891 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
893 ohci_dump (ohci, 1);
897 ohci_usb_reset (ohci);
898 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
902 if (quirk_zfmicro(ohci))
903 del_timer(&ohci->unlink_watchdog);
904 if (quirk_amdiso(ohci))
907 remove_debug_files (ohci);
908 ohci_mem_cleanup (ohci);
909 if (ohci->hcca) {
911 sizeof *ohci->hcca,
912 ohci->hcca, ohci->hcca_dma);
913 ohci->hcca = NULL;
914 ohci->hcca_dma = 0;
923 static int ohci_restart (struct ohci_hcd *ohci)
929 spin_lock_irq(&ohci->lock);
930 disable (ohci);
933 if (!list_empty (&ohci->pending))
934 ohci_dbg(ohci, "abort schedule...\n");
935 list_for_each_entry (priv, &ohci->pending, pending) {
942 ed->hwINFO |= cpu_to_hc32(ohci, ED_DEQUEUE);
943 ed_deschedule (ohci, ed);
945 ed->ed_next = ohci->ed_rm_list;
947 ohci->ed_rm_list = ed;
952 ohci_dbg(ohci, "bogus ed %p state %d\n",
959 finish_unlinks (ohci, 0);
960 spin_unlock_irq(&ohci->lock);
965 for (i = 0; i < NUM_INTS; i++) ohci->load [i] = 0;
966 for (i = 0; i < NUM_INTS; i++) ohci->hcca->int_table [i] = 0;
969 ohci->ed_rm_list = NULL;
972 ohci->ed_controltail = NULL;
973 ohci->ed_bulktail = NULL;
975 if ((temp = ohci_run (ohci)) < 0) {
976 ohci_err (ohci, "can't restart, %d\n", temp);
979 ohci_dbg(ohci, "restart complete\n");
992 #include "ohci-pci.c"
997 #include "ohci-sa1111.c"
1002 #include "ohci-s3c2410.c"
1007 #include "ohci-omap.c"
1012 #include "ohci-omap3.c"
1017 #include "ohci-lh7a404.c"
1022 #include "ohci-pxa27x.c"
1027 #include "ohci-ep93xx.c"
1032 #include "ohci-au1xxx.c"
1037 #include "ohci-pnx8550.c"
1042 #include "ohci-ppc-soc.c"
1047 #include "ohci-at91.c"
1052 #include "ohci-pnx4008.c"
1057 #include "ohci-da8xx.c"
1063 #include "ohci-sh.c"
1069 #include "ohci-ppc-of.c"
1074 #include "ohci-ps3.c"
1079 #include "ohci-ssb.c"
1084 #include "ohci-sm501.c"
1089 #include "ohci-tmio.c"
1094 #include "ohci-jz4740.c"
1103 #error "missing bus glue for ohci-hcd"
1119 ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root);