From patchwork Thu Sep 5 20:06:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13792969 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 CBA62CD5BB8 for ; Thu, 5 Sep 2024 20:10:49 +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=O/PzFrWtGF9hTyrICETmWUx3fh3QeBCjPfvhvO5Lh9g=; b=4smRrkWPLX3TuS4WzexEoMk4nV rwoME7J5tVrKUQkp/IsRrYTWgQOyof5g4EXVU1JpsXCXgw+aJHjcCYLx71GQRHgGpaCADjO8xofmg +I7UZLIKlqOD9X+N4bsNapacMtPQnP4DkBXqlS4cbrSNs0bFKKPCp/igOBO4wflGvx1SLnrfOGi2X 0WvCWPnd/E9f/dWhHnK5IHDKpT+Sb1XPwA78tuuDcO8o5rhUMKlvzvkaU+erDmpCwU743DyJfGhT7 l+54ey+xG/J6tK+1i/QbWi+bIfwAXF/gXqwqCFlCN6AorMcFq1GeeIkrE71fpEzlTk/CMgoqZbFr6 XqC6covw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1smIoS-00000009hOm-32SB; Thu, 05 Sep 2024 20:10:40 +0000 Received: from mail-northeuropeazlp170110001.outbound.protection.outlook.com ([2a01:111:f403:c200::1] helo=DB3PR0202CU003.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1smIki-00000009gdC-1pnB for linux-arm-kernel@lists.infradead.org; Thu, 05 Sep 2024 20:06:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CfTCmHu7F6lBUKKZWYTI+26UWRgl1iM2RRpsOIqoh7iJoBX6mBrqjFbkphJJo0GVbhzYrivYkfD+uvqR20vlpoY74LMcUudUD0euPiVW0YodNWK9H+xkQTnhUzNGesMaO1ID1mSTDXkFj0CLEGfOiQtMFH/Cy2FLq9wZ4uNDlMAtDY3zgf2Th00ShoTNSBcXoj+hucdVP44lBp3G4GOxRBlDwcK+QoQhQrJH60W/aYLnO7tf09aZjAAeGFwIQOJhChm1Y9oATq7chkbHHyX/dtQr1ebAFA3SFg744sazpnoAeqB+lhE4O0aGZ4bF/cMWsRuD3UY+Tn1Epy3CWbLz4A== 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=O/PzFrWtGF9hTyrICETmWUx3fh3QeBCjPfvhvO5Lh9g=; b=S/RV2z3aM/jgkUyyWbERwEE5BoiT4nY1TLvUZvbqPUl3DdDVPsp9qIJ0cqdMbMBYM56eoZaiOGOqpVvg/acbktoFpCHmDUW8BlE6vTeuqr6ITgvtTxFZRP9vpnJZfhnR0bxy3VOARRdgLfRxPuMT7+c3MJR6nhyU3dReu52u885doSUQL0L7bdl1IDbXUsAt/dRw3ooN/zYXCkc3NvCkWE2Ag0SvPkzgj5mpmZje4LWlWuDiTeDRUrOchQ55DsIW+0Bsc7wtg3BEawu2h3AGOXuDbEabVfJ8SszRREEmai5NTfUNFZdtrm6cZ2N591RsNBdQs+fefHcmBFEIFptSsg== 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=O/PzFrWtGF9hTyrICETmWUx3fh3QeBCjPfvhvO5Lh9g=; b=C8HGo+jT5rvyu/yQ7PrnMq00Fe04CSnzUqTGiGrrrbdXI29+64evGtUdk8tZjHv/FG3AjT2nHB6vJ3wOCVoGoy8jmt+e6l/9qDGKBlEcedTMVBZamlIFjUEHVDhPlSaK+bo3apfNaUc3jPLgdJc1x6hUkwvKbdG1NRnVgjEHeVW/CTGM2DO1riODbpKMsD3jsR/WZdZ1xDILYy+uP528EwoSb8XUni2gF0+GSnKh3YL9J8zIhkxZl/Di9XsGBWxMBh1BduW8bWGADEVMrpHPlvHWYHgIYb6gB7PVf5JtgeWxhu/lLMIWf+7V7AvUClf1N7d/O1qI2mxCQJx4vd2OTw== 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 AM9PR04MB8423.eurprd04.prod.outlook.com (2603:10a6:20b:3e3::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7918.28; Thu, 5 Sep 2024 20:06:44 +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; Thu, 5 Sep 2024 20:06:44 +0000 From: Frank Li Date: Thu, 05 Sep 2024 16:06:21 -0400 Subject: [PATCH v4 3/3] usb: dwc3: imx8mp: disable SS_CON and U3 wakeup for system sleep Message-Id: <20240905-dwc-mp-v4-3-aedaeacf0556@nxp.com> References: <20240905-dwc-mp-v4-0-aedaeacf0556@nxp.com> In-Reply-To: <20240905-dwc-mp-v4-0-aedaeacf0556@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=1725566789; l=2128; i=Frank.Li@nxp.com; s=20240130; h=from:subject:message-id; bh=Hs4mq3jmjFdySao7yPW+t4juTxFDV5Z8B1pHbqTlbAg=; b=3satTEOeuofPWVgLaIqoanfIZ1EW/2VQkW/Fp+in5oHDN3mr2/pwWbMz5apHpIqf/SH/HDbCI gBZ5x6HhtkMCf1ABNNFrDk8lDRaDY5tGtM6a1IFPJ7BAkqDBKF7RdAN X-Developer-Key: i=Frank.Li@nxp.com; a=ed25519; pk=I0L1sDUfPxpAkRvPKy7MdauTuSENRq+DnA+G4qcS94Q= X-ClientProxiedBy: BYAPR05CA0105.namprd05.prod.outlook.com (2603:10b6:a03:e0::46) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|AM9PR04MB8423:EE_ X-MS-Office365-Filtering-Correlation-Id: 7dd2ac5a-06ce-4654-080a-08dccde64383 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|52116014|376014|366016|7416014|38350700014; X-Microsoft-Antispam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8bhepJPwSnXisJFHm7StSmdu73yHQUyh7JJhfu?= =?utf-8?q?4d0cyiyYTLIOkKi47W4ahcYszWFj+k8z5EINJJO/+TvuToXcIxPifsnZGnu5U2AnV?= =?utf-8?q?LI2FRi4Tiv4L7P6heXdbFosT1KtFtp+9siw1lkQcSaBejQcpgYpB4Uzfi2Z5UTfXv?= =?utf-8?q?f+jaGvSBGLRwxZl/aWYqQegyGIl/RscvgAdihSzP5oRLdWwRmBmk562/iq/QpljLM?= =?utf-8?q?wRzwdcNavMzZmj8//RK/Q1X46+0XgncQN1xRpa74XLOkTiuGy/lzOAuRZGItlowZ+?= =?utf-8?q?Zk5aiugRYnkL83zkVLKmJ4DsMtl7G2g8EapekKklrXWvjkb0O4vGUchWzc9OxdvHk?= =?utf-8?q?PggyrDkowplsUnN9vqQ3sUM+ryFdgCsfwf/Z/F8hdPpFC5BPWjHuTyg77uPthdfmq?= =?utf-8?q?ehQo7SInFaMaf557TJ/BUGMwq70dbrdl6YiOJZO05Ux+frRIbXuqupSY9gkyiG42r?= =?utf-8?q?KCXMKNPVp+g/FI63ZacGkYKhkpnQtvjZmQ=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)(52116014)(376014)(366016)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?nySg0UWJ+j8fTvZExCz2Lgjv5HPE?= =?utf-8?q?HG4w5xebYCz3UvtfRvLsZMp+7aqJ4UykYW3ZsRgNeIbHtA31sGcOjrYBJS0Vx4RNS?= =?utf-8?q?uROAK+zbkFvT1XGGl4JixMqoISO+u5OWeI8hcyueZMqpbpe87VB8TYW6K1ju1Odip?= =?utf-8?q?hdVvLMtFhiebws1r0YVAmFlxun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arhtekbe78Cu4?= =?utf-8?q?H1HbuDTqWddNvlTJqKMr5YOknZk/NT8jzdif8BRyde1knvRFSY8plJNS2H4izL2ES?= =?utf-8?q?UYO1+WLkP2g/bXd3ZwzZQmLlXHUhCRGRH5TaiNhwXK5qHKNvpu2C+WJ28tvQzb6A+?= =?utf-8?q?BzW3uyd4f32CIp1j1v2Wp/T41rRibQe5unX2FztdDcevZ/7XPdEPqQloBASNRx6eK?= =?utf-8?q?aj+/S1ZVdJhwLIE3y4t9JVg/PMBtRZ0U4BxCZI/lmKBt8W6wpoVLdSxb+FDEI1DWN?= =?utf-8?q?3tWaRznOnMz6CyY2+UWbF5Bn7Yk6w5pYVs5K2dcMNN4b2CvwutlgOd7LUSURRcHTF?= =?utf-8?q?NGqtY5kVtL6TB74hduQwAP1Ectyn4+2MtTQV7ur/FCZ14xw7y/TEEO6/wRSBUcjX5?= =?utf-8?q?sxu+3nipr/hI4xMjb2MToW47Z5jyFxQRLhLhI0GSj3i5KmRXi1sYYkLM1Wdnu55MA?= =?utf-8?q?NmObjfpgnpOO?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7dd2ac5a-06ce-4654-080a-08dccde64383 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Sep 2024 20:06:43.9623 (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: HyW2ljZA47VOGNP2HxE8HAAwYnR8RD0aQ/gBbpjxwcL0wmh9+36AlGBryZNPyvc0n7EvW4VDms9NoNZlbOL1Xg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8423 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240905_130648_521862_8EA8DB3E X-CRM114-Status: GOOD ( 12.30 ) 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 f62f6f960e501..4c0aef5792ce2 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); } @@ -284,7 +287,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;