From 5b06d2cdc77951f3ca9b4b3c8dc391725a88807d Mon Sep 17 00:00:00 2001 From: Sriharsha Allenki Date: Tue, 7 Jan 2020 14:34:31 +0530 Subject: [PATCH] usb: dwc3: gadget: Clear delayed_status on reset If the host issued BUS RESET just after the SETUP packet for which the composite device has sent the DELAYED_STATUS, the device does not respond on the next SETUP which is generally GET_DEVICE_DESCRIPTOR. Fix this by clearing the delayed_status on BUS RESET to ensure the response from composite device for GET_DEVICE_DESCRIPTOR can be queued properly on endpoint 0. Change-Id: I5e93b5e3c61eb943443a4ef9ec554de2935dfb4e Signed-off-by: Sriharsha Allenki --- drivers/usb/dwc3/gadget.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index f1da87452e93..e531a94ad0dc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -847,7 +847,7 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep) if (dep->number == 1 && dwc->ep0state != EP0_SETUP_PHASE) { unsigned int dir; - dbg_log_string("CTRLPEND", dwc->ep0state); + dbg_log_string("CTRLPEND(%d)", dwc->ep0state); dir = !!dwc->ep0_expect_in; if (dwc->ep0state == EP0_DATA_PHASE) dwc3_ep0_end_control_data(dwc, dwc->eps[dir]); @@ -3328,7 +3328,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) if (dwc->ep0state != EP0_SETUP_PHASE) { unsigned int dir; - dbg_event(0xFF, "CONTRPEND", dwc->ep0state); + dbg_event(0xFF, "CONTRPEND(%d)", dwc->ep0state); dir = !!dwc->ep0_expect_in; if (dwc->ep0state == EP0_DATA_PHASE) dwc3_ep0_end_control_data(dwc, dwc->eps[dir]); @@ -3337,6 +3337,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc) dwc3_ep0_stall_and_restart(dwc); } + dwc->delayed_status = false; dwc3_stop_active_transfers(dwc); dwc3_clear_stall_all_ep(dwc);