Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b61d5608 authored by Jack Pham's avatar Jack Pham Committed by Gerrit - the friendly Code Review server
Browse files

usb: dwc3: gadget: Update dwc->link_state after reset/disconnect



commit 9a5e551d (usb: dwc3: gadget: Ignore L1 RESUME events)
changed the check in dwc3_gadget_is_suspended() to rely only
on the tracking variable dwc->link_state, rather than actually
reading from the equivalent HW register. However, this variable
is only getting updated in the suspend & wakeup event handlers.
Consequently, a SUSPEND preceding a DISCONNECT will leave this
variable indicating LINK_STATE_U3, and a later re-connect will
fail to enumerate, since function drivers will try to call
dwc3_gadget_ep_queue(), see that is_suspended() is true, and
will bail because of the -EAGAIN that's returned. Fix this by
updating this link_state variable after the RESET and DISCONNECT
events as well.

Change-Id: I76558717661f749f715627a03b1e9298b941d0fb
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent 17dc38a5
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2853,6 +2853,7 @@ static void dwc3_gadget_disconnect_interrupt(struct dwc3 *dwc)

	dwc->gadget.speed = USB_SPEED_UNKNOWN;
	dwc->setup_packet_pending = false;
	dwc->link_state = dwc3_get_link_state(dwc);
}

void dwc3_gadget_usb3_phy_suspend(struct dwc3 *dwc, int suspend)
@@ -2940,6 +2941,7 @@ static void dwc3_gadget_reset_interrupt(struct dwc3 *dwc)
	reg &= ~(DWC3_DCFG_DEVADDR_MASK);
	dwc3_writel(dwc->regs, DWC3_DCFG, reg);
	dwc->gadget.speed = USB_SPEED_UNKNOWN;
	dwc->link_state = dwc3_get_link_state(dwc);
}

static void dwc3_update_ram_clk_sel(struct dwc3 *dwc, u32 speed)