aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/usb/host/ehci-hcd.c23
-rw-r--r--drivers/usb/host/ehci-sched.c14
2 files changed, 20 insertions, 17 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 360712207262..40f7391bf2aa 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -145,6 +145,16 @@ static int handshake (struct ehci_hcd *ehci, void __iomem *ptr,
145 return -ETIMEDOUT; 145 return -ETIMEDOUT;
146} 146}
147 147
148static int handshake_on_error_set_halt(struct ehci_hcd *ehci, void __iomem *ptr,
149 u32 mask, u32 done, int usec)
150{
151 int error = handshake(ehci, ptr, mask, done, usec);
152 if (error)
153 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
154
155 return error;
156}
157
148/* force HC to halt state from unknown (EHCI spec section 2.3) */ 158/* force HC to halt state from unknown (EHCI spec section 2.3) */
149static int ehci_halt (struct ehci_hcd *ehci) 159static int ehci_halt (struct ehci_hcd *ehci)
150{ 160{
@@ -217,11 +227,9 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
217 /* wait for any schedule enables/disables to take effect */ 227 /* wait for any schedule enables/disables to take effect */
218 temp = ehci_readl(ehci, &ehci->regs->command) << 10; 228 temp = ehci_readl(ehci, &ehci->regs->command) << 10;
219 temp &= STS_ASS | STS_PSS; 229 temp &= STS_ASS | STS_PSS;
220 if (handshake (ehci, &ehci->regs->status, STS_ASS | STS_PSS, 230 if (handshake_on_error_set_halt(ehci, &ehci->regs->status,
221 temp, 16 * 125) != 0) { 231 STS_ASS | STS_PSS, temp, 16 * 125))
222 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
223 return; 232 return;
224 }
225 233
226 /* then disable anything that's still active */ 234 /* then disable anything that's still active */
227 temp = ehci_readl(ehci, &ehci->regs->command); 235 temp = ehci_readl(ehci, &ehci->regs->command);
@@ -229,11 +237,8 @@ static void ehci_quiesce (struct ehci_hcd *ehci)
229 ehci_writel(ehci, temp, &ehci->regs->command); 237 ehci_writel(ehci, temp, &ehci->regs->command);
230 238
231 /* hardware can take 16 microframes to turn off ... */ 239 /* hardware can take 16 microframes to turn off ... */
232 if (handshake (ehci, &ehci->regs->status, STS_ASS | STS_PSS, 240 handshake_on_error_set_halt(ehci, &ehci->regs->status,
233 0, 16 * 125) != 0) { 241 STS_ASS | STS_PSS, 0, 16 * 125);
234 ehci_to_hcd(ehci)->state = HC_STATE_HALT;
235 return;
236 }
237} 242}
238 243
239/*-------------------------------------------------------------------------*/ 244/*-------------------------------------------------------------------------*/
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 8a8e08a51ba3..38c606c13db1 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -440,11 +440,10 @@ static int enable_periodic (struct ehci_hcd *ehci)
440 /* did clearing PSE did take effect yet? 440 /* did clearing PSE did take effect yet?
441 * takes effect only at frame boundaries... 441 * takes effect only at frame boundaries...
442 */ 442 */
443 status = handshake(ehci, &ehci->regs->status, STS_PSS, 0, 9 * 125); 443 status = handshake_on_error_set_halt(ehci, &ehci->regs->status,
444 if (status != 0) { 444 STS_PSS, 0, 9 * 125);
445 ehci_to_hcd(ehci)->state = HC_STATE_HALT; 445 if (status)
446 return status; 446 return status;
447 }
448 447
449 cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; 448 cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE;
450 ehci_writel(ehci, cmd, &ehci->regs->command); 449 ehci_writel(ehci, cmd, &ehci->regs->command);
@@ -465,11 +464,10 @@ static int disable_periodic (struct ehci_hcd *ehci)
465 /* did setting PSE not take effect yet? 464 /* did setting PSE not take effect yet?
466 * takes effect only at frame boundaries... 465 * takes effect only at frame boundaries...
467 */ 466 */
468 status = handshake(ehci, &ehci->regs->status, STS_PSS, STS_PSS, 9 * 125); 467 status = handshake_on_error_set_halt(ehci, &ehci->regs->status,
469 if (status != 0) { 468 STS_PSS, STS_PSS, 9 * 125);
470 ehci_to_hcd(ehci)->state = HC_STATE_HALT; 469 if (status)
471 return status; 470 return status;
472 }
473 471
474 cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; 472 cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE;
475 ehci_writel(ehci, cmd, &ehci->regs->command); 473 ehci_writel(ehci, cmd, &ehci->regs->command);