From patchwork Wed Aug 21 16:19:08 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13771905 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9D89FC52D7C for ; Wed, 21 Aug 2024 16:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:MIME-Version:Cc:To: In-Reply-To:References:Message-Id:Content-Transfer-Encoding:Content-Type: Subject:Date:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tgm4R5uH4tZ7nv2R+bN4sepTZE/cef+kW8N7+irfSno=; b=De/rRVk6HoXrC7I5U8F8tF/vcQ VJ1/zxxMB3A9aBc7bcOPZnKvilPc8w3Ol6w5guRDmxHssg0JMph/vptB8HWF8btNPPlo2gAmAegLn Wl85aNJr9VIxsM24g7NyqRMSP7mDouwQn/Y7NA51gaGtZFNekTbl6M7n1i6MAaN56863agVLM5L21 Cgt3UyV2R8gHj3K6TqlVxAjwuzyI+MkkfeIM+5H7ZpyPVblsE2IdolnPXThMi8cCQP34qWhsFDfyY jIUGjOYoS4tcWtbYeFpCV/V+UAy9vbAnE5LWpVHLQPBUtu+zy9HoHhlH4862ZH0HaJV1/CSuQS9OD lTHHAE1g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgo6i-00000009jZm-2FKz; Wed, 21 Aug 2024 16:22:48 +0000 Received: from mail-vi1eur03on2060f.outbound.protection.outlook.com ([2a01:111:f403:260c::60f] helo=EUR03-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sgo3x-00000009ijs-038K for linux-arm-kernel@lists.infradead.org; Wed, 21 Aug 2024 16:19:58 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=SIN7F9pwGsXwVjVMCtMPHaWRPU+Pddo6Wp+Mhr+g0Zcj8CXi9cB8yQBGVHIYbRmeaAxZzK+zh4XFTruzshdIFbbucDH4nMQXYHt5QCtmUxnUMhcPSmOiLRXb+mRIlmrfw4bnNF5AaFycNfMkaJrQIbz7JQSqMlBZg82kAVHzHJZddIOaUh9ACNBK8wi4qgB2b5okZiS1ppiJdwSyNsQu3ddWSVONawjPNm9c3NC3xS5lJsabaoa0QNjtJ/+BUOLXNUg2NsI8a77vNLzw4iHG5yxUyO6TUN4pEJWpLAc9M+EglltE3P6B6j9AbUpRTzFp6TdRypKRS0g/McN6YL1ViA== 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=tgm4R5uH4tZ7nv2R+bN4sepTZE/cef+kW8N7+irfSno=; b=SoGRIZnN8Ep8LJypMgeZrN5LQ0QsK4PgjvqXTgpGsizi0BztjzJteKC9f1IQt85sQRTLC8dxDCb2A0I8z2ovtodxZEUWDXI9q6AkrWyynFd4Rou5ZwDYvdT5ZkoQ/obCMyCr/rTr3SevK72VR6JvqTm2navycJEJhCfsPviCFlveoBDluuK8GquZ7eb+XcN/jGfI7uAVJUQPu9BLcKVAZeUIo6vA9pqBnRy96NkZ8RmEpxFohGYsqzMND7yd9FT9ma0AxuRFRPAAOhazUf/lAZ0lGDHJiVDyhg5Zhi/WR7WFcXrxTgVlIhDshdqMbtJaEuJl62WcwN7cHZ0NGToi5A== 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=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tgm4R5uH4tZ7nv2R+bN4sepTZE/cef+kW8N7+irfSno=; b=HPNMwVW5PfbPkZbCMpASH+eWpLSLP0RB12JBw0GA6DcK9X0zNa7iTMlA97Q9AXXvo4Hw74r8I5a9OMG9GCXRco6vjeA3YJDBzq7P3B/mIzrbyTtwNfw56oVLqIRtMhr1I9kPwQyqkgGrvFLKXdGQxzgtC4wLZj7COXl7CfrNrqPEC3fjK1YLMJtqH/Ivr/MD4zgjrEeK1BKZal6iXjFrIJD+A92+mp6/mV5wVJcIJ5RKGl5o5Q3A81+9EzXhb+jWONFguPuPl9my+m6xg1BpkvNDexgT7Q0SuHDJ5r7x00fpSB8UjabDjtOofQLiyrt7MqzVHpQWkALlfZrMYA4QKg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) by DBBPR04MB7817.eurprd04.prod.outlook.com (2603:10a6:10:1ef::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7897.18; Wed, 21 Aug 2024 16:19:54 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%3]) with mapi id 15.20.7875.019; Wed, 21 Aug 2024 16:19:54 +0000 From: Frank Li Date: Wed, 21 Aug 2024 12:19:08 -0400 Subject: [PATCH v2 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Message-Id: <20240821-dwc-mp-v2-3-2a29b6a5c2f4@nxp.com> References: <20240821-dwc-mp-v2-0-2a29b6a5c2f4@nxp.com> In-Reply-To: <20240821-dwc-mp-v2-0-2a29b6a5c2f4@nxp.com> To: Mathias Nyman , Greg Kroah-Hartman , Thinh Nguyen , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, jun.li@nxp.com, Frank Li , Xu Yang X-Mailer: b4 0.13-dev-e586c X-Developer-Signature: v=1; a=ed25519-sha256; t=1724257180; l=2128; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=5+IVkwBerM0rBDtlaz9W/KvOLIbVp8/vpBPWsSyKKOE=; b=P1kcUcvTcUNH7zx+WBhqy7hSd3LltbRirQhmDI7Ocvl8hfzpPGrshn6IyLVnLGV3CUFoaqXK/ H9cL2g+JFEABuHydmCBTko0cwLgaQCsZFjH2naK9t98gvyM1/9A34Cn X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR08CA0056.namprd08.prod.outlook.com (2603:10b6:a03:117::33) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DBBPR04MB7817:EE_ X-MS-Office365-Filtering-Correlation-Id: 8bd0510e-7b33-4b79-2412-08dcc1fd1771 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|376014|7416014|52116014|38350700014; X-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JOkEIFIE7vAjVjgV3bcBa1NugE9lGdN5u7ggpYIuj6/P+a1lRSWWGyU1R3gL4Z+p?= =?utf-8?q?klOHhlMXDFLbbynd5EKYf0wZwhah23U4SMIxSgtLltrPDFlYjNit9htG/l3skGjIp?= =?utf-8?q?ueCLPaYMCgts9S4outNSAh8gO0BdocwdsMitXr9vDfg/qxvpTzwMSSSa+sEhnQpmi?= =?utf-8?q?0AXF+pTEMq4ZQMLCo4dcPlEIYpFMeaSvqv1Zc4KCdaxdQ9eJZSKChY94YUcwttWtN?= =?utf-8?q?1SJj8i6SUN+Mwif+bDwmfMAPfzGUSZOCnJv4Voj9Q11t09JsZitGwk61cpEjB5Ngb?= =?utf-8?q?V3TTJI3LrEUZgiS8vqreLGurRzLRurqg6FvP9eqWqwkK5Z00uTDTQlWH3sV0xNvlc?= =?utf-8?q?teOfrpBdUNGBzn3dTYD1hkDf5Vo3LGDm4FQ5emSAsefx0IqcXljrAjyBatJAAQi5o?= =?utf-8?q?VLpXfi35Hs+Mxm99VMwgJNBLQ7SEXvHCT204rhsdWYnqVkmslWRaq/dn2/1tVe9sH?= =?utf-8?q?abZbGBYY+MZ/Xy9Xuukd4K3A/S5iXcL5Dg=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(1800799024)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?HmJCSdTIZEt/Y5zgzDCaQJnEOnCl?= =?utf-8?q?Y4L2b5ObsnxtgzXKmenlcpc3YoE8hFgqAJyQnngHOI2b3DIs9kjdLZ/diUN09PfNC?= =?utf-8?q?gcfirqqim/RwoWj2VvkHkke4anzUThsFs48+fjJ4QtMu97w6l3C5lJR9KAPanE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=?utf-8?q?pS9ZupusWSGVrfG8hNsndrs+LSfW69FYzwVgJ0hjLN6xu2xaxHATyNAZ5WH8d7n1l?= =?utf-8?q?cZZJANPgeEvSOin0Y7p84tpokdxQOSmZtTsUvuPrbKtod1zK2fz4HSTbVUFH0qS4e?= =?utf-8?q?Cs5OjUTuashEkR++n3MXaoFwQpm4D6gU4KQ+4L3290fsyH8Y2SC9LGREvIwekFfrd?= =?utf-8?q?Mn+NkQxxv8VY1a9F67YK6zcg6PpdSWo9oehziPQDGIDRQ3A0PYQJq0KBAZQMYu0MO?= =?utf-8?q?wcnIgHksRwZIo8HQhGCX3Sl7ojS9GKKAUtKIUJqMw4+By6wepOttP0XpAduM/KHRq?= =?utf-8?q?RpdaLeVHSDVhz8+CS0Wx4KDgIHQQExb9oxy7loPaNBvvaDnMinNFRHR+djJ4DoNT9?= =?utf-8?q?zWScDn5tuIMMPiOmYJ9jts6rcnQEsN0wIxttZ0ZvhLfJeibxnzVnxNMBuE3zg3gL1?= =?utf-8?q?fyWt9/k0JLQQ8DXA73+fJkaGThPkE8VE+uJ7FnW3Sg3CsrHW6HYak0sdzsF0cyinS?= =?utf-8?q?I1Xozkneoagv?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd0510e-7b33-4b79-2412-08dcc1fd1771 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 16:19:54.5024 (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: u06oO0KvO2Ku56fBQ9es2BtRe2kCnMwR1YnETRAPradlKiTSSOHF5BZCQNxRpnJlr7z/dzFp653wh61BhUEIew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBBPR04MB7817 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240821_091957_093981_9A5DB29A X-CRM114-Status: GOOD ( 13.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Li Jun SS_CON and U3 wakeup need 'ref_clk' on. iMX8MP turn off it while system sleep, So disable these wakeup source and only enable DP/DM wakeup source for host mode. Reviewed-by: Xu Yang Signed-off-by: Li Jun Acked-by: Thinh Nguyen Signed-off-by: Frank Li --- drivers/usb/dwc3/dwc3-imx8mp.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/usb/dwc3/dwc3-imx8mp.c b/drivers/usb/dwc3/dwc3-imx8mp.c index bd6953246f42e..02159cd820a10 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -96,7 +96,8 @@ static void imx8mp_configure_glue(struct dwc3_imx8mp *dwc3_imx) writel(value, dwc3_imx->glue_base + USB_CTRL1); } -static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) +static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx, + pm_message_t msg) { struct dwc3 *dwc3 = platform_get_drvdata(dwc3_imx->dwc3); u32 val; @@ -106,12 +107,14 @@ static void dwc3_imx8mp_wakeup_enable(struct dwc3_imx8mp *dwc3_imx) val = readl(dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); - if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) - val |= USB_WAKEUP_EN | USB_WAKEUP_SS_CONN | - USB_WAKEUP_U3_EN | USB_WAKEUP_DPDM_EN; - else if (dwc3->current_dr_role == DWC3_GCTL_PRTCAP_DEVICE) + if ((dwc3->current_dr_role == DWC3_GCTL_PRTCAP_HOST) && dwc3->xhci) { + val |= USB_WAKEUP_EN | USB_WAKEUP_DPDM_EN; + if (PMSG_IS_AUTO(msg)) + val |= USB_WAKEUP_SS_CONN | USB_WAKEUP_U3_EN; + } else { val |= USB_WAKEUP_EN | USB_WAKEUP_VBUS_EN | USB_WAKEUP_VBUS_SRC_SESS_VAL; + } writel(val, dwc3_imx->hsio_blk_base + USB_WAKEUP_CTRL); } @@ -307,7 +310,7 @@ static int dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, pm_message_t msg) /* Wakeup enable */ if (PMSG_IS_AUTO(msg) || device_may_wakeup(dwc3_imx->dev)) - dwc3_imx8mp_wakeup_enable(dwc3_imx); + dwc3_imx8mp_wakeup_enable(dwc3_imx, msg); dwc3_imx->pm_suspended = true;