diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2012-04-23 13:54:36 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-04-23 15:05:44 -0400 |
commit | 3d9545cc375d117554a9b35dfddadf9189c62775 (patch) | |
tree | b01707d2e0901665f20bae0f0c5a0930af69651a /drivers/usb/host/ehci-hcd.c | |
parent | 09091a4d5f2dd378dcf71de50b48cdacc58a8ac0 (diff) |
EHCI: maintain the ehci->command value properly
The ehci-hcd driver is a little haphazard about keeping track of the
state of the USBCMD register. The ehci->command field is supposed to
hold the register's value (apart from a few special bits) at all
times, but it isn't maintained properly.
This patch (as1543) cleans up the situation. It keeps ehci->command
up-to-date, and uses that value rather than reading the register from
the hardware whenever possible.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host/ehci-hcd.c')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index a87c0573c860..de1e689d3df0 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -226,8 +226,13 @@ static int ehci_halt (struct ehci_hcd *ehci) | |||
226 | if ((temp & STS_HALT) != 0) | 226 | if ((temp & STS_HALT) != 0) |
227 | return 0; | 227 | return 0; |
228 | 228 | ||
229 | /* | ||
230 | * This routine gets called during probe before ehci->command | ||
231 | * has been initialized, so we can't rely on its value. | ||
232 | */ | ||
233 | ehci->command &= ~CMD_RUN; | ||
229 | temp = ehci_readl(ehci, &ehci->regs->command); | 234 | temp = ehci_readl(ehci, &ehci->regs->command); |
230 | temp &= ~CMD_RUN; | 235 | temp &= ~(CMD_RUN | CMD_IAAD); |
231 | ehci_writel(ehci, temp, &ehci->regs->command); | 236 | ehci_writel(ehci, temp, &ehci->regs->command); |
232 | return handshake (ehci, &ehci->regs->status, | 237 | return handshake (ehci, &ehci->regs->status, |
233 | STS_HALT, STS_HALT, 16 * 125); | 238 | STS_HALT, STS_HALT, 16 * 125); |
@@ -347,6 +352,7 @@ static int ehci_reset (struct ehci_hcd *ehci) | |||
347 | if (ehci->debug) | 352 | if (ehci->debug) |
348 | dbgp_external_startup(); | 353 | dbgp_external_startup(); |
349 | 354 | ||
355 | ehci->command = ehci_readl(ehci, &ehci->regs->command); | ||
350 | ehci->port_c_suspend = ehci->suspended_ports = | 356 | ehci->port_c_suspend = ehci->suspended_ports = |
351 | ehci->resuming_ports = 0; | 357 | ehci->resuming_ports = 0; |
352 | return retval; | 358 | return retval; |
@@ -363,16 +369,14 @@ static void ehci_quiesce (struct ehci_hcd *ehci) | |||
363 | #endif | 369 | #endif |
364 | 370 | ||
365 | /* wait for any schedule enables/disables to take effect */ | 371 | /* wait for any schedule enables/disables to take effect */ |
366 | temp = ehci_readl(ehci, &ehci->regs->command) << 10; | 372 | temp = (ehci->command << 10) & (STS_ASS | STS_PSS); |
367 | temp &= STS_ASS | STS_PSS; | ||
368 | if (handshake_on_error_set_halt(ehci, &ehci->regs->status, | 373 | if (handshake_on_error_set_halt(ehci, &ehci->regs->status, |
369 | STS_ASS | STS_PSS, temp, 16 * 125)) | 374 | STS_ASS | STS_PSS, temp, 16 * 125)) |
370 | return; | 375 | return; |
371 | 376 | ||
372 | /* then disable anything that's still active */ | 377 | /* then disable anything that's still active */ |
373 | temp = ehci_readl(ehci, &ehci->regs->command); | 378 | ehci->command &= ~(CMD_ASE | CMD_PSE); |
374 | temp &= ~(CMD_ASE | CMD_IAAD | CMD_PSE); | 379 | ehci_writel(ehci, ehci->command, &ehci->regs->command); |
375 | ehci_writel(ehci, temp, &ehci->regs->command); | ||
376 | 380 | ||
377 | /* hardware can take 16 microframes to turn off ... */ | 381 | /* hardware can take 16 microframes to turn off ... */ |
378 | handshake_on_error_set_halt(ehci, &ehci->regs->status, | 382 | handshake_on_error_set_halt(ehci, &ehci->regs->status, |