From patchwork Mon Jul 29 20:06:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13745751 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 78289C3DA61 for ; Mon, 29 Jul 2024 20:24:10 +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:Content-Type: Content-Transfer-Encoding:Message-Id:Date:Subject:Cc:To:From:Reply-To: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=Bb/z57ZWW+QfUw0pe0UhWXMof84AjZc9frniFjotkn4=; b=M8LtF2krcjuU2FFuXNzP7JnpSs 3qrOm4/p2FD+wF3ELgHfzPTOWG7Y+CUX0wURBkZle8e07t3o0xyRtEoPhM8tFO5LeFRfC11gb7+f7 34yV0GSYOJt/35tFmM6XwRkqwgXhf6CZ+xdIS5mH29VsKiY46ZBUJl+kg+0+d8C/3/QOwTYlL81S7 5KToPoiaH/87OEUcqZtsfvXzf1Z5Sg+RGm9T/C2oyks5EYa+8/vh43zt0OpnUcqwYquFFEseWYdTM aU06099nB1yilJkd+xV4pi2/LOTxdDpYtUejViFeqdpDuWb0/eAI4yZiYrXqyRGRP2/I+qh8+0pwo 9vty5Q7g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYWuU-0000000Cd4p-2j5X; Mon, 29 Jul 2024 20:23:58 +0000 Received: from mail-db8eur05on20625.outbound.protection.outlook.com ([2a01:111:f400:7e1a::625] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sYWrM-0000000CbpV-3jK2 for linux-arm-kernel@lists.infradead.org; Mon, 29 Jul 2024 20:20:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A4I4nrWKS+9LThf+dsaEFhvoWvJOV/Uo0JYdkhkGFEFiX4wFEkk7z9ZSQBnAapp58kMYI792EZwlj64cWPSlKbUq4LZ9kcLW/Xx5RrpNgeBKa8S14O7GW+ttoVIHjvm57n0cF25KB9M4Ow5/73t1oZ24MGntDktZ3ebQDkoH01xQQK4Cw0J6Pfv2bQovh7dwJHdcQ32NWtGV9THVTfnKzp/FsJT0IfhYHO0lUTgrBzpopD/CwSHJI0YCovbJ28Z4Cteqjks3Oy2VuCmsiImK0wAGJX+yvC3H3K7sMKdWr4P3E35m6gJyFeXUSDWyO7ne/dfqRbcsWP/7qMCuI91oog== 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=Bb/z57ZWW+QfUw0pe0UhWXMof84AjZc9frniFjotkn4=; b=Zao2eDYwHDsqso5YrxCqrOYvdC25pQ69q///YcLrCBzRBgQYOpLxrDyb8IIcF2h85zjhm7LlkW/DtJIXatoJ/eu4uzz/a876xP7yUcdlZd37Ixj+oSTEPKv1hFGCImpw5RXOXG72ZMWDmR7EOQ+8LjAwlG3pYPUuyR8UeqgtEFSD6kfllTrW+6JEG/MPqWpntQf8nxbBzpcn+oh+h8Ll5xki2b8ZXeVpXM/CPmBal+ZFcjybZA7qEAFcrcOcftAEeBvmiLK8t9DvCLF3EGrw+qItqnkvmsby/taHjExOfyCbyQrizBUZJ4t7CemyJBEQNYUiC5we1X+VYXfyXa3ZtQ== 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=Bb/z57ZWW+QfUw0pe0UhWXMof84AjZc9frniFjotkn4=; b=kCUy3d+EuPM9khQFkuZ5NUgU7CKO/87u6tUSewclbHWthmsrArAOZpq8gHfgaWlv7eDh9SsWR2s7POU1/ejRvesRGMtuUdzGzKhrb926mcXlkR2Rxc/zZnNEey2KWRlQ14Z6w0tdCHUIEAZK3NuJHx22cC9YvpKyzpmzEAG+TbZ71fzAhRgSzZJqbbxhedn6Ul/qXHhBkdwYUpN3yTKhq0Nc+qYmydEjphB1bpRvmDSE58nOvRrtY8uDUMUE0zBlP/xzCH7zUFebdF4XOmtQ/w4LoxvrhiuUENdH22R3YuN6hWfYe/FKhShOdhnDbP6VIocpoWnsXF7bW3U6I5+8DA== 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 DB9PR04MB8282.eurprd04.prod.outlook.com (2603:10a6:10:24a::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7807.28; Mon, 29 Jul 2024 20:06:18 +0000 Received: from PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06]) by PAXPR04MB9642.eurprd04.prod.outlook.com ([fe80::9126:a61e:341d:4b06%5]) with mapi id 15.20.7807.026; Mon, 29 Jul 2024 20:06:17 +0000 From: Frank Li To: linux@roeck-us.net Cc: Frank.li@nxp.com, alice.guo@nxp.com, festevam@gmail.com, imx@lists.linux.dev, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, s.hauer@pengutronix.de, shawnguo@kernel.org, wim@linux-watchdog.org, ye.li@nxp.com Subject: [PATCH v4 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature Date: Mon, 29 Jul 2024 16:06:01 -0400 Message-Id: <20240729200601.1995387-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: BY5PR17CA0045.namprd17.prod.outlook.com (2603:10b6:a03:167::22) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|DB9PR04MB8282:EE_ X-MS-Office365-Filtering-Correlation-Id: f0e7bd2c-c1a4-45e7-0c1a-08dcb009e7d0 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|52116014|7416014|376014|1800799024|38350700014; X-Microsoft-Antispam-Message-Info: sXvx1cJYOFqwSQ0VJOOyLf8wSOT3oNMwSH5i71Wjl2nudtydPWICTLQJKmnx3LwWmPr/ExME4bv1DreqSodyZaHTd8/js0FzSO5w5QazFS+hPBhCfAiFql6hkGC66pa2L1bYkx7Edrw3uAolu0tNAra9n5sxGJ/LN6li/kkNA8mjvv0qDM8VtD6rsf46w9rVBiIo0jgAtcHMlWX5xisG/67/kwKMB4odrCUMmTGtbfqtDjIOBReFPUlgRJQ+IJsC3odJQGqRKQnDUT7sRW05/SICPJAPnDrawgztZlEKHdgdmphw/o/qdimZJbTevFkoOPnt0oFP+aGL3lvI6hp/nEFPp7mv78N/U3N1KuDXEm0O3I7TsgwtiJbZR5HKvBE9wG7aSPd9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RY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PAXPR04MB9642.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(52116014)(7416014)(376014)(1800799024)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: aA6RfxmZc0Zz34AsL1m4S3yoCKr5SkSkX5XnQgY72dqTA1A691Rx6/cKIX0f1dszMqxjLRKR26mEWCHjseFUjZtjJ9p51t/iY0ETonQQBJEqfLpD2TBkKLyQXC9Mw2Mt5HTaavxzx9WbId0GGoly33D3S2KA4vQX5HbSo9nJ9mIoOiKmpL0/KlbA6j/uKPPY5/n2Tw7pGT96ua6Nc1svs4dXlABaamIGng1aqAdMorngdIc8GdsfL3aCtZuS5QJkUGbwrt3smHTrWwd/mq0LbBDRUVEkIrHdjkhgaW5rr5qwy11lA5sxoYzdT5dM52t5WK124IvVoA5QTCEho6IEYVURNCo/fAHm6PXXiDxNgKGi9NQpF8Cnax5cevMX0/7GCxlgzgYRZ24scQy/JVIqbm2PbJayYLB+5oew2b4nNhGmwwvOAVNkFaMZnp0piE37P8L1fjKtk4VMG2jK8oOhYG/3GBjCkdAc3PKOZiAyqVUiIAvwo4wAKSrKTboY/7ugSesGStLAZN1MZpa8La7QxQ0z2nO0xsH+j+vGI4xF1StC8qRN/PsMTRdQ0VyNocPXfRE2QQTeUh7dLhs9BbDk2YY5VILqjmEnNgr6uoSFzFMGmKDvA0U1WuSQlirPomRfu2C+So5rsYSpjKzvQgESCb6rUvP1LOlfvXYOhVdoOmCoYCMilm7IS8oBhSrNajxuP8zyLziH4ar/zdtaFfSBHMrCJ2NyGI/wVDKacy/vrHQMm1Dvqt8ZQMcEJbFkiAQ8Zu61ltkkuoqYBbcPDa1z/uOnL709sM5g+Roq2wKotw7lqgcbkXLPuEbsRMQ1RFYJ/m/JuT0vx4f1kEO0oZFvUaEWe8iDb1PNQ1MoGbkoYd2dPXNIblg/alzfrqJMy/TUGtritUNumSgznWunQX93IDGGnDq1eqE9keooycqthoQTkBTw7nZN2IXHQMMzJR+6/9ExVozmrBV9TAEgHF4hsbsC64hyN6nuKvh0tN/LEn2+YmfKT/HqYHf8CldwZmKwGMwkfV9qbJHCJjUNzYo212psOikRyHw/sCJ9/5A8AKa94BVz43ZCEZWCLFTawIlJgrbEfcIvu0NbCnxcO6Rut68ZvbEfGK0M5Croes95BR2EpTfoin0Glc3ilEjR2f883iQL7SFKf26txJm4RfW8ejUVKiPscWNAWhizAwqGNeqoMu7+ZNPQhPS96DB6Yv/dasGUotms0z9yzdcDpwZfwabRHHykGTtauqJH1VUyegf5acnPPLIia9kTsu1NpNcEV3ot7ZDoEXTldQP3huWIq0fSj/R4RsX6nOvHrXYXHebutF/UTKMNposQ1sYXv3QYPDurGNodYMa6dy43/TMJGLTla/PMZu53RdsU7yrVtG4o7Afvua93dsAgySm9PWas1A/hOufiasVP5C+VQulquxnlg7SYW+a5vuxXzfkxbZAgIy1sl2QtYbLXEVyCJgGmzZdiIEqtwTnfrpD2J+iaYwxAhmGjvKfJ8QxXyX9tROB343Mz09mhi8H8gbaBL6qNa5LILrL7MvdyGJOz7BcPR3RLgGyqZnUjKBvOT4MEicCxwexI8L5zztl2W6X8jns3 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: f0e7bd2c-c1a4-45e7-0c1a-08dcb009e7d0 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Jul 2024 20:06:17.8034 (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: 3v0/BHkcw2EOmgLwnqidhD0bqr9cGCzRonYT8AiB5gz1cq3z+gDZzWzhVrnm/R7qobKO/VlaOT6c/nKZv4gEhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9PR04MB8282 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240729_132045_134025_AA80EEF3 X-CRM114-Status: GOOD ( 15.18 ) 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 Move post_rcs_wait into struct imx_wdt_hw_feature to simple code logic for difference compatible string. i.MX93 watchdog needn't wait 2.5 clocks after RCS is done. So needn't set post_rcs_wait. Reviewed-by: Guenter Roeck Signed-off-by: Alice Guo Reviewed-by: Ye Li Signed-off-by: Frank Li --- Chagne from v3 to v4: - Go back to v2 according to Guenter's feedback Change from v2 to v3: - Set post_rcs_wait to false explicitly to maintain code consistency - Add Guenter review tag. Change from v1 to v2: - Combine to one patch --- drivers/watchdog/imx7ulp_wdt.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/drivers/watchdog/imx7ulp_wdt.c b/drivers/watchdog/imx7ulp_wdt.c index 94914a22daff7..3a75a6f98f8f0 100644 --- a/drivers/watchdog/imx7ulp_wdt.c +++ b/drivers/watchdog/imx7ulp_wdt.c @@ -55,6 +55,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" struct imx_wdt_hw_feature { bool prescaler_enable; + bool post_rcs_wait; u32 wdog_clock_rate; }; @@ -62,7 +63,6 @@ struct imx7ulp_wdt_device { struct watchdog_device wdd; void __iomem *base; struct clk *clk; - bool post_rcs_wait; bool ext_reset; const struct imx_wdt_hw_feature *hw; }; @@ -95,7 +95,7 @@ static int imx7ulp_wdt_wait_rcs(struct imx7ulp_wdt_device *wdt) ret = -ETIMEDOUT; /* Wait 2.5 clocks after RCS done */ - if (wdt->post_rcs_wait) + if (wdt->hw->post_rcs_wait) usleep_range(wait_min, wait_min + 2000); return ret; @@ -334,15 +334,6 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev) /* The WDOG may need to do external reset through dedicated pin */ imx7ulp_wdt->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output"); - imx7ulp_wdt->post_rcs_wait = true; - if (of_device_is_compatible(dev->of_node, - "fsl,imx8ulp-wdt")) { - dev_info(dev, "imx8ulp wdt probe\n"); - imx7ulp_wdt->post_rcs_wait = false; - } else { - dev_info(dev, "imx7ulp wdt probe\n"); - } - wdog = &imx7ulp_wdt->wdd; wdog->info = &imx7ulp_wdt_info; wdog->ops = &imx7ulp_wdt_ops; @@ -403,6 +394,12 @@ static const struct dev_pm_ops imx7ulp_wdt_pm_ops = { static const struct imx_wdt_hw_feature imx7ulp_wdt_hw = { .prescaler_enable = false, .wdog_clock_rate = 1000, + .post_rcs_wait = true, +}; + +static const struct imx_wdt_hw_feature imx8ulp_wdt_hw = { + .prescaler_enable = false, + .wdog_clock_rate = 1000, }; static const struct imx_wdt_hw_feature imx93_wdt_hw = { @@ -411,7 +408,7 @@ static const struct imx_wdt_hw_feature imx93_wdt_hw = { }; static const struct of_device_id imx7ulp_wdt_dt_ids[] = { - { .compatible = "fsl,imx8ulp-wdt", .data = &imx7ulp_wdt_hw, }, + { .compatible = "fsl,imx8ulp-wdt", .data = &imx8ulp_wdt_hw, }, { .compatible = "fsl,imx7ulp-wdt", .data = &imx7ulp_wdt_hw, }, { .compatible = "fsl,imx93-wdt", .data = &imx93_wdt_hw, }, { /* sentinel */ }