Skip to content

Commit 20fbe62

Browse files
kelvincheungWim Van Sebroeck
authored andcommitted
watchdog: loongson1_wdt: Add DT support
This patch adds the of_match_table to enable DT support of Loongson-1 watchdog driver. And modify the parameter of devm_clk_get_enabled() accordingly. Signed-off-by: Keguang Zhang <[email protected]> Reviewed-by: Guenter Roeck <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]> Signed-off-by: Wim Van Sebroeck <[email protected]>
1 parent 547cc9b commit 20fbe62

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

drivers/watchdog/loongson1_wdt.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <linux/clk.h>
77
#include <linux/module.h>
8+
#include <linux/of.h>
89
#include <linux/platform_device.h>
910
#include <linux/watchdog.h>
1011

@@ -112,7 +113,7 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
112113
if (IS_ERR(drvdata->base))
113114
return PTR_ERR(drvdata->base);
114115

115-
drvdata->clk = devm_clk_get_enabled(dev, pdev->name);
116+
drvdata->clk = devm_clk_get_enabled(dev, NULL);
116117
if (IS_ERR(drvdata->clk))
117118
return PTR_ERR(drvdata->clk);
118119

@@ -144,10 +145,20 @@ static int ls1x_wdt_probe(struct platform_device *pdev)
144145
return 0;
145146
}
146147

148+
#ifdef CONFIG_OF
149+
static const struct of_device_id ls1x_wdt_dt_ids[] = {
150+
{ .compatible = "loongson,ls1b-wdt", },
151+
{ .compatible = "loongson,ls1c-wdt", },
152+
{ /* sentinel */ }
153+
};
154+
MODULE_DEVICE_TABLE(of, ls1x_wdt_dt_ids);
155+
#endif
156+
147157
static struct platform_driver ls1x_wdt_driver = {
148158
.probe = ls1x_wdt_probe,
149159
.driver = {
150160
.name = "ls1x-wdt",
161+
.of_match_table = of_match_ptr(ls1x_wdt_dt_ids),
151162
},
152163
};
153164

0 commit comments

Comments
 (0)