]> 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 d8da5162f0dda5f7487736168fe9700fb4b7e925..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);