mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
UPSTREAM: usb: dwc3: gadget: Submit endxfer command if delayed during disconnect
During a cable disconnect sequence, if ep0state is not in the SETUP phase,
then nothing will trigger any pending end transfer commands. Force
stopping of any pending SETUP transaction, and move back to the SETUP
phase.
Reviewed-by: Thinh Nguyen <Thinh.Nguyen@synopsys.com>
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
Link: https://lore.kernel.org/r/20220901193625.8727-6-quic_wcheng@quicinc.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Bug: 318577849
Change-Id: I7845e7730e48b0e6de5e2a428c6e6c310602771a
(cherry picked from commit 8422b769fa)
Signed-off-by: Wesley Cheng <quic_wcheng@quicinc.com>
This commit is contained in:
committed by
Matthias Männich
parent
02524b7519
commit
b68fafef56
@@ -3725,13 +3725,24 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)
|
||||
reg &= ~DWC3_DCTL_INITU2ENA;
|
||||
dwc3_gadget_dctl_write_safe(dwc, reg);
|
||||
|
||||
dwc->connected = false;
|
||||
|
||||
dwc3_disconnect_gadget(dwc);
|
||||
|
||||
dwc->gadget->speed = USB_SPEED_UNKNOWN;
|
||||
dwc->setup_packet_pending = false;
|
||||
usb_gadget_set_state(dwc->gadget, USB_STATE_NOTATTACHED);
|
||||
|
||||
dwc->connected = false;
|
||||
if (dwc->ep0state != EP0_SETUP_PHASE) {
|
||||
unsigned int dir;
|
||||
|
||||
dir = !!dwc->ep0_expect_in;
|
||||
if (dwc->ep0state == EP0_DATA_PHASE)
|
||||
dwc3_ep0_end_control_data(dwc, dwc->eps[dir]);
|
||||
else
|
||||
dwc3_ep0_end_control_data(dwc, dwc->eps[!dir]);
|
||||
dwc3_ep0_stall_and_restart(dwc);
|
||||
}
|
||||
}
|
||||
|
||||
static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
|
||||
|
||||
Reference in New Issue
Block a user