From nobody Thu Sep 24 15:11:50 2026 Received: from CO1PR03CU002.outbound.protection.outlook.com (mail-westus2azon11010063.outbound.protection.outlook.com [52.101.46.63]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 857A93E6399; Tue, 22 Sep 2026 18:21:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.46.63 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790101318; cv=fail; b=a1otTWIYj2Rjw9I76Qua6SgA+kd0epdLjRMnqU/Fi4GrV5HlTqWk4+LaRUBD2GJv6gLrbP29s1Jyh0wa/iKwnI8Kgv4Aqyzo0HdcrU+t4l3nZ/0hX7GArXwQUqBmEmniCsnYP0j+2b+ScZyfCFxl/F/5mc+/TFu02HlBPZO3soY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790101318; c=relaxed/simple; bh=gIzUW0Ii8oj9cUJFvJSstkx6pBaBvo+oS+z9mKnsEPo=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ELkD2PA16SCe4AYe1IZjHK7k1I8VSXgMsxycKlY3i0z3Vx1EbIfUQUY6OuDvAOjJvL0hv3jCb57T4gnQ+YOIpjhRjR+ahDGREdpaGC+0aXjohvpMHvbgPmkFEdHTi9Tw2xe69LOnlRw3XfaXXQWZ/janukaYOh8vm6KyGHhLMHs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=dVX0eIqq; arc=fail smtp.client-ip=52.101.46.63 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="dVX0eIqq" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uAWLK0iN4A2aiNVItSZqB041cgCStr0isoxKrU3UB3T218mMo08bCY0MkQAOy6w7FOIH8/iuWvxucET/pOQR3C8QoC/4XRThFlP49ZZtDQpuQgYswprGpePCSzG1S6pCvaht9aBzL69yrlhJDECO+ea+HryQcg/OZX7zHdOYP3UZ1CiTjtH9Yp2FXbm7SZA91R6jJ0d+Bw+NSZz24HzexIxBcRYcWgjB+Jm5xpHbVW40x3kv95H17A2t8e3QEcDA0PVxsDrlJuY9m0+9H65lYfNJwyRz888Ly+hEEe5nz7hJL1lWMDN6opRs8em2BhzFOyrmKupmGEEuDGLdtuITjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5Y+2bKC+1zppb1lKc08MiOvCJKQVmQw34cnoLKfiBTQ=; b=pNINfwFg4XCSdB8AzOSfk05xlyKcumCtgFnyaF6BjTQgB7FrLN64OeELquuRW+TUB9F/FtcoPtEp8MpLaeDt98bmGgCh73AKohrvPxY5c7hiwBWouumDzmjqBAoF6ci6EjrUheg3ccBV/+5FcnMmoewxbpBHO4rXfVf0sovoSwfhHkBkTn6vXMTLOELZYAJRryxc38yoHI3dIy/N2TRPA4mWs4rL8uc96DaoJnd7JlCSsWsF08khQTvGngDVSY1I5DcukpDQ0l6IKoFyNreF5dgeo5+2+mgFK4ocwOaBXrCe4JxnFu7LMJtTnOPPzuMC3+k97Qg34TjU3TwDslPKoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=synopsys.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5Y+2bKC+1zppb1lKc08MiOvCJKQVmQw34cnoLKfiBTQ=; b=dVX0eIqqHsr3iYPM/x+aehmqWYF9cM3B5YG4jM19IMWi1KEaRxxOz49n5oElt3sKMzT4OqPbgaQcryYz9q0AE9VzgfreMy2eLFItNSwt6+dxxeYJ0v7G/sS970khtw/VD1GKTP61lqreeikGW034uOFoCVpXO9hc4cujwGflwA4= Received: from PH7P220CA0082.NAMP220.PROD.OUTLOOK.COM (2603:10b6:510:32c::17) by MW3PR12MB4492.namprd12.prod.outlook.com (2603:10b6:303:57::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.14; Tue, 22 Sep 2026 18:21:50 +0000 Received: from BY1PEPF000264B3.namprd02.prod.outlook.com (2603:10b6:510:32c:cafe::a8) by PH7P220CA0082.outlook.office365.com (2603:10b6:510:32c::17) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.451.14 via Frontend Transport; Tue, 22 Sep 2026 18:21:49 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BY1PEPF000264B3.mail.protection.outlook.com (10.167.242.120) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Tue, 22 Sep 2026 18:21:49 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 22 Sep 2026 13:21:48 -0500 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 22 Sep 2026 13:21:48 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.49 via Frontend Transport; Tue, 22 Sep 2026 13:21:46 -0500 From: Radhey Shyam Pandey To: , , , CC: , , , Radhey Shyam Pandey , Subject: [PATCH v2 1/3] usb: dwc3: xilinx: fix system suspend and resume PHY handling Date: Tue, 22 Sep 2026 23:51:23 +0530 Message-ID: <20260922182125.11067-2-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260922182125.11067-1-radhey.shyam.pandey@amd.com> References: <20260922182125.11067-1-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY1PEPF000264B3:EE_|MW3PR12MB4492:EE_ X-MS-Office365-Filtering-Correlation-Id: 4928345a-4a59-4bd8-8dcb-08df18d65e5d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|376014|23010399003|6133799003|18002099003|22082099003|11063799006|10067099003|56012099006; X-Microsoft-Antispam-Message-Info: BuXuaWgNwywpjNtl0qAFcAkmK3DXqYuP4WBSPQ7bcbkYYPXQShLIu5zLNaDXok3PTTX5wHy1E7y/6l08aOQH9G9RBdtW6et9AhDY2ETPIIxHBQ3bnUbI693ZzqpRs9M6npnYSpiPp78owsXw9xE8jXx5/IOzt8YaarE62yNqLAKj6VUW4cOh4xgQl5OVUe/folwLCPxOsOCWmVOzZO8wMS7zJfPFfnsyWl7BYQBTEXPQxlv+tckJXVadu7TTuFotkFOXTSKINomdHkqcpeVx4Y0178KtJ1Xk8Hxpf1yGE6F+3CJ9fjoVOb69lZeiBLDULXLkua10+AlTepUkqIYEYjuqljwdqMcor3GZ8wtJmwZcfqzrpgcAAF+0NXszgV2O8D4tGlVd5w0D61t45fUX95mx/L2+NOTIuwm6FbJOvAKkg+cZiiaUTTcSRfaVRMng2rMlxfQHVk2rT8XR/DVZMbaP7FrwU6+hClIMFe1wfdEF8PR1poKaLQlMv71XKSCedqBymPFqMu5EzLpKiAbufOMB2MV7Q2s5ZinWx80rp5Fud989iIfuVZlk4IwOjeWVgvvBK0PbChIDTQBVboQE3wJWtnkCuto0jqdoJTBRfBuHXO7pxcfjsICWp3bvsvpyExatYsguErpzJ7AIYkL+x1R2AZrOZomagGJNCmv5i0tBnaZnSPDaTfzC0l9CN+v6exoFZpe5Quj7Y7l2dmqd2Q== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700016)(82310400026)(376014)(23010399003)(6133799003)(18002099003)(22082099003)(11063799006)(10067099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lOkRwLpSEqKRO0MBND2JNHCx9UXmGxL9qAXKYqbRupBic7NU0jfO9x2/AByertQ+8pQwZ6w0uaP43+lLnjlmuGRYC9mbkT+QPEDkCLqKR5U5iM1zlKGrjiapA3ETHEMlkXFbR0/Mn/sThhJVsjN/SAhy0JcBzHMxX7zjDR8oZl3O9MzDBGnUUzNjfSnjl0Ks+noi7JA/XxpsxTzHUV6S7t4WMu8lfQZPUNAsns3JRJIgJJ4y/om3fB+ZLTlpEcvT6TQD/9uBuWlqBbCTMcOYOBvs4TbgriNwbabyHHSpqPZhDAPUrBxM2OZIooldAfFeDQKr1a0umkjPWTqVFHypaC3bv6Q3JSgUsRwBNyZgUCbgbv6Cau/NdSbC4VINh/hFOhRH0V0UlLPkGrcuWYl1KfTlRpfI4O/8g8IzdhferBQaAVecJ+TRO2jNbYiWANFe X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 18:21:49.3424 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4928345a-4a59-4bd8-8dcb-08df18d65e5d X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BY1PEPF000264B3.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW3PR12MB4492 Content-Type: text/plain; charset="utf-8" System suspend and resume error paths do not handle PHY and clock resources correctly. Suspend calls phy_exit() without first powering off the PHY and ignores failures, while resume can leave clocks enabled if PHY reinitialization fails. Propagate errors to the PM core and unwind resources to ensure a consistent state on suspend and resume failures. Fixes: d6edcdc1ef06 ("usb: dwc3: xilinx: fix usb3 non-wakeup source resume = failure") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5 Signed-off-by: Radhey Shyam Pandey --- Changes in v2: - Split out of the combined five patch series so the fixes can be sent and backported on their own, per review feedback. - Reordered ahead of the platform-data cleanups. - Log a failure of the phy_power_on() rollback. phy_exit() leaves init_count untouched when it fails, so if the rollback also fails the PHY is left with power_count and init_count out of step; that is now at least visible in the log. - Added Cc: stable. drivers/usb/dwc3/dwc3-xilinx.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index b832505e1b04..8c63e02575f1 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -383,13 +383,26 @@ static int __maybe_unused dwc3_xlnx_runtime_idle(stru= ct device *dev) static int __maybe_unused dwc3_xlnx_suspend(struct device *dev) { struct dwc3_xlnx *priv_data =3D dev_get_drvdata(dev); + int ret; =20 - phy_exit(priv_data->usb3_phy); + ret =3D phy_power_off(priv_data->usb3_phy); + if (ret < 0) + return ret; + + ret =3D phy_exit(priv_data->usb3_phy); + if (ret < 0) + goto err_phy_power_on; =20 /* Disable the clocks */ clk_bulk_disable(priv_data->num_clocks, priv_data->clks); =20 return 0; + +err_phy_power_on: + if (phy_power_on(priv_data->usb3_phy)) + dev_err(dev, "failed to restore PHY power after suspend error\n"); + + return ret; } =20 static int __maybe_unused dwc3_xlnx_resume(struct device *dev) @@ -403,15 +416,20 @@ static int __maybe_unused dwc3_xlnx_resume(struct dev= ice *dev) =20 ret =3D phy_init(priv_data->usb3_phy); if (ret < 0) - return ret; + goto err_clk_disable; =20 ret =3D phy_power_on(priv_data->usb3_phy); if (ret < 0) { phy_exit(priv_data->usb3_phy); - return ret; + goto err_clk_disable; } =20 return 0; + +err_clk_disable: + clk_bulk_disable(priv_data->num_clocks, priv_data->clks); + + return ret; } =20 static const struct dev_pm_ops dwc3_xlnx_dev_pm_ops =3D { --=20 2.43.0 From nobody Thu Sep 24 15:11:50 2026 Received: from BN8PR05CU002.outbound.protection.outlook.com (mail-eastus2azon11011054.outbound.protection.outlook.com [52.101.57.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 07C5748F03D; Tue, 22 Sep 2026 18:22:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.57.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790101326; cv=fail; b=eTsIVvCiILQOtkP4y8VsKE4G0g9ARjzNtBiI50lBFnnAZhyUGZLReDJAmAxNbUfEnhUErEQB9p9NnmWgWmbRPUb66e0ALZJ+5htGdhRB5bIXE3AelIgK1Vc9QkC1/OYeCHEwmZvgnOXuBnYM9hcvDusIF1CH0UkdIFGDHmCmv8k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790101326; c=relaxed/simple; bh=oOAkgwof80FUFNhj0qASUWzuxO7TfGW8oCW4X1rf4r8=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=klg+U9CIa8LGBxBl4vOWNWtRzvECG6bW3QkwvH1+lKM3nF1EWPzgs+tCZ5SLywMaVDGHqPovXtACCSFa0qlGGbpkZDVZqZDSKWSqjckKfJYmPidjfFi1TZzolM3WXAyDUQphaZ+Nfgk724c1ayJ5GQDzr7R1jeymGgbDh2+mcUs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=hNMp4uwa; arc=fail smtp.client-ip=52.101.57.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="hNMp4uwa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=yIsIc0MAgPzT62GkJjNwRntx21MK5kRdQXntxeMW1Df//tsB4obdJ3gfmaaQyKYxUB/DmfmHnn/GUAbLC5XQ9jw14pHBJrLUuePbvuUgThK2h/IBZSyCOtB/WOUXqip/jENWGERB0rDWZWhC80TJBji5oAoxNsSTDi4wAg6BifVEkXUWNhhuK7OgHK2b5Uj10NJ1pWu4T9fKiV/oFTH2rV3eJICFJ7z4H+JiC+at9kPyytZpOB7m3aEP6OudD6Khc/antma6tOzinW1Gmu/lRqlBFZEeOatIsJSgXBupUMa9OxqqVbljZ+Sd+0VzgA7BejjPUlQS5/hUUQnHq99XXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=rbTpVqSdLfiImzM60AVTajEWpu2PRiqcYfs1wecYkGI=; b=xn6+E5jpVhSemTOYProYe0BfoO73/23Ubgb8raUnpwJMFIweBrV6loOpxP2cIpMecG1MzlfvFH7UsDaJwFHGtmIVqbUPGrV493ZxPKRZ6mtzWvfF98FSSzA4bL0x9Xc3ps1PRNN6aljXDrwVDZccAYtlcsLUk739zOx/nk3qAZTZoNp0tYJ6U6pz6Mxf5VN1cvpal7lfUwC2zETwfkGRfQT6IdobxgWmo4qpMU2zak9p4l9yjryJdIZLIKlZpymR93PV2pPAAGiituDc7z25i4OywPg2Hen1mzPOsSbd1Z9IAn6KBVlY87GZNB9ZQh/mAdZaqh7ajXfFBkuvz1UhzQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=synopsys.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=rbTpVqSdLfiImzM60AVTajEWpu2PRiqcYfs1wecYkGI=; b=hNMp4uwazHxkg/l7c167zqcFFDMBlvCNjxz1q71LPie1egZav+0IRDIzlgvHY0faZdx/IzPDY6Gn9QYsZ57Dai4GHuPlsAgfrOOF1SXxdL7SOlWfrBZ+anlIf1GkNYVJFVRGkBFw4t7swfPCai0K2jevxdG69b4/k8WpbkzHJdE= Received: from IA1P220CA0006.NAMP220.PROD.OUTLOOK.COM (2603:10b6:208:461::11) by LV3PR12MB9096.namprd12.prod.outlook.com (2603:10b6:408:198::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.13; Tue, 22 Sep 2026 18:22:00 +0000 Received: from BN6PEPF00000072.namprd03.prod.outlook.com (2603:10b6:208:461:cafe::78) by IA1P220CA0006.outlook.office365.com (2603:10b6:208:461::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.451.14 via Frontend Transport; Tue, 22 Sep 2026 18:21:59 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb08.amd.com; pr=C Received: from satlexmb08.amd.com (165.204.84.17) by BN6PEPF00000072.mail.protection.outlook.com (10.167.248.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Tue, 22 Sep 2026 18:21:59 +0000 Received: from Satlexmb09.amd.com (10.181.42.218) by satlexmb08.amd.com (10.181.42.217) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 22 Sep 2026 13:21:51 -0500 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb09.amd.com (10.181.42.218) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 22 Sep 2026 13:21:51 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.49 via Frontend Transport; Tue, 22 Sep 2026 13:21:48 -0500 From: Radhey Shyam Pandey To: , , , CC: , , , Radhey Shyam Pandey , Subject: [PATCH v2 2/3] usb: dwc3: xilinx: re-assert resets on ZynqMP init error paths Date: Tue, 22 Sep 2026 23:51:24 +0530 Message-ID: <20260922182125.11067-3-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260922182125.11067-1-radhey.shyam.pandey@amd.com> References: <20260922182125.11067-1-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN6PEPF00000072:EE_|LV3PR12MB9096:EE_ X-MS-Office365-Filtering-Correlation-Id: 1491e538-207a-4ca6-922f-08df18d66453 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|376014|23010399003|18002099003|22082099003|11063799006|10067099003|56012099006; X-Microsoft-Antispam-Message-Info: 6wCKFotcGKQCQkuOWGb4aNA2WKBiDaoINgmntx43rKJ+4VVfjnfOAiiwBP0CAvsnINtNT1gsJOqk6E5d/oGIo2HFTEPFMF7Kg23+u9GXKqOmeV7uzfLvnnIFAF1lgDnPoHxJDjQpVfgQ75hNSKhItNAtC5cQBLsPuWYMiFWmsSxHo5DmoP/zH8Qkgnh87ktbe5IbbSYHvvPWMQPvliu6pnsL6kinUC9Lg5e3yhhdGa6daihu3Yb/vUQDTtyc7gT6uZprTtna8Vl0GDuQZwQqkjZKoJ3WZ6ys4aMH66jFhLrI7HJgg1GI1E8kuGJgzZd0gl80IAxul1+9RVoflu6JUMhkE7OM+WK896p0f4uo861TKO9p+t153pzpCf46UB+8/lTSFF+jUscHzz7vPZqz2pmiWeuwKVqMNezAszuzuD4AaE7KYHj7YD6IOxq/dK9cBTUxOS56W1i7hV1CZry8swRtfNhV483U7W7AhK5yaZFcsNqsb03aneaaNAekPWstSmpt/zbgB8rLad4G2XlgW0apMOcyIXRu1K5sBqvq/2n8YexOvwZPE2hIV5of2Or0K1a7h41mkI7AENsOTcVmcFu1RlHyWabfSgJy92yIfsCc1DlCUGI52U+is7BxC02knHF6I52Bhu0oCD2shBEoHmStL1OMqHqEjfzFQV8EASwBS49iVdcn42xF9TFgTCjdKfi7YKjBuVUwLmyZeJhLeg== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb08.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700016)(82310400026)(376014)(23010399003)(18002099003)(22082099003)(11063799006)(10067099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 5aC24urWkeSgsxOZ1EM17cAwu+SoFrx5IJGya4CmugwD5YNPeEefGSYSQty34XbwcMJs50i91AwwsBbsrO3e3Anjlq2bORs/2t+Xldusshj1I8F6VlcYgFkuTDrPVvdhzJwH4Sx9XO0nzd+83RIoeI/Fs2nGbyKP+30WTRW6B7QjjP50Jsop189IOqgOx2MubcyFo8uUY3a1sJ1EDT/TiWH68Ej5ImSvj4QMUORAmOpw/ZhlWFsWhKjBRdh5N9qxJPEnnTjXhH8b3YBho6eVioPKwDzdD3A1c88mucOaHl/OBsoNxLW5NEDe/mG1ifYRigCwSx7Dm/Qzfm6tpvRiWAoqK/Bu0FmPtZ+UT2c+aIdJ85CLup6D8fwzkxtLf7u9QlPENZ1GM7afrJEQc3noAjXBaSe3o+pIE0zI2cmoqNRl9HLUCoNNtbb0h5IxnsiB X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 18:21:59.3878 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1491e538-207a-4ca6-922f-08df18d66453 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb08.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BN6PEPF00000072.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV3PR12MB9096 Content-Type: text/plain; charset="utf-8" If reset deassert or PHY setup fails partway through dwc3_xlnx_init_zynqmp(), re-assert any resets that were already released before unwinding the PHY. Use fall-through error labels so unwind matches how far init progressed, for both USB2 and USB3 paths. Save the ZynqMP reset handles in driver private data so later probe teardown can re-assert released resets. Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5 Signed-off-by: Radhey Shyam Pandey --- Changes in v2: - Split out of the combined five patch series; see patch 1. - Reordered ahead of the platform-data cleanups. - Added Cc: stable. - No functional change to the patch itself. drivers/usb/dwc3/dwc3-xilinx.c | 49 +++++++++++++++++++++------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index 8c63e02575f1..d18d3e364381 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -48,6 +48,10 @@ struct dwc3_xlnx { void __iomem *regs; int (*pltfm_init)(struct dwc3_xlnx *data); struct phy *usb3_phy; + struct reset_control *usb_crst; + struct reset_control *usb_hibrst; + struct reset_control *usb_apbrst; + bool usb_resets_released; }; =20 static void dwc3_xlnx_mask_phy_rst(struct dwc3_xlnx *priv_data, bool mask) @@ -112,7 +116,6 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *priv= _data) static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) { struct device *dev =3D priv_data->dev; - struct reset_control *crst, *hibrst, *apbrst; struct gpio_desc *reset_gpio; int ret =3D 0; =20 @@ -124,25 +127,25 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *pr= iv_data) goto err; } =20 - crst =3D devm_reset_control_get_exclusive(dev, "usb_crst"); - if (IS_ERR(crst)) { - ret =3D PTR_ERR(crst); + priv_data->usb_crst =3D devm_reset_control_get_exclusive(dev, "usb_crst"); + if (IS_ERR(priv_data->usb_crst)) { + ret =3D PTR_ERR(priv_data->usb_crst); dev_err_probe(dev, ret, "failed to get core reset signal\n"); goto err; } =20 - hibrst =3D devm_reset_control_get_exclusive(dev, "usb_hibrst"); - if (IS_ERR(hibrst)) { - ret =3D PTR_ERR(hibrst); + priv_data->usb_hibrst =3D devm_reset_control_get_exclusive(dev, "usb_hibr= st"); + if (IS_ERR(priv_data->usb_hibrst)) { + ret =3D PTR_ERR(priv_data->usb_hibrst); dev_err_probe(dev, ret, "failed to get hibernation reset signal\n"); goto err; } =20 - apbrst =3D devm_reset_control_get_exclusive(dev, "usb_apbrst"); - if (IS_ERR(apbrst)) { - ret =3D PTR_ERR(apbrst); + priv_data->usb_apbrst =3D devm_reset_control_get_exclusive(dev, "usb_apbr= st"); + if (IS_ERR(priv_data->usb_apbrst)) { + ret =3D PTR_ERR(priv_data->usb_apbrst); dev_err_probe(dev, ret, "failed to get APB reset signal\n"); goto err; @@ -156,19 +159,19 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *pr= iv_data) * absent. */ if (priv_data->usb3_phy) { - ret =3D reset_control_assert(crst); + ret =3D reset_control_assert(priv_data->usb_crst); if (ret < 0) { dev_err(dev, "Failed to assert core reset\n"); goto err; } =20 - ret =3D reset_control_assert(hibrst); + ret =3D reset_control_assert(priv_data->usb_hibrst); if (ret < 0) { dev_err(dev, "Failed to assert hibernation reset\n"); goto err; } =20 - ret =3D reset_control_assert(apbrst); + ret =3D reset_control_assert(priv_data->usb_apbrst); if (ret < 0) { dev_err(dev, "Failed to assert APB reset\n"); goto err; @@ -179,7 +182,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv= _data) if (ret < 0) goto err; =20 - ret =3D reset_control_deassert(apbrst); + ret =3D reset_control_deassert(priv_data->usb_apbrst); if (ret < 0) { dev_err(dev, "Failed to release APB reset\n"); goto err_phy_exit; @@ -195,21 +198,21 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *pr= iv_data) writel(PIPE_CLK_DESELECT, priv_data->regs + XLNX_USB_FPD_PIPE_CLK); } =20 - ret =3D reset_control_deassert(crst); + ret =3D reset_control_deassert(priv_data->usb_crst); if (ret < 0) { dev_err(dev, "Failed to release core reset\n"); - goto err_phy_exit; + goto err_apbrst_assert; } =20 - ret =3D reset_control_deassert(hibrst); + ret =3D reset_control_deassert(priv_data->usb_hibrst); if (ret < 0) { dev_err(dev, "Failed to release hibernation reset\n"); - goto err_phy_exit; + goto err_crst_assert; } =20 ret =3D phy_power_on(priv_data->usb3_phy); if (ret < 0) - goto err_phy_exit; + goto err_hibrst_assert; =20 /* ulpi reset via gpio-modepin or gpio-framework driver */ reset_gpio =3D devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH); @@ -226,10 +229,18 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *pr= iv_data) =20 dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG); =20 + priv_data->usb_resets_released =3D true; + return 0; =20 err_phy_power_off: phy_power_off(priv_data->usb3_phy); +err_hibrst_assert: + reset_control_assert(priv_data->usb_hibrst); +err_crst_assert: + reset_control_assert(priv_data->usb_crst); +err_apbrst_assert: + reset_control_assert(priv_data->usb_apbrst); err_phy_exit: phy_exit(priv_data->usb3_phy); err: --=20 2.43.0 From nobody Thu Sep 24 15:11:50 2026 Received: from PH7PR06CU001.outbound.protection.outlook.com (mail-westus3azon11010030.outbound.protection.outlook.com [52.101.201.30]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 943E348E0DE; Tue, 22 Sep 2026 18:22:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.201.30 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790101322; cv=fail; b=tUfSdYVUH+POi+ZKhbl4yzRuldSSMFKEDwD4n3+Iu7FVq9ypaM36KANInQPDM5vXl3JYeRhyDENYZ2Jf8LIvEM2YQs6qo9l+vpoZ+d5Q6kvIObc+NHd80SnJXWeaHSF3zNd7WmDq/NPGvYr/svZwYl/G6KRgsczx6r0Ytc0+lwM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790101322; c=relaxed/simple; bh=pWNqCFX7jJoaCDsHKcQI3tmuezCruS3jwflp9m6rT3M=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=O5p4XZoE3MbAYVIM2MFUo1ihCTN+4HOUy3s73Qyhf5jemnBmJ5fPKaYF0ERj98VIR3lvrBU/iEXY57+kKPeWdwcLNXPd0vZedqGjSKJ4AoaVEpJ3kkpqtODM4SsIhvgvgXM55Exa/A+0ZdEpXVfbkRHDZ3mQYbcVYuwHTgO81nU= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=XwXs0TcM; arc=fail smtp.client-ip=52.101.201.30 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="XwXs0TcM" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=WDNmYiGpqjmUGA03Fc4pYPiAYJef3rnfD48W3TUONIrapu47YoDIQo3JOAQZ7E2ovGkj7UehARNu5y1jkHnjBwbJhw+Snes2lqGYHWJNOtRU9jt6mPvVlJ0hgtXDTJzQM5ISkd9rwRxQtj3Uy6LTmoFLkMGMVI3we0T98HLL1Lsa+/qMK7b1849pRamZYmYkyzk00EYp0uP8+D7wwlr6wizgCxQKY+0dXN+Cqi+S31EaEwBCOuVTPq/LWgfzLq+vl6iVwRYLQ9VDKiYJT+h2BPzGm+MvQjj+fJuzYoQkTP9Vnq6AEr4pgeqDgOP+1I8mrjDCdbqvQb8qfaCpvXyRgA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=JigeNknI8wuBBmVHL+frGcINWYqhE/sVOMrs6eGC3qQ=; b=BBYuVahfgw0ZutPse7jaWUzOzEum5mX+gFVdz0zDINLLRUrz53AKTryHOBflWOM1b3ecX6pbVqx0HnAEnH24RUudRmDrCA9+san3C3cC1gwNnS85ls2nAO+mqeeSdd5JQpTnLCSaB3n97dCk5jORFBjQ8R/4bJZtlK4uCxxmWVL5LLRu0+djq6spMzT9Jqi6wm7rid5h1zFRuEOM5Sf0vekF8uN3cMkYDDalyVhPxrKlsrS234xdILxQyNbOJwAyqtIVXaP7tzM/Xb28LMk0NvJV3EFlDMmrYDYk5JdUpT69s9FLUMg5L8Vae3JxzhdfGnbKN5TwDD37aXND7aY/VQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=synopsys.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JigeNknI8wuBBmVHL+frGcINWYqhE/sVOMrs6eGC3qQ=; b=XwXs0TcMgg7r0NtFAySYIis7YcggAAA4ga5hnDE7HQmXY/TOzY+tFxZCZlkwIGS90JABhV2LQIvHecUTQE5MVgtzLbn6MFcc4eIfiQGu55laXij3+7+nIWezM/Q+iAo7Xjd/Ihb/60VvaYIKsF3xk5YH04cu5xcLN1luopyb7hE= Received: from PH7P223CA0015.NAMP223.PROD.OUTLOOK.COM (2603:10b6:510:338::11) by LV5PR12MB9801.namprd12.prod.outlook.com (2603:10b6:408:2fc::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.13; Tue, 22 Sep 2026 18:21:55 +0000 Received: from BY1PEPF000264B4.namprd02.prod.outlook.com (2603:10b6:510:338:cafe::91) by PH7P223CA0015.outlook.office365.com (2603:10b6:510:338::11) with Microsoft SMTP Server (version=TLS1_3, cipher=TLS_AES_256_GCM_SHA384) id 15.21.428.11 via Frontend Transport; Tue, 22 Sep 2026 18:21:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=satlexmb07.amd.com; pr=C Received: from satlexmb07.amd.com (165.204.84.17) by BY1PEPF000264B4.mail.protection.outlook.com (10.167.242.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.21.451.8 via Frontend Transport; Tue, 22 Sep 2026 18:21:55 +0000 Received: from satlexmb07.amd.com (10.181.42.216) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.49; Tue, 22 Sep 2026 13:21:54 -0500 Received: from xhdradheys41.xilinx.com (10.180.168.240) by satlexmb07.amd.com (10.181.42.216) with Microsoft SMTP Server id 15.2.2562.49 via Frontend Transport; Tue, 22 Sep 2026 13:21:51 -0500 From: Radhey Shyam Pandey To: , , , CC: , , , Radhey Shyam Pandey , Subject: [PATCH v2 3/3] usb: dwc3: xilinx: unwind ZynqMP platform init on probe failure and remove Date: Tue, 22 Sep 2026 23:51:25 +0530 Message-ID: <20260922182125.11067-4-radhey.shyam.pandey@amd.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260922182125.11067-1-radhey.shyam.pandey@amd.com> References: <20260922182125.11067-1-radhey.shyam.pandey@amd.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BY1PEPF000264B4:EE_|LV5PR12MB9801:EE_ X-MS-Office365-Filtering-Correlation-Id: 1aeb19c2-a894-4f03-662b-08df18d661c7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|36860700016|82310400026|376014|23010399003|18002099003|22082099003|5023799004|11063799006|10067099003|56012099006; X-Microsoft-Antispam-Message-Info: LfiVeHZE10BxFOxwg1RPZfnQRJblUbtleuc0/rfwQVFAJ2F9bQJBxyZsM6J7c6+wDfSy3Yr143m+57szJyTiz881Ka0PJQNnTGB4yurwsIeFOu1brdXX7n9CmYFBh/JgSKPtqB1S0ipFhpJ6yT8bGCxClCUjTVLHBHTiAUQZq0+yA/PG5T1RQCYxuEnbT5Quvs2fjw7ZL3HIFqy0tev+LXwK2CNmwTCsFLiGOXymoeMuY5YCoskSTow59kInmeW5xphM7nPDPYBRtcmUhAzRc2pGIpDQQT4Lukf7XEz7yPpG/1WgHcZgNVRoy5i9aCI1svjohrW0dXyPu+dSQyDzeYXL9xB5LzJpChnEqZ3JmxM1lD0uJXkgmSBrt5z3CCNqORE6+9v/omAk0/3PBdlch3n4GaRUTOAFvM70dpgGpwkGUVoE8kXmh1dEQuLFetb1nS4Li8+sEcWpBOMYLb8SI5cMA3nHOAuLy+0yowJuV6Zcv6qBobdt/actXygCVXn1RtiUSYKiPhmnKJYVHSOJUb+tPqE9waE5QK89brV70n7iqt+Ez9RcuXWV5OiLguIc0wdLbHsup9mvrlHPDtG0vLyGVuvTf71doiB7WWaPuqZHuFC9VjOOeK1qqYIS2mNOp+qP+W2sfRuoTO/wEUn2etkHwxKyB8JzmQEFmrY7L70f/D6MgyoEDTvQ9vKqo0VftU+c/W09MY7m+FEYCSJg5w== X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:satlexmb07.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(1800799024)(36860700016)(82310400026)(376014)(23010399003)(18002099003)(22082099003)(5023799004)(11063799006)(10067099003)(56012099006);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8WKXquOOXdhB0cPJQ8jN2r2jPBqfI0Gke0i5Xr5EvODods7WnwBX0TeILrK/62JfgyEddg/wSqig2rsMbl9AIHUPMer8f021kuYYa1TPocSUL+H63L+5OdxUXvUTqqmoiJ7aXLe4pYfdMB/VTOfy7TNstqKwYpg0h89omxk37lt0K0gkhTUbZmgLShSHTMbcqYEb5o3UK3Glsl7ZaLc2h53h0hSvQ7/hPQELdJeyXKcAVhPB/8NFaN+wZqVYverNK0/LLj1F8C+CZUGs2SJunj2CRqliI8X4LPZTb8IxUbBZ5sgLg5g0II81n/g62ZNZqTAPfbAveB+BC2d5dQylJnbG9HYKNsb6uIUUmJyBdSlyBp1QezemKnDxR354TbZJU04iS04ShjS5sDYKr4ECV3GcscofCayAP13+JMk+ULCfNyDL9t4E7IJqVLc5dNqp X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2026 18:21:55.0876 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1aeb19c2-a894-4f03-662b-08df18d661c7 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[satlexmb07.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BY1PEPF000264B4.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: LV5PR12MB9801 Content-Type: text/plain; charset="utf-8" dwc3_xlnx_init_zynqmp() deasserts resets and initialises the USB3 PHY, but nothing undoes that if a later probe step fails, and nothing undoes it on remove either. The resets stay deasserted and the PHY stays initialised while the clocks are disabled underneath them. Add dwc3_xlnx_exit_zynqmp() and register it as the platform exit handler once ZynqMP init has completed. Call it from the probe error path for failures after init succeeded, and from remove(), which also serves as the shutdown callback. Fixes: 84770f028fab ("usb: dwc3: Add driver for Xilinx platforms") Cc: stable@vger.kernel.org Assisted-by: Claude:claude-opus-5 Signed-off-by: Radhey Shyam Pandey --- Changes in v2: - Reworked so the fix no longer depends on the platform-data cleanup. v1 registered the teardown as plat->exit in struct dwc3_xlnx_platdata, which is introduced by one of the cleanup patches; that made the fix unbackportable. It now uses a pltfm_exit pointer alongside the existing pltfm_init in struct dwc3_xlnx, assigned by dwc3_xlnx_init_zynqmp() once init has succeeded. The follow-up cleanup series folds both pointers into the platform data struct. - Made dwc3_xlnx_exit_zynqmp() idempotent by returning early when usb_resets_released is clear, rather than guarding only the reset assertions. phy_power_off() and phy_exit() decrement their counts unconditionally, so an unbalanced second call would underflow them. - Rewrote the commit message to describe the bug rather than the implementation, since the callback it referred to no longer exists at this point in the series. - Added Cc: stable. drivers/usb/dwc3/dwc3-xilinx.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-xilinx.c b/drivers/usb/dwc3/dwc3-xilinx.c index d18d3e364381..31ac75b79709 100644 --- a/drivers/usb/dwc3/dwc3-xilinx.c +++ b/drivers/usb/dwc3/dwc3-xilinx.c @@ -47,6 +47,7 @@ struct dwc3_xlnx { struct device *dev; void __iomem *regs; int (*pltfm_init)(struct dwc3_xlnx *data); + void (*pltfm_exit)(struct dwc3_xlnx *data); struct phy *usb3_phy; struct reset_control *usb_crst; struct reset_control *usb_hibrst; @@ -113,6 +114,21 @@ static int dwc3_xlnx_init_versal(struct dwc3_xlnx *pri= v_data) return 0; } =20 +static void dwc3_xlnx_exit_zynqmp(struct dwc3_xlnx *priv_data) +{ + if (!priv_data->usb_resets_released) + return; + + phy_power_off(priv_data->usb3_phy); + + reset_control_assert(priv_data->usb_hibrst); + reset_control_assert(priv_data->usb_crst); + reset_control_assert(priv_data->usb_apbrst); + priv_data->usb_resets_released =3D false; + + phy_exit(priv_data->usb3_phy); +} + static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv_data) { struct device *dev =3D priv_data->dev; @@ -230,6 +246,7 @@ static int dwc3_xlnx_init_zynqmp(struct dwc3_xlnx *priv= _data) dwc3_xlnx_set_coherency(priv_data, XLNX_USB_TRAFFIC_ROUTE_CONFIG); =20 priv_data->usb_resets_released =3D true; + priv_data->pltfm_exit =3D dwc3_xlnx_exit_zynqmp; =20 return 0; =20 @@ -326,11 +343,11 @@ static int dwc3_xlnx_probe(struct platform_device *pd= ev) =20 ret =3D dwc3_set_swnode(dev); if (ret) - goto err_clk_put; + goto err_pltfm_exit; =20 ret =3D of_platform_populate(np, NULL, NULL, dev); if (ret) - goto err_clk_put; + goto err_pltfm_exit; =20 pm_runtime_set_active(dev); ret =3D devm_pm_runtime_enable(dev); @@ -348,6 +365,10 @@ static int dwc3_xlnx_probe(struct platform_device *pde= v) of_platform_depopulate(dev); pm_runtime_set_suspended(dev); =20 +err_pltfm_exit: + if (priv_data->pltfm_exit) + priv_data->pltfm_exit(priv_data); + err_clk_put: clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks); =20 @@ -361,6 +382,9 @@ static void dwc3_xlnx_remove(struct platform_device *pd= ev) =20 of_platform_depopulate(dev); =20 + if (priv_data->pltfm_exit) + priv_data->pltfm_exit(priv_data); + clk_bulk_disable_unprepare(priv_data->num_clocks, priv_data->clks); priv_data->num_clocks =3D 0; =20 --=20 2.43.0