From patchwork Mon Dec 18 06:14:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13496217 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2043.outbound.protection.outlook.com [40.107.7.43]) (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 A67446AAC for ; Mon, 18 Dec 2023 06:08:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="kn6ijUOt" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Kggh/Xea6hYjnD3KIrQltfa8Jxwo/ifdX80kLZb2zIAbY7n7uySI4YHwzsITk9Nx0ttvGGx6vyxne6wgr7GbjcD9U4WsSc8uvaNDqM1KQcZWf5EZeKXAGDrLelD5N5gHTk2hye3NI+1UbdVJ6ojs7LCjNyOqNa3kE/zHdafcfPbhM7OciikB6x0JGSrphjW8N1CSfuejmbJSI90vvIwL8BGCXgXywHxxevOmke7ithUP32vGp9UXMoszJ1L02SKI52S+SsdKS3Kiyjhzhq6xt89R2aM44ggf4Jz7aySsw/Dy1NqfaRwa733adG08wDa5rv4z6IKEYPZ3YeFzr4NLQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=DpNZMM6p3e2KyODfyRjiHxqFvOz20SVXar7IjcUGE7o=; b=YAD1l6ZKqPFX7ivmN+0owutDrtlVNA7AGtr2Mv4/z8M/A+qls/sLBRppeMkN1ctv4WbC3t4bd+BFfE/nYoT7zlPAen1hg4Fr6yO/RcvH5D0R3pApy+5LqxDP/qZIwprn9pPm1/txvOyeFOxXZPm7yAE77sBTVZO+W3mY7YvFVtnsVHOgd/dbUbm6onjOGYyw2wfAngeLaBb+apOeqNs+DKZ9xBksb3GYAIilbq8TBRZeyWbzCLwkBFcMFLtDJ8yuPZD+mtYy0DPhcsmS0znDoK4vFNi0OJao9yFBAciYSJBfBEo3Tdu8nhwtUXjmvZ6FT3UeD81cKvcin/hJH4qcJg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=DpNZMM6p3e2KyODfyRjiHxqFvOz20SVXar7IjcUGE7o=; b=kn6ijUOt0GR2mH9WMf5letrxPW601FDVXB0TddJuQVqXUfAOIFzJw+KzuagF6285/xS152qItfNAVVJ1xDAIGcjMSK3LNtlnwOHpurxLe0XIW5esEO2S+POn019mobEqMcilovQkOulFshHQa/rb0oj2PQwRwg1/u2cUjGkWl7U= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5146.eurprd04.prod.outlook.com (2603:10a6:10:23::16) by AS8PR04MB8625.eurprd04.prod.outlook.com (2603:10a6:20b:428::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 06:08:26 +0000 Received: from DB7PR04MB5146.eurprd04.prod.outlook.com ([fe80::709e:6876:7df0:fc30]) by DB7PR04MB5146.eurprd04.prod.outlook.com ([fe80::709e:6876:7df0:fc30%7]) with mapi id 15.20.7091.034; Mon, 18 Dec 2023 06:08:26 +0000 From: Xu Yang To: peter.chen@kernel.org Cc: gregkh@linuxfoundation.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, luca.ceresoli@bootlin.com, jun.li@nxp.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 1/3] usb: chipidea: ci_hdrc_imx: add wakeup clock and keep it always on Date: Mon, 18 Dec 2023 14:14:18 +0800 Message-Id: <20231218061420.3460145-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SGXP274CA0016.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::28) To DB7PR04MB5146.eurprd04.prod.outlook.com (2603:10a6:10:23::16) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB5146:EE_|AS8PR04MB8625:EE_ X-MS-Office365-Filtering-Correlation-Id: 5129f9f6-f7b9-4152-183b-08dbff8fbf6b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: nypote94KeBsqKO6jhgP+bwCN4arNxGE0u4viOKHM/Uicd7ZpJBDCM/HAEI/alBWZVORaHib/lkalftf5/pq20n5NUrcjkTt41H+uKzPAtZ8hK5fzH3GKTVwu5qena0TrDh1UkEAwLST4LwaGoqB7KKTsVmA5MhL18NV3kfVKw6CSDyot0+ivd0KIliCGWcGp/tXHewy2UW+ny+yxBbztuwTxAWIy/ef2p5wgFTKFqLmga2QQ9RHJxRpuGH6Jy2j0reyC5VYifyo1wk+YJMuCfk6iBDh3Jmh9DXHMeVujnb3nlbdnO1syZcxFZBC0F1Rg2jwwvscJdD3PDj3PQXVBGkGYLG2LZ4Zx/IzaAYKoNe4RnhNoRcmN2mhfSEVJizwl5kvw0KAzqO98opvwMasVdbYhaEReCCOf/y93o2pF4qWyqiyzmTEFPC09p2+pJkTjFkcBXdIu3VApkc24bySG92iX/vb6e85IKyBAG+Hwr+yShvds3njDzXP9s4AuMTmH7DpYO+1HELxBxbO3x8kJm0llIE6/dx3+plaw9jeDGXWUKpqRQnP/glPjdMJmmgeschAyKpe532hPE8IpBw7nW897Qb06+JuSFjuSOtlakRQpY2I3r3mO5kTxTozJFOz X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB5146.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(136003)(346002)(376002)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(1076003)(26005)(2616005)(38350700005)(36756003)(86362001)(38100700002)(83380400001)(5660300002)(6512007)(6506007)(52116002)(6666004)(8936002)(8676002)(4326008)(66946007)(66556008)(6486002)(316002)(6916009)(66476007)(2906002)(41300700001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: LdJy6rQgwhC27xHU4JfBaWnQge4iPVZudT4tYx9vm8LZFD/oiJtS8YTBGSbRAw/Bm7Xo48jg1YdIfS453wYW5nG2xRAapmzqXbZ6ZQpQnjJdqkxZuZissWI9CCaBzX2DWuObZzAHoZHOrH2zUEFhcsXi10/+nWIs0wGiW/fa2AoRxcq2Meo2Bx7Ifz9pHnZ/g8PrMVCIub3AvQuGRtR4SVM2doPhBqMJEeqzmqSBKM4F+FevbPK5OnKW1+qWNoCxCEwqcZrhD0nzwUnZrmiu+qjLCIAZ9PunT7PupumGFgNG/Wp3xRd5GlvW1+FRR60MRGNh8cwReCnbx+B1Q0s8KRGcA0HiAqu9Xa/EA/nW+AgZHtUr/EUTUDRJ3vKyJieyMQn/4gPCvWlAvLA7M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/mUd/B5DV4DgREQiGiDd5eXe7Tu4q3MauebwSHXafEc0nhZzBYfn1p7Nc+nS3pTwFaHtpI/qPck6dhz1DAO+tBxJHgMOhezjHZuIhaMM3gSCosh5oAAPkuKtQ9/sH/FBF2MWWHcQIVu8t6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5129f9f6-f7b9-4152-183b-08dbff8fbf6b X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5146.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2023 06:08:26.1969 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: cTHIHy+HRR16R0FkuFVQUVaT1X2NfvNgPhbsSsr2hKCj/IJ/u2LRxhHq55Rf7kKQXZtCZEZFEI7fNJcE9k9/sg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8625 Some platform using ChipIdea IP may keep 32KHz wakeup clock always on without usb driver intervention. And some may need driver to handle this clock. For now only i.MX93 needs this wakeup clock. This patch will get wakeup clock and keep it always on to make controller work properly. Signed-off-by: Xu Yang Acked-by: Peter Chen --- Changes in v2: - modify commit msg to make it clear --- drivers/usb/chipidea/ci_hdrc_imx.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index e28bb2f2612d..4330be8240ff 100644 --- a/drivers/usb/chipidea/ci_hdrc_imx.c +++ b/drivers/usb/chipidea/ci_hdrc_imx.c @@ -96,6 +96,7 @@ struct ci_hdrc_imx_data { struct usb_phy *phy; struct platform_device *ci_pdev; struct clk *clk; + struct clk *clk_wakeup; struct imx_usbmisc_data *usbmisc_data; bool supports_runtime_pm; bool override_phy_control; @@ -199,7 +200,7 @@ static int imx_get_clks(struct device *dev) data->clk_ipg = devm_clk_get(dev, "ipg"); if (IS_ERR(data->clk_ipg)) { - /* If the platform only needs one clocks */ + /* If the platform only needs one primary clock */ data->clk = devm_clk_get(dev, NULL); if (IS_ERR(data->clk)) { ret = PTR_ERR(data->clk); @@ -208,6 +209,18 @@ static int imx_get_clks(struct device *dev) PTR_ERR(data->clk), PTR_ERR(data->clk_ipg)); return ret; } + /* Get wakeup clock. Not all of the platforms need to + * handle this clock. So make it optional. + */ + data->clk_wakeup = devm_clk_get_optional(dev, + "usb_wakeup_clk"); + if (IS_ERR(data->clk_wakeup)) { + ret = PTR_ERR(data->clk_wakeup); + dev_err(dev, + "Failed to get wakeup clk, err=%ld\n", + PTR_ERR(data->clk_wakeup)); + return ret; + } return ret; } @@ -423,6 +436,10 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) if (ret) goto disable_hsic_regulator; + ret = clk_prepare_enable(data->clk_wakeup); + if (ret) + goto err_wakeup_clk; + data->phy = devm_usb_get_phy_by_phandle(dev, "fsl,usbphy", 0); if (IS_ERR(data->phy)) { ret = PTR_ERR(data->phy); @@ -504,6 +521,8 @@ static int ci_hdrc_imx_probe(struct platform_device *pdev) disable_device: ci_hdrc_remove_device(data->ci_pdev); err_clk: + clk_disable_unprepare(data->clk_wakeup); +err_wakeup_clk: imx_disable_unprepare_clks(dev); disable_hsic_regulator: if (data->hsic_pad_regulator) @@ -530,6 +549,7 @@ static void ci_hdrc_imx_remove(struct platform_device *pdev) usb_phy_shutdown(data->phy); if (data->ci_pdev) { imx_disable_unprepare_clks(&pdev->dev); + clk_disable_unprepare(data->clk_wakeup); if (data->plat_data->flags & CI_HDRC_PMQOS) cpu_latency_qos_remove_request(&data->pm_qos_req); if (data->hsic_pad_regulator) From patchwork Mon Dec 18 06:14:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13496218 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2043.outbound.protection.outlook.com [40.107.7.43]) (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 6B3F16AB0 for ; Mon, 18 Dec 2023 06:08:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="fcpk5U91" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Op7TnEsNMPut8DF217mchmJBxVmffhKt7aon2XViX5Hv3tvTP0elomrvBi2T4MDjxN/Gi5Jaq5HhrwSnWeId5gXGifzSAjSun+bt+BFxAROlcfaZi8dCzvZVEVvtJrsXFPW/X9sqS0FY8VU+dQJvbWiEYp+MDkQGTd4cOh++yyHoF/wg4dSmsNxxTvvFDtHQ6J7Br+GtSY+KI1r9eh5+0upUG5outRKVCsXl58Clb59/YPgSW+ue33ZlS9qwQkePCxZS4qrLVVDWCHLdUimkUH+tuA2fleNYL6UqCgtUn//EQ0xsVD+RkDJZNXSnU6rBh9SnnAjuRPln3vQLTlPILQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=xq1MyAjGyTGWxmdxGTsVG8Mytvv+w3+GwNWUHLAZWb4=; b=IqHRqznmdGciAqDbVhtluGvF+CavPBtz/oZLP6YQdFRdSG26Jzi/Si5uEI94PwJsgc+0Z8X3t/QdDjkbqv7ATHO6BH+e37FvmPgZshP1B3R51ruKRWOJWrbtNFKdLKMxojGwmSRSWdg8zXcJoHSoFFtq5mNM+1vunKcIqX2J7ccNHz6tyOQnZdi4vcs7S+Aaeuc9uiB/tiHT8CcQRLIyMRc5HwMKLOAfhUhxqnGSQTsj+6gNsuGwNJlM4Ms5LjmyRI5ScHbM+1vj6Vd+KexY07fOKPBCWPDA3vc2ceB/9JeOYqrerVPRp9g8mV/zrr6YRyE1ghdmHym5pE/KryC9vQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xq1MyAjGyTGWxmdxGTsVG8Mytvv+w3+GwNWUHLAZWb4=; b=fcpk5U91DZHFjY7gxTB3eZpnOSkxZ3VmElj4EqeyCBIGz+ZczOYQkQD7xl1aAVhthAkutxA6bSQHGDFeYshqjq8sk2JoFI4/GaJp0K1lkj9ZPCzIvnadWHpkICeBkPi6hd2NtAAyDBIkpBHAdOUa3r01Cvh0ams2YIBCH5BvP7k= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5146.eurprd04.prod.outlook.com (2603:10a6:10:23::16) by AS8PR04MB8625.eurprd04.prod.outlook.com (2603:10a6:20b:428::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 06:08:29 +0000 Received: from DB7PR04MB5146.eurprd04.prod.outlook.com ([fe80::709e:6876:7df0:fc30]) by DB7PR04MB5146.eurprd04.prod.outlook.com ([fe80::709e:6876:7df0:fc30%7]) with mapi id 15.20.7091.034; Mon, 18 Dec 2023 06:08:29 +0000 From: Xu Yang To: peter.chen@kernel.org Cc: gregkh@linuxfoundation.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, luca.ceresoli@bootlin.com, jun.li@nxp.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 2/3] usb: chipidea: wait controller resume finished for wakeup irq Date: Mon, 18 Dec 2023 14:14:19 +0800 Message-Id: <20231218061420.3460145-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231218061420.3460145-1-xu.yang_2@nxp.com> References: <20231218061420.3460145-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SGXP274CA0016.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::28) To DB7PR04MB5146.eurprd04.prod.outlook.com (2603:10a6:10:23::16) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB5146:EE_|AS8PR04MB8625:EE_ X-MS-Office365-Filtering-Correlation-Id: cd2fa90f-7c25-470a-7608-08dbff8fc170 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ahEKuNg7OWq8Bhi5OjF3jYlgjpsqSf3X8+8HsYEtEpBho/3IOjiCZIHTysGrDV84fS4uSkqWmmk9OoOIhaDBYermsfUXd+9w4FEVWKwzmeSf0sn5VziJZi0RrwP0w6eG2VjBnhhTDO3+vwkgZQUMA8CSIqJGd3OtYH8KQftChKrOyfTrUWRcAeyfFLL1SLw3dlODGzpaWThdEXTnnSN/WL4KxdOUp3OwOG/W7zjdeDlmSpI/LaM1LaM0sVqL1Hz/Vos9B3JytJAQyoHmsIlidx1INfVRLslyXbvunirADEksmFlFTytry6NabEvqsMx1V9MI09gsof+b/WTahTYL2M14gZRYMt3QNmsveuMqB91Mo5eN2eyo/a3HC7/iIcPc5YrFas76BYjy/mL+H6YC0ibdxubzEuCWIWQenBIgIsRBH0cY2KwqsojjuT4oJWDQjy//tlC1hBo+iCcVgaXfIk3iI+ozp7KijWGDbslAFxKi+qCpb3SbPZ3ejE0i/tqv6ZwEX+zXAp2JvWHiSDW2m4OKssAi8ArMRbCm+6CF38rcxeCvsc9rZ9xTjG9ucGYlfaQCjJBsJpkMrPZnj7Q6IepvEpnxDByINn49HzCOt1TuwzobmuHeWUjXdSX3SkS8 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB5146.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(136003)(346002)(376002)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(1076003)(26005)(2616005)(38350700005)(36756003)(86362001)(38100700002)(5660300002)(6512007)(6506007)(52116002)(6666004)(8936002)(8676002)(4326008)(66946007)(66556008)(6486002)(316002)(6916009)(66476007)(2906002)(41300700001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: tiH5XGenCXDcXVvx6gSQnqMfINybKl5mAiUPYpYGh7/5oC7GEtEiA/YPXr9gOsk7EA7N/cigh9MADUxGDSP0vM8NfgnCxOv3DLZ0Tkm+XUbBhB3jzhhD4GrqqViXP0AEBazhqpWDTOvMXPYJiTgwAVt+KgaDHhKe9AzuoxbqY7G3xKHL+apnAasQGpqNyjZqyCkUmoAOD8RsUfpzOlFC/Mae680c/TSXj7NbiaHFYlgTAAbGqKHtRwc8WnPnWJhASaalCj50adXHRPxgE0c3rFpuH4LWhghO3D0EGNmb9PhIFp+om+efagD+JQpJW5Ae7RIRPnP+w0n6wuOP5+qB1y6KF3f68Pe6Ym0yPNDORuOj++djGMJNLnypYkkybufVkSAD6PF3H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yK0/s41zeKFhXV2Tf3mlMD+PIygmyKKca/HeOH7Te+/cxwtMva5cAiKjulDLzFdFF6plQjhSnqYyfPQlEzjO2TRplTlKNLPCm+fP+Uay63OWaOyt26xG4uh6Q+Y1Wkpye/V7 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: cd2fa90f-7c25-470a-7608-08dbff8fc170 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5146.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2023 06:08:29.5513 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: M8MmkvAN53uhHHGJ5Yy9DxnU6c6dF8G3CQo8bWxbEG14plNllVW6dF3uqwG7uVDRm8yteUKCuRfvGWa5WiLnkw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8625 After the chipidea driver introduce extcon for id and vbus, it's able to wakeup from another irq source, in case the system with extcon ID cable, wakeup from usb ID cable and device removal, the usb device disconnect irq may come firstly before the extcon notifier while system resume, so we will get 2 "wakeup" irq, one for usb device disconnect; and one for extcon ID cable change(real wakeup event), current driver treat them as 2 successive wakeup irq so can't handle it correctly, then finally the usb irq can't be enabled. This patch adds a check to bypass further usb events before controller resume finished to fix it. Fixes: 1f874edcb731 ("usb: chipidea: add runtime power management support") cc: Signed-off-by: Xu Yang Signed-off-by: Li Jun Acked-by: Peter Chen --- Changes in v2: - no changes --- drivers/usb/chipidea/core.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/usb/chipidea/core.c b/drivers/usb/chipidea/core.c index 7ac39a281b8c..85e9c3ab66e9 100644 --- a/drivers/usb/chipidea/core.c +++ b/drivers/usb/chipidea/core.c @@ -523,6 +523,13 @@ static irqreturn_t ci_irq_handler(int irq, void *data) u32 otgsc = 0; if (ci->in_lpm) { + /* + * If we already have a wakeup irq pending there, + * let's just return to wait resume finished firstly. + */ + if (ci->wakeup_int) + return IRQ_HANDLED; + disable_irq_nosync(irq); ci->wakeup_int = true; pm_runtime_get(ci->dev); From patchwork Mon Dec 18 06:14:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13496219 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on2043.outbound.protection.outlook.com [40.107.7.43]) (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 8CFE56D24 for ; Mon, 18 Dec 2023 06:08:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="BP9x+L7W" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V1N4+sFOfj79joOsLeacLv48mTJUSeNgrJysp+h/DWM+ROKmFKlA5T1fSXkM+OgcoFuMWjlUmk86hr4wrQgvi0BWAUWzTbhKC2sGTYsGK365sH0zOakTtMgWwmbAWwj/XHSOBWQaW9ojEFJKE5E6qXAB7rxNErGBmUCWpTcdktLgJKszYnMSXWsiid8JADuGuFKMQ5IRCbfkG8xZ8Rl15tjHnCsMC5oIqmPUfPOpiuCBtvJRICYH/YLxvHhnhZkkZ1YsrNHpToxzea92nmFRwQP9LTmmcf2gWdpmKfno4EHM3jV4Fa3DQ9fBr+KHsWySYROYm0xgclHcGZuIFpDT9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=+TQ/j572EOcKYXrKSYQHqSuZNVe19DRoQx35XFJPd6E=; b=XzFXNPdKi2tAKycoKxND6sK34GE8fOOP1JHWSZAK4mXf2Bs438xT/udg4WPUfnTcDcn+0sZcaLGJlwV2s1mB9+at6Ff+YcnB7Gr7lvS+EYpRLbnVZu7GtzRDX8MSQwUKcI6n/LH5NjycU7UtynOFJCFX65T/4mhHgfPEUonH5UvYKBkL8xG0k0DGzIrthTQf99bQ64HA1fdEeXXzZQSuaTQx84QnF9+W9MME+hJp3cakG4UuaKZOMM5uLOQiTGHOHCus+tQmrZRB+Lx+lKaI0aAboCkOl5VtnelWFRM1MCVuzeaPdPOXrQ8VuliUFgcg+VJ8cG8tsutmVjtLiq3JuA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=+TQ/j572EOcKYXrKSYQHqSuZNVe19DRoQx35XFJPd6E=; b=BP9x+L7WO75Ef+XptBoSBg3aqxxT1L0QhyWZRBSkVqkwo+V4zaMkBfpH7vQis6SgyinnQA96PcsrGJSc/mKiivMNcMBBArHS5QCU7SBqavIfAx3oYDqhJcFGsYU+L7Mkvk+Wt/9BJ3KnMP7GZV47G+8noy4Y8wO5pKCF6r98Okw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB5146.eurprd04.prod.outlook.com (2603:10a6:10:23::16) by AS8PR04MB8625.eurprd04.prod.outlook.com (2603:10a6:20b:428::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.37; Mon, 18 Dec 2023 06:08:33 +0000 Received: from DB7PR04MB5146.eurprd04.prod.outlook.com ([fe80::709e:6876:7df0:fc30]) by DB7PR04MB5146.eurprd04.prod.outlook.com ([fe80::709e:6876:7df0:fc30%7]) with mapi id 15.20.7091.034; Mon, 18 Dec 2023 06:08:33 +0000 From: Xu Yang To: peter.chen@kernel.org Cc: gregkh@linuxfoundation.org, shawnguo@kernel.org, s.hauer@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, luca.ceresoli@bootlin.com, jun.li@nxp.com, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 3/3] usb: phy: mxs: remove CONFIG_USB_OTG condition for mxs_phy_is_otg_host() Date: Mon, 18 Dec 2023 14:14:20 +0800 Message-Id: <20231218061420.3460145-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231218061420.3460145-1-xu.yang_2@nxp.com> References: <20231218061420.3460145-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SGXP274CA0016.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::28) To DB7PR04MB5146.eurprd04.prod.outlook.com (2603:10a6:10:23::16) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB5146:EE_|AS8PR04MB8625:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b849373-6ca9-4828-e811-08dbff8fc369 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FY6BPOTpK8Ms72kEFeJuSmaieTQ5lA6VOIV0wg4pgPsoMXB+30YwIjV1IoFjo6fCM9O5ZDHafpaHAT4FCPATRxhM6UDYtc+JR+L3cPAhARgcsI/TCDmfxXOONPo0xVWQHzdIZ2N+++tEkaiK6PgUrHjHLsnzcQeOXchX/zWNi9mtIagirKLecWEhFrC5tI7jDnrJL5rY54xTT7OV6E+3fhHS7ilgPnWit9QwLUtTU88HKtR3vxj/rWMU/9NtxSyTCstUmZAhi9Q1O4HG8lHs/yQad9w087ES/jxzqLFptlCSP78G1f7UIw5BIUwDdOPrAjtBTO0OIlB3Bv+1DWvDbmKRMVt10rNjs+oxom9azTMDrenkuxO9V1JQSvYitnLJUbFjEvts/LyJT817kiBsWkXLJ/wvANCv+j4N5upIoaNGddfxJMW3o63LEjt5GfqXzq6tx1GclvkksW/kJvH8bgbOfdpQsUIAJSuJfVjWhfV2yL7HQUY8/m5K7NGted+27XaqcX6XXgF2TdVO+sInx771IdD+IgVctrcRT9ydVEKB/4rRgx/w2EVc9k/RXk/2c1nNAT2m5uFQ8xS6wh6+b7A2voenx7ekc4O1Acb6cRamcEi5hfxO0jrp00BCt4YK X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB5146.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(396003)(39860400002)(136003)(346002)(376002)(366004)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(1076003)(26005)(2616005)(38350700005)(36756003)(86362001)(38100700002)(83380400001)(5660300002)(6512007)(6506007)(52116002)(6666004)(8936002)(8676002)(4326008)(66946007)(66556008)(6486002)(316002)(6916009)(66476007)(2906002)(41300700001)(478600001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: O/+bB4zPaS4LpOKe1Uougn2ymghqAGXnbdTLc/KbO8AiApv/BSew574sVsdpB4lC5tNCn9eetx4VytmtEEZKbZaKTgG2BwWoQsBj6D4a/4rpA9rpWxULlUpNC+7qvSqdcxnLOL6/Mvy5dr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cPt6scau0VO9viw8onhUJf6C3KehSJ1o30rpOvPAWRTqZdckGgcgiDEMZTWO9neia6paZWZBorShHOH/T8QNcvFVvNAijlHZ8QZs6rYJWhytcea2RHYGa6Fv9R0tTGdiuj9QoI+4q+47MITEa9XIIKBoeP5fg9NFSrWqVlsV88xTFRPMKrTT9u3o4kZ46JVvs0vo3z7J8xI8Ga7tMghpC3OLoARJNy1T7U7gtH5TryGnwi5ERPZJf4nGh5KUS4dYDOqdvsOTWMo3l8vI8+TcrINpScitOsZV8fLh7RrNkgkRcURz5KU9HiglkTcq36BdUke/a8CZAU6QiEgNJDMbYABAieAhqOK0EIzWeyxOXoCuezQOFEZYWqauGd/f3Gy3s7XvSwE X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b849373-6ca9-4828-e811-08dbff8fc369 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5146.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Dec 2023 06:08:33.0092 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: l7Xpp0BuEtDAk0UCuBpQW6DGGo0DeX4EgeLEotkNp8DEewEP5PIpKlwo4v/voxtZgQGBaHjRuAT3gqrNHykMXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB8625 When CONFIG_USB_OTG is not set, mxs_phy_is_otg_host() will always return false. This behaviour is wrong. Since phy.last_event will always be set for either host or device mode. Therefore, CONFIG_USB_OTG condition can be removed. Fixes: 5eda42aebb76 ("usb: phy: mxs: fix getting wrong state with mxs_phy_is_otg_host()") cc: Signed-off-by: Xu Yang Acked-by: Peter Chen --- Changes in v2: - add fix tag and stable maillist --- drivers/usb/phy/phy-mxs-usb.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/phy/phy-mxs-usb.c b/drivers/usb/phy/phy-mxs-usb.c index acd46b72899e..920a32cd094d 100644 --- a/drivers/usb/phy/phy-mxs-usb.c +++ b/drivers/usb/phy/phy-mxs-usb.c @@ -388,8 +388,7 @@ static void __mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool disconnect) static bool mxs_phy_is_otg_host(struct mxs_phy *mxs_phy) { - return IS_ENABLED(CONFIG_USB_OTG) && - mxs_phy->phy.last_event == USB_EVENT_ID; + return mxs_phy->phy.last_event == USB_EVENT_ID; } static void mxs_phy_disconnect_line(struct mxs_phy *mxs_phy, bool on)