blob: fbcb6f6a809d896bee054ea0ad4535afe0c5597f [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/err.h>
38#include <linux/platform_device.h>
39#include <linux/moduleparam.h>
Wim Van Sebroeck089ab072008-07-15 11:46:11 +000040#include <linux/io.h>
Tejun Heo5a0e3ad2010-03-24 17:04:11 +090041#include <linux/slab.h>
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +053042#include <linux/pm_runtime.h>
Paul Walmsley129f5572012-10-29 20:49:44 -060043#include <linux/platform_data/omap-wd-timer.h>
Komal Shah7768a132006-09-29 01:59:18 -070044
45#include "omap_wdt.h"
46
Pali Rohár2dd7b242013-02-17 00:49:26 +010047static bool nowayout = WATCHDOG_NOWAYOUT;
48module_param(nowayout, bool, 0);
49MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
50 "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
51
Komal Shah7768a132006-09-29 01:59:18 -070052static unsigned timer_margin;
53module_param(timer_margin, uint, 0);
54MODULE_PARM_DESC(timer_margin, "initial watchdog timeout (in seconds)");
55
Felipe Balbi28171422008-09-20 04:14:01 +030056struct omap_wdt_dev {
57 void __iomem *base; /* physical */
58 struct device *dev;
Aaro Koskinen67c0f552012-10-10 23:23:32 +030059 bool omap_wdt_users;
Felipe Balbi28171422008-09-20 04:14:01 +030060 struct resource *mem;
Aaro Koskinen67c0f552012-10-10 23:23:32 +030061 int wdt_trgr_pattern;
62 struct mutex lock; /* to avoid races with PM */
Felipe Balbi28171422008-09-20 04:14:01 +030063};
64
Aaro Koskinen67c0f552012-10-10 23:23:32 +030065static void omap_wdt_reload(struct omap_wdt_dev *wdev)
Komal Shah7768a132006-09-29 01:59:18 -070066{
Felipe Balbi28171422008-09-20 04:14:01 +030067 void __iomem *base = wdev->base;
Felipe Balbib3112182008-09-20 04:14:03 +030068
Komal Shah7768a132006-09-29 01:59:18 -070069 /* wait for posted write to complete */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020070 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x08)
Komal Shah7768a132006-09-29 01:59:18 -070071 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +030072
Aaro Koskinen67c0f552012-10-10 23:23:32 +030073 wdev->wdt_trgr_pattern = ~wdev->wdt_trgr_pattern;
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020074 writel_relaxed(wdev->wdt_trgr_pattern, (base + OMAP_WATCHDOG_TGR));
Felipe Balbib3112182008-09-20 04:14:03 +030075
Komal Shah7768a132006-09-29 01:59:18 -070076 /* wait for posted write to complete */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020077 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x08)
Komal Shah7768a132006-09-29 01:59:18 -070078 cpu_relax();
79 /* reloaded WCRR from WLDR */
80}
81
Felipe Balbi28171422008-09-20 04:14:01 +030082static void omap_wdt_enable(struct omap_wdt_dev *wdev)
Komal Shah7768a132006-09-29 01:59:18 -070083{
Felipe Balbib3112182008-09-20 04:14:03 +030084 void __iomem *base = wdev->base;
85
Komal Shah7768a132006-09-29 01:59:18 -070086 /* Sequence to enable the watchdog */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020087 writel_relaxed(0xBBBB, base + OMAP_WATCHDOG_SPR);
88 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -070089 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +030090
Victor Kamensky4a7e94a2013-11-16 02:01:05 +020091 writel_relaxed(0x4444, base + OMAP_WATCHDOG_SPR);
92 while ((readl_relaxed(base + OMAP_WATCHDOG_WPS)) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -070093 cpu_relax();
94}
95
Felipe Balbi28171422008-09-20 04:14:01 +030096static void omap_wdt_disable(struct omap_wdt_dev *wdev)
Komal Shah7768a132006-09-29 01:59:18 -070097{
Felipe Balbib3112182008-09-20 04:14:03 +030098 void __iomem *base = wdev->base;
99
Komal Shah7768a132006-09-29 01:59:18 -0700100 /* sequence required to disable watchdog */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200101 writel_relaxed(0xAAAA, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */
102 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -0700103 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +0300104
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200105 writel_relaxed(0x5555, base + OMAP_WATCHDOG_SPR); /* TIMER_MODE */
106 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x10)
Komal Shah7768a132006-09-29 01:59:18 -0700107 cpu_relax();
108}
109
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300110static void omap_wdt_set_timer(struct omap_wdt_dev *wdev,
111 unsigned int timeout)
Komal Shah7768a132006-09-29 01:59:18 -0700112{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300113 u32 pre_margin = GET_WLDR_VAL(timeout);
Felipe Balbib3112182008-09-20 04:14:03 +0300114 void __iomem *base = wdev->base;
Komal Shah7768a132006-09-29 01:59:18 -0700115
116 /* just count up at 32 KHz */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200117 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x04)
Komal Shah7768a132006-09-29 01:59:18 -0700118 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +0300119
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200120 writel_relaxed(pre_margin, base + OMAP_WATCHDOG_LDR);
121 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x04)
Komal Shah7768a132006-09-29 01:59:18 -0700122 cpu_relax();
123}
124
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300125static int omap_wdt_start(struct watchdog_device *wdog)
Komal Shah7768a132006-09-29 01:59:18 -0700126{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300127 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300128 void __iomem *base = wdev->base;
129
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300130 mutex_lock(&wdev->lock);
131
132 wdev->omap_wdt_users = true;
Komal Shah7768a132006-09-29 01:59:18 -0700133
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +0530134 pm_runtime_get_sync(wdev->dev);
Komal Shah7768a132006-09-29 01:59:18 -0700135
136 /* initialize prescaler */
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200137 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01)
Komal Shah7768a132006-09-29 01:59:18 -0700138 cpu_relax();
Felipe Balbib3112182008-09-20 04:14:03 +0300139
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200140 writel_relaxed((1 << 5) | (PTV << 2), base + OMAP_WATCHDOG_CNTRL);
141 while (readl_relaxed(base + OMAP_WATCHDOG_WPS) & 0x01)
Komal Shah7768a132006-09-29 01:59:18 -0700142 cpu_relax();
143
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300144 omap_wdt_set_timer(wdev, wdog->timeout);
145 omap_wdt_reload(wdev); /* trigger loading of new timeout value */
Felipe Balbi28171422008-09-20 04:14:01 +0300146 omap_wdt_enable(wdev);
Felipe Balbib3112182008-09-20 04:14:03 +0300147
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300148 mutex_unlock(&wdev->lock);
Felipe Balbib3112182008-09-20 04:14:03 +0300149
Komal Shah7768a132006-09-29 01:59:18 -0700150 return 0;
151}
152
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300153static int omap_wdt_stop(struct watchdog_device *wdog)
Komal Shah7768a132006-09-29 01:59:18 -0700154{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300155 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300156
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300157 mutex_lock(&wdev->lock);
158 omap_wdt_disable(wdev);
159 pm_runtime_put_sync(wdev->dev);
160 wdev->omap_wdt_users = false;
161 mutex_unlock(&wdev->lock);
162 return 0;
Komal Shah7768a132006-09-29 01:59:18 -0700163}
164
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300165static int omap_wdt_ping(struct watchdog_device *wdog)
Komal Shah7768a132006-09-29 01:59:18 -0700166{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300167 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300168
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300169 mutex_lock(&wdev->lock);
170 omap_wdt_reload(wdev);
171 mutex_unlock(&wdev->lock);
Komal Shah7768a132006-09-29 01:59:18 -0700172
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300173 return 0;
Komal Shah7768a132006-09-29 01:59:18 -0700174}
175
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300176static int omap_wdt_set_timeout(struct watchdog_device *wdog,
177 unsigned int timeout)
178{
179 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
180
181 mutex_lock(&wdev->lock);
182 omap_wdt_disable(wdev);
183 omap_wdt_set_timer(wdev, timeout);
184 omap_wdt_enable(wdev);
185 omap_wdt_reload(wdev);
186 wdog->timeout = timeout;
187 mutex_unlock(&wdev->lock);
188
189 return 0;
190}
191
192static const struct watchdog_info omap_wdt_info = {
193 .options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
194 .identity = "OMAP Watchdog",
195};
196
197static const struct watchdog_ops omap_wdt_ops = {
198 .owner = THIS_MODULE,
199 .start = omap_wdt_start,
200 .stop = omap_wdt_stop,
201 .ping = omap_wdt_ping,
202 .set_timeout = omap_wdt_set_timeout,
Komal Shah7768a132006-09-29 01:59:18 -0700203};
204
Bill Pemberton2d991a12012-11-19 13:21:41 -0500205static int omap_wdt_probe(struct platform_device *pdev)
Komal Shah7768a132006-09-29 01:59:18 -0700206{
Jingoo Hanbc8fdfb2013-07-30 19:58:51 +0900207 struct omap_wd_timer_platform_data *pdata = dev_get_platdata(&pdev->dev);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300208 struct watchdog_device *omap_wdt;
Komal Shah7768a132006-09-29 01:59:18 -0700209 struct resource *res, *mem;
Felipe Balbi28171422008-09-20 04:14:01 +0300210 struct omap_wdt_dev *wdev;
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300211 u32 rs;
Felipe Balbib3112182008-09-20 04:14:03 +0300212 int ret;
Komal Shah7768a132006-09-29 01:59:18 -0700213
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300214 omap_wdt = devm_kzalloc(&pdev->dev, sizeof(*omap_wdt), GFP_KERNEL);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300215 if (!omap_wdt)
216 return -ENOMEM;
217
Komal Shah7768a132006-09-29 01:59:18 -0700218 /* reserve static register mappings */
219 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300220 if (!res)
221 return -ENOENT;
Komal Shah7768a132006-09-29 01:59:18 -0700222
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300223 mem = devm_request_mem_region(&pdev->dev, res->start,
224 resource_size(res), pdev->name);
225 if (!mem)
226 return -EBUSY;
Komal Shah7768a132006-09-29 01:59:18 -0700227
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300228 wdev = devm_kzalloc(&pdev->dev, sizeof(*wdev), GFP_KERNEL);
229 if (!wdev)
230 return -ENOMEM;
Felipe Balbib3112182008-09-20 04:14:03 +0300231
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300232 wdev->omap_wdt_users = false;
233 wdev->mem = mem;
234 wdev->dev = &pdev->dev;
235 wdev->wdt_trgr_pattern = 0x1234;
236 mutex_init(&wdev->lock);
Komal Shah7768a132006-09-29 01:59:18 -0700237
Aaro Koskinen4f4753d2012-10-10 23:23:33 +0300238 wdev->base = devm_ioremap(&pdev->dev, res->start, resource_size(res));
239 if (!wdev->base)
240 return -ENOMEM;
Felipe Balbi9f69e3b2008-09-20 04:14:02 +0300241
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300242 omap_wdt->info = &omap_wdt_info;
243 omap_wdt->ops = &omap_wdt_ops;
244 omap_wdt->min_timeout = TIMER_MARGIN_MIN;
245 omap_wdt->max_timeout = TIMER_MARGIN_MAX;
246
247 if (timer_margin >= TIMER_MARGIN_MIN &&
248 timer_margin <= TIMER_MARGIN_MAX)
249 omap_wdt->timeout = timer_margin;
250 else
251 omap_wdt->timeout = TIMER_MARGIN_DEFAULT;
252
253 watchdog_set_drvdata(omap_wdt, wdev);
254 watchdog_set_nowayout(omap_wdt, nowayout);
255
256 platform_set_drvdata(pdev, omap_wdt);
Felipe Balbi28171422008-09-20 04:14:01 +0300257
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +0530258 pm_runtime_enable(wdev->dev);
259 pm_runtime_get_sync(wdev->dev);
Ulrik Bech Hald789cd472009-06-12 16:18:32 -0500260
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300261 if (pdata && pdata->read_reset_sources)
262 rs = pdata->read_reset_sources();
263 else
264 rs = 0;
265 omap_wdt->bootstatus = (rs & (1 << OMAP_MPU_WD_RST_SRC_ID_SHIFT)) ?
266 WDIOF_CARDRESET : 0;
267
Felipe Balbi28171422008-09-20 04:14:01 +0300268 omap_wdt_disable(wdev);
Komal Shah7768a132006-09-29 01:59:18 -0700269
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300270 ret = watchdog_register_device(omap_wdt);
Aaro Koskinen1ba85382012-10-10 23:23:37 +0300271 if (ret) {
272 pm_runtime_disable(wdev->dev);
273 return ret;
274 }
Komal Shah7768a132006-09-29 01:59:18 -0700275
Felipe Balbi28171422008-09-20 04:14:01 +0300276 pr_info("OMAP Watchdog Timer Rev 0x%02x: initial timeout %d sec\n",
Victor Kamensky4a7e94a2013-11-16 02:01:05 +0200277 readl_relaxed(wdev->base + OMAP_WATCHDOG_REV) & 0xFF,
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300278 omap_wdt->timeout);
Komal Shah7768a132006-09-29 01:59:18 -0700279
Varadarajan, Charulatha7ec5ad02010-09-23 20:02:43 +0530280 pm_runtime_put_sync(wdev->dev);
Ulrik Bech Hald789cd472009-06-12 16:18:32 -0500281
Komal Shah7768a132006-09-29 01:59:18 -0700282 return 0;
Komal Shah7768a132006-09-29 01:59:18 -0700283}
284
285static void omap_wdt_shutdown(struct platform_device *pdev)
286{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300287 struct watchdog_device *wdog = platform_get_drvdata(pdev);
288 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbi28171422008-09-20 04:14:01 +0300289
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300290 mutex_lock(&wdev->lock);
Paul Walmsley0503add2011-03-10 22:40:05 -0700291 if (wdev->omap_wdt_users) {
Felipe Balbi28171422008-09-20 04:14:01 +0300292 omap_wdt_disable(wdev);
Paul Walmsley0503add2011-03-10 22:40:05 -0700293 pm_runtime_put_sync(wdev->dev);
294 }
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300295 mutex_unlock(&wdev->lock);
Komal Shah7768a132006-09-29 01:59:18 -0700296}
297
Bill Pemberton4b12b892012-11-19 13:26:24 -0500298static int omap_wdt_remove(struct platform_device *pdev)
Komal Shah7768a132006-09-29 01:59:18 -0700299{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300300 struct watchdog_device *wdog = platform_get_drvdata(pdev);
301 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbi28171422008-09-20 04:14:01 +0300302
Shubhrajyoti D12c583d2012-01-11 19:50:18 +0530303 pm_runtime_disable(wdev->dev);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300304 watchdog_unregister_device(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300305
Komal Shah7768a132006-09-29 01:59:18 -0700306 return 0;
307}
308
309#ifdef CONFIG_PM
310
311/* REVISIT ... not clear this is the best way to handle system suspend; and
312 * it's very inappropriate for selective device suspend (e.g. suspending this
313 * through sysfs rather than by stopping the watchdog daemon). Also, this
314 * may not play well enough with NOWAYOUT...
315 */
316
317static int omap_wdt_suspend(struct platform_device *pdev, pm_message_t state)
318{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300319 struct watchdog_device *wdog = platform_get_drvdata(pdev);
320 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300321
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300322 mutex_lock(&wdev->lock);
Paul Walmsley0503add2011-03-10 22:40:05 -0700323 if (wdev->omap_wdt_users) {
Felipe Balbi28171422008-09-20 04:14:01 +0300324 omap_wdt_disable(wdev);
Paul Walmsley0503add2011-03-10 22:40:05 -0700325 pm_runtime_put_sync(wdev->dev);
326 }
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300327 mutex_unlock(&wdev->lock);
Felipe Balbib3112182008-09-20 04:14:03 +0300328
Komal Shah7768a132006-09-29 01:59:18 -0700329 return 0;
330}
331
332static int omap_wdt_resume(struct platform_device *pdev)
333{
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300334 struct watchdog_device *wdog = platform_get_drvdata(pdev);
335 struct omap_wdt_dev *wdev = watchdog_get_drvdata(wdog);
Felipe Balbib3112182008-09-20 04:14:03 +0300336
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300337 mutex_lock(&wdev->lock);
Felipe Balbi28171422008-09-20 04:14:01 +0300338 if (wdev->omap_wdt_users) {
Paul Walmsley0503add2011-03-10 22:40:05 -0700339 pm_runtime_get_sync(wdev->dev);
Felipe Balbi28171422008-09-20 04:14:01 +0300340 omap_wdt_enable(wdev);
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300341 omap_wdt_reload(wdev);
Komal Shah7768a132006-09-29 01:59:18 -0700342 }
Aaro Koskinen67c0f552012-10-10 23:23:32 +0300343 mutex_unlock(&wdev->lock);
Felipe Balbib3112182008-09-20 04:14:03 +0300344
Komal Shah7768a132006-09-29 01:59:18 -0700345 return 0;
346}
347
348#else
349#define omap_wdt_suspend NULL
350#define omap_wdt_resume NULL
351#endif
352
Xiao Jiange6ca04e2012-06-01 12:44:16 +0800353static const struct of_device_id omap_wdt_of_match[] = {
354 { .compatible = "ti,omap3-wdt", },
355 {},
356};
357MODULE_DEVICE_TABLE(of, omap_wdt_of_match);
358
Komal Shah7768a132006-09-29 01:59:18 -0700359static struct platform_driver omap_wdt_driver = {
360 .probe = omap_wdt_probe,
Bill Pemberton82268712012-11-19 13:21:12 -0500361 .remove = omap_wdt_remove,
Komal Shah7768a132006-09-29 01:59:18 -0700362 .shutdown = omap_wdt_shutdown,
363 .suspend = omap_wdt_suspend,
364 .resume = omap_wdt_resume,
365 .driver = {
366 .owner = THIS_MODULE,
367 .name = "omap_wdt",
Xiao Jiange6ca04e2012-06-01 12:44:16 +0800368 .of_match_table = omap_wdt_of_match,
Komal Shah7768a132006-09-29 01:59:18 -0700369 },
370};
371
Axel Linb8ec6112011-11-29 13:56:27 +0800372module_platform_driver(omap_wdt_driver);
Komal Shah7768a132006-09-29 01:59:18 -0700373
374MODULE_AUTHOR("George G. Davis");
375MODULE_LICENSE("GPL");
Kay Sieversf37d1932008-04-10 21:29:23 -0700376MODULE_ALIAS("platform:omap_wdt");