From patchwork Wed Sep 4 15:49:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13791152 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2083.outbound.protection.outlook.com [40.107.21.83]) (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 635A010A12 for ; Wed, 4 Sep 2024 15:49:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.21.83 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725464982; cv=fail; b=ryGZbE1CdaieKhXShCASVdqBUWoJFIhgUgRj2BvfLes82vzzgtmAP1QqWexZAsG8BVVc9XAsBLXRwztqc9Ie7jQvSATotQkFX3DgakhhbIFVc1u10MYkwfcH/BiA+PbNXHyIkUN3SI/vHhehVBFiaNizjP5EywYqfnejIRMhsgo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725464982; c=relaxed/simple; bh=nEj/K1ERPksvYT9CUWSWEh7L//sN6UL3ybiMuxZKiIg=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=qF77c6nBCO4MgO4aaGXfk/U2bzm27OxVph9v0CIjjtZqGbO6uFcTHz+AI9iTp1j4t1/mclAInWbm1/rIDP3+YnMZO9i7dHyn6gAd9PainmVRkLhszeb+wR2O30P9OTrE5HU3ZA2It/HKrKFNjVH1dAI3kUDXvsuKxtlQKx6eTVk= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=T7DAbsvy; arc=fail smtp.client-ip=40.107.21.83 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 (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="T7DAbsvy" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=uvhK3ssGnsZMijlsRa4ol250h+GZicJAWObiHIpR96slQuS0GvCOZXjKoVOPM+C4Q6/Y4iORgsx4h5a1D2xx8C1xI2g949MQIuDq/xg/7aG4pspB9Zh7l5hww9yKmrZ4i+n/z34sel0WzK97L9zrFr559PvTrCzXoLst2kEeMA9646Wld/v+e39JgwuwYx4QBPd2YmTLDTiCOoI97myZmjIuiPrU/4BfkFMCwg0dwcL1k+kzJ0tTktN0ftQlrIyFsoZ6NzZlYo6HRydYGCRyJ6mDb7ODo6JAYBaA7D3myGtNqpKRuLKbAm7fQqIXuawFoDdtvRc8ndGvwuds/g1bZQ== 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=nVdzU9A+CAU6duPfd61IiMrfJBYd7VNYirrUjVvay9bjrd8HfS0YnTbIEm65eOQBom0fOUDdaF6YQt9wRYu4g9l8r4OPWoyTLhEQ9J5tzT9Y5afUlI7xrMG5vXC6YVkz4MGTZoKIGEOrxWJDEPYiKyJRcBuxgqo8crxkBVfNp+fYGvRg05dfz+OGNUIw2axqXTDlQkPvlLth+sGrxljeIURTUJs+GLC/00w5iUMck4jqy8fCDLFDwBAsyfmNAPEoXtPcO6RKMpK3Gmi4mmhNuM8xmE+rk4t2ZTC0ogqwJcCliRfjuatbw5MGO1CKuqSNQTzagTVMzcKE9W/k3q4Q4g== 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=T7DAbsvyGsEcAuwpjvuuH0D6Y7OVPQwSY2omZKs04sLbXmU/OUoZcWmaNuyDyRg/ZikpJxYEswXQ4yKzw60zD+0d0knnGJ+m4Vt+eBL320fd6z8u4efNhVEj9Gv9oxVDZMQASVIpFtJOl/y0YkzhW5jirlyYFCQjUTa3MaQ9EXu0nmOfVJmSBJ1GNvec3khJaItILj7snQ1ujmGPGgQhfIYN+5u/qeM93aLzthXfr20gfZa/OoZbGzBdctonOhWMSIC0lQMR1FFGry0WJQRUsTjR3olqXy/LgceNs7c3NUHCZ9+G6PJbZxtAxKgCx7XbLBMV2aQws0z8qISOHQmJnQ== 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 VI1PR04MB9859.eurprd04.prod.outlook.com (2603:10a6:800:1d9::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.25; Wed, 4 Sep 2024 15:49:36 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%4]) with mapi id 15.20.7918.024; Wed, 4 Sep 2024 15:49:36 +0000 From: Frank Li Date: Wed, 04 Sep 2024 11:49:04 -0400 Subject: [PATCH v3 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Message-Id: <20240904-dwc-mp-v3-3-319947736ec0@nxp.com> References: <20240904-dwc-mp-v3-0-319947736ec0@nxp.com> In-Reply-To: <20240904-dwc-mp-v3-0-319947736ec0@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=1725464962; l=2128; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=5+IVkwBerM0rBDtlaz9W/KvOLIbVp8/vpBPWsSyKKOE=; b=99aFnmraoka2Wx+kQOgzshmrwvTcSyOaEC51xOBGH78f7+UGsCOoFgI7JKTeLsYUq6D536/DM J0w3y/00tzUACoEsb1pjOutjaz1ym7NwX6sXIEA1Y0l9JMNBpPsu/bh X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR05CA0008.namprd05.prod.outlook.com (2603:10b6:a03:33b::13) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB9859:EE_ X-MS-Office365-Filtering-Correlation-Id: ef20a551-ee3f-4d52-a244-08dcccf92d8c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|52116014|366016|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?v85vhiSZJX4gG+1D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UVaArm?= =?utf-8?q?8UjI+nL5xEJvQdpWSGP2qA/XtQ9YpdQj/GHotanu1YBtkki3zy0/riMMte7nhbI/0?= =?utf-8?q?mvPwf5IZlU9aL2yzMWA82JZ9+pRAshKMxiCKWnLosRMTKelMiqtwqeS0cjUZWoq1b?= =?utf-8?q?vwgdVtgEt0z0iQEI9Inifg9AzO27hKIcbRNKGHJPmRcPIX28VmBk54xOV9dMJbHze?= =?utf-8?q?fsWZY/yJG5jB+Oh5/E9i7WofRu6xmggfJaNzbZpLoafrYaCymWdzYh4fGmQBj59n7?= =?utf-8?q?8IyOClvb22f5q0VAmhiiMzZdIooEMwd2ffGXwGvDeqxgsK1yHFOVmtrJpLOkYhbT6?= =?utf-8?q?zWBx4L1Pa811ec8U0eV7Qh4ggkdD3qbU3WfU9arraIIw9sNgtyCEP9yACBviUystg?= =?utf-8?q?DhX1MlsEFgRNnNZZ1YBYVi8TVNOX1TT/xzBgUiecVTB2mAaLo8fIi6WMX1hQ1TZui?= =?utf-8?q?y/SmsZQjpkXCOELIh3dFjpNwlMczv58+bQ=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)(1800799024)(7416014)(376014)(52116014)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?FbhnYGzDJ4uWODA4BGhDaNdEosiN?= =?utf-8?q?alYFszEPiLm03oc2hXwBysd6xNkLgMudf3rVmh/eGWr/sa9wcMVmbAs3JfeyQngrO?= =?utf-8?q?nTTGOzR5V/mPo0G7GIyjcWJDnWKnvJ/dMX0XsahqjivWYXaXPOUVrXBHxs+otKNpN?= =?utf-8?q?tD2nDygoV4Tmjv0GaArUW9t5f0OsN2+JpvrEn5eiVI6HbujYyRCs5y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?= =?utf-8?q?3MIU1dOwIOtLKZRpoCAJOrzSzM5ss2hfMr/rDIL2lQDRsmuzXNSXSZFps/tqmzfCJ?= =?utf-8?q?uCnFlw7LUjVgga9HbT/uZo8dXQF5F3bBmmbxhuZzcHqZQon9+KHbiMbKShWP8xcsA?= =?utf-8?q?ox3Y3uIQ0CToeApp+PZePDPqI2xE6igCSG/CrR8dAcqXre+BCWwaqIQVjIm9KKQ+T?= =?utf-8?q?I3Z5LL1TPMj6MNznzaftM9ub1mJVJouQBygnEwczUdOagbpnrDZq3/DsUPJwYl4m1?= =?utf-8?q?ceGOtEx5BO71GcpVaUmPJ7156B0p2V+bn29UDzf6e+m29oxTfov/5Ld0fIVHM0Ido?= =?utf-8?q?/SeLws5mVnRHnUAo6KHiVzgjdE8K9k3VVua9ojVxtHPS59ArtU/VLqp/+gwyblOjs?= =?utf-8?q?LZYp0fWrHDcP4hgin1PYagl8aUoKP/hl/oQpEEmNkB88lwqt8t6onQuWSmSMqKige?= =?utf-8?q?FHJ2hx87OZI8?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef20a551-ee3f-4d52-a244-08dcccf92d8c X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Sep 2024 15:49:36.3740 (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: yvZBRkWRbeyB6SEgcK3aezGvL7RzRM82pHLfhdAoxI1P9HQ2g3Pn2ovVzUYwI8d6vccoV84v3Tktef3XuQhUhA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB9859 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;