From patchwork Thu Dec 14 11:26: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: 13492826 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="NfZxA0UW" Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2071.outbound.protection.outlook.com [40.107.21.71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C10B9CF for ; Thu, 14 Dec 2023 03:20:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RzuoOX3zXU2viL+PTsWQjP2Hj6NXKCd1cIIX4gvHIFgO+DQbhrFJVdF7660MDwQhatD1LlJv9N356ETdy1sJpjpz6ONhKrhnoId79meMCWaAD90E2o7UCZ9ulEYHTw42QWx6XugYtBNHMn9E38ZckQBsTNBH5R+U6EXVk79VWcOnXNOwUbG/19Irl0G67AwfXwcl/L4+9HWeT/YdIJA+t/TE5etFKQV/t8ov3simnOgRhp/78fr+rcNKbcgTc2EKvMe+6/dmh1f3Tlh1vOEB7fztBAQ5CxPqTwVgFR+Y78N4Up8l/lfJTH5/vTd0IoykmtG02i1+R37iZCPzW15Xkg== 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=PRYjOSWvYDSkXe8mHjVPBGjF60MyLLwJhilw8Q/vfMs=; b=Ygb9vIa9sZxMMZZLAmMaG33Mrll7zt/Jc4VLkrOyyAh7WUbeB6YReJdqxKeL8MkViWcxrQd80pTo8iZrjbjBWDIPrUeY+X8pOzZztn1YJ6dl/yk2kKkfPVjdnch2g5szACzgKiJI06zfEqHxYlyfMBJ4UZexZim83XcUGQh6mHqfftqtdAVn8RdBgkbwblB7SmZq3VGkc+8AZifbI/QvtKiGuCkVx/wez8P+T3OhlYgb+AwBXxszwqJwocBoYLPqU2XeYKrLecQeZBzge3F/MeqZdnGZBHMgFAW1JvVbn5baSoxc/SdGcWEqZq+0WzBy20NCz7eST3ACXe7+B7ifWQ== 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=PRYjOSWvYDSkXe8mHjVPBGjF60MyLLwJhilw8Q/vfMs=; b=NfZxA0UWVLcZiHprFjsvXpOM7YPyZL+Atx2HxaLV0KyZzHGf+dXQWS/j2UNCUW7sDF4E2gMhbltau+1eXrZDaNOBezvnTsE1FV1iHCzz/JHkN5haefCyraRItYAHfLd1SaUP4CYKQLVz6oos0PupiRlMvrOy9zIG7VwLd6KdZkw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5152.eurprd04.prod.outlook.com (2603:10a6:803:5b::13) by AS8PR04MB7880.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Thu, 14 Dec 2023 11:20:35 +0000 Received: from VI1PR04MB5152.eurprd04.prod.outlook.com ([fe80::577e:f2c6:9d67:f89f]) by VI1PR04MB5152.eurprd04.prod.outlook.com ([fe80::577e:f2c6:9d67:f89f%7]) with mapi id 15.20.7068.033; Thu, 14 Dec 2023 11:20:35 +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 1/3] usb: chipidea: ci_hdrc_imx: add wakeup clock and keep it always on Date: Thu, 14 Dec 2023 19:26:20 +0800 Message-Id: <20231214112622.2412321-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SI1PR02CA0029.apcprd02.prod.outlook.com (2603:1096:4:1f4::20) To AM6PR04MB5144.eurprd04.prod.outlook.com (2603:10a6:20b:a::32) 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: VI1PR04MB5152:EE_|AS8PR04MB7880:EE_ X-MS-Office365-Filtering-Correlation-Id: 873a3786-caea-4f57-03b2-08dbfc96b09d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FBit8rKYEp2tXgUo0BIzx8WSNSDmmB5Qf9sFEkrAx0MWwiJi1DdpvzGTjfbm4zWTUx0lX/x936i4wdL/Ju2n8BdIrkySsLms6Dh34rfYjSiGqOIAsC3ykZtrQAB9hGChkZax2mEAiiC7gt9TV2jxQ5/f0roYgWYj6EPSwTJi4oIeHG7uTrKbXx2NSYjfFofvXbuecxY1niMngzjaRMwgATOhYe8ZZ0chB8QImEl6bRwCmPVd9RE4L0oexcFLKdAII/Ghq8q+7XAPjqjLpxb6f5Xhi5GqN/my5nWLHVQWHq4guuShShdQn/cXxAatmRI1uhNh9FYhTzZtIbSDoM7tW2i9oMUSyFg0pzf5L225ehWFA1BZgaT11sHqldbdGfezB2coU253pfBNprPH2H3bCfowmT5gbnSr5mvd5wJvQnTYYXwbV0rlzaZSbDN7Eb/1fHj8eI10KQVhY76mXal/lcw+ruo3dP7QblnQlvcF4IrQSDDqj4w/bRDUmAejIjk72Jn3QSBALzTobsTEnIGsR08JVTV3s6Aw5FUuXepucWiX+99fi+8VBaKXrdioXiODTYAfCyAT7tyiLlpz72ipT3mdmObhvhNF7kf4AkPRO81C8H8VojvUDFBktMUb4SUD X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5152.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(366004)(396003)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(26005)(66946007)(6916009)(66476007)(66556008)(86362001)(38350700005)(36756003)(6666004)(83380400001)(6506007)(2616005)(6512007)(1076003)(52116002)(316002)(2906002)(478600001)(6486002)(5660300002)(8676002)(4326008)(38100700002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EupdhgCGwtcTSHVENCFtHNCm9t7RjWB209pLGmS9FQIpuWDSafW22zo/smhjzSsidCGjgPffiFd1tUgz0N93jHNeJeNfN5ZV3zQ5wl/oR5Xz4Sajt40FlvI6O5toqzsboIOLbHYt74Mw0fQcFnq2xiOzpoveCWmNi1YlkoFM0ZaaEx5jNXh2uhWx54FlnrJPWOJ7E7hj7uvm1r02wx1mDqVZvW1TB4b9GG1aC7DARpkvvPlXmW01Lpby6EbLtUuyh3RHgpWfiaPCKLhJ8RbqtrAAP7AqPHUwZd4ZxzmkQ931GcWsKzbOD5TI6z3ujJfJhf3fA7IxhoArgHtC6GKbbfn2Dv6Haudl14yFoodcCWPbH/L4WQcbnaU2K13mncsiv62WvIl6OkY3btkvfjRiQKjqW+JGVQt+yOtde2Bd8JdeKotYDv9CfIydbuiQXf1R7Bh92Tf1/s01ivJgb2dwkLiLjEsNIdsGN1mqYM+Cal5n1U6PWKnlEFZ+ppK3SSi/dRGMSde95pAXL1HdnewSAKWNOEhoHM/RzVlix+92glXXDrWvYckD6oiZzWOCOhqUUMqxzX/sg6QBxzOvwulMXnI3BV8I5B6Nycv79otY5TkX1ckgplK5LZDOH5AJg5i4oG/HHjz6bu8kv4iqWZ1Y99/sKo8i+ucFiYBeFBaHPD7vQ42Q6mdcZMHSDYcb5wNDW7ZFHVqF/a1/c8+U21bG6CMyOAYYf1peNfeHGRWN39D0vcFmdveEqwPIcoWpcjyWJlhax4sqj5PrLWQlWg3Xj11yDFSEd+1gdXF4Zb6OhtLVoABhHdCsModDXdnWFFxjCiXePooU9qoWPVZ0E88rMkhFHRgNFvI9SCff6y5XfV8/Zt+dPL3CHLohh/BTwMpxvSbdb6Ej46e6rBfK+yfHzDYqjg6ZTDvHbra1xE6mqvZsegIFVG0Fm4yhpUx3Etp4TOjN0fEuPrUelxBE7ckAtvFvGwtUAlzu7CffycFrXI7ueAOABjN76Ai1ZbQMmxfYlq8ie6P177j+sdGqTglK1EGzlQI1JikSuvK62b+x0re1EypTivcJd1l+nwUeZ8N2+zrnwFoYgxyjsL0ZlviuyqbDMhg1UGjdX0t0gD0IJA+mzdH6FHRE3UTINKfVkxS/kNVjF9Bv01XygsPDzITbvtyLV0LIzZrL5G5+AMIKNdQ2q7/UBF+MySRgi4C66wBdjgLQBSOOCHxP2iruh/lneHFoq/KqeDjTdKC089frYm2KSGYst/Hgpw165z1CfaCrQeNQhTT0QQXOpYfwjxchr7jXQkdSdAb9GiP3PX2GX7htxSIm5F0IKzfAIFjpAQ50IjZzctiv8mUMcjITghf0MfMV0UEiite8ybhzoIMPEL9KbQHzlH0IoJe37EXWytNXFseZxMEelDxJPssI6rw82+ezngrOXJPABJ49pNT27KWdvGMiAvUpLB6r3du2UtjV1ILuhw+fU0fUTnqXq5lNRb8Sfy8l+f9EGOKSI9dWGud12C4oieaCu6VXNE46hNS9b5ANEa9TX0oT4ydisno9bqpI46qfkdOS8wxyjnY6lI0TtKIDaX0fbP7A9z24zQi8 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 873a3786-caea-4f57-03b2-08dbfc96b09d X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5144.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 11:20:35.0005 (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: /vgIsDn1J/+TiR3Wa/E13jPCbs1HbJpxP5Lpw99Plld5XMUkMFz1GqMxXtddmfcXH5LhuPUtvumnNeyXxHwGUQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7880 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. This patch will get wakeup clock and keep it always on to make controller work correctlly. Signed-off-by: Xu Yang --- 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 Thu Dec 14 11:26:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13492827 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="ZMBuMXhJ" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3CBF38E for ; Thu, 14 Dec 2023 03:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nnBccI1shDL98yzC1mrp/De/FKYjutJxWNZxIVW30Tp0Xod4ELA2YTpLGlEp3SBFS4PqgmfqHWqSg8BuL9ReAlXqhyVJdRidtpGy/szbz5U0UOXrNcz6UxjgIeedIUcgMIhMBh5/2QqxUhvOgLqd8PN+Eb0S0dBYuhFx4Qhf8BV0Msdz8nMu/aNHFXHcNPiFMRgk/K5aTSM7ENbiWI2PIf4C50Qu2WgdB5jfdCwjxy063WK7ilNgxtu/ame6jHZVx694l0orYnF4ZLmfzvvOv8OGApmT3uXrTCiGukegg0LConHlFSjtKRy+acv5j3LL0DTeD83KIzFbqn88df8BCw== 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=8vmXWpMklDUFj6qdNuCAtAxN5Tpkm5gHNNNMkV0Br8o=; b=FLEYtkjuR/DQx6Ab4cosfJbhZV2rKODiJom/xgI+lp4ACJq39CDEW5Ug4cuBczAVaNEAm1e97Wu7/PHvpTYvxUxwyKz1rZQ7j9WuxGMrItw2WBj9pw1VS5A+nG3e0wURT5VkUllNJQ7CoQnCMJqLqrttsxNmsLS4UFx+ORYOMK/WbUkP0q/j1guF8g0MnX7YyxQuT1zF4ZCr0Uysm+ieP7iPUQGoxCRjQKWwcfj8EG8HpIQCaz8766iIBbAW9UCIju1q/i7258L4HA4mHTa8uXb/PzmT2AhxXE8TX7j0zmYaEEum6qC61i/+X/kf1vITJQdP4/v6FtfiL/r8npIwZw== 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=8vmXWpMklDUFj6qdNuCAtAxN5Tpkm5gHNNNMkV0Br8o=; b=ZMBuMXhJJG1wNXP1bC15po26ycRLxYVKM+NTwjU0+IeTuM+X/HciiTUvklgzls5Sd6gR9CaqAb8PeiHoNawvY2/qVfTFeB8zUrzfAviBknn4V60QIm3IBfeZRt1ZTQM57t4sm9gbM1r6joA9grAzcY8x90a4736H1gjMaBaFuwg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5152.eurprd04.prod.outlook.com (2603:10a6:803:5b::13) by AS8PR04MB7880.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Thu, 14 Dec 2023 11:20:41 +0000 Received: from VI1PR04MB5152.eurprd04.prod.outlook.com ([fe80::577e:f2c6:9d67:f89f]) by VI1PR04MB5152.eurprd04.prod.outlook.com ([fe80::577e:f2c6:9d67:f89f%7]) with mapi id 15.20.7068.033; Thu, 14 Dec 2023 11:20:39 +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 2/3] usb: chipidea: wait controller resume finished for wakeup irq Date: Thu, 14 Dec 2023 19:26:21 +0800 Message-Id: <20231214112622.2412321-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231214112622.2412321-1-xu.yang_2@nxp.com> References: <20231214112622.2412321-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI1PR02CA0029.apcprd02.prod.outlook.com (2603:1096:4:1f4::20) To AM6PR04MB5144.eurprd04.prod.outlook.com (2603:10a6:20b:a::32) 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: VI1PR04MB5152:EE_|AS8PR04MB7880:EE_ X-MS-Office365-Filtering-Correlation-Id: 75fd658b-68f5-4ba6-f508-08dbfc96b378 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: LSWykH9VRIx6IyYHccylysi38a6MJ4JzZ4dO5/OhZQjgpZNbyxR1SrFM0dZAvgiy98mSvHv0VTzaMBqdZDGn5H9jly2h4YXxMrILRsCtLe0h1oYu4+ZhZbz37qgHET1NvmNIazPOBD91zmAHCJDttjn6wwDVvks1ubYr/aMg/wCKcTiNLWszhTjiPDL9jIrhNnjjY4ReXTYW8FgVocDjk0AxJTsUBa6SGowlJyivome3ytOydIa1M2lNfjvwmQ7C5W9DIAItbi7H77Mwji8KD2mUz2gwOc8/kwcWVu74IYASZUHa1f9/JfOyJhyX0gibU7EtZt/luASy51iKj8HJ8w1do0EsQbySt5fesp8TEq8+aVpIZGMcYL0LP9WX6EwTBFmigm5bjm5/f3ftgnqmFVF0rdQ2qM5USx5ozAyYWKcC1wx4FNxU3xFuFiwKnDPniPNC034vo8HwA4DOIaGKiv/I5z8YvHll0zNAkowqzgxUD3k3XyxcetFVK+PVH6VG/wVv4qstQwQZpZ2uNzj8/j8sLL1ytnpzXAUrMVEaVZDDqamga9b2ynksE0+W7XK+J1nRUTTiniKUSgdGDgaPTZG1+Q/6vLxo+wi2ks0PHv2Xp5kI/uBT9Q8rXB32cPpp X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5152.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(366004)(396003)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(26005)(66946007)(6916009)(66476007)(66556008)(86362001)(38350700005)(36756003)(6666004)(6506007)(2616005)(6512007)(1076003)(52116002)(316002)(2906002)(478600001)(6486002)(5660300002)(8676002)(4326008)(38100700002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: HbQG7CUSlgl5Z4tCYivYSyFzI1qYsxjkOVJ8UxpQ0D7pZpKeiQZjElIZaIzEB2LCfvYFAeC83EiGx1i+GdXxn/oVN1WSzL5agD5uIGsZgKUqiuFmmYc4MYKE0loqTLqWKAtpBHAM5/EAHq7O619NPumoXNuRns5ib/DRFFcBLytdbWplLxMkBRbRfohbC84qoCx1GuBAWPgSR/b24LxbCCCNgKwDDkNx/A4lJIgh4/jVfspEMYo2I1F7V/KrNDDSLSmnRQhvavxEHwhCJEaFO+oOWr0+slcdIWrEx7didvKkDKyAkcoWuOdVAmLq9iNtvtMvJ9WK2RnDr/pcOdC7CDlp5xZ24i6vrcTq8s47LNVJcX2n/lGnss/rTJobiQntgFqswWRstw5evhhj2f4d2QzF8JJVuqreAfwb+fjaRASYgxaYPpzD2LNXAHXc8MyRyOorkPjf0l0SHhCbKDQKMuDSILKp/L2oZtKtDb45YqWQbs61fnDdFH2JNSaUDsDguAU8wlNqCcma+JK/xhpLNiWXa0NV23xCNvlDY2eSdLexUMkv/DOJczptOxmkCPMhkrFeviLvvK0/KWT96t1pnlp/S5YrbE5PKWDCyUWSCBNf0Gwu6QCpp0S3RDDyXWMVlO2Ekq8qFBEGWH3BJfrTVwcHl8FtcITEn1/K7ncS1BXSY1gdavJpi6lDgNpEEg9CdotI9u7YI4sXui/Nk9J0WPdnfYXftb7YmR7tFsbFYwnu/uhLd3tFOye+82Xf+Fymfynhr10s5AgGtylc+glf+v0S0zNmQfVn8n+/7czB7KS4GdvXlAY4DRC1lcVsMbOnQlr6Lm2cBnwKz9+h2LXS4gRSMRI3FSdvkKDzXeKQrdRbiuO6mUP8DbFXFACTcPRFYiDtxbn8K11xMLDpSRfVYi2cL0AmZV+B7UKLxf5ErHbrwuKPpE8J1wCXougEwSHYH1/VgjQpoEYKJcIihmuhNxk3KssRngAOZ2apYamd9ddSuPQ4VRndSphe4NHEjEStFIdlJjlD5ijBmVYzz61b4l1dKfEhMdBkwGQb7F/Eu8GYwd9pdgxki4qhbxENNWxxG/TyRNn+z91zzc1+4PbPOCbZ3VSbHEgFjAvht4vFMBNK9oHom4L2NXKNv+rPjBsmHud1/jbrbJGqIdH9ATKu90z2LgIKuvjBk0eUKlng54PuYIQXcjHTUhw3dByMEVuL2vHxsMYF2gnrhUM+lL3FL+fBWbObtFg7dG0qF3bxYjHXZP7MkpkGRlYj8qHJVGstslsPcT0NsZI/o9E7nNWT1IgW1lT8UnchIixG1rxl4Um0gctwwvkRrjav3N0sWmml2KgO/Xaq1v/XYOCQzCT4Ug95lCXzh+KoYq3/cshasI4t/EUZQXIH4aFfw3GE/gp2gviZa+/Iexs/9M7RPap+eGGa8WzFlRupJ7AXnqpZEcZNvQR0sQGASVJcmA1/5SeHSqHYrckYDbIVxqbf2x4wCas1q9OF7jWwIHYdntUPmtJuT8I0ZnFDKyqwgi2XV76jquhMtMjEYQhWsyqY0Ny3Dr2prPxrtyhXV2DhekxjgVdykqITWOstXeRSL+vhiL61 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75fd658b-68f5-4ba6-f508-08dbfc96b378 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5144.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 11:20:39.3952 (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: Jz4SFG+qMoHI8bO1dyydOhaIpIxRbXa2nXz5Gs6+0daP9e3du2dBEagCnjTfbLq0u1J4ekMIrY/IigNPfxMlvg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7880 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 --- 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 Thu Dec 14 11:26:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13492828 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="E8QR/6B3" Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2076.outbound.protection.outlook.com [40.107.22.76]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 445DEB7 for ; Thu, 14 Dec 2023 03:20:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Xchlj/DwQhh9Ds8EO2AEeoRVT4Kw1/atkIBm0QxUmZXqpOCctL4hIj+zZQAd4VMvuHCn3tV+9nx1hPqNIuHS/Btlu44vdD2b/iJECaAnP2RK18WGD83+5n2URGllX054C8dGiDAQzRu6y9OlVJaxnJcoMO/PoWTnOI0VxaoXbS6IjAw8eFfYtB9o+ZReKMR7HNi3kctyknipBCkIOMD79TM4/o6M80d5A433DzvuY77Mrm6kK3XclXqs1nnlNeQ8Cx33Vilg0MPCXahbp3FD1grkdA0r9+p4xcnKA6Ug3UtIVUIDmFBFsXEsfP3KKNAbiwQh6J2zmQms2FlDML6Izw== 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=TWkHzCiiS0OsKUPa4dvy9YEUn5YLD2ZWt12jHafIw8Q=; b=ihz7D0NAlcnMWSj7sj6ruoU5RlgL3b/qTzldLc4AzFboZ7CFjeb1WzSQcMI2ueoLDnGN9XMjIJ1fDl+Lb/H3vtMM+GXcWdTV4U5A938EWxg0xOzJ96UeNYdwsG03zUL6NjSxqVoVt+/XyJS/9szH14nZUsMhkvbrHDkgZHsYXXG/aBMlGnRWZ5Y0RIiPzUgp+IkCSfblHbUBmJ768zN7InTEoaH0s6N6xc4rFfMkBLvScyA1uEyqbFuFI6QXOTIG6NDK1Kyq03crMpay4SCoDu6dNBw5msk5iAbSll6hfBe2+O6aZQpr8fE9NARJYb9D+kGCX4VsvjciI43+GefWPg== 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=TWkHzCiiS0OsKUPa4dvy9YEUn5YLD2ZWt12jHafIw8Q=; b=E8QR/6B38CXMWHa6JL8jIwJaC8uq9E/cj7lpKNUWgpoarZvbtrBK05naSTCOWd62LKVPtiMIwSRVNU6Jhv03snH+1jpvW3UsAu+brepW9SLPEHWLCXNRPcS1IIIwhQEymZwz2hlL9AKYStVD5F736/J+Lo9E65jIFTdAPsPRODs= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB5152.eurprd04.prod.outlook.com (2603:10a6:803:5b::13) by AS8PR04MB7880.eurprd04.prod.outlook.com (2603:10a6:20b:2a5::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7091.26; Thu, 14 Dec 2023 11:20:43 +0000 Received: from VI1PR04MB5152.eurprd04.prod.outlook.com ([fe80::577e:f2c6:9d67:f89f]) by VI1PR04MB5152.eurprd04.prod.outlook.com ([fe80::577e:f2c6:9d67:f89f%7]) with mapi id 15.20.7068.033; Thu, 14 Dec 2023 11:20:43 +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 3/3] usb: phy: mxs: remove CONFIG_USB_OTG condition for mxs_phy_is_otg_host() Date: Thu, 14 Dec 2023 19:26:22 +0800 Message-Id: <20231214112622.2412321-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231214112622.2412321-1-xu.yang_2@nxp.com> References: <20231214112622.2412321-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SI1PR02CA0029.apcprd02.prod.outlook.com (2603:1096:4:1f4::20) To AM6PR04MB5144.eurprd04.prod.outlook.com (2603:10a6:20b:a::32) 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: VI1PR04MB5152:EE_|AS8PR04MB7880:EE_ X-MS-Office365-Filtering-Correlation-Id: c5e28156-4484-4a3e-3b96-08dbfc96b5c8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: a+axQlnb5sBKp87xGJxg9SRa6dCuheuyBuUHwDY5EYZrMBcxRCrLA8K12mBD8lyiF7gl8ZZb76ZuOH32M6VHjtAm9XAxqiyHPlhHU+QP+b+zebsboRJrMmdIpfkn8WY8GUwp+Zu/K9qou+EoWhdTIssF/GjwhCpX6IUltgd9QwL0jH7lUbpMkMCcWYY2RBkG37ZOiYrQdL4OomPuzbXkrjbTRY1he3MayNND8wOWJSttIC7jcJblmHHfn0TS/RX4CcaNLZaxX8rX7fSaaUDrzcT4RQHWhqFVM7oerA+uXZGkPvJuEBYU1n/x537KaLsjJNFq22yol+I/wZAk/zBDdxZUwL8qEoAkWcd7IhWR10dos6vFH/4V/hhlfPIe+7eW/rPdZiA60d0KPMAu5YgdngLo4yXeOMHnbS9+pw+0poASzBPAtrU1zBEzm4h7YKi0MapkokeVjGeJCw+xerUZHBxqGw/RVoM3Jbhdu0EHkd531oNBNFn1oCZeud/H12vggcEPXaxgsg0N36ORM2xUwTqr6g+Zw7L0dgmAyULEZbHJJiUt7UWGM75mA9lcXB5I4/UNqg8Z9YyRnkogn+mKsq8grdJOtqNWhgxYDsRBIxfvhXo+1uePtYh5V+aKSsCe X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5152.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(136003)(346002)(376002)(366004)(396003)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(26005)(66946007)(6916009)(66476007)(66556008)(86362001)(38350700005)(36756003)(6666004)(83380400001)(6506007)(2616005)(6512007)(1076003)(52116002)(316002)(4744005)(2906002)(478600001)(6486002)(5660300002)(8676002)(4326008)(38100700002)(41300700001)(8936002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UAVKstgqHRoAi5q2FKKbUBB+K1JBdsp8GhJPwQCqyaZ0t9YTK0Y9V0IHbOwjUoq7jvszJH19qPiIEbpfu/kJO6IgdS6HSEmhi5bW77O0f95wLG9DePq+rq0zvL94wJpkj+LPEPdfZXLt55sgtluCmQ775FFksiDK+FGXY+fkv+v+ekoJSYMlHrF/XUZSmO+hS4Z25QpqqfQkNiJ8tiS1ULQ89s1+8Ux1IS6MdjC85bpO41zcaVYLZxfYRE1ryr17myHI8GpF4lh960ez9oRxLWF2LJ5oDWojaAE/bKWvNuMbS7yruPcnfu5xvFH1r0BpIsvT8fvv+MKROHqPvk9SA1mOtzzGe+eKrtxPoXtwwaZNWdedAO43wlNIfyqbog/uYQc5bk11AWcHWj5GRy0OMpeUtoiMwjhjg71lrV5QwDvRJYGL5IYB/jOqzQi+mlD4ieOk6iPOBrZrc5akXtZCVFzHIyY+awJns5Q5+GKeCYlevhh8tg/eFutKv6LR/cVn+rFO7oi29sbPjkIwurS3sUlcmKa0C+V3SkEKc9p9xi4R06X0nnI0pg0mnJ6GXxdSCC3RGorBZLRU5xuo6iNG9yRdYy0CTNZf9X++wVXkMTSn39JAgSv+xmdbI7jQk/I5jcJVnnoJYI6hJz8pofEZ/nnUiEckw4qIKnpL9EESfguhnfNOBD8qzWYQOxEsVqgq5Sz8Pe2UU1EK7y85EmQpydTFVSCW2ZzJp7n74zNODC41t2mTlmhKU0J9AbWmZxJQ0qUoK4mh6vI7s2uXe60vTdbmdzPfhBs0qfxwmIc0qvkWto78psR5PUPil4V0L8x9JQBFNbupH9cs2Lo7K6+tJsfC5VD8C4d2dJSo006a9jJJ+l2kv4Lx6KWaBfvdoG9zJ3vPfYP0gEH3gZCAouw8/bWF6zru9vsllgRgezMWDAaoqqE5Q2harj/71aPzoieK0Jo4IoXE3COjFTDryYi/xa77BBvsrgk9aXRZPLlL6UeJTN70ic2u9niTh7iBfi3XXvUj6jQRNR+Kgc0r8BUnOxxUFPcCj/BFXxQ72zm9GdaFFLIxUZUZ3px1SPUbqQDZw56SL885qrklhv8me/uf/TI43tDAJ6rW2JU1duBmxEFSwqKIqa4S3uX8grBnlL+GUtQDz3I80P1geYUJ7OnCQinnyPV9QXmW6TTvWAOLkzmqsmGp/aawd4n/IhhLtOIGtk79Oudi+8wgO4ONUlu/SOaJYGvSePUW8CHw8gyxRnzSUbUl/7lMKTuoqHJyCel539ywuFjR3qR0tMea2dGp6iLn8WqWxuW56SQxET3T4bjHoXePwlEP8E0zQkmOL7cCY/4c8z+KH4j3ONtLWAZfzsxSrbBprTEpGpN+V79PsWeU/mE9LHqK4dbGA3kON6w+ceiE3czAFbDhKhWCrwHAcdIkF5YVveE0QB1xY64ps7ECPd+fsVqy/djybVyijqXhn4hX1ueeZhDyagg4bRjjttZAgkiEGa4kEETezd+mY0vZAPmtj71jFYoxrSkZ+F4jqylmnYkWgA02xvLEF1WKTE4ieRBYeGxhNZ+5W8daac3q0ZlPomniqGtrjAgu45bg X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: c5e28156-4484-4a3e-3b96-08dbfc96b5c8 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB5144.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Dec 2023 11:20:43.3425 (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: SIiE6QfGuam30pNfh+RknQ4uA3NBAdzUy3XD6Oj/BVUrdKSbZ3gcNVXBjyU09pgOpPo0gpTzPO55N9Wy0ATFBQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB7880 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. Signed-off-by: Xu Yang --- 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)