From patchwork Fri Jul 12 15:40:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13731902 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011010.outbound.protection.outlook.com [52.101.70.10]) (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 7298D1741EB; Fri, 12 Jul 2024 15:41:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.10 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720798868; cv=fail; b=q75A6BRz7cjlwGrZOsWJCLsA0uDsd8sCom8+5kotlc2TeJ0NDEM3j2sdY6YuRq1gyqFojoZqIwLU1dBj8/l+fRjGHcVypTE98y3e8NWGHT4fVnk+o5jEhOLgh4rCzgOG3fO2LrRHvrfV6Rbx5bSrnholFRC+oUxY6fBVeXYP1ng= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1720798868; c=relaxed/simple; bh=KZVlfOTIefgB6kiTQwKkq6g+Kg893MkWvMwdF+odVUo=; h=From:Date:Subject:Content-Type:Message-Id:References:In-Reply-To: To:Cc:MIME-Version; b=FTSPNCuIS8aZ7JVaVhP8IqWFqw7Ln9ksaIRF7NVBwYvxwGZzKtdXCxJSUwztV4Oef5DhopYdOlop+1ahf5n/8Bwpx5HaQ87WoDbRUremmS/a4cyd/xckOh15iwekTbqdaq0hr4HA04Tm0znyF9tsISyCwkFev7UKWl6ihmOUN2I= 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 (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b=HIbO/uNk; arc=fail smtp.client-ip=52.101.70.10 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="HIbO/uNk" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TWntMa057cvfi1L6BFtVHpxmL4y2us7uVUL6gLReCn+Mm0T/3N1UOoz053OEBNXzK0pkHVxv89yCFZ0/HAuzeoyl+s+QuRyYyRbIcc9Je6ViObYD3dKpZHPTO7Pie9+xnZVCKhcl1m7xNoO6bnjP3HUI5DMxR2qPBfQsejq53+jk5TWkmcF1KrW9iA+mJlrM/e7yN8I5Qr3m1rpG41k0kv704tCjTdXdkEqXw5BEYz2PeetoVZ/Cm6/aRjBmX4Fzp4DD2RIztjvIY2rUOc/tsgV5ZPWe9MyPTJjRSxYLXqxq9C0e6PZ5ZvCpLRhg4MQEv4as9GrF8i8EZ2wENF7Psg== 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=e03HWMjyVXsG8PkNe0yFHYiSkt4HxQVPGWPZkD0srTU=; b=jcSAU84lwbzSWK/C4ygNeNa+ADZI3JFS6gAyYk6wfn7wdenCLW5aWtAJLHEX5HMpAbKt3YdQwwqnaV5H/CsIZmCaT89d0OYzHcBOl/y+cKIfcKmoEKZ+KBNAJnRbjrXEBsDBR5tIOhDO/xlEJicswG9y1fa3wN2FyyOOUfpPj32JBljqAPlo01EB/ZMUYHAOfjNS0fjqE22S4MiVWUvKhZMQDOuimY0uGVG2K3whDNqyYiPJ82j5L0WPS39ElPklyli3V3EQHhDMZhmLQ1fLcNdr/wmx72mYtljJOllveiDx9tAvsHLGd6FV52I8VC8SEGFHHjdf8HgAlmMe2a+H3w== 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=e03HWMjyVXsG8PkNe0yFHYiSkt4HxQVPGWPZkD0srTU=; b=HIbO/uNk0qX6SsudA+f8d3ule37OC+nLmp6u68rqZzPPnxfenlXb+EibaFrIwmsJX+4+B0IZn8hT5vPv41xSJ29f5jaYi/e5BvDFlYbfNJzr7mGMkfK8EigEBxAUkJmDakdCwi37Vr59Bj+17fXguWZ6OkDwwr8o3Sqh1Z/aZlQ= 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 GVXPR04MB9803.eurprd04.prod.outlook.com (2603:10a6:150:111::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7741.35; Fri, 12 Jul 2024 15:41:03 +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.7762.020; Fri, 12 Jul 2024 15:41:02 +0000 From: Frank Li Date: Fri, 12 Jul 2024 11:40:30 -0400 Subject: [PATCH 4/4] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Message-Id: <20240712-dwc-mp-v1-4-295e5c4e3ec9@nxp.com> References: <20240712-dwc-mp-v1-0-295e5c4e3ec9@nxp.com> In-Reply-To: <20240712-dwc-mp-v1-0-295e5c4e3ec9@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=1720798845; l=2073; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=VbRag4/639rtFHwlkO1MlheNQd7FvEZ1sV+cuNpxmC4=; b=aXc6+SKCt/4bwS6Zek2nqH4bdndGgx9KXOmBz1W71z9gwBV6qag3PRIX/QItCzi2m9plPeidC 3+EXNN1SP0XCi8Gvt8xUt9ETK1Eu2ykXgJFvffpU6x0nUSd9TH+LqxF X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: SJ0PR13CA0075.namprd13.prod.outlook.com (2603:10b6:a03:2c4::20) 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_|GVXPR04MB9803:EE_ X-MS-Office365-Filtering-Correlation-Id: 4f439cca-63cc-4e5c-2116-08dca2890920 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014|52116014|38350700014; X-Microsoft-Antispam-Message-Info: =?utf-8?q?/FXeWPC/GWfWU/kRhgVvJtiaVhB8MWx?= =?utf-8?q?xoYHgeWqOwbFwmdvVZmSd44xsmYsf3Le3UOYiKYrEtiWLcMh2D5rhdc4OHcDJ0DKv?= =?utf-8?q?clEidVRTE7pUsyNRSbMHxDMQ5Oia2W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Bc9DZkxTZMbm62YKFxLpsQr/WOZXo?= =?utf-8?q?PuRp9h8RMXcAHV5QcjizvOglelfAWwgmqBp0LSgVVm+wjBPE0Lobt4KuU8rK2IOxa?= =?utf-8?q?khg2hEKi6lFwhHlqIlRh5aEPyLsLrQ/XR6iyy5AzKbb1VhjXq3vJlgmde+PpF8MH5?= =?utf-8?q?mntFYETXslKVBWko2y8WSmtDdB0gHEL/xcRXyXo5z8dhILrWXhyTOv4aJhV6U+3tc?= =?utf-8?q?CcEH15mDWPp7jLHYKuLWIE6wsxnKF5yo55thPmejUI2IgIy68nWJBrNWu5wsC1YYN?= =?utf-8?q?oa1/2AJSF3WG2YrkhTOfp5hhnbBfNEk2EWDpf/v12EX7x1USSDTe7Lk0Dk3CCk0Sm?= =?utf-8?q?zalcCRLNOxPFAWjuXM90eCxt82A7BG9/Zg=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)(366016)(376014)(7416014)(52116014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?3t/W4XmViLGNLD1Tc3G+TsEwGb/A?= =?utf-8?q?5FYc5b7jd8YLEb8G63kqC7T6LL7gkfwPhaL0gTCblDOUkgswhDfeIcLjgh3L7Vr10?= =?utf-8?q?umI9sFVXlN3cGq2ESMb3e6N9PlPFG1Q9diFMutWB5ghO+NYovu3aB7UuxWsfn6vaQ?= =?utf-8?q?Guxya3qFvmZb6Q2P8nHIqsglWCFKOXZbVQDldzTrVVKh52691/729XRY8QRsT1cv6?= =?utf-8?q?agRJEnts9NrbuAbl0QJz4Sg1bdRuxQUDWEToJQrMDTQ+aAtcUN0jAntCwquIxF/4/?= =?utf-8?q?WUcFqhmhlzsedrwHqHiDVDBD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K6gcOKHIpMJ+HwDhON7yqUNtPT?= =?utf-8?q?VN7X+lKKA5ETFb+bvzFLm8l/HbBGXSL+6iG73/CIi61JbIHOOFJCXO8YGRO8xOlZT?= =?utf-8?q?2FPak328UKtlTK6+wzCJOavP9T9EtD6Dq83hDXRK4uV9UtLPiPAzXX/pnviSWINyx?= =?utf-8?q?6jKHDscfoX6nV/+u6Tc81bMpDXS6heQmAkehvvXO0vTZA7N7biO9c8yoj+Ea2Gvnv?= =?utf-8?q?31IIZAtoTVexADcbY5K/F3YvvdV55x0LoB8jPMf7xp2shpaTt4QI5bsh29QKo5jbu?= =?utf-8?q?3QBw7n2hj50mVQ+bd6znXJZYp3vc+zALuAtVuEm659cg3Fy3rUeYVv8E=3D?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4f439cca-63cc-4e5c-2116-08dca2890920 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 15:41:02.8011 (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: OXpT3S7RNDPMPwxtYFX0CeAB6gAO/hL+m1lZ2mmDn4ck+H7QJrIcpHMu+Cg9Cq2aKnKmGsK/5VuTCV5MT890oA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GVXPR04MB9803 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 Signed-off-by: Frank Li Acked-by: Thinh Nguyen --- 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 5794bb75f7604..9f8c34d09a8e9 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); } @@ -308,7 +311,7 @@ static int __maybe_unused dwc3_imx8mp_suspend(struct dwc3_imx8mp *dwc3_imx, /* 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;