@@ -64,6 +69,8 @@ struct imx2_wdt_device {
bool ext_reset;
};
+static const struct of_device_id imx2_wdt_dt_ids[];
+
static bool nowayout = WATCHDOG_NOWAYOUT;
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="@@ -261,12 +271,24 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
set_bit(WDOG_HW_RUNNING, &wdog->status);
}
+ if (pdev->dev.of_node) {
+ of_id = of_match_device(imx2_wdt_dt_ids, &pdev->dev);
+ if (!of_id)
+ return -ENODEV;
+
+ data = of_id->data;
+ has_pdc = data->has_pdc;
+ } else {
+ has_pdc = false;
+ }
+
/*
* Disable the watchdog power down counter at boot. Otherwise the power
* down counter will pull down the #WDOG interrupt line for one clock
* cycle.
*/
- regmap_write(wdev->regmap, IMX2_WDT_WMCR, 0);
+ if (has_pdc)
+ regmap_write(wdev->regmap, IMX2_WDT_WMCR, 0);
ret = watchdog_register_device(wdog);
if (ret) {@@ -363,8 +385,29 @@ static int imx2_wdt_resume(struct device *dev)
static SIMPLE_DEV_PM_OPS(imx2_wdt_pm_ops, imx2_wdt_suspend,
imx2_wdt_resume);
+static const struct imx2_wdt_data imx21_wdt_data = {
+ .has_pdc = false,
+};
+
+static const struct imx2_wdt_data imx25_wdt_data = {
+ .has_pdc = true,
+};
+
static const struct of_device_id imx2_wdt_dt_ids[] = {
- { .compatible = "fsl,imx21-wdt", },
+ { .compatible = "fsl,imx21-wdt", .data = &imx21_wdt_data },
+ { .compatible = "fsl,imx25-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx27-wdt", .data = &imx21_wdt_data },
+ { .compatible = "fsl,imx31-wdt", .data = &imx21_wdt_data },
+ { .compatible = "fsl,imx35-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx50-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx51-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx53-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx6q-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx6sl-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx6sx-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx6ul-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,imx7d-wdt", .data = &imx25_wdt_data },
+ { .compatible = "fsl,vf610-wdt", .data = &imx25_wdt_data },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, imx2_wdt_dt_ids);