aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2006-09-25 15:41:21 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-28 18:36:46 -0400
commit1f7e1a3b7e05c833229c4b6e9d3c96262df59e99 (patch)
treeb5b618378407be0785e3ba4324d8423dcb1c2a6d /drivers/usb
parentd19ac7da72ab950c315d0da0aa03464587d88b53 (diff)
OHCI: remove existing autosuspend code
The autosuspend technique used by ohci-hcd doesn't mesh well with the newer USB core autosuspend code. This patch (as789) removes ohci-hcd's autosuspend support. Now the driver will be usable, but it won't automatically go into a low-power state when no devices are connected. That's for a later patch. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r--drivers/usb/host/ohci-hub.c50
1 files changed, 6 insertions, 44 deletions
diff --git a/drivers/usb/host/ohci-hub.c b/drivers/usb/host/ohci-hub.c
index 0b899339cac8..ef4965450de5 100644
--- a/drivers/usb/host/ohci-hub.c
+++ b/drivers/usb/host/ohci-hub.c
@@ -41,6 +41,7 @@ static void ohci_rhsc_enable (struct usb_hcd *hcd)
41{ 41{
42 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 42 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
43 43
44 hcd->poll_rh = 0;
44 ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable); 45 ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrenable);
45} 46}
46 47
@@ -117,8 +118,10 @@ static int ohci_bus_suspend (struct usb_hcd *hcd)
117 /* maybe resume can wake root hub */ 118 /* maybe resume can wake root hub */
118 if (device_may_wakeup(&ohci_to_hcd(ohci)->self.root_hub->dev)) 119 if (device_may_wakeup(&ohci_to_hcd(ohci)->self.root_hub->dev))
119 ohci->hc_control |= OHCI_CTRL_RWE; 120 ohci->hc_control |= OHCI_CTRL_RWE;
120 else 121 else {
122 ohci_writel (ohci, OHCI_INTR_RHSC, &ohci->regs->intrdisable);
121 ohci->hc_control &= ~OHCI_CTRL_RWE; 123 ohci->hc_control &= ~OHCI_CTRL_RWE;
124 }
122 125
123 /* Suspend hub ... this is the "global (to this bus) suspend" mode, 126 /* Suspend hub ... this is the "global (to this bus) suspend" mode,
124 * which doesn't imply ports will first be individually suspended. 127 * which doesn't imply ports will first be individually suspended.
@@ -310,20 +313,16 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
310{ 313{
311 struct ohci_hcd *ohci = hcd_to_ohci (hcd); 314 struct ohci_hcd *ohci = hcd_to_ohci (hcd);
312 int i, changed = 0, length = 1; 315 int i, changed = 0, length = 1;
313 int can_suspend;
314 unsigned long flags; 316 unsigned long flags;
315 317
316 can_suspend = device_may_wakeup(&hcd->self.root_hub->dev);
317 spin_lock_irqsave (&ohci->lock, flags); 318 spin_lock_irqsave (&ohci->lock, flags);
318 319
319 /* handle autosuspended root: finish resuming before 320 /* handle autosuspended root: finish resuming before
320 * letting khubd or root hub timer see state changes. 321 * letting khubd or root hub timer see state changes.
321 */ 322 */
322 if (unlikely((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER 323 if (unlikely((ohci->hc_control & OHCI_CTRL_HCFS) != OHCI_USB_OPER
323 || !HC_IS_RUNNING(hcd->state))) { 324 || !HC_IS_RUNNING(hcd->state)))
324 can_suspend = 0;
325 goto done; 325 goto done;
326 }
327 326
328 /* undocumented erratum seen on at least rev D */ 327 /* undocumented erratum seen on at least rev D */
329 if ((ohci->flags & OHCI_QUIRK_AMD756) 328 if ((ohci->flags & OHCI_QUIRK_AMD756)
@@ -348,10 +347,6 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
348 for (i = 0; i < ohci->num_ports; i++) { 347 for (i = 0; i < ohci->num_ports; i++) {
349 u32 status = roothub_portstatus (ohci, i); 348 u32 status = roothub_portstatus (ohci, i);
350 349
351 /* can't autosuspend with active ports */
352 if ((status & RH_PS_PES) && !(status & RH_PS_PSS))
353 can_suspend = 0;
354
355 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC 350 if (status & (RH_PS_CSC | RH_PS_PESC | RH_PS_PSSC
356 | RH_PS_OCIC | RH_PS_PRSC)) { 351 | RH_PS_OCIC | RH_PS_PRSC)) {
357 changed = 1; 352 changed = 1;
@@ -366,42 +361,12 @@ ohci_hub_status_data (struct usb_hcd *hcd, char *buf)
366 /* after root hub changes, stop polling after debouncing 361 /* after root hub changes, stop polling after debouncing
367 * for a while and maybe kicking in autosuspend 362 * for a while and maybe kicking in autosuspend
368 */ 363 */
369 if (changed) { 364 if (changed)
370 ohci->next_statechange = jiffies + STATECHANGE_DELAY; 365 ohci->next_statechange = jiffies + STATECHANGE_DELAY;
371 can_suspend = 0;
372 } else if (time_before (jiffies, ohci->next_statechange)) {
373 can_suspend = 0;
374 } else {
375#ifdef CONFIG_PM
376 can_suspend = can_suspend
377 && !ohci->ed_rm_list
378 && ((OHCI_CTRL_HCFS | OHCI_SCHED_ENABLES)
379 & ohci->hc_control)
380 == OHCI_USB_OPER;
381#endif
382 if (hcd->uses_new_polling) {
383 hcd->poll_rh = 0;
384 /* use INTR_RHSC iff INTR_RD won't apply */
385 if (!can_suspend)
386 ohci_writel (ohci, OHCI_INTR_RHSC,
387 &ohci->regs->intrenable);
388 }
389 }
390 366
391done: 367done:
392 spin_unlock_irqrestore (&ohci->lock, flags); 368 spin_unlock_irqrestore (&ohci->lock, flags);
393 369
394#ifdef CONFIG_PM
395 /* save power by autosuspending idle root hubs;
396 * INTR_RD wakes us when there's work
397 */
398 if (can_suspend && usb_trylock_device (hcd->self.root_hub) == 0) {
399 ohci_vdbg (ohci, "autosuspend\n");
400 (void) ohci_bus_suspend (hcd);
401 usb_unlock_device (hcd->self.root_hub);
402 }
403#endif
404
405 return changed ? length : 0; 370 return changed ? length : 0;
406} 371}
407 372
@@ -572,9 +537,6 @@ static int ohci_hub_control (
572 break; 537 break;
573 case USB_PORT_FEAT_SUSPEND: 538 case USB_PORT_FEAT_SUSPEND:
574 temp = RH_PS_POCI; 539 temp = RH_PS_POCI;
575 if ((ohci->hc_control & OHCI_CTRL_HCFS)
576 != OHCI_USB_OPER)
577 usb_hcd_resume_root_hub(hcd);
578 break; 540 break;
579 case USB_PORT_FEAT_C_SUSPEND: 541 case USB_PORT_FEAT_C_SUSPEND:
580 temp = RH_PS_PSSC; 542 temp = RH_PS_PSSC;