libpayload/udc: dwc2: Add timeout for shutdown operation
BUG=b:24676003 BRANCH=None TEST=Verified that udc shutdown returns after the timeout. Change-Id: I5df598c4eddecbecb353343ef5a4e44eae4fc20b Signed-off-by: Patrick Georgi <pgeorgi@chromium.org> Original-Commit-Id: 268913f21adea9969c9f88e3cb759341a60719f0 Original-Change-Id: I3ee059791d6e821f83f9ac41fd7c5385bd60e21e Original-Signed-off-by: Furquan Shaikh <furquan@google.com> Original-Reviewed-on: https://chromium-review.googlesource.com/310983 Original-Commit-Ready: Furquan Shaikh <furquan@chromium.org> Original-Tested-by: Furquan Shaikh <furquan@chromium.org> Original-Reviewed-by: Aaron Durbin <adurbin@chromium.org> Reviewed-on: http://review.coreboot.org/12347 Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org> Tested-by: build bot (Jenkins)
This commit is contained in:
parent
e78a1bedc5
commit
3d6c95c1cd
|
@ -695,7 +695,12 @@ static void dwc2_shutdown(struct usbdev_ctrl *this)
|
|||
int i, j;
|
||||
int is_empty = 0;
|
||||
|
||||
while (!is_empty) {
|
||||
uint64_t shutdown_timer_us = timer_us(0);
|
||||
/* Wait up to 3 seconds for packets to be flushed out. */
|
||||
uint64_t shutdown_timeout_us = 3 * 1000 * 1000UL;
|
||||
|
||||
while ((!is_empty) &&
|
||||
(timer_us(shutdown_timer_us) < shutdown_timeout_us)) {
|
||||
is_empty = 1;
|
||||
this->poll(this);
|
||||
for (i = 0; i < 16; i++)
|
||||
|
@ -704,6 +709,9 @@ static void dwc2_shutdown(struct usbdev_ctrl *this)
|
|||
is_empty = 0;
|
||||
}
|
||||
|
||||
if (timer_us(shutdown_timer_us) >= shutdown_timeout_us)
|
||||
usb_debug("Error: Failed to empty queues.. timeout\n");
|
||||
|
||||
dwc2_force_shutdown(this);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue