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.c47
1 files changed, 3 insertions, 44 deletions
diff --git a/drivers/usb/host/ohci-pci.c b/drivers/usb/host/ohci-pci.c
index d0360f65ebd9..3bf175d95a23 100644
--- a/drivers/usb/host/ohci-pci.c
+++ b/drivers/usb/host/ohci-pci.c
@@ -238,42 +238,6 @@ static int __devinit ohci_pci_start (struct usb_hcd *hcd)
238 return ret; 238 return ret;
239} 239}
240 240
241#if defined(CONFIG_USB_PERSIST) && (defined(CONFIG_USB_EHCI_HCD) || \
242 defined(CONFIG_USB_EHCI_HCD_MODULE))
243
244/* Following a power loss, we must prepare to regain control of the ports
245 * we used to own. This means turning on the port power before ehci-hcd
246 * tries to switch ownership.
247 *
248 * This isn't a 100% perfect solution. On most systems the OHCI controllers
249 * lie at lower PCI addresses than the EHCI controller, so they will be
250 * discovered (and hence resumed) first. But there is no guarantee things
251 * will always work this way. If the EHCI controller is resumed first and
252 * the OHCI ports are unpowered, then the handover will fail.
253 */
254static void prepare_for_handover(struct usb_hcd *hcd)
255{
256 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
257 int port;
258
259 /* Here we "know" root ports should always stay powered */
260 ohci_dbg(ohci, "powerup ports\n");
261 for (port = 0; port < ohci->num_ports; port++)
262 ohci_writel(ohci, RH_PS_PPS,
263 &ohci->regs->roothub.portstatus[port]);
264
265 /* Flush those writes */
266 ohci_readl(ohci, &ohci->regs->control);
267 msleep(20);
268}
269
270#else
271
272static inline void prepare_for_handover(struct usb_hcd *hcd)
273{ }
274
275#endif /* CONFIG_USB_PERSIST etc. */
276
277#ifdef CONFIG_PM 241#ifdef CONFIG_PM
278 242
279static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message) 243static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
@@ -313,10 +277,7 @@ static int ohci_pci_suspend (struct usb_hcd *hcd, pm_message_t message)
313static int ohci_pci_resume (struct usb_hcd *hcd) 277static int ohci_pci_resume (struct usb_hcd *hcd)
314{ 278{
315 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 279 set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
316 280 ohci_finish_controller_resume(hcd);
317 /* FIXME: we should try to detect loss of VBUS power here */
318 prepare_for_handover(hcd);
319
320 return 0; 281 return 0;
321} 282}
322 283
@@ -345,9 +306,8 @@ static const struct hc_driver ohci_pci_hc_driver = {
345 .shutdown = ohci_shutdown, 306 .shutdown = ohci_shutdown,
346 307
347#ifdef CONFIG_PM 308#ifdef CONFIG_PM
348 /* these suspend/resume entries are for upstream PCI glue ONLY */ 309 .pci_suspend = ohci_pci_suspend,
349 .suspend = ohci_pci_suspend, 310 .pci_resume = ohci_pci_resume,
350 .resume = ohci_pci_resume,
351#endif 311#endif
352 312
353 /* 313 /*
@@ -367,7 +327,6 @@ static const struct hc_driver ohci_pci_hc_driver = {
367 */ 327 */
368 .hub_status_data = ohci_hub_status_data, 328 .hub_status_data = ohci_hub_status_data,
369 .hub_control = ohci_hub_control, 329 .hub_control = ohci_hub_control,
370 .hub_irq_enable = ohci_rhsc_enable,
371#ifdef CONFIG_PM 330#ifdef CONFIG_PM
372 .bus_suspend = ohci_bus_suspend, 331 .bus_suspend = ohci_bus_suspend,
373 .bus_resume = ohci_bus_resume, 332 .bus_resume = ohci_bus_resume,