1 diff --git a/drivers/watchdog/mtx-1_wdt.c b/drivers/watchdog/mtx-1_wdt.c
2 index dcfd401..5d8c51f 100644
3 --- a/drivers/watchdog/mtx-1_wdt.c
4 +++ b/drivers/watchdog/mtx-1_wdt.c
6 #include <linux/completion.h>
7 #include <linux/jiffies.h>
8 #include <linux/watchdog.h>
9 +#include <linux/platform_device.h>
12 #include <asm/uaccess.h>
14 #include <asm/mach-au1x00/au1000.h>
15 +#include <asm/gpio.h>
17 #define MTX1_WDT_INTERVAL (5 * HZ)
19 @@ -61,6 +64,7 @@ static struct {
26 static void mtx1_wdt_trigger(unsigned long unused)
27 @@ -73,7 +77,7 @@ static void mtx1_wdt_trigger(unsigned long unused)
30 tmp = au_readl(GPIO2_DIR);
31 - tmp = (tmp & ~(1<<15)) | ((~tmp) & (1<<15));
32 + tmp = (tmp & ~(1<< mtx1_wdt_device.gpio)) | ((~tmp) & (1<< mtx1_wdt_device.gpio));
33 au_writel (tmp, GPIO2_DIR);
35 if (mtx1_wdt_device.queue && ticks)
36 @@ -93,7 +97,7 @@ static void mtx1_wdt_start(void)
38 if (!mtx1_wdt_device.queue) {
39 mtx1_wdt_device.queue = 1;
40 - au_writel (au_readl(GPIO2_DIR) | (u32)(1<<15), GPIO2_DIR);
41 + gpio_set_value(mtx1_wdt_device.gpio, 1);
42 mod_timer(&mtx1_wdt_device.timer, jiffies + MTX1_WDT_INTERVAL);
44 mtx1_wdt_device.running++;
45 @@ -103,7 +107,7 @@ static int mtx1_wdt_stop(void)
47 if (mtx1_wdt_device.queue) {
48 mtx1_wdt_device.queue = 0;
49 - au_writel (au_readl(GPIO2_DIR) & ~((u32)(1<<15)), GPIO2_DIR);
50 + gpio_set_value(mtx1_wdt_device.gpio, 0);
53 ticks = mtx1_wdt_device.default_ticks;
54 @@ -197,10 +201,12 @@ static struct miscdevice mtx1_wdt_misc = {
58 -static int __init mtx1_wdt_init(void)
59 +static int mtx1_wdt_probe(struct platform_device *pdev)
63 + mtx1_wdt_device.gpio = pdev->resource[0].start;
65 if ((ret = misc_register(&mtx1_wdt_misc)) < 0) {
66 printk(KERN_ERR " mtx-1_wdt : failed to register\n");
68 @@ -222,13 +228,30 @@ static int __init mtx1_wdt_init(void)
72 -static void __exit mtx1_wdt_exit(void)
73 +static int mtx1_wdt_remove(struct platform_device *pdev)
75 if (mtx1_wdt_device.queue) {
76 mtx1_wdt_device.queue = 0;
77 wait_for_completion(&mtx1_wdt_device.stop);
79 misc_deregister(&mtx1_wdt_misc);
83 +static struct platform_driver mtx1_wdt = {
84 + .probe = mtx1_wdt_probe,
85 + .remove = mtx1_wdt_remove,
86 + .driver.name = "mtx1-wdt",
89 +static int __init mtx1_wdt_init(void)
91 + return platform_driver_register(&mtx1_wdt);
94 +static void __exit mtx1_wdt_exit(void)
96 + platform_driver_unregister(&mtx1_wdt);
99 module_init(mtx1_wdt_init);
100 @@ -237,3 +260,4 @@ module_exit(mtx1_wdt_exit);
101 MODULE_AUTHOR("Michael Stickel, Florian Fainelli");
102 MODULE_DESCRIPTION("Driver for the MTX-1 watchdog");
103 MODULE_LICENSE("GPL");
104 +MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);