aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-sched.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r--drivers/usb/host/ehci-sched.c55
1 files changed, 28 insertions, 27 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index a60679cbbf8..33182c6d1ff 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -481,7 +481,6 @@ static int tt_no_collision (
481 481
482static int enable_periodic (struct ehci_hcd *ehci) 482static int enable_periodic (struct ehci_hcd *ehci)
483{ 483{
484 u32 cmd;
485 int status; 484 int status;
486 485
487 if (ehci->periodic_sched++) 486 if (ehci->periodic_sched++)
@@ -497,8 +496,8 @@ static int enable_periodic (struct ehci_hcd *ehci)
497 return status; 496 return status;
498 } 497 }
499 498
500 cmd = ehci_readl(ehci, &ehci->regs->command) | CMD_PSE; 499 ehci->command |= CMD_PSE;
501 ehci_writel(ehci, cmd, &ehci->regs->command); 500 ehci_writel(ehci, ehci->command, &ehci->regs->command);
502 /* posted write ... PSS happens later */ 501 /* posted write ... PSS happens later */
503 502
504 /* make sure ehci_work scans these */ 503 /* make sure ehci_work scans these */
@@ -511,7 +510,6 @@ static int enable_periodic (struct ehci_hcd *ehci)
511 510
512static int disable_periodic (struct ehci_hcd *ehci) 511static int disable_periodic (struct ehci_hcd *ehci)
513{ 512{
514 u32 cmd;
515 int status; 513 int status;
516 514
517 if (--ehci->periodic_sched) 515 if (--ehci->periodic_sched)
@@ -537,8 +535,8 @@ static int disable_periodic (struct ehci_hcd *ehci)
537 return status; 535 return status;
538 } 536 }
539 537
540 cmd = ehci_readl(ehci, &ehci->regs->command) & ~CMD_PSE; 538 ehci->command &= ~CMD_PSE;
541 ehci_writel(ehci, cmd, &ehci->regs->command); 539 ehci_writel(ehci, ehci->command, &ehci->regs->command);
542 /* posted write ... */ 540 /* posted write ... */
543 541
544 free_cached_lists(ehci); 542 free_cached_lists(ehci);
@@ -1333,34 +1331,36 @@ sitd_slot_ok (
1333 if (mask & ~0xffff) 1331 if (mask & ~0xffff)
1334 return 0; 1332 return 0;
1335 1333
1334 /* check bandwidth */
1335 uframe %= period_uframes;
1336 frame = uframe >> 3;
1337
1338#ifdef CONFIG_USB_EHCI_TT_NEWSCHED
1339 /* The tt's fullspeed bus bandwidth must be available.
1340 * tt_available scheduling guarantees 10+% for control/bulk.
1341 */
1342 uf = uframe & 7;
1343 if (!tt_available(ehci, period_uframes >> 3,
1344 stream->udev, frame, uf, stream->tt_usecs))
1345 return 0;
1346#else
1347 /* tt must be idle for start(s), any gap, and csplit.
1348 * assume scheduling slop leaves 10+% for control/bulk.
1349 */
1350 if (!tt_no_collision(ehci, period_uframes >> 3,
1351 stream->udev, frame, mask))
1352 return 0;
1353#endif
1354
1336 /* this multi-pass logic is simple, but performance may 1355 /* this multi-pass logic is simple, but performance may
1337 * suffer when the schedule data isn't cached. 1356 * suffer when the schedule data isn't cached.
1338 */ 1357 */
1339
1340 /* check bandwidth */
1341 uframe %= period_uframes;
1342 do { 1358 do {
1343 u32 max_used; 1359 u32 max_used;
1344 1360
1345 frame = uframe >> 3; 1361 frame = uframe >> 3;
1346 uf = uframe & 7; 1362 uf = uframe & 7;
1347 1363
1348#ifdef CONFIG_USB_EHCI_TT_NEWSCHED
1349 /* The tt's fullspeed bus bandwidth must be available.
1350 * tt_available scheduling guarantees 10+% for control/bulk.
1351 */
1352 if (!tt_available (ehci, period_uframes << 3,
1353 stream->udev, frame, uf, stream->tt_usecs))
1354 return 0;
1355#else
1356 /* tt must be idle for start(s), any gap, and csplit.
1357 * assume scheduling slop leaves 10+% for control/bulk.
1358 */
1359 if (!tt_no_collision (ehci, period_uframes << 3,
1360 stream->udev, frame, mask))
1361 return 0;
1362#endif
1363
1364 /* check starts (OUT uses more than one) */ 1364 /* check starts (OUT uses more than one) */
1365 max_used = ehci->uframe_periodic_max - stream->usecs; 1365 max_used = ehci->uframe_periodic_max - stream->usecs;
1366 for (tmp = stream->raw_mask & 0xff; tmp; tmp >>= 1, uf++) { 1366 for (tmp = stream->raw_mask & 0xff; tmp; tmp >>= 1, uf++) {
@@ -2358,7 +2358,8 @@ restart:
2358 * in the previous frame for completions. 2358 * in the previous frame for completions.
2359 */ 2359 */
2360 if (q.fstn->hw_prev != EHCI_LIST_END(ehci)) { 2360 if (q.fstn->hw_prev != EHCI_LIST_END(ehci)) {
2361 dbg ("ignoring completions from FSTNs"); 2361 ehci_dbg(ehci,
2362 "ignoring completions from FSTNs\n");
2362 } 2363 }
2363 type = Q_NEXT_TYPE(ehci, q.fstn->hw_next); 2364 type = Q_NEXT_TYPE(ehci, q.fstn->hw_next);
2364 q = q.fstn->fstn_next; 2365 q = q.fstn->fstn_next;
@@ -2441,7 +2442,7 @@ restart:
2441 q = *q_p; 2442 q = *q_p;
2442 break; 2443 break;
2443 default: 2444 default:
2444 dbg ("corrupt type %d frame %d shadow %p", 2445 ehci_dbg(ehci, "corrupt type %d frame %d shadow %p\n",
2445 type, frame, q.ptr); 2446 type, frame, q.ptr);
2446 // BUG (); 2447 // BUG ();
2447 q.ptr = NULL; 2448 q.ptr = NULL;