Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
@ 2024-07-12 14:18 Frank Li
  2024-07-12 14:30 ` Fabio Estevam
  2024-07-12 15:03 ` Guenter Roeck
  0 siblings, 2 replies; 5+ messages in thread
From: Frank Li @ 2024-07-12 14:18 UTC (permalink / raw)
  To: linux
  Cc: Frank.li, alice.guo, festevam, imx, kernel, linux-arm-kernel,
	linux-kernel, linux-watchdog, s.hauer, shawnguo, wim, ye.li

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 <alice.guo@nxp.com>
Reviewed-by: Ye Li <ye.li@nxp.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
---
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 */ }
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
  2024-07-12 14:18 [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature Frank Li
@ 2024-07-12 14:30 ` Fabio Estevam
  2024-07-12 14:38   ` Frank Li
  2024-07-12 15:03 ` Guenter Roeck
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2024-07-12 14:30 UTC (permalink / raw)
  To: Frank Li
  Cc: linux, alice.guo, imx, kernel, linux-arm-kernel, linux-kernel,
	linux-watchdog, s.hauer, shawnguo, wim, ye.li

On Fri, Jul 12, 2024 at 11:19 AM Frank Li <Frank.Li@nxp.com> wrote:
>
> 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

s/needn't/does not need

You mention i.MX93 here, but the code touches i.MX8ULP. Is that correct?


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
  2024-07-12 14:30 ` Fabio Estevam
@ 2024-07-12 14:38   ` Frank Li
  2024-07-12 14:54     ` Fabio Estevam
  0 siblings, 1 reply; 5+ messages in thread
From: Frank Li @ 2024-07-12 14:38 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: linux, alice.guo, imx, kernel, linux-arm-kernel, linux-kernel,
	linux-watchdog, s.hauer, shawnguo, wim, ye.li

On Fri, Jul 12, 2024 at 11:30:14AM -0300, Fabio Estevam wrote:
> On Fri, Jul 12, 2024 at 11:19 AM Frank Li <Frank.Li@nxp.com> wrote:
> >
> > 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
> 
> s/needn't/does not need
> 
> You mention i.MX93 here, but the code touches i.MX8ULP. Is that correct?

Yes, default is disabled. 

Please ref v1
https://lore.kernel.org/imx/20240711-wdt-v1-0-8955a9e05ba0@nxp.com/T/#t



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
  2024-07-12 14:38   ` Frank Li
@ 2024-07-12 14:54     ` Fabio Estevam
  0 siblings, 0 replies; 5+ messages in thread
From: Fabio Estevam @ 2024-07-12 14:54 UTC (permalink / raw)
  To: Frank Li
  Cc: linux, alice.guo, imx, kernel, linux-arm-kernel, linux-kernel,
	linux-watchdog, s.hauer, shawnguo, wim, ye.li

On Fri, Jul 12, 2024 at 11:38 AM Frank Li <Frank.li@nxp.com> wrote:

> Yes, default is disabled.
>
> Please ref v1
> https://lore.kernel.org/imx/20240711-wdt-v1-0-8955a9e05ba0@nxp.com/T/#t

I understand that.

My point is about the commit log: you mention i.MX93, but you change
i.MX8ULP. This is confusing.

Also, better to explicitly pass .prescaler_enable = false inside
imx93_wdt_hw for consistency.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
  2024-07-12 14:18 [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature Frank Li
  2024-07-12 14:30 ` Fabio Estevam
@ 2024-07-12 15:03 ` Guenter Roeck
  1 sibling, 0 replies; 5+ messages in thread
From: Guenter Roeck @ 2024-07-12 15:03 UTC (permalink / raw)
  To: Frank Li
  Cc: alice.guo, festevam, imx, kernel, linux-arm-kernel, linux-kernel,
	linux-watchdog, s.hauer, shawnguo, wim, ye.li

On 7/12/24 07:18, Frank Li wrote:
> 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 <alice.guo@nxp.com>
> Reviewed-by: Ye Li <ye.li@nxp.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>

Reviewed-by: Guenter Roeck <linux@roeck-us.net>



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-12 15:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-12 14:18 [PATCH v2 1/1] watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature Frank Li
2024-07-12 14:30 ` Fabio Estevam
2024-07-12 14:38   ` Frank Li
2024-07-12 14:54     ` Fabio Estevam
2024-07-12 15:03 ` Guenter Roeck

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox