From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 42932EB64DD for ; Tue, 1 Aug 2023 07:29:39 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 79A5886BE2; Tue, 1 Aug 2023 09:28:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=collabora.com header.i=@collabora.com header.b="Wa7OkyGC"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15E3486C60; Tue, 1 Aug 2023 09:28:42 +0200 (CEST) Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8776E86B4C for ; Tue, 1 Aug 2023 09:28:36 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=quarantine dis=none) header.from=collabora.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=eugen.hristev@collabora.com Received: from eugen-station.. (unknown [82.76.24.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: ehristev) by madras.collabora.co.uk (Postfix) with ESMTPSA id 960A8660718A; Tue, 1 Aug 2023 08:28:35 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1690874916; bh=sB9JAgvcCJAZRxdyABSQeVej8pZs5Skaxy9n2fuBdxw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wa7OkyGC+L6yxSuC2ENVjNnD/8egX7pe5/I3B/YD2qGj4n1E0F4oMUbY+vr63RzWr CkTbyWFJzclzrxhNm60xSTTzZ9c+qrZsL66hQXIJzDovpZnOy87BDn2YWFz6ORBMdZ dIHzXE0MsSyqcoXXOLF2Q09SIQLXMLfU1nXvAlUlklXYqrt34MAO+WsWcclW8+t1dE xqFxENdW70KTyvv1cqEdiTtJbBK6Ne8YlkeQPdnVGLeakOdzzaKvlqI9LtyBLqjXaq bGV9mUr2ub8la2JMICBrQ/qKws9+yfBhTxcWFpaW7PHnvV/9SkCuto7HMLyoo8s/hI 4GYY1B9YF5ftQ== From: Eugen Hristev To: kever.yang@rock-chips.com, u-boot@lists.denx.de Cc: marex@denx.de, jonas@kwiboo.se, jagan@edgeble.ai, eugen.hristev@collabora.com, kernel@collabora.com, Wesley Cheng Subject: [PATCH v2 05/10] usb: dwc3: Increase DWC3 controller halt timeout Date: Tue, 1 Aug 2023 10:28:06 +0300 Message-Id: <20230801072811.10354-6-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230801072811.10354-1-eugen.hristev@collabora.com> References: <20230801072811.10354-1-eugen.hristev@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Since EP0 transactions need to be completed before the controller halt sequence is finished, this may take some time depending on the host and the enabled functions. Increase the controller halt timeout, so that we give the controller sufficient time to handle EP0 transfers. Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/20220901193625.8727-4-quic_wcheng@quicinc.com Cherry-picked from Linux: 461ee467507c ("usb: dwc3: Increase DWC3 controller halt timeout") Signed-off-by: Eugen Hristev --- Not to be merged, I know Marek does not apply any patches to DWC3. drivers/usb/dwc3/gadget.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 24a2c455b0a4..a86680719108 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1356,7 +1356,7 @@ static int dwc3_gadget_set_selfpowered(struct usb_gadget *g, static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) { u32 reg; - u32 timeout = 500; + u32 timeout = 2000; reg = dwc3_readl(dwc->regs, DWC3_DCTL); if (is_on) { @@ -1385,6 +1385,7 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) dwc3_gadget_dctl_write_safe(dwc, reg); do { + mdelay(2); reg = dwc3_readl(dwc->regs, DWC3_DSTS); if (is_on) { if (!(reg & DWC3_DSTS_DEVCTRLHLT)) @@ -1396,7 +1397,6 @@ static int dwc3_gadget_run_stop(struct dwc3 *dwc, int is_on, int suspend) timeout--; if (!timeout) return -ETIMEDOUT; - udelay(1); } while (1); dev_vdbg(dwc->dev, "gadget %s data soft-%s\n", -- 2.34.1