summaryrefslogtreecommitdiff
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorKamal Kannan Balagopalan <kbalagopalan@nvidia.com>2012-01-23 22:46:09 -0800
committerVarun Colbert <vcolbert@nvidia.com>2012-01-30 12:31:45 -0800
commit579eb179694319acbc75b6c97a13a88742652bd3 (patch)
tree26cea0d87380f2dacac7db6a0a9df45c6bb6d7cd /drivers/watchdog
parenta97621dc0ddf4983cdb9a17af3caffe2903abea7 (diff)
tegra: wdt: Add KEEPALIVE function to WDT driver
Add KEEPALIVE functionality to Tegra WDT driver for use by user space applications. Bug 887733 Reviewed-on: http://git-master/r/77135 Change-Id: I966371bc5db34416de08c8dc2af9069b4bd34c5d Signed-off-by: Kamal Kannan Balagopalan <kbalagopalan@nvidia.com> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Reviewed-on: http://git-master/r/77750 Reviewed-by: Automatic_Commit_Validation_User
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/tegra_wdt.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/drivers/watchdog/tegra_wdt.c b/drivers/watchdog/tegra_wdt.c
index d873eccfcd4b..12266049e160 100644
--- a/drivers/watchdog/tegra_wdt.c
+++ b/drivers/watchdog/tegra_wdt.c
@@ -91,6 +91,11 @@ static void tegra_wdt_disable(struct tegra_wdt *wdt)
writel(0, wdt->wdt_timer + TIMER_PTV);
}
+static inline void tegra_wdt_ping(struct tegra_wdt *wdt)
+{
+ return;
+}
+
static irqreturn_t tegra_wdt_interrupt(int irq, void *dev_id)
{
struct tegra_wdt *wdt = dev_id;
@@ -134,15 +139,21 @@ static void tegra_wdt_set_timeout(struct tegra_wdt *wdt, int sec)
}
}
+static inline void tegra_wdt_ping(struct tegra_wdt *wdt)
+{
+ writel(WDT_CMD_START_COUNTER, wdt->wdt_source + WDT_CMD);
+}
+
static void tegra_wdt_enable(struct tegra_wdt *wdt)
{
u32 val;
+ writel(TIMER_PCR_INTR, wdt->wdt_timer + TIMER_PCR);
val = (wdt->timeout * 1000000ul) / 4;
val |= (TIMER_EN | TIMER_PERIODIC);
writel(val, wdt->wdt_timer + TIMER_PTV);
- val = WDT_CFG_TMR_SRC | WDT_CFG_PERIOD | WDT_CFG_INT_EN |
+ val = WDT_CFG_TMR_SRC | WDT_CFG_PERIOD | /*WDT_CFG_INT_EN |*/
/*WDT_CFG_SYS_RST_EN |*/ WDT_CFG_PMC2CAR_RST_EN;
writel(val, wdt->wdt_source + WDT_CFG);
writel(WDT_CMD_START_COUNTER, wdt->wdt_source + WDT_CMD);
@@ -160,7 +171,7 @@ static irqreturn_t tegra_wdt_interrupt(int irq, void *dev_id)
{
struct tegra_wdt *wdt = dev_id;
- writel(WDT_CMD_START_COUNTER, wdt->wdt_source + WDT_CMD);
+ tegra_wdt_ping(wdt);
return IRQ_HANDLED;
}
#endif
@@ -222,6 +233,9 @@ static long tegra_wdt_ioctl(struct file *file, unsigned int cmd,
return put_user(0, (int __user *)arg);
case WDIOC_KEEPALIVE:
+ spin_lock(&lock);
+ tegra_wdt_ping(wdt);
+ spin_unlock(&lock);
return 0;
case WDIOC_SETTIMEOUT: