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

Commit 9ce8d0f3 authored by Mayank Rana's avatar Mayank Rana
Browse files

dwc3: gadget: Stop active transfers before stopping USB device controller



Stop all active data transfers before clearing run/stop bit per Synopsys
databook. Hence call dwc3_stop_active_transfers() API before stopping USB
device controller.

CRs-Fixed: 2194063
Change-Id: I21b1556ce2c69cdbed744191d6fabae7a37ae061
Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
parent 65ca63e7
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@

static void dwc3_gadget_wakeup_interrupt(struct dwc3 *dwc, bool remote_wakeup);
static int dwc3_gadget_wakeup_int(struct dwc3 *dwc);
static void dwc3_stop_active_transfers(struct dwc3 *dwc);
/**
 * dwc3_gadget_set_test_mode - Enables USB2 Test Modes
 * @dwc: pointer to our context structure
@@ -2034,6 +2035,14 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend)
		__dwc3_gadget_ep_disable(dwc->eps[0]);
		__dwc3_gadget_ep_disable(dwc->eps[1]);

		/*
		 * According to dwc3 databook, it is must to remove any active
		 * transfers before trying to stop USB device controller. Hence
		 * call dwc3_stop_active_transfers() API before stopping USB
		 * device controller.
		 */
		dwc3_stop_active_transfers(dwc);

		reg &= ~DWC3_DCTL_RUN_STOP;

		if (dwc->has_hibernation && !suspend)