From fe35623f20c4e94e59630143e6a01717f69851e8 Mon Sep 17 00:00:00 2001 From: Furquan Shaikh Date: Fri, 6 Nov 2015 22:22:56 -0800 Subject: 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 Original-Commit-Id: 4e7c27d849c0411aae58e60a24d8170a27ab8485 Original-Change-Id: Ifa493ce0e41964ee7ca8bb3a1f4bb8726fa11173 Original-Signed-off-by: Furquan Shaikh Original-Reviewed-on: https://chromium-review.googlesource.com/311257 Original-Commit-Ready: Furquan Shaikh Original-Tested-by: Furquan Shaikh Original-Reviewed-by: Aaron Durbin Reviewed-on: http://review.coreboot.org/12413 Reviewed-by: Furquan Shaikh Tested-by: build bot (Jenkins) --- payloads/libpayload/drivers/udc/dwc2.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'payloads/libpayload/drivers') diff --git a/payloads/libpayload/drivers/udc/dwc2.c b/payloads/libpayload/drivers/udc/dwc2.c index dc9eb7c3f5..cde3a76c06 100644 --- a/payloads/libpayload/drivers/udc/dwc2.c +++ b/payloads/libpayload/drivers/udc/dwc2.c @@ -704,9 +704,21 @@ static void dwc2_shutdown(struct usbdev_ctrl *this) 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) -- cgit v1.2.3