diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2006-11-09 14:42:16 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-01 17:25:52 -0500 |
commit | 8c03356a559ced6fa78931f498193f776d67e445 (patch) | |
tree | 56539740dea1febc7cac7a83bde1a56e48e9d5ec /drivers/usb/host/ehci-hcd.c | |
parent | c066475e1fe3b3afbd613ddf5f1eca9be4fb6de0 (diff) |
EHCI: Fix root-hub and port suspend/resume problems
This patch (as738b) fixes numerous problems in the controller/root-hub
suspend/resume/remote-wakeup support in ehci-hcd:
The bus_resume() routine should wake up only the ports that
were suspended by bus_suspend(). Ports that were already
suspended should remain that way.
The interrupt mask is used to detect loss of power in the
bus_resume() routine (if the mask is 0 then power was lost).
However bus_suspend() always sets the mask to 0. Instead the
mask should retain its normal value, with port-change-detect
interrupts disabled if remote wakeup is turned off.
The interrupt mask should be reset to its correct value at the
end of bus_resume() regardless of whether power was lost.
bus_resume() reinitializes the operational registers if power
was lost. However those registers are not in the aux power
well, hence they can lose their values whenever the controller
is put into D3. They should always be reinitialized.
When a port-change interrupt occurs and the root hub is
suspended, the interrupt handler should request a root-hub
resume instead of starting up the controller all by itself.
There's no need for the interrupt handler to request a
root-hub resume every time a suspended port sends a
remote-wakeup request.
The pci_resume() method doesn't need to check for connected
ports when deciding whether or not to reset the controller.
It can make that decision based on whether Vaux power was
maintained.
Even when the controller does not need to be reset,
pci_resume() must undo the effect of pci_suspend() by
re-enabling the interrupt mask.
If power was lost, pci_resume() must not call ehci_run().
At this point the root hub is still supposed to be suspended,
not running. It's enough to rewrite the command register and
set the configured_flag.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index f2ceb5fdbeb7..025d33313681 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -619,9 +619,8 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
619 | unsigned i = HCS_N_PORTS (ehci->hcs_params); | 619 | unsigned i = HCS_N_PORTS (ehci->hcs_params); |
620 | 620 | ||
621 | /* resume root hub? */ | 621 | /* resume root hub? */ |
622 | status = readl (&ehci->regs->command); | 622 | if (!(readl(&ehci->regs->command) & CMD_RUN)) |
623 | if (!(status & CMD_RUN)) | 623 | usb_hcd_resume_root_hub(hcd); |
624 | writel (status | CMD_RUN, &ehci->regs->command); | ||
625 | 624 | ||
626 | while (i--) { | 625 | while (i--) { |
627 | int pstatus = readl (&ehci->regs->port_status [i]); | 626 | int pstatus = readl (&ehci->regs->port_status [i]); |
@@ -638,7 +637,6 @@ static irqreturn_t ehci_irq (struct usb_hcd *hcd) | |||
638 | */ | 637 | */ |
639 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); | 638 | ehci->reset_done [i] = jiffies + msecs_to_jiffies (20); |
640 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); | 639 | ehci_dbg (ehci, "port %d remote wakeup\n", i + 1); |
641 | usb_hcd_resume_root_hub(hcd); | ||
642 | } | 640 | } |
643 | } | 641 | } |
644 | 642 | ||