libpayload: udc/dwc2: Ignore setup packet in check for queue empty
during shutdown
DWC2 UDC controller always requires an active packet to be present in
EP0-OUT to ensure proper operation of control plane. Thus, during
shutdown ignore EP0-OUT for queue empty check if only 1 packet is
present.
BUG=b:24676003
BRANCH=None
TEST=Compiles successfully. "fastboot reboot-bootloader" reboots
device without timeout in udc shutdown.
Change-Id: Iafe46c80f58c4cd57f8d58f060d805b603506bbd
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 4e7c27d849c0411aae58e60a24d8170a27ab8485
Original-Change-Id: Ifa493ce0e41964ee7ca8bb3a1f4bb8726fa11173
Original-Signed-off-by: Furquan Shaikh <furquan@google.com>
Original-Reviewed-on: https://chromium-review.googlesource.com/311257
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/12413
Reviewed-by: Furquan Shaikh <furquan@google.com>
Tested-by: build bot (Jenkins)
diff --git a/payloads/libpayload/drivers/udc/dwc2.c b/payloads/libpayload/drivers/udc/dwc2.c
index dc9eb7c..cde3a76 100644
--- a/payloads/libpayload/drivers/udc/dwc2.c
+++ b/payloads/libpayload/drivers/udc/dwc2.c
@@ -704,9 +704,21 @@
is_empty = 1;
this->poll(this);
for (i = 0; i < 16; i++)
- for (j = 0; j < 2; j++)
+ for (j = 0; j < 2; j++) {
+ /*
+ * EP0-OUT needs to always have an active packet
+ * for proper operation of control packet
+ * flow. Thus, ignore if only 1 packet is
+ * present in EP0-OUT.
+ */
+ if ((i == 0) && (j == 0) &&
+ SIMPLEQ_SINGLETON(&p->eps[0][0].job_queue,
+ queue))
+ continue;
+
if (!SIMPLEQ_EMPTY(&p->eps[i][j].job_queue))
is_empty = 0;
+ }
}
if (timer_us(shutdown_timer_us) >= shutdown_timeout_us)