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 smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 61D71C61CE3 for ; Mon, 24 Aug 2026 16:45:27 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 03E4780F03; Mon, 24 Aug 2026 16:45:27 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ieNI02gbnZGK; Mon, 24 Aug 2026 16:45:24 +0000 (UTC) X-Comment: SPF check N/A for local connections - client-ip=140.211.166.142; helo=lists1.osuosl.org; envelope-from=u-boot-bounces@lists.u-boot-project.org; receiver= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=lists.u-boot-project.org; s=default; t=1787589879; bh=/KFNr8DKTP66lbcycGlalqZwtlVGRomEuOkj6qwfZXU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Zhy3lmpt0dXymhWgEbSgTyFsBHHPeyddSz+97CU/Abd+qZLMRZzwPufWMDCXW9uje hb8+ph7daCnHJMil6xIABlP26QLFQ/5inWBrHCWWy5+EopKhUWvgFJQ2AhmhDozKOJ mDMZHUHWTbHLblEKE+z2tbob9lrMk3zThLwUB1XGEa2YDYnU7aqUZ+J4FLaBdX98L/ d4kt875H4oVs2tV6jG/8cqUtgWaJXcV3uHy26/G7Go1hT5jdJ6Pg2Lwf60mR4a4HeY eOa4PZjK8iHXTZ0a/1wbxdu2bfEkJTAmiOPZYoYqtUCppsGxdAWWmKHXGZ+CfCi2dF spUgKfTBvdxEw== Received: from lists1.osuosl.org (lists1.osuosl.org [140.211.166.142]) by smtp1.osuosl.org (Postfix) with ESMTP id E4D6580D50; Mon, 24 Aug 2026 16:44:38 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [IPv6:2605:bc80:3010::136]) by lists1.osuosl.org (Postfix) with ESMTP id 58C95279 for ; Mon, 24 Aug 2026 15:29:46 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 3F14B6062C for ; Mon, 24 Aug 2026 15:29:46 +0000 (UTC) X-Virus-Scanned: amavis at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavis, port 10024) with ESMTP id 0-nkPcF47LOK for ; Mon, 24 Aug 2026 15:29:45 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=2a00:1450:4864:20::62b; helo=mail-ej1-x62b.google.com; envelope-from=anders.roxell@linaro.org; receiver= Authentication-Results: smtp3.osuosl.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.a=rsa-sha256 header.s=google header.b=hp5imiHC Received: from mail-ej1-x62b.google.com (mail-ej1-x62b.google.com [IPv6:2a00:1450:4864:20::62b]) by smtp3.osuosl.org (Postfix) with ESMTPS id D90C760626 for ; Mon, 24 Aug 2026 15:29:44 +0000 (UTC) Received: by mail-ej1-x62b.google.com with SMTP id a640c23a62f3a-c15f025146dso49191866b.2 for ; Mon, 24 Aug 2026 08:29:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1787585383; x=1788190183; darn=lists.u-boot-project.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to:content-type; bh=/KFNr8DKTP66lbcycGlalqZwtlVGRomEuOkj6qwfZXU=; b=hp5imiHCCBk1RTyPdnE7Ccn4RfZOuEqExjSoaciTP9Jdk7AFRVKZfIeeoze1huEDip iJCAArfmT2rcA2UDkBeKzDjevxSO7raqLKZI0XVCd0rttypGPKxegYzWMk66CZXnIsV+ v0yzB2efYWE/Do7Ps+leqT/Lm93Fou3wzP3xkO+b4wHA2WDiozdNj1KV4611uYhe+AoV UzsGIzijyb/AOB+ye6c3lOwVBcnp9LLhkR792wKpNrgiIklGbUvFXiAD+ae5UBgOj02I I5b2lQpcxeRSONEUk37P8XOT+LIhYPV0fgRxNQsvA1vI1MSX28EF+JAZunUuB9zJcw9p FtMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787585383; x=1788190183; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to:content-type; bh=/KFNr8DKTP66lbcycGlalqZwtlVGRomEuOkj6qwfZXU=; b=NAN+vApmnfvRDVVcj0mvHpBGwj65e+Gv8uW8U26JMm3uqXxjg9axTj8Jm0FrZLDcQw 6IDc3A61oWgFC8aBlddR25knt0WItKUGv96weQ5Db9yO0Wfc35EjvJWE/9jOxAPNezI/ iH7FboVawAPmEvQbAimFdhBNkOUdugx8BTUlwmZVQ16UjNZE+u/1FKxq6m6mYgb2J1eM cBEMSv7Vg4SIXK7YfFRGzuk9m3PKLwxKKizqETpUPfLXn6ljYl7Fc9HeYM011/25dGn7 mEphqZ6UeqxoEenp9OHmg0wuJ4OT0FEdO9AzxBu6B/JZZiXE2XPRBFctOd7ltZ9Q0tAj bjPA== X-Gm-Message-State: AFuF++kwT9KyapgFIuyNmzpc/YpnWLQKG0QYf6/c9zJt9bhaGH/6otUF zPrC8P/ZQKtyYTjV/eHvZs/kbYHVMFIXC0x6hzlUUL47Zans3edh+KZGdb599fGo+SK/dF5+mVX e0txL X-Gm-Gg: AR+sD11HnDLdmz0Bbf+N+FbASbD0CoLTRxeVrXs/d1wQ8Y43Kgx4hbNo1xli9eNW0kB vacG62EGCaS1CFCJAE++YHWQOgDmJsMY6Fsu/YUGTkfPpq9cZJ2lCBB9rHE/JU3wayysTYfmvC2 wd/XZHHNbT1cLS/y+uTGi7sjipvrohJEI/oVp7bseLhu7fkt2SCCICrColz6o5I7G2DhTVRjaZ4 3AycSc2lbX6pCxcA1gepbMvrlXEYJk6nV28JsprQgd93hwcCLbmFCl+iSpnv2qwgevoUhZP2stV pzKv8uKdejV7MZx9yiOerT7bxmySEBnAKbFkLOJB7hJrRt6u1hy98/8s6DfYtptL0V4XOptlsWw +y4tnRADYRV7X1vQzjvm+8fH5seHSklZcjaiRZdLRkwwxVZeZP/EBKdpR9Icux6cP+CakOC2opP +GLnTJx6fAYEuOfMot3sxCrv80yzWUjpC9293SVvYoTKhwA8oBj44OCLfMWYCg/XZ8m38XN+it2 /Fin8RXBgWj7Gzi2+6FxQ== X-Received: by 2002:a17:906:f59a:b0:c21:7bf1:2c88 with SMTP id a640c23a62f3a-c246a67540dmr1429497766b.2.1787585382548; Mon, 24 Aug 2026 08:29:42 -0700 (PDT) Received: from monster (c-85-229-7-191.bbcust.telenor.se. [85.229.7.191]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c24962bbea6sm1228499066b.27.2026.08.24.08.29.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Aug 2026 08:29:41 -0700 (PDT) From: Anders Roxell To: u-boot@lists.u-boot-project.org Cc: marek.vasut@mailbox.org, trini@konsulko.com, ilias.apalodimas@linaro.org, michal.simek@amd.com, lukma@denx.de, alchark@flipper.net, jerome.forissier@arm.com, Jens Wiklander , Simon Glass , Anders Roxell , Mattijs Korpershoek Subject: [PATCH v7 27/63] usb: dwc3: import from kernel v5.2 Date: Mon, 24 Aug 2026 17:26:58 +0200 Message-ID: <20260824152734.159794-28-anders.roxell@linaro.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260824152734.159794-1-anders.roxell@linaro.org> References: <20260824152734.159794-1-anders.roxell@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Mailman-Approved-At: Mon, 24 Aug 2026 16:43:55 +0000 X-BeenThere: u-boot@lists.u-boot-project.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.u-boot-project.org From: Jens Wiklander Sync Linux kernel dwc3 changes from v5.1 to v5.2. The following files are preserved across the import: Makefile Kconfig dwc3-meson-g12a.c dwc3-meson-gxl.c dwc3-omap.c dwc3-uniphier.c dwc3-generic.h dwc3-generic.c dwc3-generic-sti.c dwc3-layerscape.c ti_usb_phy.c Skipping unused files: debugfs.c drd.c dwc3-exynos.c dwc3-haps.c dwc3-imx8mp.c dwc3-keystone.c dwc3-octeon.c dwc3-of-simple.c dwc3-pci.c dwc3-qcom.c dwc3-qcom-legacy.c dwc3-rtk.c dwc3-st.c dwc3-xilinx.c host.c trace.c trace.h ulpi.c Note that this is a raw import and doesn't build. A fixup commit at the end of the series fixes that. List of commits: git log --oneline v5.1..v5.2 Commits imported: 2e487d280525 usb: dwc3: Rename DWC3_DCTL_LPM_ERRATA 8d791929b2fb usb: dwc3: Fix default lpm_nyet_threshold value dd24f9b604d3 usb: dwc3: debug: Print GET_STATUS(device) tracepoint b873e2d0ea1e usb: dwc3: Do core validation early on probe c729969b2b69 usb: dwc3: gadget: Set lpm_capable 41a91c606e7d usb: dwc3: move synchronize_irq() out of the spinlock protected block 75ecb9dd56a7 usb: dwc3: Free resource immediately after use Signed-off-by: Jens Wiklander Reviewed-by: Simon Glass Signed-off-by: Anders Roxell Reviewed-by: Mattijs Korpershoek --- drivers/usb/dwc3/core.c | 18 +++++++++++------- drivers/usb/dwc3/core.h | 3 +-- drivers/usb/dwc3/debug.h | 3 +++ drivers/usb/dwc3/gadget.c | 5 ++--- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index a1b126f90261..4aff1d8dbc4f 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -828,6 +828,7 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) ret = device_property_read_u32_array(dev, "snps,incr-burst-type-adjustment", vals, ntype); if (ret) { + kfree(vals); dev_err(dev, "Error to get property\n"); return; } @@ -846,6 +847,8 @@ static void dwc3_set_incr_burst_type(struct dwc3 *dwc) incrx_mode = INCRX_BURST_MODE; } + kfree(vals); + /* Enable Undefined Length INCR Burst and Enable INCRx Burst */ cfg &= ~DWC3_GSBUSCFG0_INCRBRST_MASK; if (incrx_mode) @@ -893,12 +896,6 @@ static int dwc3_core_init(struct dwc3 *dwc) u32 reg; int ret; - if (!dwc3_core_is_valid(dwc)) { - dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); - ret = -ENODEV; - goto err0; - } - /* * Write Linux Version Code to our GUID register so it's easy to figure * out which kernel version a bug was found. @@ -1218,7 +1215,7 @@ static void dwc3_get_properties(struct dwc3 *dwc) u8 tx_max_burst_prd; /* default to highest possible threshold */ - lpm_nyet_threshold = 0xff; + lpm_nyet_threshold = 0xf; /* default to -3.5dB de-emphasis */ tx_de_emphasis = 1; @@ -1426,6 +1423,11 @@ static int dwc3_probe(struct platform_device *pdev) dwc->regs = regs; dwc->regs_size = resource_size(&dwc_res); + if (!dwc3_core_is_valid(dwc)) { + dev_err(dwc->dev, "this is not a DesignWare USB3 DRD Core\n"); + return -ENODEV; + } + dwc3_get_properties(dwc); dwc->reset = devm_reset_control_get_optional_shared(dev, NULL); @@ -1600,6 +1602,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) spin_lock_irqsave(&dwc->lock, flags); dwc3_gadget_suspend(dwc); spin_unlock_irqrestore(&dwc->lock, flags); + synchronize_irq(dwc->irq_gadget); dwc3_core_exit(dwc); break; case DWC3_GCTL_PRTCAP_HOST: @@ -1632,6 +1635,7 @@ static int dwc3_suspend_common(struct dwc3 *dwc, pm_message_t msg) spin_lock_irqsave(&dwc->lock, flags); dwc3_gadget_suspend(dwc); spin_unlock_irqrestore(&dwc->lock, flags); + synchronize_irq(dwc->irq_gadget); } dwc3_otg_exit(dwc); diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h index 1528d395b156..f19cbeb01087 100644 --- a/drivers/usb/dwc3/core.h +++ b/drivers/usb/dwc3/core.h @@ -406,8 +406,7 @@ #define DWC3_DCTL_TRGTULST_SS_INACT (DWC3_DCTL_TRGTULST(6)) /* These apply for core versions 1.94a and later */ -#define DWC3_DCTL_LPM_ERRATA_MASK DWC3_DCTL_LPM_ERRATA(0xf) -#define DWC3_DCTL_LPM_ERRATA(n) ((n) << 20) +#define DWC3_DCTL_NYET_THRES(n) (((n) & 0xf) << 20) #define DWC3_DCTL_KEEP_CONNECT BIT(19) #define DWC3_DCTL_L1_HIBER_EN BIT(18) diff --git a/drivers/usb/dwc3/debug.h b/drivers/usb/dwc3/debug.h index 6759a7efd8d5..068259fdfb0c 100644 --- a/drivers/usb/dwc3/debug.h +++ b/drivers/usb/dwc3/debug.h @@ -250,6 +250,9 @@ static inline void dwc3_decode_get_status(__u8 t, __u16 i, __u16 l, char *str, size_t size) { switch (t & USB_RECIP_MASK) { + case USB_RECIP_DEVICE: + snprintf(str, size, "Get Device Status(Length = %d)", l); + break; case USB_RECIP_INTERFACE: snprintf(str, size, "Get Interface Status(Intf = %d, Length = %d)", i, l); diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index e293400cc6e9..d67655384eb2 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2863,7 +2863,7 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc) "LPM Erratum not available on dwc3 revisions < 2.40a\n"); if (dwc->has_lpm_erratum && dwc->revision >= DWC3_REVISION_240A) - reg |= DWC3_DCTL_LPM_ERRATA(dwc->lpm_nyet_threshold); + reg |= DWC3_DCTL_NYET_THRES(dwc->lpm_nyet_threshold); dwc3_writel(dwc->regs, DWC3_DCTL, reg); } else { @@ -3301,6 +3301,7 @@ int dwc3_gadget_init(struct dwc3 *dwc) dwc->gadget.sg_supported = true; dwc->gadget.name = "dwc3-gadget"; dwc->gadget.is_otg = dwc->dr_mode == USB_DR_MODE_OTG; + dwc->gadget.lpm_capable = true; /* * FIXME We might be setting max_speed to irq_gadget); - return 0; } -- 2.53.0