libpayload: Check for completion more often in ehci_set_periodic_schedule.

This function was using mdelay in a loop to check for the completion of an USB
controller operation. Since we're busy waiting anyway, we might as well wait
only 1 us before checking again and potentially seeing the completion 999 us
earlier than we would otherwise.

Change-Id: I177b303c5503a0078c608d5f945c395691d4bd8a
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: http://review.coreboot.org/2522
Tested-by: build bot (Jenkins)
Reviewed-by: Dave Frodin <dave.frodin@se-eng.com>
Reviewed-by: Anton Kochkov <anton.kochkov@gmail.com>
This commit is contained in:
Gabe Black 2012-11-21 02:16:13 -08:00 committed by Stefan Reinauer
parent 1cca340942
commit ef650a5d24
1 changed files with 2 additions and 2 deletions

View File

@ -157,10 +157,10 @@ static int ehci_set_periodic_schedule(ehci_t *ehcic, int enable)
* This shouldn't take too long, but we should timeout nevertheless.
*/
enable = enable ? HC_OP_PERIODIC_SCHED_STAT : 0;
int timeout = 100; /* time out after 100ms */
int timeout = 100000; /* time out after 100ms */
while (((ehcic->operation->usbsts & HC_OP_PERIODIC_SCHED_STAT) != enable)
&& timeout--)
mdelay(1);
udelay(1);
if (timeout < 0) {
usb_debug("ehci periodic schedule status change timed out.\n");
return 1;