* [RFC PATCH 1/2] watchdog: booke: Convert to platform driver
@ 2013-05-03 15:56 Guenter Roeck
2013-05-03 15:56 ` [RFC PATCH 2/2] watchdog: booke: Add device tree support Guenter Roeck
0 siblings, 1 reply; 2+ messages in thread
From: Guenter Roeck @ 2013-05-03 15:56 UTC (permalink / raw)
To: linux-watchdog; +Cc: linux-kernel, Guenter Roeck, Dirk Eibach
Required to be able to add device tree support
Cc: Dirk Eibach <dirk.eibach@gdsys.cc>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Compile tested only. I'll test it on a real system over the weekend
or early next week.
drivers/watchdog/booke_wdt.c | 28 +++++++++++++++++++++++-----
1 file changed, 23 insertions(+), 5 deletions(-)
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index a8dbceb3..9b066b9 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -17,6 +17,7 @@
#include <linux/module.h>
#include <linux/smp.h>
#include <linux/watchdog.h>
+#include <linux/platform_device.h>
#include <asm/reg_booke.h>
#include <asm/time.h>
@@ -218,17 +219,24 @@ static struct watchdog_device booke_wdt_dev = {
.max_timeout = 0xFFFF
};
-static void __exit booke_wdt_exit(void)
+static int booke_wdt_remove(struct platform_device *pdev)
{
watchdog_unregister_device(&booke_wdt_dev);
+ return 0;
+}
+
+static void booke_wdt_shutdown(struct platform_device *pdev)
+{
+ booke_wdt_stop(&booke_wdt_dev);
}
-static int __init booke_wdt_init(void)
+static int booke_wdt_probe(struct platform_device *pdev)
{
int ret = 0;
bool nowayout = WATCHDOG_NOWAYOUT;
- pr_info("powerpc book-e watchdog driver loaded\n");
+ dev_info(&pdev->dev, "powerpc book-e watchdog driver loaded\n");
+
booke_wdt_info.firmware_version = cur_cpu_spec->pvr_value;
booke_wdt_set_timeout(&booke_wdt_dev,
period_to_sec(CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT));
@@ -241,8 +249,18 @@ static int __init booke_wdt_init(void)
return ret;
}
-module_init(booke_wdt_init);
-module_exit(booke_wdt_exit);
+static struct platform_driver booke_wdt_driver = {
+ .probe = booke_wdt_probe,
+ .remove = booke_wdt_remove,
+ .shutdown = booke_wdt_shutdown,
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "booke_wdt",
+ },
+};
+
+module_platform_driver(booke_wdt_driver);
MODULE_DESCRIPTION("PowerPC Book-E watchdog driver");
MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:booke_wdt");
--
1.7.9.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [RFC PATCH 2/2] watchdog: booke: Add device tree support
2013-05-03 15:56 [RFC PATCH 1/2] watchdog: booke: Convert to platform driver Guenter Roeck
@ 2013-05-03 15:56 ` Guenter Roeck
0 siblings, 0 replies; 2+ messages in thread
From: Guenter Roeck @ 2013-05-03 15:56 UTC (permalink / raw)
To: linux-watchdog; +Cc: linux-kernel, Guenter Roeck, Dirk Eibach
Enable timeout initialization from device tree data.
Cc: Dirk Eibach <dirk.eibach@gdsys.cc>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
Compile tested only. Need to determine final "compatible" strings
documentation of properties.
drivers/watchdog/booke_wdt.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 9b066b9..d433675 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -18,6 +18,7 @@
#include <linux/smp.h>
#include <linux/watchdog.h>
#include <linux/platform_device.h>
+#include <linux/of.h>
#include <asm/reg_booke.h>
#include <asm/time.h>
@@ -238,8 +239,10 @@ static int booke_wdt_probe(struct platform_device *pdev)
dev_info(&pdev->dev, "powerpc book-e watchdog driver loaded\n");
booke_wdt_info.firmware_version = cur_cpu_spec->pvr_value;
- booke_wdt_set_timeout(&booke_wdt_dev,
- period_to_sec(CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT));
+ watchdog_init_timeout(&booke_wdt_dev,
+ period_to_sec(CONFIG_BOOKE_WDT_DEFAULT_TIMEOUT),
+ &pdev->dev);
+ booke_wdt_set_timeout(&booke_wdt_dev, booke_wdt_dev.timeout);
watchdog_set_nowayout(&booke_wdt_dev, nowayout);
if (booke_wdt_enabled)
__booke_wdt_start(&booke_wdt_dev);
@@ -249,6 +252,13 @@ static int booke_wdt_probe(struct platform_device *pdev)
return ret;
}
+static const struct of_device_id booke_wdt_of_match[] = {
+ { .compatible = "booke_wdt", },
+ { .compatible = "fsl,booke-wdt", },
+ { },
+};
+MODULE_DEVICE_TABLE(of, booke_wdt_of_match);
+
static struct platform_driver booke_wdt_driver = {
.probe = booke_wdt_probe,
.remove = booke_wdt_remove,
@@ -256,6 +266,7 @@ static struct platform_driver booke_wdt_driver = {
.driver = {
.owner = THIS_MODULE,
.name = "booke_wdt",
+ .of_match_table = booke_wdt_of_match,
},
};
--
1.7.9.7
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-05-03 15:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-03 15:56 [RFC PATCH 1/2] watchdog: booke: Convert to platform driver Guenter Roeck
2013-05-03 15:56 ` [RFC PATCH 2/2] watchdog: booke: Add device tree support Guenter Roeck
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).