aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-hcd.c
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /drivers/usb/host/ohci-hcd.c
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'drivers/usb/host/ohci-hcd.c')
-rw-r--r--drivers/usb/host/ohci-hcd.c75
1 files changed, 46 insertions, 29 deletions
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index c3b4ccc7337b..f9cf3f04b742 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1,5 +1,7 @@
1/* 1/*
2 * OHCI HCD (Host Controller Driver) for USB. 2 * Open Host Controller Interface (OHCI) driver for USB.
3 *
4 * Maintainer: Alan Stern <stern@rowland.harvard.edu>
3 * 5 *
4 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> 6 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
5 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net> 7 * (C) Copyright 2000-2004 David Brownell <dbrownell@users.sourceforge.net>
@@ -75,6 +77,7 @@ static const char hcd_name [] = "ohci_hcd";
75#define STATECHANGE_DELAY msecs_to_jiffies(300) 77#define STATECHANGE_DELAY msecs_to_jiffies(300)
76 78
77#include "ohci.h" 79#include "ohci.h"
80#include "pci-quirks.h"
78 81
79static void ohci_dump (struct ohci_hcd *ohci, int verbose); 82static void ohci_dump (struct ohci_hcd *ohci, int verbose);
80static int ohci_init (struct ohci_hcd *ohci); 83static int ohci_init (struct ohci_hcd *ohci);
@@ -85,18 +88,8 @@ static int ohci_restart (struct ohci_hcd *ohci);
85#endif 88#endif
86 89
87#ifdef CONFIG_PCI 90#ifdef CONFIG_PCI
88static void quirk_amd_pll(int state);
89static void amd_iso_dev_put(void);
90static void sb800_prefetch(struct ohci_hcd *ohci, int on); 91static void sb800_prefetch(struct ohci_hcd *ohci, int on);
91#else 92#else
92static inline void quirk_amd_pll(int state)
93{
94 return;
95}
96static inline void amd_iso_dev_put(void)
97{
98 return;
99}
100static inline void sb800_prefetch(struct ohci_hcd *ohci, int on) 93static inline void sb800_prefetch(struct ohci_hcd *ohci, int on)
101{ 94{
102 return; 95 return;
@@ -171,7 +164,7 @@ static int ohci_urb_enqueue (
171 // case PIPE_INTERRUPT: 164 // case PIPE_INTERRUPT:
172 // case PIPE_BULK: 165 // case PIPE_BULK:
173 default: 166 default:
174 /* one TD for every 4096 Bytes (can be upto 8K) */ 167 /* one TD for every 4096 Bytes (can be up to 8K) */
175 size += urb->transfer_buffer_length / 4096; 168 size += urb->transfer_buffer_length / 4096;
176 /* ... and for any remaining bytes ... */ 169 /* ... and for any remaining bytes ... */
177 if ((urb->transfer_buffer_length % 4096) != 0) 170 if ((urb->transfer_buffer_length % 4096) != 0)
@@ -370,7 +363,6 @@ sanitize:
370 } 363 }
371 ep->hcpriv = NULL; 364 ep->hcpriv = NULL;
372 spin_unlock_irqrestore (&ohci->lock, flags); 365 spin_unlock_irqrestore (&ohci->lock, flags);
373 return;
374} 366}
375 367
376static int ohci_get_frame (struct usb_hcd *hcd) 368static int ohci_get_frame (struct usb_hcd *hcd)
@@ -398,7 +390,14 @@ ohci_shutdown (struct usb_hcd *hcd)
398 390
399 ohci = hcd_to_ohci (hcd); 391 ohci = hcd_to_ohci (hcd);
400 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); 392 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
401 ohci_usb_reset (ohci); 393 ohci->hc_control = ohci_readl(ohci, &ohci->regs->control);
394
395 /* If the SHUTDOWN quirk is set, don't put the controller in RESET */
396 ohci->hc_control &= (ohci->flags & OHCI_QUIRK_SHUTDOWN ?
397 OHCI_CTRL_RWC | OHCI_CTRL_HCFS :
398 OHCI_CTRL_RWC);
399 ohci_writel(ohci, ohci->hc_control, &ohci->regs->control);
400
402 /* flush the writes */ 401 /* flush the writes */
403 (void) ohci_readl (ohci, &ohci->regs->control); 402 (void) ohci_readl (ohci, &ohci->regs->control);
404} 403}
@@ -767,6 +766,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
767 if (ints == ~(u32)0) { 766 if (ints == ~(u32)0) {
768 disable (ohci); 767 disable (ohci);
769 ohci_dbg (ohci, "device removed!\n"); 768 ohci_dbg (ohci, "device removed!\n");
769 usb_hc_died(hcd);
770 return IRQ_HANDLED; 770 return IRQ_HANDLED;
771 } 771 }
772 772
@@ -774,7 +774,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
774 ints &= ohci_readl(ohci, &regs->intrenable); 774 ints &= ohci_readl(ohci, &regs->intrenable);
775 775
776 /* interrupt for some other device? */ 776 /* interrupt for some other device? */
777 if (ints == 0) 777 if (ints == 0 || unlikely(hcd->state == HC_STATE_HALT))
778 return IRQ_NOTMINE; 778 return IRQ_NOTMINE;
779 779
780 if (ints & OHCI_INTR_UE) { 780 if (ints & OHCI_INTR_UE) {
@@ -791,6 +791,7 @@ static irqreturn_t ohci_irq (struct usb_hcd *hcd)
791 } else { 791 } else {
792 disable (ohci); 792 disable (ohci);
793 ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n"); 793 ohci_err (ohci, "OHCI Unrecoverable Error, disabled\n");
794 usb_hc_died(hcd);
794 } 795 }
795 796
796 ohci_dump (ohci, 1); 797 ohci_dump (ohci, 1);
@@ -895,7 +896,8 @@ static void ohci_stop (struct usb_hcd *hcd)
895 896
896 ohci_dump (ohci, 1); 897 ohci_dump (ohci, 1);
897 898
898 flush_scheduled_work(); 899 if (quirk_nec(ohci))
900 flush_work_sync(&ohci->nec_work);
899 901
900 ohci_usb_reset (ohci); 902 ohci_usb_reset (ohci);
901 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); 903 ohci_writel (ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
@@ -905,7 +907,7 @@ static void ohci_stop (struct usb_hcd *hcd)
905 if (quirk_zfmicro(ohci)) 907 if (quirk_zfmicro(ohci))
906 del_timer(&ohci->unlink_watchdog); 908 del_timer(&ohci->unlink_watchdog);
907 if (quirk_amdiso(ohci)) 909 if (quirk_amdiso(ohci))
908 amd_iso_dev_put(); 910 usb_amd_dev_put();
909 911
910 remove_debug_files (ohci); 912 remove_debug_files (ohci);
911 ohci_mem_cleanup (ohci); 913 ohci_mem_cleanup (ohci);
@@ -1016,11 +1018,6 @@ MODULE_LICENSE ("GPL");
1016#define OMAP3_PLATFORM_DRIVER ohci_hcd_omap3_driver 1018#define OMAP3_PLATFORM_DRIVER ohci_hcd_omap3_driver
1017#endif 1019#endif
1018 1020
1019#ifdef CONFIG_ARCH_LH7A404
1020#include "ohci-lh7a404.c"
1021#define PLATFORM_DRIVER ohci_hcd_lh7a404_driver
1022#endif
1023
1024#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) 1021#if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx)
1025#include "ohci-pxa27x.c" 1022#include "ohci-pxa27x.c"
1026#define PLATFORM_DRIVER ohci_hcd_pxa27x_driver 1023#define PLATFORM_DRIVER ohci_hcd_pxa27x_driver
@@ -1061,10 +1058,7 @@ MODULE_LICENSE ("GPL");
1061#define PLATFORM_DRIVER ohci_hcd_da8xx_driver 1058#define PLATFORM_DRIVER ohci_hcd_da8xx_driver
1062#endif 1059#endif
1063 1060
1064#if defined(CONFIG_CPU_SUBTYPE_SH7720) || \ 1061#ifdef CONFIG_USB_OHCI_SH
1065 defined(CONFIG_CPU_SUBTYPE_SH7721) || \
1066 defined(CONFIG_CPU_SUBTYPE_SH7763) || \
1067 defined(CONFIG_CPU_SUBTYPE_SH7786)
1068#include "ohci-sh.c" 1062#include "ohci-sh.c"
1069#define PLATFORM_DRIVER ohci_hcd_sh_driver 1063#define PLATFORM_DRIVER ohci_hcd_sh_driver
1070#endif 1064#endif
@@ -1075,6 +1069,11 @@ MODULE_LICENSE ("GPL");
1075#define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver 1069#define OF_PLATFORM_DRIVER ohci_hcd_ppc_of_driver
1076#endif 1070#endif
1077 1071
1072#ifdef CONFIG_PLAT_SPEAR
1073#include "ohci-spear.c"
1074#define PLATFORM_DRIVER spear_ohci_hcd_driver
1075#endif
1076
1078#ifdef CONFIG_PPC_PS3 1077#ifdef CONFIG_PPC_PS3
1079#include "ohci-ps3.c" 1078#include "ohci-ps3.c"
1080#define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver 1079#define PS3_SYSTEM_BUS_DRIVER ps3_ohci_driver
@@ -1100,6 +1099,21 @@ MODULE_LICENSE ("GPL");
1100#define PLATFORM_DRIVER ohci_hcd_jz4740_driver 1099#define PLATFORM_DRIVER ohci_hcd_jz4740_driver
1101#endif 1100#endif
1102 1101
1102#ifdef CONFIG_USB_OCTEON_OHCI
1103#include "ohci-octeon.c"
1104#define PLATFORM_DRIVER ohci_octeon_driver
1105#endif
1106
1107#ifdef CONFIG_USB_CNS3XXX_OHCI
1108#include "ohci-cns3xxx.c"
1109#define PLATFORM_DRIVER ohci_hcd_cns3xxx_driver
1110#endif
1111
1112#ifdef CONFIG_USB_OHCI_ATH79
1113#include "ohci-ath79.c"
1114#define PLATFORM_DRIVER ohci_hcd_ath79_driver
1115#endif
1116
1103#if !defined(PCI_DRIVER) && \ 1117#if !defined(PCI_DRIVER) && \
1104 !defined(PLATFORM_DRIVER) && \ 1118 !defined(PLATFORM_DRIVER) && \
1105 !defined(OMAP1_PLATFORM_DRIVER) && \ 1119 !defined(OMAP1_PLATFORM_DRIVER) && \
@@ -1158,7 +1172,7 @@ static int __init ohci_hcd_mod_init(void)
1158#endif 1172#endif
1159 1173
1160#ifdef OF_PLATFORM_DRIVER 1174#ifdef OF_PLATFORM_DRIVER
1161 retval = of_register_platform_driver(&OF_PLATFORM_DRIVER); 1175 retval = platform_driver_register(&OF_PLATFORM_DRIVER);
1162 if (retval < 0) 1176 if (retval < 0)
1163 goto error_of_platform; 1177 goto error_of_platform;
1164#endif 1178#endif
@@ -1217,7 +1231,7 @@ static int __init ohci_hcd_mod_init(void)
1217 error_sa1111: 1231 error_sa1111:
1218#endif 1232#endif
1219#ifdef OF_PLATFORM_DRIVER 1233#ifdef OF_PLATFORM_DRIVER
1220 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1234 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1221 error_of_platform: 1235 error_of_platform:
1222#endif 1236#endif
1223#ifdef PLATFORM_DRIVER 1237#ifdef PLATFORM_DRIVER
@@ -1265,11 +1279,14 @@ static void __exit ohci_hcd_mod_exit(void)
1265 sa1111_driver_unregister(&SA1111_DRIVER); 1279 sa1111_driver_unregister(&SA1111_DRIVER);
1266#endif 1280#endif
1267#ifdef OF_PLATFORM_DRIVER 1281#ifdef OF_PLATFORM_DRIVER
1268 of_unregister_platform_driver(&OF_PLATFORM_DRIVER); 1282 platform_driver_unregister(&OF_PLATFORM_DRIVER);
1269#endif 1283#endif
1270#ifdef PLATFORM_DRIVER 1284#ifdef PLATFORM_DRIVER
1271 platform_driver_unregister(&PLATFORM_DRIVER); 1285 platform_driver_unregister(&PLATFORM_DRIVER);
1272#endif 1286#endif
1287#ifdef OMAP3_PLATFORM_DRIVER
1288 platform_driver_unregister(&OMAP3_PLATFORM_DRIVER);
1289#endif
1273#ifdef PS3_SYSTEM_BUS_DRIVER 1290#ifdef PS3_SYSTEM_BUS_DRIVER
1274 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER); 1291 ps3_ohci_driver_unregister(&PS3_SYSTEM_BUS_DRIVER);
1275#endif 1292#endif