Skip to content

Commit 1f87c57

Browse files
nxpfrankliWim Van Sebroeck
authored andcommitted
watchdog: imx7ulp_wdt: move post_rcs_wait into struct imx_wdt_hw_feature
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: Frank Li <[email protected]> Signed-off-by: Alice Guo <[email protected]> Reviewed-by: Ye Li <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent bc83b4d commit 1f87c57

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

drivers/watchdog/imx7ulp_wdt.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,14 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
5555

5656
struct imx_wdt_hw_feature {
5757
bool prescaler_enable;
58+
bool post_rcs_wait;
5859
u32 wdog_clock_rate;
5960
};
6061

6162
struct imx7ulp_wdt_device {
6263
struct watchdog_device wdd;
6364
void __iomem *base;
6465
struct clk *clk;
65-
bool post_rcs_wait;
6666
bool ext_reset;
6767
const struct imx_wdt_hw_feature *hw;
6868
};
@@ -95,7 +95,7 @@ static int imx7ulp_wdt_wait_rcs(struct imx7ulp_wdt_device *wdt)
9595
ret = -ETIMEDOUT;
9696

9797
/* Wait 2.5 clocks after RCS done */
98-
if (wdt->post_rcs_wait)
98+
if (wdt->hw->post_rcs_wait)
9999
usleep_range(wait_min, wait_min + 2000);
100100

101101
return ret;
@@ -334,15 +334,6 @@ static int imx7ulp_wdt_probe(struct platform_device *pdev)
334334
/* The WDOG may need to do external reset through dedicated pin */
335335
imx7ulp_wdt->ext_reset = of_property_read_bool(dev->of_node, "fsl,ext-reset-output");
336336

337-
imx7ulp_wdt->post_rcs_wait = true;
338-
if (of_device_is_compatible(dev->of_node,
339-
"fsl,imx8ulp-wdt")) {
340-
dev_info(dev, "imx8ulp wdt probe\n");
341-
imx7ulp_wdt->post_rcs_wait = false;
342-
} else {
343-
dev_info(dev, "imx7ulp wdt probe\n");
344-
}
345-
346337
wdog = &imx7ulp_wdt->wdd;
347338
wdog->info = &imx7ulp_wdt_info;
348339
wdog->ops = &imx7ulp_wdt_ops;
@@ -403,6 +394,12 @@ static const struct dev_pm_ops imx7ulp_wdt_pm_ops = {
403394
static const struct imx_wdt_hw_feature imx7ulp_wdt_hw = {
404395
.prescaler_enable = false,
405396
.wdog_clock_rate = 1000,
397+
.post_rcs_wait = true,
398+
};
399+
400+
static const struct imx_wdt_hw_feature imx8ulp_wdt_hw = {
401+
.prescaler_enable = false,
402+
.wdog_clock_rate = 1000,
406403
};
407404

408405
static const struct imx_wdt_hw_feature imx93_wdt_hw = {
@@ -411,8 +408,8 @@ static const struct imx_wdt_hw_feature imx93_wdt_hw = {
411408
};
412409

413410
static const struct of_device_id imx7ulp_wdt_dt_ids[] = {
414-
{ .compatible = "fsl,imx8ulp-wdt", .data = &imx7ulp_wdt_hw, },
415411
{ .compatible = "fsl,imx7ulp-wdt", .data = &imx7ulp_wdt_hw, },
412+
{ .compatible = "fsl,imx8ulp-wdt", .data = &imx8ulp_wdt_hw, },
416413
{ .compatible = "fsl,imx93-wdt", .data = &imx93_wdt_hw, },
417414
{ /* sentinel */ }
418415
};

0 commit comments

Comments
 (0)