]> rtime.felk.cvut.cz Git - can-eth-gw-linux.git/blobdiff - drivers/watchdog/omap_wdt.c
Merge tag 'pm-merge' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[can-eth-gw-linux.git] / drivers / watchdog / omap_wdt.c
index f5db18dbc0f9e5e9092462142aa805a87239d696..3e3ebbc83fafe8ba194470c0da8d9fe862897684 100644 (file)
@@ -45,9 +45,7 @@
 #include <linux/uaccess.h>
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
-#include <mach/hardware.h>
-#include <plat/cpu.h>
-#include <plat/prcm.h>
+#include <linux/platform_data/omap-wd-timer.h>
 
 #include "omap_wdt.h"
 
@@ -202,8 +200,10 @@ static ssize_t omap_wdt_write(struct file *file, const char __user *data,
 static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
                                                unsigned long arg)
 {
+       struct omap_wd_timer_platform_data *pdata;
        struct omap_wdt_dev *wdev;
-       int new_margin;
+       u32 rs;
+       int new_margin, bs;
        static const struct watchdog_info ident = {
                .identity = "OMAP Watchdog",
                .options = WDIOF_SETTIMEOUT,
@@ -211,6 +211,7 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
        };
 
        wdev = file->private_data;
+       pdata = wdev->dev->platform_data;
 
        switch (cmd) {
        case WDIOC_GETSUPPORT:
@@ -219,17 +220,12 @@ static long omap_wdt_ioctl(struct file *file, unsigned int cmd,
        case WDIOC_GETSTATUS:
                return put_user(0, (int __user *)arg);
        case WDIOC_GETBOOTSTATUS:
-#ifdef CONFIG_ARCH_OMAP1
-               if (cpu_is_omap16xx())
-                       return put_user(__raw_readw(ARM_SYSST),
-                                       (int __user *)arg);
-#endif
-#ifdef CONFIG_ARCH_OMAP2PLUS
-               if (cpu_is_omap24xx())
-                       return put_user(omap_prcm_get_reset_sources(),
-                                       (int __user *)arg);
-#endif
-               return put_user(0, (int __user *)arg);
+               if (!pdata || !pdata->read_reset_sources)
+                       return put_user(0, (int __user *)arg);
+               rs = pdata->read_reset_sources();
+               bs = (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT)) ?
+                       WDIOF_CARDRESET : 0;
+               return put_user(bs, (int __user *)arg);
        case WDIOC_KEEPALIVE:
                spin_lock(&wdt_lock);
                omap_wdt_ping(wdev);
@@ -264,7 +260,7 @@ static const struct file_operations omap_wdt_fops = {
        .llseek = no_llseek,
 };
 
-static int __devinit omap_wdt_probe(struct platform_device *pdev)
+static int omap_wdt_probe(struct platform_device *pdev)
 {
        struct resource *res, *mem;
        struct omap_wdt_dev *wdev;
@@ -359,7 +355,7 @@ static void omap_wdt_shutdown(struct platform_device *pdev)
        }
 }
 
-static int __devexit omap_wdt_remove(struct platform_device *pdev)
+static int omap_wdt_remove(struct platform_device *pdev)
 {
        struct omap_wdt_dev *wdev = platform_get_drvdata(pdev);
        struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -426,7 +422,7 @@ MODULE_DEVICE_TABLE(of, omap_wdt_of_match);
 
 static struct platform_driver omap_wdt_driver = {
        .probe          = omap_wdt_probe,
-       .remove         = __devexit_p(omap_wdt_remove),
+       .remove         = omap_wdt_remove,
        .shutdown       = omap_wdt_shutdown,
        .suspend        = omap_wdt_suspend,
        .resume         = omap_wdt_resume,