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 D2DC4EB64D8 for ; Thu, 22 Jun 2023 10:01:24 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 515C8863A5; Thu, 22 Jun 2023 12:00:00 +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="VLJ4JkkD"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 81C1D8591B; Thu, 22 Jun 2023 11:59:38 +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 1929D862FD for ; Thu, 22 Jun 2023 11:59:31 +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 [192.166.149.251]) (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 13590660703A; Thu, 22 Jun 2023 10:59:30 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1687427970; bh=4kglrBBeFwQpfBAPdy0y7r2fWegrqD52kAeNGxROlww=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VLJ4JkkDYpYG4iE5gcSIlMkCQJfmSk8E1UunOdsqnmzOK+omAx9zFkLJl/DQtsYux oOj2n20QkUzuduGyDMQkNYKViLuJRfPocO33MoaRZ+z2LsqEQH9Ryd6O2L7s4fvQTg q/CF1RrMaFVw3dZyaSA1Ewh5cgCAkQclWHLRc1NbuE6Jghme5ew1MKK3zTEY4KxofQ k8ZPjdBsCk0f3TVjPwKajAgLzwamH97xG+Gcg8bUegzvZ8nDxNKQupnsjoLMNnWsC5 7A0ewmeIKclP5kVnKKOr+lVCWIanrcLXE3qaBr7ddnCwCXhUQ4mFq0yEZQpB+Ixt5z wRGgGrmZjMSag== From: Eugen Hristev To: kever.yang@rock-chips.com Cc: marex@denx.de, jonas@kwiboo.se, jagan@edgeble.ai, venkatesh.abbarapu@amd.com, eugen.hristev@collabora.com, u-boot@lists.denx.de, Wesley Cheng Subject: [PATCH 05/10] usb: dwc3: Increase DWC3 controller halt timeout Date: Thu, 22 Jun 2023 12:58:44 +0300 Message-Id: <20230622095849.498702-6-eugen.hristev@collabora.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230622095849.498702-1-eugen.hristev@collabora.com> References: <20230622095849.498702-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 --- Sent for consistency, I know Marek does not accept 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