xref: /linux/drivers/watchdog/mtk_wdt.c (revision bbece05c0d3a96817483e0b249ad1e302ba95117)
12e62c498SMarcus Folkesson // SPDX-License-Identifier: GPL-2.0+
2a44a4553SMatthias Brugger /*
3a44a4553SMatthias Brugger  * Mediatek Watchdog Driver
4a44a4553SMatthias Brugger  *
5a44a4553SMatthias Brugger  * Copyright (C) 2014 Matthias Brugger
6a44a4553SMatthias Brugger  *
7a44a4553SMatthias Brugger  * Matthias Brugger <matthias.bgg@gmail.com>
8a44a4553SMatthias Brugger  *
9a44a4553SMatthias Brugger  * Based on sunxi_wdt.c
10a44a4553SMatthias Brugger  */
11a44a4553SMatthias Brugger 
129e5236e7Syong.liang #include <dt-bindings/reset-controller/mt2712-resets.h>
13c254e103Syong.liang #include <dt-bindings/reset-controller/mt8183-resets.h>
14c254e103Syong.liang #include <linux/delay.h>
15a44a4553SMatthias Brugger #include <linux/err.h>
16a44a4553SMatthias Brugger #include <linux/init.h>
17a44a4553SMatthias Brugger #include <linux/io.h>
18a44a4553SMatthias Brugger #include <linux/kernel.h>
19a44a4553SMatthias Brugger #include <linux/module.h>
20a44a4553SMatthias Brugger #include <linux/moduleparam.h>
21a44a4553SMatthias Brugger #include <linux/of.h>
22c254e103Syong.liang #include <linux/of_device.h>
23a44a4553SMatthias Brugger #include <linux/platform_device.h>
24c254e103Syong.liang #include <linux/reset-controller.h>
25a44a4553SMatthias Brugger #include <linux/types.h>
26a44a4553SMatthias Brugger #include <linux/watchdog.h>
27a44a4553SMatthias Brugger 
28a44a4553SMatthias Brugger #define WDT_MAX_TIMEOUT		31
29a44a4553SMatthias Brugger #define WDT_MIN_TIMEOUT		1
30a44a4553SMatthias Brugger #define WDT_LENGTH_TIMEOUT(n)	((n) << 5)
31a44a4553SMatthias Brugger 
32a44a4553SMatthias Brugger #define WDT_LENGTH		0x04
33a44a4553SMatthias Brugger #define WDT_LENGTH_KEY		0x8
34a44a4553SMatthias Brugger 
35a44a4553SMatthias Brugger #define WDT_RST			0x08
36a44a4553SMatthias Brugger #define WDT_RST_RELOAD		0x1971
37a44a4553SMatthias Brugger 
38a44a4553SMatthias Brugger #define WDT_MODE		0x00
39a44a4553SMatthias Brugger #define WDT_MODE_EN		(1 << 0)
40a44a4553SMatthias Brugger #define WDT_MODE_EXT_POL_LOW	(0 << 1)
41a44a4553SMatthias Brugger #define WDT_MODE_EXT_POL_HIGH	(1 << 1)
42a44a4553SMatthias Brugger #define WDT_MODE_EXRST_EN	(1 << 2)
43a44a4553SMatthias Brugger #define WDT_MODE_IRQ_EN		(1 << 3)
44a44a4553SMatthias Brugger #define WDT_MODE_AUTO_START	(1 << 4)
45a44a4553SMatthias Brugger #define WDT_MODE_DUAL_EN	(1 << 6)
46a44a4553SMatthias Brugger #define WDT_MODE_KEY		0x22000000
47a44a4553SMatthias Brugger 
48a44a4553SMatthias Brugger #define WDT_SWRST		0x14
49a44a4553SMatthias Brugger #define WDT_SWRST_KEY		0x1209
50a44a4553SMatthias Brugger 
51c254e103Syong.liang #define WDT_SWSYSRST		0x18U
52c254e103Syong.liang #define WDT_SWSYS_RST_KEY	0x88000000
53c254e103Syong.liang 
54a44a4553SMatthias Brugger #define DRV_NAME		"mtk-wdt"
55a44a4553SMatthias Brugger #define DRV_VERSION		"1.0"
56a44a4553SMatthias Brugger 
57a44a4553SMatthias Brugger static bool nowayout = WATCHDOG_NOWAYOUT;
58b82e6953SMarcus Folkesson static unsigned int timeout;
59a44a4553SMatthias Brugger 
60a44a4553SMatthias Brugger struct mtk_wdt_dev {
61a44a4553SMatthias Brugger 	struct watchdog_device wdt_dev;
62a44a4553SMatthias Brugger 	void __iomem *wdt_base;
63c254e103Syong.liang 	spinlock_t lock; /* protects WDT_SWSYSRST reg */
64c254e103Syong.liang 	struct reset_controller_dev rcdev;
65a44a4553SMatthias Brugger };
66a44a4553SMatthias Brugger 
67c254e103Syong.liang struct mtk_wdt_data {
68c254e103Syong.liang 	int toprgu_sw_rst_num;
69c254e103Syong.liang };
70c254e103Syong.liang 
719e5236e7Syong.liang static const struct mtk_wdt_data mt2712_data = {
729e5236e7Syong.liang 	.toprgu_sw_rst_num = MT2712_TOPRGU_SW_RST_NUM,
739e5236e7Syong.liang };
749e5236e7Syong.liang 
75c254e103Syong.liang static const struct mtk_wdt_data mt8183_data = {
76c254e103Syong.liang 	.toprgu_sw_rst_num = MT8183_TOPRGU_SW_RST_NUM,
77c254e103Syong.liang };
78c254e103Syong.liang 
79c254e103Syong.liang static int toprgu_reset_update(struct reset_controller_dev *rcdev,
80c254e103Syong.liang 			       unsigned long id, bool assert)
81c254e103Syong.liang {
82c254e103Syong.liang 	unsigned int tmp;
83c254e103Syong.liang 	unsigned long flags;
84c254e103Syong.liang 	struct mtk_wdt_dev *data =
85c254e103Syong.liang 		 container_of(rcdev, struct mtk_wdt_dev, rcdev);
86c254e103Syong.liang 
87c254e103Syong.liang 	spin_lock_irqsave(&data->lock, flags);
88c254e103Syong.liang 
89c254e103Syong.liang 	tmp = readl(data->wdt_base + WDT_SWSYSRST);
90c254e103Syong.liang 	if (assert)
91c254e103Syong.liang 		tmp |= BIT(id);
92c254e103Syong.liang 	else
93c254e103Syong.liang 		tmp &= ~BIT(id);
94c254e103Syong.liang 	tmp |= WDT_SWSYS_RST_KEY;
95c254e103Syong.liang 	writel(tmp, data->wdt_base + WDT_SWSYSRST);
96c254e103Syong.liang 
97c254e103Syong.liang 	spin_unlock_irqrestore(&data->lock, flags);
98c254e103Syong.liang 
99c254e103Syong.liang 	return 0;
100c254e103Syong.liang }
101c254e103Syong.liang 
102c254e103Syong.liang static int toprgu_reset_assert(struct reset_controller_dev *rcdev,
103c254e103Syong.liang 			       unsigned long id)
104c254e103Syong.liang {
105c254e103Syong.liang 	return toprgu_reset_update(rcdev, id, true);
106c254e103Syong.liang }
107c254e103Syong.liang 
108c254e103Syong.liang static int toprgu_reset_deassert(struct reset_controller_dev *rcdev,
109c254e103Syong.liang 				 unsigned long id)
110c254e103Syong.liang {
111c254e103Syong.liang 	return toprgu_reset_update(rcdev, id, false);
112c254e103Syong.liang }
113c254e103Syong.liang 
114c254e103Syong.liang static int toprgu_reset(struct reset_controller_dev *rcdev,
115c254e103Syong.liang 			unsigned long id)
116c254e103Syong.liang {
117c254e103Syong.liang 	int ret;
118c254e103Syong.liang 
119c254e103Syong.liang 	ret = toprgu_reset_assert(rcdev, id);
120c254e103Syong.liang 	if (ret)
121c254e103Syong.liang 		return ret;
122c254e103Syong.liang 
123c254e103Syong.liang 	return toprgu_reset_deassert(rcdev, id);
124c254e103Syong.liang }
125c254e103Syong.liang 
126c254e103Syong.liang static const struct reset_control_ops toprgu_reset_ops = {
127c254e103Syong.liang 	.assert = toprgu_reset_assert,
128c254e103Syong.liang 	.deassert = toprgu_reset_deassert,
129c254e103Syong.liang 	.reset = toprgu_reset,
130c254e103Syong.liang };
131c254e103Syong.liang 
132c254e103Syong.liang static int toprgu_register_reset_controller(struct platform_device *pdev,
133c254e103Syong.liang 					    int rst_num)
134c254e103Syong.liang {
135c254e103Syong.liang 	int ret;
136c254e103Syong.liang 	struct mtk_wdt_dev *mtk_wdt = platform_get_drvdata(pdev);
137c254e103Syong.liang 
138c254e103Syong.liang 	spin_lock_init(&mtk_wdt->lock);
139c254e103Syong.liang 
140c254e103Syong.liang 	mtk_wdt->rcdev.owner = THIS_MODULE;
141c254e103Syong.liang 	mtk_wdt->rcdev.nr_resets = rst_num;
142c254e103Syong.liang 	mtk_wdt->rcdev.ops = &toprgu_reset_ops;
143c254e103Syong.liang 	mtk_wdt->rcdev.of_node = pdev->dev.of_node;
144c254e103Syong.liang 	ret = devm_reset_controller_register(&pdev->dev, &mtk_wdt->rcdev);
145c254e103Syong.liang 	if (ret != 0)
146c254e103Syong.liang 		dev_err(&pdev->dev,
147c254e103Syong.liang 			"couldn't register wdt reset controller: %d\n", ret);
148c254e103Syong.liang 	return ret;
149c254e103Syong.liang }
150c254e103Syong.liang 
1514d8b229dSGuenter Roeck static int mtk_wdt_restart(struct watchdog_device *wdt_dev,
1524d8b229dSGuenter Roeck 			   unsigned long action, void *data)
153a44a4553SMatthias Brugger {
154e86adc3fSDamien Riegel 	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
155a44a4553SMatthias Brugger 	void __iomem *wdt_base;
156a44a4553SMatthias Brugger 
157a44a4553SMatthias Brugger 	wdt_base = mtk_wdt->wdt_base;
158a44a4553SMatthias Brugger 
159a44a4553SMatthias Brugger 	while (1) {
160a44a4553SMatthias Brugger 		writel(WDT_SWRST_KEY, wdt_base + WDT_SWRST);
161a44a4553SMatthias Brugger 		mdelay(5);
162a44a4553SMatthias Brugger 	}
163a44a4553SMatthias Brugger 
164e86adc3fSDamien Riegel 	return 0;
165a44a4553SMatthias Brugger }
166a44a4553SMatthias Brugger 
167a44a4553SMatthias Brugger static int mtk_wdt_ping(struct watchdog_device *wdt_dev)
168a44a4553SMatthias Brugger {
169a44a4553SMatthias Brugger 	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
170a44a4553SMatthias Brugger 	void __iomem *wdt_base = mtk_wdt->wdt_base;
171a44a4553SMatthias Brugger 
172a44a4553SMatthias Brugger 	iowrite32(WDT_RST_RELOAD, wdt_base + WDT_RST);
173a44a4553SMatthias Brugger 
174a44a4553SMatthias Brugger 	return 0;
175a44a4553SMatthias Brugger }
176a44a4553SMatthias Brugger 
177a44a4553SMatthias Brugger static int mtk_wdt_set_timeout(struct watchdog_device *wdt_dev,
178a44a4553SMatthias Brugger 				unsigned int timeout)
179a44a4553SMatthias Brugger {
180a44a4553SMatthias Brugger 	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
181a44a4553SMatthias Brugger 	void __iomem *wdt_base = mtk_wdt->wdt_base;
182a44a4553SMatthias Brugger 	u32 reg;
183a44a4553SMatthias Brugger 
184a44a4553SMatthias Brugger 	wdt_dev->timeout = timeout;
185a44a4553SMatthias Brugger 
186a44a4553SMatthias Brugger 	/*
187a44a4553SMatthias Brugger 	 * One bit is the value of 512 ticks
188a44a4553SMatthias Brugger 	 * The clock has 32 KHz
189a44a4553SMatthias Brugger 	 */
190a44a4553SMatthias Brugger 	reg = WDT_LENGTH_TIMEOUT(timeout << 6) | WDT_LENGTH_KEY;
191a44a4553SMatthias Brugger 	iowrite32(reg, wdt_base + WDT_LENGTH);
192a44a4553SMatthias Brugger 
193a44a4553SMatthias Brugger 	mtk_wdt_ping(wdt_dev);
194a44a4553SMatthias Brugger 
195a44a4553SMatthias Brugger 	return 0;
196a44a4553SMatthias Brugger }
197a44a4553SMatthias Brugger 
198*bbece05cSfreddy.hsin static void mtk_wdt_init(struct watchdog_device *wdt_dev)
199*bbece05cSfreddy.hsin {
200*bbece05cSfreddy.hsin 	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
201*bbece05cSfreddy.hsin 	void __iomem *wdt_base;
202*bbece05cSfreddy.hsin 
203*bbece05cSfreddy.hsin 	wdt_base = mtk_wdt->wdt_base;
204*bbece05cSfreddy.hsin 
205*bbece05cSfreddy.hsin 	if (readl(wdt_base + WDT_MODE) & WDT_MODE_EN) {
206*bbece05cSfreddy.hsin 		set_bit(WDOG_HW_RUNNING, &wdt_dev->status);
207*bbece05cSfreddy.hsin 		mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
208*bbece05cSfreddy.hsin 	}
209*bbece05cSfreddy.hsin }
210*bbece05cSfreddy.hsin 
211a44a4553SMatthias Brugger static int mtk_wdt_stop(struct watchdog_device *wdt_dev)
212a44a4553SMatthias Brugger {
213a44a4553SMatthias Brugger 	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
214a44a4553SMatthias Brugger 	void __iomem *wdt_base = mtk_wdt->wdt_base;
215a44a4553SMatthias Brugger 	u32 reg;
216a44a4553SMatthias Brugger 
217a44a4553SMatthias Brugger 	reg = readl(wdt_base + WDT_MODE);
218a44a4553SMatthias Brugger 	reg &= ~WDT_MODE_EN;
2195da2bf1aSNicolas Boichat 	reg |= WDT_MODE_KEY;
220a44a4553SMatthias Brugger 	iowrite32(reg, wdt_base + WDT_MODE);
221a44a4553SMatthias Brugger 
222a44a4553SMatthias Brugger 	return 0;
223a44a4553SMatthias Brugger }
224a44a4553SMatthias Brugger 
225a44a4553SMatthias Brugger static int mtk_wdt_start(struct watchdog_device *wdt_dev)
226a44a4553SMatthias Brugger {
227a44a4553SMatthias Brugger 	u32 reg;
228a44a4553SMatthias Brugger 	struct mtk_wdt_dev *mtk_wdt = watchdog_get_drvdata(wdt_dev);
229a44a4553SMatthias Brugger 	void __iomem *wdt_base = mtk_wdt->wdt_base;
2309ffd906dSDan Carpenter 	int ret;
231a44a4553SMatthias Brugger 
232a44a4553SMatthias Brugger 	ret = mtk_wdt_set_timeout(wdt_dev, wdt_dev->timeout);
233a44a4553SMatthias Brugger 	if (ret < 0)
234a44a4553SMatthias Brugger 		return ret;
235a44a4553SMatthias Brugger 
236a44a4553SMatthias Brugger 	reg = ioread32(wdt_base + WDT_MODE);
237a44a4553SMatthias Brugger 	reg &= ~(WDT_MODE_IRQ_EN | WDT_MODE_DUAL_EN);
238a44a4553SMatthias Brugger 	reg |= (WDT_MODE_EN | WDT_MODE_KEY);
239a44a4553SMatthias Brugger 	iowrite32(reg, wdt_base + WDT_MODE);
240a44a4553SMatthias Brugger 
241a44a4553SMatthias Brugger 	return 0;
242a44a4553SMatthias Brugger }
243a44a4553SMatthias Brugger 
244a44a4553SMatthias Brugger static const struct watchdog_info mtk_wdt_info = {
245a44a4553SMatthias Brugger 	.identity	= DRV_NAME,
246a44a4553SMatthias Brugger 	.options	= WDIOF_SETTIMEOUT |
247a44a4553SMatthias Brugger 			  WDIOF_KEEPALIVEPING |
248a44a4553SMatthias Brugger 			  WDIOF_MAGICCLOSE,
249a44a4553SMatthias Brugger };
250a44a4553SMatthias Brugger 
251a44a4553SMatthias Brugger static const struct watchdog_ops mtk_wdt_ops = {
252a44a4553SMatthias Brugger 	.owner		= THIS_MODULE,
253a44a4553SMatthias Brugger 	.start		= mtk_wdt_start,
254a44a4553SMatthias Brugger 	.stop		= mtk_wdt_stop,
255a44a4553SMatthias Brugger 	.ping		= mtk_wdt_ping,
256a44a4553SMatthias Brugger 	.set_timeout	= mtk_wdt_set_timeout,
257e86adc3fSDamien Riegel 	.restart	= mtk_wdt_restart,
258a44a4553SMatthias Brugger };
259a44a4553SMatthias Brugger 
260a44a4553SMatthias Brugger static int mtk_wdt_probe(struct platform_device *pdev)
261a44a4553SMatthias Brugger {
262a15f6e64SGuenter Roeck 	struct device *dev = &pdev->dev;
263a44a4553SMatthias Brugger 	struct mtk_wdt_dev *mtk_wdt;
264c254e103Syong.liang 	const struct mtk_wdt_data *wdt_data;
265a44a4553SMatthias Brugger 	int err;
266a44a4553SMatthias Brugger 
267a15f6e64SGuenter Roeck 	mtk_wdt = devm_kzalloc(dev, sizeof(*mtk_wdt), GFP_KERNEL);
268a44a4553SMatthias Brugger 	if (!mtk_wdt)
269a44a4553SMatthias Brugger 		return -ENOMEM;
270a44a4553SMatthias Brugger 
271a44a4553SMatthias Brugger 	platform_set_drvdata(pdev, mtk_wdt);
272a44a4553SMatthias Brugger 
2730f0a6a28SGuenter Roeck 	mtk_wdt->wdt_base = devm_platform_ioremap_resource(pdev, 0);
274a44a4553SMatthias Brugger 	if (IS_ERR(mtk_wdt->wdt_base))
275a44a4553SMatthias Brugger 		return PTR_ERR(mtk_wdt->wdt_base);
276a44a4553SMatthias Brugger 
277a44a4553SMatthias Brugger 	mtk_wdt->wdt_dev.info = &mtk_wdt_info;
278a44a4553SMatthias Brugger 	mtk_wdt->wdt_dev.ops = &mtk_wdt_ops;
279a44a4553SMatthias Brugger 	mtk_wdt->wdt_dev.timeout = WDT_MAX_TIMEOUT;
280*bbece05cSfreddy.hsin 	mtk_wdt->wdt_dev.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT * 1000;
281a44a4553SMatthias Brugger 	mtk_wdt->wdt_dev.min_timeout = WDT_MIN_TIMEOUT;
282a15f6e64SGuenter Roeck 	mtk_wdt->wdt_dev.parent = dev;
283a44a4553SMatthias Brugger 
284a15f6e64SGuenter Roeck 	watchdog_init_timeout(&mtk_wdt->wdt_dev, timeout, dev);
285a44a4553SMatthias Brugger 	watchdog_set_nowayout(&mtk_wdt->wdt_dev, nowayout);
286e86adc3fSDamien Riegel 	watchdog_set_restart_priority(&mtk_wdt->wdt_dev, 128);
287a44a4553SMatthias Brugger 
288a44a4553SMatthias Brugger 	watchdog_set_drvdata(&mtk_wdt->wdt_dev, mtk_wdt);
289a44a4553SMatthias Brugger 
290*bbece05cSfreddy.hsin 	mtk_wdt_init(&mtk_wdt->wdt_dev);
291a44a4553SMatthias Brugger 
292a15f6e64SGuenter Roeck 	watchdog_stop_on_reboot(&mtk_wdt->wdt_dev);
293a15f6e64SGuenter Roeck 	err = devm_watchdog_register_device(dev, &mtk_wdt->wdt_dev);
294a44a4553SMatthias Brugger 	if (unlikely(err))
295a44a4553SMatthias Brugger 		return err;
296a44a4553SMatthias Brugger 
297a15f6e64SGuenter Roeck 	dev_info(dev, "Watchdog enabled (timeout=%d sec, nowayout=%d)\n",
298a44a4553SMatthias Brugger 		 mtk_wdt->wdt_dev.timeout, nowayout);
299a44a4553SMatthias Brugger 
300c254e103Syong.liang 	wdt_data = of_device_get_match_data(dev);
301c254e103Syong.liang 	if (wdt_data) {
302c254e103Syong.liang 		err = toprgu_register_reset_controller(pdev,
303c254e103Syong.liang 						       wdt_data->toprgu_sw_rst_num);
304c254e103Syong.liang 		if (err)
305c254e103Syong.liang 			return err;
306c254e103Syong.liang 	}
307a44a4553SMatthias Brugger 	return 0;
308a44a4553SMatthias Brugger }
309a44a4553SMatthias Brugger 
3109fab0692SGreta Zhang #ifdef CONFIG_PM_SLEEP
3119fab0692SGreta Zhang static int mtk_wdt_suspend(struct device *dev)
3129fab0692SGreta Zhang {
3139fab0692SGreta Zhang 	struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev);
3149fab0692SGreta Zhang 
3159fab0692SGreta Zhang 	if (watchdog_active(&mtk_wdt->wdt_dev))
3169fab0692SGreta Zhang 		mtk_wdt_stop(&mtk_wdt->wdt_dev);
3179fab0692SGreta Zhang 
3189fab0692SGreta Zhang 	return 0;
3199fab0692SGreta Zhang }
3209fab0692SGreta Zhang 
3219fab0692SGreta Zhang static int mtk_wdt_resume(struct device *dev)
3229fab0692SGreta Zhang {
3239fab0692SGreta Zhang 	struct mtk_wdt_dev *mtk_wdt = dev_get_drvdata(dev);
3249fab0692SGreta Zhang 
3259fab0692SGreta Zhang 	if (watchdog_active(&mtk_wdt->wdt_dev)) {
3269fab0692SGreta Zhang 		mtk_wdt_start(&mtk_wdt->wdt_dev);
3279fab0692SGreta Zhang 		mtk_wdt_ping(&mtk_wdt->wdt_dev);
3289fab0692SGreta Zhang 	}
3299fab0692SGreta Zhang 
3309fab0692SGreta Zhang 	return 0;
3319fab0692SGreta Zhang }
3329fab0692SGreta Zhang #endif
3339fab0692SGreta Zhang 
334a44a4553SMatthias Brugger static const struct of_device_id mtk_wdt_dt_ids[] = {
3359e5236e7Syong.liang 	{ .compatible = "mediatek,mt2712-wdt", .data = &mt2712_data },
336a44a4553SMatthias Brugger 	{ .compatible = "mediatek,mt6589-wdt" },
337c254e103Syong.liang 	{ .compatible = "mediatek,mt8183-wdt", .data = &mt8183_data },
338a44a4553SMatthias Brugger 	{ /* sentinel */ }
339a44a4553SMatthias Brugger };
340a44a4553SMatthias Brugger MODULE_DEVICE_TABLE(of, mtk_wdt_dt_ids);
341a44a4553SMatthias Brugger 
3429fab0692SGreta Zhang static const struct dev_pm_ops mtk_wdt_pm_ops = {
3439fab0692SGreta Zhang 	SET_SYSTEM_SLEEP_PM_OPS(mtk_wdt_suspend,
3449fab0692SGreta Zhang 				mtk_wdt_resume)
3459fab0692SGreta Zhang };
3469fab0692SGreta Zhang 
347a44a4553SMatthias Brugger static struct platform_driver mtk_wdt_driver = {
348a44a4553SMatthias Brugger 	.probe		= mtk_wdt_probe,
349a44a4553SMatthias Brugger 	.driver		= {
350a44a4553SMatthias Brugger 		.name		= DRV_NAME,
3519fab0692SGreta Zhang 		.pm		= &mtk_wdt_pm_ops,
352a44a4553SMatthias Brugger 		.of_match_table	= mtk_wdt_dt_ids,
353a44a4553SMatthias Brugger 	},
354a44a4553SMatthias Brugger };
355a44a4553SMatthias Brugger 
356a44a4553SMatthias Brugger module_platform_driver(mtk_wdt_driver);
357a44a4553SMatthias Brugger 
358a44a4553SMatthias Brugger module_param(timeout, uint, 0);
359a44a4553SMatthias Brugger MODULE_PARM_DESC(timeout, "Watchdog heartbeat in seconds");
360a44a4553SMatthias Brugger 
361a44a4553SMatthias Brugger module_param(nowayout, bool, 0);
362a44a4553SMatthias Brugger MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
363a44a4553SMatthias Brugger 			__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
364a44a4553SMatthias Brugger 
365a44a4553SMatthias Brugger MODULE_LICENSE("GPL");
366a44a4553SMatthias Brugger MODULE_AUTHOR("Matthias Brugger <matthias.bgg@gmail.com>");
367a44a4553SMatthias Brugger MODULE_DESCRIPTION("Mediatek WatchDog Timer Driver");
368a44a4553SMatthias Brugger MODULE_VERSION(DRV_VERSION);
369