From patchwork Fri Jul 12 14:18:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Frank Li X-Patchwork-Id: 13731845 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 E79FAC2BD09 for ; Fri, 12 Jul 2024 14:19:46 +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=AulT1rV9EalUSpn2OcVEXeuDpSLFEhivsjP9C+z/PSc=; b=xOKYavn6MuxN7KWMyxRNGbOlcD gR5gCCmivgm8wJV1JyJ9Q0LQI3P97hlcHeZxKOoUBpzpDa+V/Cs1db2+jyuEL3nd3/Qv2HgoPJ4FB 52UFNsVKH6w3iOGPvsPwqYrylwiNIoFXQ1XO9wgpQfYg5iPueSFghR6vOj1AaLpiaNBUWYhXpmWuy Loh2vO6S/dkh+7k2/jlsQ40eB7C34FTsC4Dnh2zJmpFSifhSaVrgheXT6G8E86I46sw2Ktz2aEG6N KTcOiZHS8ygYGHimxq+e9uo0fF8z0CPBuYw5k/FFHcDpR/tbsA7Kf6WTP7EkDWm94sFoC7p9QgA6z 3OaacjBg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSH7X-00000000IWW-2UCt; Fri, 12 Jul 2024 14:19:35 +0000 Received: from mail-westeuropeazlp170110003.outbound.protection.outlook.com ([2a01:111:f403:c201::3] helo=AS8PR04CU009.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sSH7E-00000000IRU-2lcB for linux-arm-kernel@lists.infradead.org; Fri, 12 Jul 2024 14:19:18 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=owMNZXGdqI5DmKHaQp05iwWkawmqxs1KVsteosvIa/AWpr0fdggg2uZsXOCfsZRj/9iwluF8NNjVYcPn66vgiodOzt85j/G+5rLQcyVY1f/F35To8lovw8BE4FPj8U19GyIOQPe5Bb3WI8Hbl7Nja2W34xFQCJqGDPsa30QPd8RmPlPKVNvmSoVWgdjHnxaXAyCDdIQj6bTBRtYAn+HfQitVexit7R8Ag7cURj9a8NgcUljko5pDJeptUmh/f/CK36oWp6k2/60m59pa/tar+EuYmPlsBtwtrfLSecSnOPdGEAgz/c4UbZZfc08oV71XOe0vbWRp8JHnnJhFkE/o6A== 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=AulT1rV9EalUSpn2OcVEXeuDpSLFEhivsjP9C+z/PSc=; b=pxR+EHL5BypJjKaTWb2I/S77HnUaOPLW/FvQsxE5LNKqrVrgufn1YwIhCV9HomEaIJlKMGVrsgmbswP+44yZ2FxgY2Y4hKuwYp2qxGo1qaD6VouEMcqNzUj5EN/1pF6/11TtXBZR9ipKUKQIjMBgF6/52UfDdrhaAeaKwaG5uOkovSntCgHyiHNenBxf2ZQoxI/FHWoyG2hZReRlzr6SM6+Au1tQSMBFw8r5zxcNeJoNMs7ejyvO0Y7wIHqKEl+h9SbJTLFmAFYTSTn6styW0V304RAmtpMpbYMmyVhidmuTNzfqA4VxEwiPzUL/x7cgZZsmThYJn/e2FcbkG/IGfQ== 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=AulT1rV9EalUSpn2OcVEXeuDpSLFEhivsjP9C+z/PSc=; b=TBSVb5snMOiW54N0QGkQycoB6f8zqoGCm18tQHhuDuMu0YYpMBpiJpUEokcgJ94ObhdtIFLmG1ePUis/xNf6xbjRN1xsoWJ/f9+QsyI9V0kYElAz/H11kjbHYdq7CppJYEPi4nLFtlwoCj1MygbygJOK9PdQwRFN/MoqCGHnR+I= 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 VI1PR04MB6864.eurprd04.prod.outlook.com (2603:10a6:803:138::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.23; Fri, 12 Jul 2024 14:19:04 +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 14:19:04 +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 v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature Date: Fri, 12 Jul 2024 10:18:44 -0400 Message-Id: <20240712141844.3274214-1-Frank.Li@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SJ0PR05CA0089.namprd05.prod.outlook.com (2603:10b6:a03:332::34) To PAXPR04MB9642.eurprd04.prod.outlook.com (2603:10a6:102:240::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PAXPR04MB9642:EE_|VI1PR04MB6864:EE_ X-MS-Office365-Filtering-Correlation-Id: b5d06a56-98ae-4bb5-ed1a-08dca27d9598 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|1800799024|376014|366016|7416014|38350700014; X-Microsoft-Antispam-Message-Info: XhjTfPvbklgajsDZJanMFiORH3OhKZRX/ta759a5beCylZgScgDyH+L4/wat849AIPtWaMH93KnwiOiSzXQkSX4yVV79AyVdsOiLGMJogbL+BN4WmajaNiIftdKQd43Xk/d4Xx9is/zC1f7wM3hP2YO/YmPzuwzvt1wyQxWfKlJ/3bZM2q3Yofq+QbwceZNOATtMCBAtAm8Tpo3ErNcG8l5LtVtCl+RlkFWzju+f3DAQCZl8IWZ2OoWovO6m/zehxi9i0BpWr7Y4qqc7CXQmTM1ivmaFNPMoXRAarlri6VO635I/tfJfCHdo/42HAvmtue3kY3KUx5aUeoUYmPsKph5EtLTKAlpPm5CkX2WvdRzw96SrzCoOpt9b6OTKL15qyTMIYY8HNAcGsgzEcvvixKcLym+Vf5qRoFAeMye7rQphiIQNhb6p28ZXYT3o7D2mI0mK8x2CuIue91u/QAs00Ynp0nE+mqxsZaeuxI4LPBd1tKCB1lnR2Hw9YqOGdImHlfDx+K7fIgaJCrNcXxOugS74WHhevP1SgkMheH17uu5kEwGAJTwBRWvD1+z4Jlwu1z+O2O5IOiz18XuZG2QILw4Zth738FkZWUASB8gmPSiJkuGffx16Cr4W41+WqXur6xwwkxoB8vB5X8M69KsdiLY7jYBWJ3oEEB4vEwVOAiox5jUwXQmcY2HtTRsNu6PMUB/qBdU4dfP9+ZlffXZEay0vULmsMPrMqmSaHeYL4FYZ9vONLLQ152ZzYZzu1eryUc8oNSeSKUi6lxmgKCPXVXZ4KkRm3knRv4pG/uHkstJbZFM3/1aHTcS2gtUnHYgMG+rNXbTq/TRq7sfNn0EV97XSSA3+1TscdaLYjQGfy5A9EXltyXqWyHe0RmKbnMNd3y76aV/WFdvjFJ2uJ4uw0mX1u6XoMgkChWdki/9UDrXfzATNji7vBNscHz4Quvio7RsFyUMjYh/5xpqCjU9HXpy9qBGUybJM9qjQgkI1ratjyKdvK5hjL9n434mRoEv8chnT41ZNwsY6BIax3vBz7je4Q9z956BQfSi4ypZObSuOf7ruIMkjS2zqrJ46vufWYyBgIN7P2QAsqgoANo+74V863FXbRxZB9X05Vq9e2gX9VnwO6EW8JBTXnJHchiTxU9BRfMJGuHDZJeyF479uTLXNcnK3gEMmGOUXxNTUyUnD3NvFKe2p0GQCZv/eC9QvE2I/q5yEh4/kha6TUvIcGv7NNY2xtd44Tj01Rpz2D/BBy3YNABfo4Lr5uHVYMXfuhLCMmcdaWUNUaJtWpKIk27qHd6bMHHZIseUVYnv8GyxKbQTFcxBG24dwcG3R6hRW5XmpkRIRcVVIkODaxpqGGoloy9doqenLdHrlsTmdURxVHDYIuZYWl5a1FY4/MI66NZnhd+GJWeZxfV+Xw7L1YQ== 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)(52116014)(1800799024)(376014)(366016)(7416014)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: TwI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ujrM1ezraUKc75phBWRGNXccEJIGanJYx7Kla//5+VKRR5fP/1bP6lgT1UCXBOr/F/9Xi9Xqq77zTTXq/YBiC2LMMg0TTKiirFXXt31hDdJb1zKdMn0GpNym21aPhxZjspGHWVYsp5IcB9hyPeYyBX4rfkMZ2oCMZa2c6JokW0Dzw/5VyFW7Zftz9/FpQSBbR0lpRldTDoxII/HiZuQawTvPL/LjtDyff+FE3YkxL5opMANXfI0iJxdSE54Y/K3dftRZox2IQ1TEKeREcy9hz6WcR7zpezv6+pl5ajf7dgc/quufadKCn778q4mRqJZOcjeQUuVj8KqG7wV6kOGFuYjq8C1OlWNWis2kEia1iE4XySuUCd0SI2GhyNquEPcM4RKJRQVdokkkeh476yQZLyrERfjDEwdo83VEGF4i74S+lL6PqJWFPbfoQNoPkkBefg6zrviKVAhBF88sv+Pt8srPN2BMwm7isJAuN2Bcku9VIo+3tFhKVlPOt0rH X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: b5d06a56-98ae-4bb5-ed1a-08dca27d9598 X-MS-Exchange-CrossTenant-AuthSource: PAXPR04MB9642.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jul 2024 14:19:04.5702 (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: UG5P/Bs1VU2Kk1V8N98uICzvnVhjofaDjys7RvXVTsfiNiKf3eiVrWlv18qbvhUqz9rRO6jDd7PxdW9y+OlUcg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6864 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240712_071916_749911_9709D240 X-CRM114-Status: GOOD ( 14.58 ) 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. Signed-off-by: Alice Guo Reviewed-by: Ye Li Signed-off-by: Frank Li Reviewed-by: Guenter Roeck --- 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 */ }