blob: 09cf0135e8acd3078d2480870109984ece309301 [file] [log] [blame]
Komal Shah7768a132006-09-29 01:59:18 -07001/*
Felipe Balbi28171422008-09-20 04:14:01 +03002 * omap_wdt.c
Komal Shah7768a132006-09-29 01:59:18 -07003 *
Felipe Balbi28171422008-09-20 04:14:01 +03004 * Watchdog driver for the TI OMAP 16xx & 24xx/34xx 32KHz (non-secure) watchdog
Komal Shah7768a132006-09-29 01:59:18 -07005 *
6 * Author: MontaVista Software, Inc.
7 * <gdavis@mvista.com> or <source@mvista.com>
8 *
9 * 2003 (c) MontaVista Software, Inc. This file is licensed under the
10 * terms of the GNU General Public License version 2. This program is
11 * licensed "as is" without any warranty of any kind, whether express
12 * or implied.
13 *
14 * History:
15 *
16 * 20030527: George G. Davis <gdavis@mvista.com>
17 * Initially based on linux-2.4.19-rmk7-pxa1/drivers/char/sa1100_wdt.c
18 * (c) Copyright 2000 Oleg Drokin <green@crimea.edu>
Alan Cox29fa0582008-10-27 15:17:56 +000019 * Based on SoftDog driver by Alan Cox <alan@lxorguk.ukuu.org.uk>
Komal Shah7768a132006-09-29 01:59:18 -070020 *
21 * Copyright (c) 2004 Texas Instruments.
22 * 1. Modified to support OMAP1610 32-KHz watchdog timer
23 * 2. Ported to 2.6 kernel
24 *
25 * Copyright (c) 2005 David Brownell
26 * Use the driver model and standard identifiers; handle bigger timeouts.
27 */
28
Joe Perches27c766a2012-02-15 15:06:19 -080029#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
30
Komal Shah7768a132006-09-29 01:59:18 -070031#include <linux/module.h>
Komal Shah7768a132006-09-29 01:59:18 -070032#include <linux/types.h>
33#include <linux/kernel.h>
Komal Shah7768a132006-09-29 01:59:18 -070034#include <linux/mm.h>
Komal Shah7768a132006-09-29 01:59:18 -070035#include <linux/watchdog.h>
36#include <linux/reboot.h>
Komal Shah7768a132006-09-29 01:59:18 -070037#include <linux/init.h>
38#include <linux/err.h>
39#include <linux/platform_device.h>
40#include <linux/moduleparam.h>
Wim Van Sebroeck089ab072008-07-15 11:46:11 +000041#include <linux/io.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090042#include <linux/slab.h>
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +053043#include <linux/pm_runtime.h>
Paul Walmsley129f5572012-10-29 20:49:44 -060044#include <linux/platform_data/omap-wd-timer.h>
Komal Shah7768a132006-09-29 01:59:18 -070045
46#include "omap_wdt.h"
47
Pali Rohár2dd7b242013-02-17 00:49:26 +010048static bool nowayout = WATCHDOG_NOWAYOUT;
49module_param(nowayout, bool, 0);
50MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
51 "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
52
Komal Shah7768a132006-09-29 01:59:18 -070053static unsigned timer_margin;
54module_param(timer_margin, uint, 0);
55MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
56
Felipe Balbi28171422008-09-20 04:14:01 +030057struct omap_wdt_dev {
58 void __iomem *base; /* physical */
59 struct device *dev;
Aaro Koskinen67c0f552012-10-10 23:23:32 +030060 bool omap_wdt_users;
Felipe Balbi28171422008-09-20 04:14:01 +030061 struct resource *mem;
Aaro Koskinen67c0f552012-10-10 23:23:32 +030062 int wdt_trgr_pattern;
63 struct mutex lock; /* to avoid races with PM */
Felipe Balbi28171422008-09-20 04:14:01 +030064};
65
Aaro Koskinen67c0f552012-10-10 23:23:32 +030066static void omap_wdt_reload(struct omap_wdt_dev *wdev)
Komal Shah7768a132006-09-29 01:59:18 -070067{
Felipe Balbi28171422008-09-20 04:14:01 +030068 void __iomem *base = wdev->base;
Felipe Balbib3112182008-09-20 04:14:03 +030069
Komal Shah7768a132006-09-29 01:59:18 -070070 /* wait for posted write to complete */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020071 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x08)
Komal Shah7768a132006-09-29 01:59:18 -070072 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +030073
Aaro Koskinen67c0f552012-10-10 23:23:32 +030074 wdev->wdt_trgr_pattern = ~wdev->wdt_trgr_pattern;
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020075 writel_relaxed(wdev->wdt_trgr_pattern, (base + OMAP_WATCHDOG_TGR));
Felipe Balbib3112182008-09-20 04:14:03 +030076
Komal Shah7768a132006-09-29 01:59:18 -070077 /* wait for posted write to complete */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020078 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x08)
Komal Shah7768a132006-09-29 01:59:18 -070079 cpu_relax();
80 /* reloaded WCRR from WLDR */
81}
82
Felipe Balbi28171422008-09-20 04:14:01 +030083static void omap_wdt_enable(struct omap_wdt_dev *wdev)
Komal Shah7768a132006-09-29 01:59:18 -070084{
Felipe Balbib3112182008-09-20 04:14:03 +030085 void __iomem *base = wdev->base;
86
Komal Shah7768a132006-09-29 01:59:18 -070087 /* Sequence to enable the watchdog */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020088 writel_relaxed(0xBBBB, base + OMAP_WATCHDOG_SPR);
89 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -070090 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +030091
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020092 writel_relaxed(0x4444, base + OMAP_WATCHDOG_SPR);
93 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -070094 cpu_relax();
95}
96
Felipe Balbi28171422008-09-20 04:14:01 +030097static void omap_wdt_disable(struct omap_wdt_dev *wdev)
Komal Shah7768a132006-09-29 01:59:18 -070098{
Felipe Balbib3112182008-09-20 04:14:03 +030099 void __iomem *base = wdev->base;
100
Komal Shah7768a132006-09-29 01:59:18 -0700101 /* sequence required to disable watchdog */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200102 writel_relaxed(0xAAAA, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */
103 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -0700104 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +0300105
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200106 writel_relaxed(0x5555, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */
107 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -0700108 cpu_relax();
109}
110
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300111static void omap_wdt_set_timer(struct omap_wdt_dev *wdev,
112 unsigned int timeout)
Komal Shah7768a132006-09-29 01:59:18 -0700113{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300114 u32 pre_margin = GET_WLDR_VAL(timeout);
Felipe Balbib3112182008-09-20 04:14:03 +0300115 void __iomem *base = wdev->base;
Komal Shah7768a132006-09-29 01:59:18 -0700116
117 /* just count up at 32 KHz */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200118 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x04)
Komal Shah7768a132006-09-29 01:59:18 -0700119 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +0300120
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200121 writel_relaxed(pre_margin, base + OMAP_WATCHDOG_LDR);
122 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x04)
Komal Shah7768a132006-09-29 01:59:18 -0700123 cpu_relax();
124}
125
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300126static int omap_wdt_start(struct watchdog_device *wdog)
Komal Shah7768a132006-09-29 01:59:18 -0700127{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300128 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300129 void __iomem *base = wdev->base;
130
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300131 mutex_lock(&wdev->lock);
132
133 wdev->omap_wdt_users = true;
Komal Shah7768a132006-09-29 01:59:18 -0700134
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +0530135 pm_runtime_get_sync(wdev->dev);
Komal Shah7768a132006-09-29 01:59:18 -0700136
137 /* initialize prescaler */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200138 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01)
Komal Shah7768a132006-09-29 01:59:18 -0700139 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +0300140
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200141 writel_relaxed((1 << 5) | (PTV << 2), base + OMAP_WATCHDOG_CNTRL);
142 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01)
Komal Shah7768a132006-09-29 01:59:18 -0700143 cpu_relax();
144
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300145 omap_wdt_set_timer(wdev, wdog->timeout);
146 omap_wdt_reload(wdev); /* trigger loading of new timeout value */
Felipe Balbi28171422008-09-20 04:14:01 +0300147 omap_wdt_enable(wdev);
Felipe Balbib3112182008-09-20 04:14:03 +0300148
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300149 mutex_unlock(&wdev->lock);
Felipe Balbib3112182008-09-20 04:14:03 +0300150
Komal Shah7768a132006-09-29 01:59:18 -0700151 return 0;
152}
153
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300154static int omap_wdt_stop(struct watchdog_device *wdog)
Komal Shah7768a132006-09-29 01:59:18 -0700155{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300156 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300157
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300158 mutex_lock(&wdev->lock);
159 omap_wdt_disable(wdev);
160 pm_runtime_put_sync(wdev->dev);
161 wdev->omap_wdt_users = false;
162 mutex_unlock(&wdev->lock);
163 return 0;
Komal Shah7768a132006-09-29 01:59:18 -0700164}
165
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300166static int omap_wdt_ping(struct watchdog_device *wdog)
Komal Shah7768a132006-09-29 01:59:18 -0700167{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300168 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300169
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300170 mutex_lock(&wdev->lock);
171 omap_wdt_reload(wdev);
172 mutex_unlock(&wdev->lock);
Komal Shah7768a132006-09-29 01:59:18 -0700173
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300174 return 0;
Komal Shah7768a132006-09-29 01:59:18 -0700175}
176
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300177static int omap_wdt_set_timeout(struct watchdog_device *wdog,
178 unsigned int timeout)
179{
180 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
181
182 mutex_lock(&wdev->lock);
183 omap_wdt_disable(wdev);
184 omap_wdt_set_timer(wdev, timeout);
185 omap_wdt_enable(wdev);
186 omap_wdt_reload(wdev);
187 wdog->timeout = timeout;
188 mutex_unlock(&wdev->lock);
189
190 return 0;
191}
192
193static const struct watchdog_info omap_wdt_info = {
194 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
195 .identity = "OMAP Watchdog",
196};
197
198static const struct watchdog_ops omap_wdt_ops = {
199 .owner = THIS_MODULE,
200 .start = omap_wdt_start,
201 .stop = omap_wdt_stop,
202 .ping = omap_wdt_ping,
203 .set_timeout = omap_wdt_set_timeout,
Komal Shah7768a132006-09-29 01:59:18 -0700204};
205
Bill Pemberton2d991a12012-11-19 13:21:41 -0500206static int omap_wdt_probe(struct platform_device *pdev)
Komal Shah7768a132006-09-29 01:59:18 -0700207{
Jingoo Hanbc8fdfb2013-07-30 19:58:51 +0900208 struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300209 struct watchdog_device *omap_wdt;
Komal Shah7768a132006-09-29 01:59:18 -0700210 struct resource *res, *mem;
Felipe Balbi28171422008-09-20 04:14:01 +0300211 struct omap_wdt_dev *wdev;
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300212 u32 rs;
Felipe Balbib3112182008-09-20 04:14:03 +0300213 int ret;
Komal Shah7768a132006-09-29 01:59:18 -0700214
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300215 omap_wdt = devm_kzalloc(&pdev->dev, sizeof(*omap_wdt), GFP_KERNEL);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300216 if (!omap_wdt)
217 return -ENOMEM;
218
Komal Shah7768a132006-09-29 01:59:18 -0700219 /* reserve static register mappings */
220 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300221 if (!res)
222 return -ENOENT;
Komal Shah7768a132006-09-29 01:59:18 -0700223
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300224 mem = devm_request_mem_region(&pdev->dev, res->start,
225 resource_size(res), pdev->name);
226 if (!mem)
227 return -EBUSY;
Komal Shah7768a132006-09-29 01:59:18 -0700228
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300229 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
230 if (!wdev)
231 return -ENOMEM;
Felipe Balbib3112182008-09-20 04:14:03 +0300232
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300233 wdev->omap_wdt_users = false;
234 wdev->mem = mem;
235 wdev->dev = &pdev->dev;
236 wdev->wdt_trgr_pattern = 0x1234;
237 mutex_init(&wdev->lock);
Komal Shah7768a132006-09-29 01:59:18 -0700238
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300239 wdev->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
240 if (!wdev->base)
241 return -ENOMEM;
Felipe Balbi9f69e3b2008-09-20 04:14:02 +0300242
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300243 omap_wdt->info = &omap_wdt_info;
244 omap_wdt->ops = &omap_wdt_ops;
245 omap_wdt->min_timeout = TIMER_MARGIN_MIN;
246 omap_wdt->max_timeout = TIMER_MARGIN_MAX;
247
248 if (timer_margin >= TIMER_MARGIN_MIN &&
249 timer_margin <= TIMER_MARGIN_MAX)
250 omap_wdt->timeout = timer_margin;
251 else
252 omap_wdt->timeout = TIMER_MARGIN_DEFAULT;
253
254 watchdog_set_drvdata(omap_wdt, wdev);
255 watchdog_set_nowayout(omap_wdt, nowayout);
256
257 platform_set_drvdata(pdev, omap_wdt);
Felipe Balbi28171422008-09-20 04:14:01 +0300258
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +0530259 pm_runtime_enable(wdev->dev);
260 pm_runtime_get_sync(wdev->dev);
Ulrik Bech Hald789cd472009-06-12 16:18:32 -0500261
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300262 if (pdata && pdata->read_reset_sources)
263 rs = pdata->read_reset_sources();
264 else
265 rs = 0;
266 omap_wdt->bootstatus = (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT)) ?
267 WDIOF_CARDRESET : 0;
268
Felipe Balbi28171422008-09-20 04:14:01 +0300269 omap_wdt_disable(wdev);
Komal Shah7768a132006-09-29 01:59:18 -0700270
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300271 ret = watchdog_register_device(omap_wdt);
Aaro Koskinen1ba85382012-10-10 23:23:37 +0300272 if (ret) {
273 pm_runtime_disable(wdev->dev);
274 return ret;
275 }
Komal Shah7768a132006-09-29 01:59:18 -0700276
Felipe Balbi28171422008-09-20 04:14:01 +0300277 pr_info("OMAP Watchdog Timer Rev 0x%02x: initial timeout %d sec\n",
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200278 readl_relaxed(wdev->base + OMAP_WATCHDOG_REV) & 0xFF,
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300279 omap_wdt->timeout);
Komal Shah7768a132006-09-29 01:59:18 -0700280
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +0530281 pm_runtime_put_sync(wdev->dev);
Ulrik Bech Hald789cd472009-06-12 16:18:32 -0500282
Komal Shah7768a132006-09-29 01:59:18 -0700283 return 0;
Komal Shah7768a132006-09-29 01:59:18 -0700284}
285
286static void omap_wdt_shutdown(struct platform_device *pdev)
287{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300288 struct watchdog_device *wdog = platform_get_drvdata(pdev);
289 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbi28171422008-09-20 04:14:01 +0300290
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300291 mutex_lock(&wdev->lock);
Paul Walmsley0503add2011-03-10 22:40:05 -0700292 if (wdev->omap_wdt_users) {
Felipe Balbi28171422008-09-20 04:14:01 +0300293 omap_wdt_disable(wdev);
Paul Walmsley0503add2011-03-10 22:40:05 -0700294 pm_runtime_put_sync(wdev->dev);
295 }
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300296 mutex_unlock(&wdev->lock);
Komal Shah7768a132006-09-29 01:59:18 -0700297}
298
Bill Pemberton4b12b892012-11-19 13:26:24 -0500299static int omap_wdt_remove(struct platform_device *pdev)
Komal Shah7768a132006-09-29 01:59:18 -0700300{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300301 struct watchdog_device *wdog = platform_get_drvdata(pdev);
302 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbi28171422008-09-20 04:14:01 +0300303
Shubhrajyoti D12c583d2012-01-11 19:50:18 +0530304 pm_runtime_disable(wdev->dev);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300305 watchdog_unregister_device(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300306
Komal Shah7768a132006-09-29 01:59:18 -0700307 return 0;
308}
309
310#ifdef CONFIG_PM
311
312/* REVISIT ... not clear this is the best way to handle system suspend; and
313 * it's very inappropriate for selective device suspend (e.g. suspending this
314 * through sysfs rather than by stopping the watchdog daemon). Also, this
315 * may not play well enough with NOWAYOUT...
316 */
317
318static int omap_wdt_suspend(struct platform_device *pdev, pm_message_t state)
319{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300320 struct watchdog_device *wdog = platform_get_drvdata(pdev);
321 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300322
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300323 mutex_lock(&wdev->lock);
Paul Walmsley0503add2011-03-10 22:40:05 -0700324 if (wdev->omap_wdt_users) {
Felipe Balbi28171422008-09-20 04:14:01 +0300325 omap_wdt_disable(wdev);
Paul Walmsley0503add2011-03-10 22:40:05 -0700326 pm_runtime_put_sync(wdev->dev);
327 }
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300328 mutex_unlock(&wdev->lock);
Felipe Balbib3112182008-09-20 04:14:03 +0300329
Komal Shah7768a132006-09-29 01:59:18 -0700330 return 0;
331}
332
333static int omap_wdt_resume(struct platform_device *pdev)
334{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300335 struct watchdog_device *wdog = platform_get_drvdata(pdev);
336 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300337
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300338 mutex_lock(&wdev->lock);
Felipe Balbi28171422008-09-20 04:14:01 +0300339 if (wdev->omap_wdt_users) {
Paul Walmsley0503add2011-03-10 22:40:05 -0700340 pm_runtime_get_sync(wdev->dev);
Felipe Balbi28171422008-09-20 04:14:01 +0300341 omap_wdt_enable(wdev);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300342 omap_wdt_reload(wdev);
Komal Shah7768a132006-09-29 01:59:18 -0700343 }
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300344 mutex_unlock(&wdev->lock);
Felipe Balbib3112182008-09-20 04:14:03 +0300345
Komal Shah7768a132006-09-29 01:59:18 -0700346 return 0;
347}
348
349#else
350#define omap_wdt_suspend NULL
351#define omap_wdt_resume NULL
352#endif
353
Xiao Jiange6ca04e2012-06-01 12:44:16 +0800354static const struct of_device_id omap_wdt_of_match[] = {
355 { .compatible = "ti,omap3-wdt", },
356 {},
357};
358MODULE_DEVICE_TABLE(of, omap_wdt_of_match);
359
Komal Shah7768a132006-09-29 01:59:18 -0700360static struct platform_driver omap_wdt_driver = {
361 .probe = omap_wdt_probe,
Bill Pemberton82268712012-11-19 13:21:12 -0500362 .remove = omap_wdt_remove,
Komal Shah7768a132006-09-29 01:59:18 -0700363 .shutdown = omap_wdt_shutdown,
364 .suspend = omap_wdt_suspend,
365 .resume = omap_wdt_resume,
366 .driver = {
367 .owner = THIS_MODULE,
368 .name = "omap_wdt",
Xiao Jiange6ca04e2012-06-01 12:44:16 +0800369 .of_match_table = omap_wdt_of_match,
Komal Shah7768a132006-09-29 01:59:18 -0700370 },
371};
372
Axel Linb8ec6112011-11-29 13:56:27 +0800373module_platform_driver(omap_wdt_driver);
Komal Shah7768a132006-09-29 01:59:18 -0700374
375MODULE_AUTHOR("George G. Davis");
376MODULE_LICENSE("GPL");
Kay Sieversf37d1932008-04-10 21:29:23 -0700377MODULE_ALIAS("platform:omap_wdt");