From patchwork Fri Sep 6 16:30:39 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 826896 Received: from DB3PR0202CU003.outbound.protection.outlook.com (mail-northeuropeazon11011014.outbound.protection.outlook.com [52.101.65.14]) (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 3E9401D47D6; Fri, 6 Sep 2024 16:31:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.65.14 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725640265; cv=fail; b=EmKHpC/g3ndPTBiv18GpabYxW8EUWUtWB6UJw4na4jEWT7x4gTi3Y6uSH7TYys0YwqefsREV6DjDpLNWvnSwhW+YNXJi9SoHCjwf6bLyP+lDSfUQkeCqIX8JWftA4I0zxpjHwJuhCutEZm89GQywImvXj/MSmJTBF/sPvu8CY4g= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725640265; c=relaxed/simple; bh=2LsMdszPxs7nPZ3WODzvRciDtq3lNGIKklis/0adT+Q=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=odLD9nv1tP2xaDuLjUEB0CCvoYKjOpHMS5Xv6fDM0c3VZtbd2FDV9Y1vfL3baG7q49eBG6aMxseqoQJiNrSWQWr97xBhYe3/QJWGZjNoGZWOmt5pkaqtuQRrcmemFmdlYQiW06KUh4KDFmZJLdF/4EXeo9b8MaoM1aRd4ikEvV0= 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=CE3s6ofY; arc=fail smtp.client-ip=52.101.65.14 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="CE3s6ofY" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=Cn6wi+7FmVwlyLgQy7KI3p6Eg2et1hRPMz4ekKUF8M7U8E7T8PsYrBpOhizrAdN64CDeBi/a4pICTG60mp+1kfgzJgJxpSuVUXDz1QZdGRAaJysAyM5IcZTgt2Zm8np4phbSCsKzkhCA/2i+rzV1NaDJn41clDQG0dN2eO+075KYO5bD4UkgPRyP3qY/ylPK0l3Cpx9K4uAPtRFhrGGXusIw4cgxZnkHMCjjeJP3VVq2SISiKXq1gDHirFP5M8TmT/VDRUCL75+6lEUZB7101azi38jULCOjXSpVbvLnOSl4YMYLIP93HPiG4hEYdknf/ASJ6usIawZT5zpIjReDQA== 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=rqy4TY/wNLiJPUHnBtGAWyth+ass9f0B7FvzsQmw1tg=; b=w3/2Uq72hfhCgZWD+on+jQ9fO0WcM6vZckC4KVjBBEZyHvkF+5YVaczFbGVKoQQcGka29xezx/Jc02rbDU91BKGUdg569fdnG7JIE2Tar52O8I5kEzbsEe0ESeb2FgTsgiOu3vJJbKr6kMv2h2ZE3bL1zeNTQtJ1HCaLhWitrb3aVdvVqNoBY5RG5mcyvf4cJPpnSU46wYXeq+pClH+S35J13fpA7/ha0EWgf7XpSctUMMyGAkmO6Ri3qSzwn/4W4T5RsEMeMBQjGi8ZkuRT2jJFCakJ9X7nmddo9f6vPCpq6/y0xKiNZnrCweWPVKUpBr3f1xFl4V76RV+WexFzIw== 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=rqy4TY/wNLiJPUHnBtGAWyth+ass9f0B7FvzsQmw1tg=; b=CE3s6ofYTtA2OCDcphA6IuvE9+N2etE3I0ddO94yycSSyQeY4y9GccY/xxu2Ve2nnRL8Sk6VBeX6BhNdXGRaki3AZrOwfy/gVTOZEoufLztlHFUrfOxmW06mCMjqQe9yX9qxLyUWUup1W/xB+VsflPb3iWbGUUEGTszh3RdSzQgOp50iAkFN7AdvB81bqdLCzovKOH+B0rKtouzlwPInOU2Uch6iylmZ5syuBjFV7TsYvu0UHoi5OMkr+Y6iPWos4qH5bcBKIFJ4PtKkBp2xCdRhZVdu/Sy4L7+QCYPZlxirg3PwfU0A+YiRvsV6HUm9h7MXHBgWkcgEPhtNgzWeSg== 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 PAXPR04MB8405.eurprd04.prod.outlook.com (2603:10a6:102:1c2::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7939.17; Fri, 6 Sep 2024 16:31:01 +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.7939.017; Fri, 6 Sep 2024 16:31:01 +0000 From: Frank Li Date: Fri, 06 Sep 2024 12:30:39 -0400 Subject: [PATCH v5 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Message-Id: <20240906-dwc-mp-v5-3-ea8ec6774e7b@nxp.com> References: <20240906-dwc-mp-v5-0-ea8ec6774e7b@nxp.com> In-Reply-To: <20240906-dwc-mp-v5-0-ea8ec6774e7b@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=1725640246; l=2163; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=gC7JEGlw6JQv9GgnXx7tvm51p7QIxUVIu7LJn/D3a5E=; b=RyeG6f3hVtlJ8uCO/OpL6DVAaGUdYUFFZvtc5B9lKmrp3esPb1eyVNx4MtPlEh/AGwRGqAJ2S 0coKm/lzkZ1BpHPHxnSH+8J8ArB42RR4PriJL1SgkTdmW/ioY2iMGYf X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BY3PR10CA0016.namprd10.prod.outlook.com (2603:10b6:a03:255::21) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) 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: PAXPR04MB9642:EE_|PAXPR04MB8405:EE_ X-MS-Office365-Filtering-Correlation-Id: 4c4bc0a7-65b2-4c75-9545-08dcce914bab X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|7416014|1800799024|52116014|38350700014; X-Microsoft-Antispam-Message-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ytalC9VyeuZKJCChTPqApFksINCP5Vu0wTNJt6JeFQ6H5I2tuM?= =?utf-8?q?u8AuQjPi/TdCLVJEFxI7pDMnsCiy2TxnZ8CQedZBqRy1Df09vPjl5axbc5RI3M5FY?= =?utf-8?q?D0pXk8Wem5R7Gg1MSyVh9xKfHWjZ9dYHwlLOHi74aYCetUPBMF+70ZS0w8AxmBscD?= =?utf-8?q?KgRyhIrI8UfC03i6d6lwfv4gcY427vDYaqxJYU7bahPkoXC92MkxOGQaCdkzYQ4S8?= =?utf-8?q?ncARqEKGIJnDuWYIStV3FiSHuf7WBRc22jrMfU0k2p8Apw8NKkiQPk6MmWpuDoChr?= =?utf-8?q?+08MWhCT/9H0l8OXcar7oy+1JbUdrTOeA5OeocbDaTXvrsLCv4UGncZ7XLmNTFUV9?= =?utf-8?q?SwRWJwgGNTd5YA3+DivEovsc50599h+QVDQ24/nplZkcn2CBpsAHK+o9W1N6YCuYQ?= =?utf-8?q?g8u1G7X+12p4k/J97ZsxOWJcADEmf1lQbhsG5kOXeI6J/pzehlJ9/hap2AP46Zg6a?= =?utf-8?q?3s3mtiZj3/s92eFUfk6YnUI0vEdMZ4TSog=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)(376014)(7416014)(1800799024)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?qIFwAMHV3IYBrdC0Wdy4DNJU0ybf?= =?utf-8?q?B6O21b18LLAsFmDWsv0oBq9EhEb1wRZ1+eXhN2MCeYyPOlgfYU/HxZCh/ru0PcUl+?= =?utf-8?q?bl4DOBJq+X5svWJj4xO2mBHlURS6icTbj3MhsbEvRfdUA8U6h/6FBA0n0qk/wt+RW?= =?utf-8?q?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?utf-8?q?Iuh+v4FJqhT3oc1lMxnI/wuMVVkWLljGrUmbOaH0JP49/IObXc5QcNTQXSxscs8Sk?= =?utf-8?q?JFkwbSQFUG/8igUTSbzoUxDQJdg5sYF4ANLlDMdJCaxeCcmTqh7D2eCHUaCcf3q83?= =?utf-8?q?Ew6x+QdkSC+DyMwxoOF/k3lwmqI2zO8ZhxILcml3mnaUq4SjVw0bgM17DcOv56P1e?= =?utf-8?q?9ujTaUttqLFGj/rKakb3JPDUEKNCpKUgYutDdIJPrvvKJc7K/9KCkSnQ8Pj9I5is7?= =?utf-8?q?0bcvQmw1IYeLkPuAwTMJdyfIpF+G1KL9RGGI0q1V+1v1IJcqwEwcYuTH9cgYOzo55?= =?utf-8?q?uGE5cALiXBHOpqSBKLQ8wOlT7KERFXmjLQz3rAoQdqSp7L+/bBY8WThomB5ko59R8?= =?utf-8?q?0IRmiNHv5Dgi7bHBsbQt/DwEaqtYmmii+fNroTYFDH1s+jJEXj1aEl1HHVoSUm2ea?= =?utf-8?q?mlHNdh5z8dNwojkB2WLm7GeZF8JbVuabchpF2KAVEGS9upJi4W0P41bjY9cmRHU72?= =?utf-8?q?3xyao3vu4mbZ?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4c4bc0a7-65b2-4c75-9545-08dcce914bab X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Sep 2024 16:31:01.5893 (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: f0Al+IsFyMql9IPyl8SkDQ80adUWX38GN1gsmQ6HiSoYvub1g94iwmHN0gN2pGgNKV+IFo3vu4rsWExYSsv9dA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXPR04MB8405 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 --- change from v2 to v5 - none --- 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 cfb59f6bf5dde..64c0cd1995aa0 100644 --- a/drivers/usb/dwc3/dwc3-imx8mp.c +++ b/drivers/usb/dwc3/dwc3-imx8mp.c @@ -97,7 +97,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; @@ -107,12 +108,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); } @@ -277,7 +280,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;