aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ohci-pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ohci-pci.c')
-rw-r--r--drivers/usb/host/ohci-pci.c60
1 files changed, 23 insertions, 37 deletions
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index 7ce1d9ef0289..1b09dde068e1 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -14,15 +14,6 @@
14 * This file is licenced under the GPL. 14 * This file is licenced under the GPL.
15 */ 15 */
16 16
17#include <linux/jiffies.h>
18
19#ifdef CONFIG_PPC_PMAC
20#include <asm/machdep.h>
21#include <asm/pmac_feature.h>
22#include <asm/pci-bridge.h>
23#include <asm/prom.h>
24#endif
25
26#ifndef CONFIG_PCI 17#ifndef CONFIG_PCI
27#error "This file is PCI bus glue. CONFIG_PCI must be defined." 18#error "This file is PCI bus glue. CONFIG_PCI must be defined."
28#endif 19#endif
@@ -114,40 +105,36 @@ ohci_pci_start (struct usb_hcd *hcd)
114 105
115static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 106static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
116{ 107{
117 /* root hub was already suspended */ 108 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
118 109 unsigned long flags;
119 /* FIXME these PMAC things get called in the wrong places. ASIC 110 int rc = 0;
120 * clocks should be turned off AFTER entering D3, and on BEFORE 111
121 * trying to enter D0. Evidently the PCI layer doesn't currently 112 /* Root hub was already suspended. Disable irq emission and
122 * provide the right sort of platform hooks for this ... 113 * mark HW unaccessible, bail out if RH has been resumed. Use
114 * the spinlock to properly synchronize with possible pending
115 * RH suspend or resume activity.
116 *
117 * This is still racy as hcd->state is manipulated outside of
118 * any locks =P But that will be a different fix.
123 */ 119 */
124#ifdef CONFIG_PPC_PMAC 120 spin_lock_irqsave (&ohci->lock, flags);
125 if (_machine == _MACH_Pmac) { 121 if (hcd->state != HC_STATE_SUSPENDED) {
126 struct device_node *of_node; 122 rc = -EINVAL;
127 123 goto bail;
128 /* Disable USB PAD & cell clock */
129 of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
130 if (of_node)
131 pmac_call_feature(PMAC_FTR_USB_ENABLE, of_node, 0, 0);
132 } 124 }
133#endif /* CONFIG_PPC_PMAC */ 125 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
134 return 0; 126 (void)ohci_readl(ohci, &ohci->regs->intrdisable);
127 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
128 bail:
129 spin_unlock_irqrestore (&ohci->lock, flags);
130
131 return rc;
135} 132}
136 133
137 134
138static int ohci_pci_resume (struct usb_hcd *hcd) 135static int ohci_pci_resume (struct usb_hcd *hcd)
139{ 136{
140#ifdef CONFIG_PPC_PMAC 137 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
141 if (_machine == _MACH_Pmac) {
142 struct device_node *of_node;
143
144 /* Re-enable USB PAD & cell clock */
145 of_node = pci_device_to_OF_node (to_pci_dev(hcd->self.controller));
146 if (of_node)
147 pmac_call_feature (PMAC_FTR_USB_ENABLE, of_node, 0, 1);
148 }
149#endif /* CONFIG_PPC_PMAC */
150
151 usb_hcd_resume_root_hub(hcd); 138 usb_hcd_resume_root_hub(hcd);
152 return 0; 139 return 0;
153} 140}
@@ -218,7 +205,6 @@ MODULE_DEVICE_TABLE (pci, pci_ids);
218static struct pci_driver ohci_pci_driver = { 205static struct pci_driver ohci_pci_driver = {
219 .name = (char *) hcd_name, 206 .name = (char *) hcd_name,
220 .id_table = pci_ids, 207 .id_table = pci_ids,
221 .owner = THIS_MODULE,
222 208
223 .probe = usb_hcd_pci_probe, 209 .probe = usb_hcd_pci_probe,
224 .remove = usb_hcd_pci_remove, 210 .remove = usb_hcd_pci_remove,