From patchwork Thu Dec 28 11:07:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 758935 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) (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 DC7AE63C9 for ; Thu, 28 Dec 2023 11:01:55 +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="A2AhcMIV" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZW71tz0ztN53TypgN8rs7PStkkQUYOWg13aH3wq0yXoussiVCOz+BBA6gW/8wcsVayaSudqO5fGHcNPcXOECB1xYQ95GtK7bTRkeIXm/F3IEBhwtbCvtogqkVOvPgZoaXPf0Mn3WJJFGJFyDRyHD8he/I05f8fMgcTm7qnNrygSG9pwW3/P0bd9z34Xz294uuNw8bNUcN3lS9b9yVvL1i0dvDpKcoyKRG6zraXHUZymuTpwFLfxkDbMh1FVefY6IlNxfxZ4E/nwjeTCZTjPfskw+/AIVbteJskVVBn0oZcsANrCxjr27PVN4Zrc5xhe15zpBcjRhlnpRrmZusZb5Rw== 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=pkGgar2trgr8Akk6iT+7SOA6bKz7H5Cqb868zWwKx2c=; b=hSv9FrhEoVleXkw/I0fg34G49CbfEpsDq4ggVgIc774aNRC+DPmbgcqUSxAsPlhDBS+zQs6vhQPfarbHFhWMVhe7lgmTQDEbxrkg70ZVaVkUVp4Xxc5YdnnVphfggrlX7CPOPAPwShcOCrD0XWx4V7WPJ93zeow9ZD/xdf+dEUce617ujEDvEYPiLrwaUZk5rQrYG1KCxfXvh/YuoSkIqnDtxMpxjaKIEOItGK2NhtocjYowGFZo6dljNeio0vGeoSo1UhNgkvUc92iKZdNk/QDjBMH3Xlk4IVqSe8bY/4EWRtN4AdpHpT2YfqBlrzsH/1hpxYmvw0QtRSAUGz2mgg== 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=pkGgar2trgr8Akk6iT+7SOA6bKz7H5Cqb868zWwKx2c=; b=A2AhcMIVsM+PODlWQCzIgylKXGQoN3MkkGiCmilq3L1RskVW/PlWIL7ytFJQaHK4E+o69wNeaKiHGLE2jFqtTZnVExOnpZBh3qHMZ3o1LeIvV9pCAOTUIO89XfxPuWq+eoYh22cvP9+jXZMXVSPs4ls0bEcHGYQ/2TU/esHmVcU= 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 DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 11:01:52 +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.7113.027; Thu, 28 Dec 2023 11:01:52 +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 v3 1/3] usb: chipidea: ci_hdrc_imx: add wakeup clock and keep it always on Date: Thu, 28 Dec 2023 19:07:51 +0800 Message-Id: <20231228110753.1755756-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SGBP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::20) 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_|DB8PR04MB6795:EE_ X-MS-Office365-Filtering-Correlation-Id: 9a4e5c52-20dc-4012-7415-08dc079465df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: gyIM9xthS3ZSl5sFaO9sEmSbZQ1GC5pcatFsgfHQysV5JPDkIf1R6QyekNt2sMBcIeE7VUeyCp3I6rP750rZ9uDYNEJJrDyKDQLLc9kdo47m7NHM7Wb0LFYbGyquNb350c/H+460MrMOo3dBbVVeDdlWIEUFhkcqXhpDl6yHUktemizNsgO0OYxF6Im57BuUNuCBZ2aykMhjJeMayS07UHHP8XblsEaMNH2EzjKCqlqOc3Nfm3XE+ZlTc2dzil3h+3SQ21h2v4OBNC57l6oBS6g2G+Yqz+5rYBsTOxN4x3IQ9UX3P5X52Q6w2O1+LrRBAPct0Jb7mrBgWYojeuIb5u3EFcx+0TksWCaSoPLrtJ+QISGGasQpUe8Ucvrj4sBtwXEkVY2R6Iqfga4sYAqYTmRHLS3pxK3XGbk1saO63aYsM5xBGrJ451OTVJaTUpNbJ/RkqVtSlY1Ry/kWhEzZH3Qb8NwYWF8mnnC+LV6Blpou2qH/Gl8UIF1m48ku+WwBskD2q0dYePM078rGG3zldJRo6vaiEmFILr3aRDt/kpxdA1UTgQruzkkNGMujrNIZw72EppwPRiRHSSasdUq6S5XObNXv8IWRmS/+lkdKhybDm2AprdF1k/3mpExSjg9W 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)(39860400002)(366004)(346002)(396003)(136003)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(6506007)(2616005)(1076003)(26005)(6512007)(52116002)(83380400001)(5660300002)(4326008)(8676002)(2906002)(6486002)(8936002)(66476007)(478600001)(316002)(66556008)(41300700001)(6916009)(66946007)(86362001)(36756003)(38100700002)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GPdnfPih3IE3mmxkwH92E9jHCiLmBLGAWF/i1NZDwbwsamF21tmmMZP3AZsvMdBCbE+9Oxlm2ISPUde5i47jAlCCyWn5m64NZViAyCmWW1dm/bP94Q3xTCDa4CmTEfauxcaT0YNWKOzbh3gVZNUZI3Cax427CtNJVj+w63oQxcoVL3FZb8j6+uoVg2qmvUHUG+PXMbu6IfEI2DVAsmCjZJaKRgBHoJE4FvTqYzTvfDUuWc2tV/EEd/0lcJfF2we9Py5yPsPy4xaoQjgCS6DdwJ8QZlI9mzI6kNJpZ0c5a2ZDNzd4n/u7Zlu14tPNU5onkY8RSk5ft5DK6qJa+zTlpRC7RSj+NYVOStsOaXIXyLJ8/lRE6i587oJJlp4JkyEc3L6awQ3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WyX33fBeT4zYx9lJ5vx1OdVeOchfq7D18Zcv7EB5lqyusmuq3WUR8gLZhyXAP+34IUJFAs1K5xQAC1vchHemFWwHxfpAfJVNJq+/q7YOKGYnucbHJV5YO8QHCQlXzAEEOHkNiQL6Mc X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9a4e5c52-20dc-4012-7415-08dc079465df X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5146.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 11:01:52.8776 (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: dTXfZne05DvXhDt/J9CWfme54MO1DF4s4YU/PTm9FZSwT4mAJI5YA49rkkt9DgkWuTZpPg4KGo9aG9OqlUZlZQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6795 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 Changes in v3: - use dev_err_probe as suggested by Stefan Wahren --- drivers/usb/chipidea/ci_hdrc_imx.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/usb/chipidea/ci_hdrc_imx.c b/drivers/usb/chipidea/ci_hdrc_imx.c index e28bb2f2612d..ae9a6a17ec6e 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,13 @@ 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 = dev_err_probe(dev, PTR_ERR(data->clk_wakeup), + "Failed to get wakeup clk\n"); return ret; } @@ -423,6 +431,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 +516,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 +544,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 28 11:07:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 758781 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05on2086.outbound.protection.outlook.com [40.107.22.86]) (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 674C56AAC for ; Thu, 28 Dec 2023 11:01:58 +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="reufqZ1J" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=a287cK4d/iqV9V3bsinLigfV7ZyyZUN0jMRDRzQdq0d0wu1Aav3DjmQvicBAH9ecC/ZbiicAI/bw/6YJjYpjxPOlp0GDaHFMTfKlLg2Kp562otoBx2Xz0TQh6OcIPCwT/RdNBmnr+LqzIBnIzrTaRg06g79ersBH1bi3AqRhnMRw70joPlMtT9E+cL77D0nZaApZ7aDZOiE0o0TEUn0E0GZWQQDSdF+5oxByCMXQ+S/pJAzdTzcuGcCeMSufmBWBWQpZwuD6KFLcQZLCNPT5JoBDnY/ZlLFBJqXQdwXPtWLYRx3rh+m5+enxAOz69Z/orn1WYqLVz7+KT1n8cHoChQ== 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=KH1j8qRhxouJwSAWosvyH/P/e6yzzfyv6AHuaXWNi1w=; b=FYLXt7SWLOQ4s1uvCaFdA833Z0jz7sy/j+Wza+u95ZU4Hce0WRc3UtM9eT3fAZntXuzO+mhkk5YLch/DBCTAGjUCrma2f7X+2n+AxBlLQYlV+aXJLtq5QjMsA9vz0rFpaMksfRV6SdECrCHkfq2RjIh91vibm/v7dn228yGExOv+WAWnVlZ8HP9+tOeR80ms3Zje1muzLu28ma+PfCV1NwkfyN5VB/3Quppm8/n4/LUsBTV8w4g0A5pCsEL9frthoIu1cWQx0/Jfi/LaaLhS8y2Pj9TiHfRXW4Q/P/qZAzoH5bjDzj18Ug01Tq/EyGhxCg/rLN0qYMTqrDZJxNz9ow== 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=KH1j8qRhxouJwSAWosvyH/P/e6yzzfyv6AHuaXWNi1w=; b=reufqZ1JdBpAKojcOV1H3Vkdmz32132Ibsct0fJVQ8c0jIz5Ln+s2llnXK4jzOJxd1Xt5HRBjFJNXkMw40h9YqcMDu6s3WGOhx8SEQf4dGQFlYyfltOb48wz9z6huLCetinDUsS48c94O+6yHslSLWoSpLWZMy74EylLFtwahE8= 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 DB8PR04MB6795.eurprd04.prod.outlook.com (2603:10a6:10:fa::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 11:01:56 +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.7113.027; Thu, 28 Dec 2023 11:01:56 +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 v3 2/3] usb: chipidea: wait controller resume finished for wakeup irq Date: Thu, 28 Dec 2023 19:07:52 +0800 Message-Id: <20231228110753.1755756-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231228110753.1755756-1-xu.yang_2@nxp.com> References: <20231228110753.1755756-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SGBP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::20) 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_|DB8PR04MB6795:EE_ X-MS-Office365-Filtering-Correlation-Id: 6657a5f0-6dd1-487f-1ffd-08dc079467f3 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FlWXCD9L/gLGwle9LbILEmfv8tAXzt767PCR921RTc4BvIQY7XtWXNwlPu4/u0KU7k/mbB6DySiLS8ZboOyaqsvEV67WAiYFmLmgBk1KBer0YHpJYr55fkLYtuU1nmubOVIY653V3cLqVjBOnbTVRRRPsS9g9xgY2dUIQeyxAHapAaGUxo/CvgzAAXX76fAbv5bZpCCtRevz8JEDYBDdje5ERtPzJjkOfTJv7EOp2IheUFvqvk4NvzWpeCkQeruGmDzy3zIbyCpyoimMRoASRVhNC+nhq5lO76BpYnK/kWjDQgFZuoPhiFy6jhjPiOe27ksRI/sTh8EFmrFQhLwai0SXdbjXYpIIjKggVup+AeliNW1A8LCVbcAivDGhH7vkCoap4ZDQJhE6DtEsMRzTFCEboRE7Hi/j8ZuO2XAWTeBv6rSXBoIswSOr/3Fc3rEu/2wijyj6SFhjOhhSk8gvUXpW72oq7QHKF2NrnJmZhEe2u25RtKJpg8ZPCQCL/0YcvJyMIHO02IT4vhaP65bDw972HUVFeHp0H78TzQsFeXfya+E6la9D6q2NKvU0L9YvOr1fsgtzwEsX+PKZoYa1MeeIrxqI44SkEg7gDQyhKo6QKNW6WTaWFPfw5GXi/wgW 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)(39860400002)(366004)(346002)(396003)(136003)(376002)(230922051799003)(451199024)(186009)(64100799003)(1800799012)(6506007)(2616005)(1076003)(26005)(6666004)(6512007)(52116002)(5660300002)(4326008)(8676002)(2906002)(6486002)(8936002)(66476007)(478600001)(316002)(66556008)(41300700001)(6916009)(66946007)(86362001)(36756003)(38100700002)(38350700005); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: arPfzHO5164Bbi/Gntr9ONPMaT6o8fZBf5ZpAIZTi6ileXZZ55CPb4Rp48ss2e3nRLx43ZVWAElB1OonaysgPKe+lEBJxTSCWGVP0zbuVY0vEMkgTfE8PzXk7UdrvltNkqEPqxasuMh/N8i2aE7GqHKuQdrGykD83ZqzK0O8r10Kktv3Cd8p9CrGPLLmQAgXxIzaT0ExEwJO0UQHA0M6mQi6JYOi9qy4pWXBODIlTrWvFEZI36n2n8Fi4GADu2WHDPqdPBLP4Wqr+Ui3KzSACkrk2AoFMdgrUkUlyoge+vNVK6jkxv0rxWcnhtqdjUhjBztsfp5jh+e8VBKjC8gE5I4yrFuuvRBa9jOyzN9lDMVFknHWq3Ny7QI0yNWmxlKvD8jCljTcUl+U9shu0EAYtYsBqCFRN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QvBZogXi5IfR2ZxS9GqiO/dV+bbD+HzPnWPCQYPK3X+0raMLKHjG1XxSvE5DdpyBwfQguSqskkmloTwMnI2E X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6657a5f0-6dd1-487f-1ffd-08dc079467f3 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5146.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 11:01:56.2006 (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: 0ao2U/GTUo/3ef2MYQGFSlvNR/8Z3wqfuDGF/pocYe1fPvrTtm5SkgBlmpFTaK7vRViN2I3IwPowmYMsWmu5aQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8PR04MB6795 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: Acked-by: Peter Chen Signed-off-by: Xu Yang Signed-off-by: Li Jun --- Changes in v2: - no changes Changes in v3: - 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 0af9e68035fb..41014f93cfdf 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 28 11:07:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 758934 Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03on2073.outbound.protection.outlook.com [40.107.104.73]) (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 B1D436FBF for ; Thu, 28 Dec 2023 11:02:03 +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="spxTlxJf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lp841mdAjewG2GE9BZF0gUGgu2m/KtO1FLgznAKhQtflBIiyje2J0MRbkn7hxKO4KSjeLQWaAJ1ngeR5Pv1XnfuImMLp+bnqYKxOsBLKX5qElYDc1xFvqI/ur8uyu2e7fJgCnRojXmrU5of/nXXNQ2Q/iK1GQOPTX8TNfpA2SvibzPfrl5efu2VZ2kwH48lrGhoVrJxChNL0+EFImtMDZBgu86hhXLt2hIegfJz1hUAOeZmx+VpH6IDXtE7KMTxaafWbffxGVznS9XTy41BN2yFIYa42jrpcmo7WZldu009vCoF89LA3ypna9cRbf4DiQoT3dalrJmF4mV1QrECZVQ== 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=tkMs+VDs/6/LRZ0t+My94tiBmizNyg/sryes2yBC+FM=; b=Ft5Oqlw8gAB+Dk6O4O7Se1m/ge6L90op8Qb9FQh65ioMPbUMjcimNAGKzKmJeevqTxteXxhu9sZBAJrMqVH5UIJToXe/e+Pb0eULdeLNaGSyJ4tzFzrIp/MUHmAaWOxiua5a0y4aDESeRi/Va7Ektkn/2Uw+xxF1mbA0KhQ9kLOUO854cZa8GbIKsiYarbf8I1ooph82RiKN6EVAoBPa/J0Kbz/s++N5OsPkJzWq0QvzoQNPKgt+jV6ryNsy6BeJ0Qe5AyM6pTLfwoT0alRr+WdbnoWh4rZ1IT9+ssFjSKMLZtKy/CY/M/xRo4lI3yKrnIkE11Qv7bXlkNpDXC01+A== 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=tkMs+VDs/6/LRZ0t+My94tiBmizNyg/sryes2yBC+FM=; b=spxTlxJf8ibczbNhlOab5jX/kty0U7cljAkAlsBY87rGXgGI+m1LdZYd+OIMGNu9CkFldOpIyjfHVmSY6oR0vczryxj4qc8zZWP7WQJQtYmQuThJfQViPI0rY1BJFvrE5LoN5jhG3koweybufnAXiJHuBVpSYhfs7l24y0oL+dw= 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 VI1PR04MB6815.eurprd04.prod.outlook.com (2603:10a6:803:130::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7135.19; Thu, 28 Dec 2023 11:02:00 +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.7113.027; Thu, 28 Dec 2023 11:01:59 +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 v3 3/3] usb: phy: mxs: remove CONFIG_USB_OTG condition for mxs_phy_is_otg_host() Date: Thu, 28 Dec 2023 19:07:53 +0800 Message-Id: <20231228110753.1755756-3-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20231228110753.1755756-1-xu.yang_2@nxp.com> References: <20231228110753.1755756-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SGBP274CA0008.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b0::20) 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_|VI1PR04MB6815:EE_ X-MS-Office365-Filtering-Correlation-Id: 3330e93d-9461-4427-5725-08dc079469f1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uwcRtUDlMU8d+Vl4sNbCICRRRUU7W+buHkel69c5NjfNo1UV8d6MbPI2LE/rUDjIKUJm7I1l8mTPhnmxHoo0o8EmqpUbEJYyY8OLibM/j0NLyv78JGpvvz1m+nFMtK9XmvaijObJCUpqN2KAAZMrc+US9s2gr7gFDrMW/BtouIIt5lehEcX8E+eSkaC0r6uIfztHWeuZqNyM9bFZt7G8FpNSilj5PjXr46q8xdm4B+q17ASd6yZ8TKI3GPezg/63lB5L//O/yG6dJuA6jwCPoBQTIZVwShBL9MKinSf3TK/2OLO0nr+dK2QEEsp1hmN7UhvWPKBMUu9YdY1WgwHMvxA+dvJwMT4amd+Kpz4QRLC1XukUeTrPnv2ZdK+yAhL9nOGVnaToG9UhWM3J5CCeUnZ5Guhl9hWYfL6s75B78Gqx05ZjfywE79OrGxww+zN5b1ETeuCYWwq6uPjJLXbO4w/QXTlBNATMMDRz8sd036YlpK1AalrdMChLH2wp51U5wNwCrT1N/8E6Ncrz22o51v01wyddnKLnWnzCYmlX8YLzQUZveX3IqvxwQd2VGr/9e+QywQ7HfBs7uf9kzJKBnK/pchTyszZUDLw88KUO/FKhQKeXS7QzzvACWezXY9wl 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)(366004)(346002)(39860400002)(396003)(376002)(136003)(230922051799003)(64100799003)(451199024)(1800799012)(186009)(26005)(1076003)(83380400001)(38100700002)(316002)(66476007)(8676002)(6916009)(8936002)(66556008)(66946007)(4326008)(5660300002)(2906002)(6506007)(6512007)(2616005)(41300700001)(6486002)(6666004)(52116002)(478600001)(38350700005)(86362001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: f63x6LOZMbk0dB/VN5IhO2jgxbG30D4x97H+u5wksxHGw3X3Sajn4rhcsibCMrijIghAh9TKOO2mjFX9KN1BHu4l2h2uonveigJQ3Pwj8Mp7jURza7s4+bxyWBU8+61mPYXIEs8g2UTa4M2YsA+stjnk9toKLso56p6yBmR1WEn+N0TjVpfTpqkJr+uS2fHTQtSIz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3n+GHqax/csr4mDCbWagW8DhzP8iEdJvxPFjjMsy6T74aRvrHQJRLrdhHOebiQJK5/9+GTzDjEZHoOoMruYFJiWL3TNxcy/WPUT+A4yyvCTGOPdxenvjG7pR2lI16M3tgZTUGf2FcA1swCFdM5LJxVpSYMETfOdYWUUq/Ibq2OEENdjFz3tT0RRmYVT5nbQ6TOMVpGyLR0M4LzL73TDEOFg5JCJfZT8daV+moD5IzMHDpf4PywIAG/PwAWeS3VypOg2C/DZ9BqbV0MFfbk3zyTnNkpAZghKIWj4C4KxW4aFEsJUxLirQXhZ4SFX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3330e93d-9461-4427-5725-08dc079469f1 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB5146.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Dec 2023 11:01:59.6922 (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: z3hbLX6Kh8O4DzDDCW5exVXF5cgXFjgtHpYEM/RiC5Jze3mUD35AxtbbyNWpO/VFf1eKG9dFIC8zYt3rV+wICg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6815 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: Acked-by: Peter Chen Signed-off-by: Xu Yang --- Changes in v2: - add fix tag and stable maillist Changes in v3: - no changes --- 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)