xref: /openbmc/linux/drivers/watchdog/rti_wdt.c (revision f20ca595ae23314db0383940a184317333c46662)
12d63908bSTero Kristo // SPDX-License-Identifier: GPL-2.0
22d63908bSTero Kristo /*
32d63908bSTero Kristo  * Watchdog driver for the K3 RTI module
42d63908bSTero Kristo  *
52d63908bSTero Kristo  * (c) Copyright 2019-2020 Texas Instruments Inc.
62d63908bSTero Kristo  * All rights reserved.
72d63908bSTero Kristo  */
82d63908bSTero Kristo 
92d63908bSTero Kristo #include <linux/clk.h>
102d63908bSTero Kristo #include <linux/device.h>
112d63908bSTero Kristo #include <linux/err.h>
122d63908bSTero Kristo #include <linux/io.h>
132d63908bSTero Kristo #include <linux/kernel.h>
142d63908bSTero Kristo #include <linux/mod_devicetable.h>
152d63908bSTero Kristo #include <linux/module.h>
162d63908bSTero Kristo #include <linux/moduleparam.h>
17*f20ca595SLi Hua Qian #include <linux/of.h>
18*f20ca595SLi Hua Qian #include <linux/of_address.h>
192d63908bSTero Kristo #include <linux/platform_device.h>
202d63908bSTero Kristo #include <linux/pm_runtime.h>
212d63908bSTero Kristo #include <linux/types.h>
222d63908bSTero Kristo #include <linux/watchdog.h>
232d63908bSTero Kristo 
242d63908bSTero Kristo #define DEFAULT_HEARTBEAT 60
252d63908bSTero Kristo 
262d63908bSTero Kristo /* Max heartbeat is calculated at 32kHz source clock */
272d63908bSTero Kristo #define MAX_HEARTBEAT	1000
282d63908bSTero Kristo 
292d63908bSTero Kristo /* Timer register set definition */
302d63908bSTero Kristo #define RTIDWDCTRL	0x90
312d63908bSTero Kristo #define RTIDWDPRLD	0x94
322d63908bSTero Kristo #define RTIWDSTATUS	0x98
332d63908bSTero Kristo #define RTIWDKEY	0x9c
342d63908bSTero Kristo #define RTIDWDCNTR	0xa0
352d63908bSTero Kristo #define RTIWWDRXCTRL	0xa4
362d63908bSTero Kristo #define RTIWWDSIZECTRL	0xa8
372d63908bSTero Kristo 
382d63908bSTero Kristo #define RTIWWDRX_NMI	0xa
392d63908bSTero Kristo 
402d63908bSTero Kristo #define RTIWWDSIZE_50P		0x50
415527483fSTero Kristo #define RTIWWDSIZE_25P		0x500
425527483fSTero Kristo #define RTIWWDSIZE_12P5		0x5000
435527483fSTero Kristo #define RTIWWDSIZE_6P25		0x50000
445527483fSTero Kristo #define RTIWWDSIZE_3P125	0x500000
452d63908bSTero Kristo 
462d63908bSTero Kristo #define WDENABLE_KEY	0xa98559da
472d63908bSTero Kristo 
482d63908bSTero Kristo #define WDKEY_SEQ0		0xe51a
492d63908bSTero Kristo #define WDKEY_SEQ1		0xa35c
502d63908bSTero Kristo 
512d63908bSTero Kristo #define WDT_PRELOAD_SHIFT	13
522d63908bSTero Kristo 
532d63908bSTero Kristo #define WDT_PRELOAD_MAX		0xfff
542d63908bSTero Kristo 
552d63908bSTero Kristo #define DWDST			BIT(1)
562d63908bSTero Kristo 
57*f20ca595SLi Hua Qian #define PON_REASON_SOF_NUM	0xBBBBCCCC
58*f20ca595SLi Hua Qian #define PON_REASON_MAGIC_NUM	0xDDDDDDDD
59*f20ca595SLi Hua Qian #define PON_REASON_EOF_NUM	0xCCCCBBBB
60*f20ca595SLi Hua Qian #define RESERVED_MEM_MIN_SIZE	12
61*f20ca595SLi Hua Qian 
625527483fSTero Kristo static int heartbeat = DEFAULT_HEARTBEAT;
632d63908bSTero Kristo 
642d63908bSTero Kristo /*
652d63908bSTero Kristo  * struct to hold data for each WDT device
662d63908bSTero Kristo  * @base - base io address of WD device
672d63908bSTero Kristo  * @freq - source clock frequency of WDT
682d63908bSTero Kristo  * @wdd  - hold watchdog device as is in WDT core
692d63908bSTero Kristo  */
702d63908bSTero Kristo struct rti_wdt_device {
712d63908bSTero Kristo 	void __iomem		*base;
722d63908bSTero Kristo 	unsigned long		freq;
732d63908bSTero Kristo 	struct watchdog_device	wdd;
742d63908bSTero Kristo };
752d63908bSTero Kristo 
762d63908bSTero Kristo static int rti_wdt_start(struct watchdog_device *wdd)
772d63908bSTero Kristo {
782d63908bSTero Kristo 	u32 timer_margin;
792d63908bSTero Kristo 	struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
802d63908bSTero Kristo 
812d63908bSTero Kristo 	/* set timeout period */
822d63908bSTero Kristo 	timer_margin = (u64)wdd->timeout * wdt->freq;
832d63908bSTero Kristo 	timer_margin >>= WDT_PRELOAD_SHIFT;
842d63908bSTero Kristo 	if (timer_margin > WDT_PRELOAD_MAX)
852d63908bSTero Kristo 		timer_margin = WDT_PRELOAD_MAX;
862d63908bSTero Kristo 	writel_relaxed(timer_margin, wdt->base + RTIDWDPRLD);
872d63908bSTero Kristo 
882d63908bSTero Kristo 	/*
892d63908bSTero Kristo 	 * RTI only supports a windowed mode, where the watchdog can only
902d63908bSTero Kristo 	 * be petted during the open window; not too early or not too late.
912d63908bSTero Kristo 	 * The HW configuration options only allow for the open window size
922d63908bSTero Kristo 	 * to be 50% or less than that; we obviouly want to configure the open
935527483fSTero Kristo 	 * window as large as possible so we select the 50% option.
942d63908bSTero Kristo 	 */
955527483fSTero Kristo 	wdd->min_hw_heartbeat_ms = 500 * wdd->timeout;
962d63908bSTero Kristo 
972d63908bSTero Kristo 	/* Generate NMI when wdt expires */
982d63908bSTero Kristo 	writel_relaxed(RTIWWDRX_NMI, wdt->base + RTIWWDRXCTRL);
992d63908bSTero Kristo 
1002d63908bSTero Kristo 	/* Open window size 50%; this is the largest window size available */
1012d63908bSTero Kristo 	writel_relaxed(RTIWWDSIZE_50P, wdt->base + RTIWWDSIZECTRL);
1022d63908bSTero Kristo 
1032d63908bSTero Kristo 	readl_relaxed(wdt->base + RTIWWDSIZECTRL);
1042d63908bSTero Kristo 
1052d63908bSTero Kristo 	/* enable watchdog */
1062d63908bSTero Kristo 	writel_relaxed(WDENABLE_KEY, wdt->base + RTIDWDCTRL);
1072d63908bSTero Kristo 	return 0;
1082d63908bSTero Kristo }
1092d63908bSTero Kristo 
1102d63908bSTero Kristo static int rti_wdt_ping(struct watchdog_device *wdd)
1112d63908bSTero Kristo {
1122d63908bSTero Kristo 	struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
1132d63908bSTero Kristo 
1142d63908bSTero Kristo 	/* put watchdog in service state */
1152d63908bSTero Kristo 	writel_relaxed(WDKEY_SEQ0, wdt->base + RTIWDKEY);
1162d63908bSTero Kristo 	/* put watchdog in active state */
1172d63908bSTero Kristo 	writel_relaxed(WDKEY_SEQ1, wdt->base + RTIWDKEY);
1182d63908bSTero Kristo 
1192d63908bSTero Kristo 	return 0;
1202d63908bSTero Kristo }
1212d63908bSTero Kristo 
1225527483fSTero Kristo static int rti_wdt_setup_hw_hb(struct watchdog_device *wdd, u32 wsize)
1235527483fSTero Kristo {
1245527483fSTero Kristo 	/*
1255527483fSTero Kristo 	 * RTI only supports a windowed mode, where the watchdog can only
1265527483fSTero Kristo 	 * be petted during the open window; not too early or not too late.
1275527483fSTero Kristo 	 * The HW configuration options only allow for the open window size
1285527483fSTero Kristo 	 * to be 50% or less than that.
1295527483fSTero Kristo 	 */
1305527483fSTero Kristo 	switch (wsize) {
1315527483fSTero Kristo 	case RTIWWDSIZE_50P:
1325527483fSTero Kristo 		/* 50% open window => 50% min heartbeat */
1335527483fSTero Kristo 		wdd->min_hw_heartbeat_ms = 500 * heartbeat;
1345527483fSTero Kristo 		break;
1355527483fSTero Kristo 
1365527483fSTero Kristo 	case RTIWWDSIZE_25P:
1375527483fSTero Kristo 		/* 25% open window => 75% min heartbeat */
1385527483fSTero Kristo 		wdd->min_hw_heartbeat_ms = 750 * heartbeat;
1395527483fSTero Kristo 		break;
1405527483fSTero Kristo 
1415527483fSTero Kristo 	case RTIWWDSIZE_12P5:
1425527483fSTero Kristo 		/* 12.5% open window => 87.5% min heartbeat */
1435527483fSTero Kristo 		wdd->min_hw_heartbeat_ms = 875 * heartbeat;
1445527483fSTero Kristo 		break;
1455527483fSTero Kristo 
1465527483fSTero Kristo 	case RTIWWDSIZE_6P25:
1475527483fSTero Kristo 		/* 6.5% open window => 93.5% min heartbeat */
1485527483fSTero Kristo 		wdd->min_hw_heartbeat_ms = 935 * heartbeat;
1495527483fSTero Kristo 		break;
1505527483fSTero Kristo 
1515527483fSTero Kristo 	case RTIWWDSIZE_3P125:
1525527483fSTero Kristo 		/* 3.125% open window => 96.9% min heartbeat */
1535527483fSTero Kristo 		wdd->min_hw_heartbeat_ms = 969 * heartbeat;
1545527483fSTero Kristo 		break;
1555527483fSTero Kristo 
1565527483fSTero Kristo 	default:
1575527483fSTero Kristo 		return -EINVAL;
1585527483fSTero Kristo 	}
1595527483fSTero Kristo 
1605527483fSTero Kristo 	return 0;
1615527483fSTero Kristo }
1625527483fSTero Kristo 
1635527483fSTero Kristo static unsigned int rti_wdt_get_timeleft_ms(struct watchdog_device *wdd)
1642d63908bSTero Kristo {
1652d63908bSTero Kristo 	u64 timer_counter;
1662d63908bSTero Kristo 	u32 val;
1672d63908bSTero Kristo 	struct rti_wdt_device *wdt = watchdog_get_drvdata(wdd);
1682d63908bSTero Kristo 
1692d63908bSTero Kristo 	/* if timeout has occurred then return 0 */
1702d63908bSTero Kristo 	val = readl_relaxed(wdt->base + RTIWDSTATUS);
1712d63908bSTero Kristo 	if (val & DWDST)
1722d63908bSTero Kristo 		return 0;
1732d63908bSTero Kristo 
1742d63908bSTero Kristo 	timer_counter = readl_relaxed(wdt->base + RTIDWDCNTR);
1752d63908bSTero Kristo 
1765527483fSTero Kristo 	timer_counter *= 1000;
1775527483fSTero Kristo 
1782d63908bSTero Kristo 	do_div(timer_counter, wdt->freq);
1792d63908bSTero Kristo 
1802d63908bSTero Kristo 	return timer_counter;
1812d63908bSTero Kristo }
1822d63908bSTero Kristo 
1835527483fSTero Kristo static unsigned int rti_wdt_get_timeleft(struct watchdog_device *wdd)
1845527483fSTero Kristo {
1855527483fSTero Kristo 	return rti_wdt_get_timeleft_ms(wdd) / 1000;
1865527483fSTero Kristo }
1875527483fSTero Kristo 
1882d63908bSTero Kristo static const struct watchdog_info rti_wdt_info = {
1892d63908bSTero Kristo 	.options = WDIOF_KEEPALIVEPING,
1902d63908bSTero Kristo 	.identity = "K3 RTI Watchdog",
1912d63908bSTero Kristo };
1922d63908bSTero Kristo 
1932d63908bSTero Kristo static const struct watchdog_ops rti_wdt_ops = {
1942d63908bSTero Kristo 	.owner		= THIS_MODULE,
1952d63908bSTero Kristo 	.start		= rti_wdt_start,
1962d63908bSTero Kristo 	.ping		= rti_wdt_ping,
1972d63908bSTero Kristo 	.get_timeleft	= rti_wdt_get_timeleft,
1982d63908bSTero Kristo };
1992d63908bSTero Kristo 
2002d63908bSTero Kristo static int rti_wdt_probe(struct platform_device *pdev)
2012d63908bSTero Kristo {
2022d63908bSTero Kristo 	int ret = 0;
2032d63908bSTero Kristo 	struct device *dev = &pdev->dev;
2042d63908bSTero Kristo 	struct watchdog_device *wdd;
2052d63908bSTero Kristo 	struct rti_wdt_device *wdt;
2062d63908bSTero Kristo 	struct clk *clk;
2075527483fSTero Kristo 	u32 last_ping = 0;
208*f20ca595SLi Hua Qian 	struct device_node *node;
209*f20ca595SLi Hua Qian 	u32 reserved_mem_size;
210*f20ca595SLi Hua Qian 	struct resource res;
211*f20ca595SLi Hua Qian 	u32 *vaddr;
212*f20ca595SLi Hua Qian 	u64 paddr;
2132d63908bSTero Kristo 
2142d63908bSTero Kristo 	wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL);
2152d63908bSTero Kristo 	if (!wdt)
2162d63908bSTero Kristo 		return -ENOMEM;
2172d63908bSTero Kristo 
2182d63908bSTero Kristo 	clk = clk_get(dev, NULL);
219d342951bSKrzysztof Kozlowski 	if (IS_ERR(clk))
220d342951bSKrzysztof Kozlowski 		return dev_err_probe(dev, PTR_ERR(clk), "failed to get clock\n");
2212d63908bSTero Kristo 
2222d63908bSTero Kristo 	wdt->freq = clk_get_rate(clk);
2232d63908bSTero Kristo 
2242d63908bSTero Kristo 	clk_put(clk);
2252d63908bSTero Kristo 
2262d63908bSTero Kristo 	if (!wdt->freq) {
2272d63908bSTero Kristo 		dev_err(dev, "Failed to get fck rate.\n");
2282d63908bSTero Kristo 		return -EINVAL;
2292d63908bSTero Kristo 	}
2302d63908bSTero Kristo 
2315527483fSTero Kristo 	/*
2325527483fSTero Kristo 	 * If watchdog is running at 32k clock, it is not accurate.
2335527483fSTero Kristo 	 * Adjust frequency down in this case so that we don't pet
2345527483fSTero Kristo 	 * the watchdog too often.
2355527483fSTero Kristo 	 */
2365527483fSTero Kristo 	if (wdt->freq < 32768)
2375527483fSTero Kristo 		wdt->freq = wdt->freq * 9 / 10;
2385527483fSTero Kristo 
2392d63908bSTero Kristo 	pm_runtime_enable(dev);
240a1f136fdSye xingchen 	ret = pm_runtime_resume_and_get(dev);
241b3ac0c58SMiaoqian Lin 	if (ret < 0) {
242d055ef3aSMiaoqian Lin 		pm_runtime_disable(&pdev->dev);
243d342951bSKrzysztof Kozlowski 		return dev_err_probe(dev, ret, "runtime pm failed\n");
2448711071eSZhang Qilong 	}
2452d63908bSTero Kristo 
2462d63908bSTero Kristo 	platform_set_drvdata(pdev, wdt);
2472d63908bSTero Kristo 
2482d63908bSTero Kristo 	wdd = &wdt->wdd;
2492d63908bSTero Kristo 	wdd->info = &rti_wdt_info;
2502d63908bSTero Kristo 	wdd->ops = &rti_wdt_ops;
2512d63908bSTero Kristo 	wdd->min_timeout = 1;
2522d63908bSTero Kristo 	wdd->max_hw_heartbeat_ms = (WDT_PRELOAD_MAX << WDT_PRELOAD_SHIFT) /
2532d63908bSTero Kristo 		wdt->freq * 1000;
2542d63908bSTero Kristo 	wdd->parent = dev;
2552d63908bSTero Kristo 
2562d63908bSTero Kristo 	watchdog_set_drvdata(wdd, wdt);
2572d63908bSTero Kristo 	watchdog_set_nowayout(wdd, 1);
2582d63908bSTero Kristo 	watchdog_set_restart_priority(wdd, 128);
2592d63908bSTero Kristo 
260b3220bdeSCai Huoqing 	wdt->base = devm_platform_ioremap_resource(pdev, 0);
2612d63908bSTero Kristo 	if (IS_ERR(wdt->base)) {
2622d63908bSTero Kristo 		ret = PTR_ERR(wdt->base);
2632d63908bSTero Kristo 		goto err_iomap;
2642d63908bSTero Kristo 	}
2652d63908bSTero Kristo 
2665527483fSTero Kristo 	if (readl(wdt->base + RTIDWDCTRL) == WDENABLE_KEY) {
267c83f6438SJan Kiszka 		int preset_heartbeat;
2685527483fSTero Kristo 		u32 time_left_ms;
2695527483fSTero Kristo 		u64 heartbeat_ms;
2705527483fSTero Kristo 		u32 wsize;
2715527483fSTero Kristo 
2725527483fSTero Kristo 		set_bit(WDOG_HW_RUNNING, &wdd->status);
2735527483fSTero Kristo 		time_left_ms = rti_wdt_get_timeleft_ms(wdd);
2745527483fSTero Kristo 		heartbeat_ms = readl(wdt->base + RTIDWDPRLD);
2755527483fSTero Kristo 		heartbeat_ms <<= WDT_PRELOAD_SHIFT;
2765527483fSTero Kristo 		heartbeat_ms *= 1000;
2775527483fSTero Kristo 		do_div(heartbeat_ms, wdt->freq);
278c83f6438SJan Kiszka 		preset_heartbeat = heartbeat_ms + 500;
279c83f6438SJan Kiszka 		preset_heartbeat /= 1000;
280c83f6438SJan Kiszka 		if (preset_heartbeat != heartbeat)
2815527483fSTero Kristo 			dev_warn(dev, "watchdog already running, ignoring heartbeat config!\n");
2825527483fSTero Kristo 
283c83f6438SJan Kiszka 		heartbeat = preset_heartbeat;
2845527483fSTero Kristo 
2855527483fSTero Kristo 		wsize = readl(wdt->base + RTIWWDSIZECTRL);
2865527483fSTero Kristo 		ret = rti_wdt_setup_hw_hb(wdd, wsize);
2875527483fSTero Kristo 		if (ret) {
2885527483fSTero Kristo 			dev_err(dev, "bad window size.\n");
2895527483fSTero Kristo 			goto err_iomap;
2905527483fSTero Kristo 		}
2915527483fSTero Kristo 
2925527483fSTero Kristo 		last_ping = heartbeat_ms - time_left_ms;
2935527483fSTero Kristo 		if (time_left_ms > heartbeat_ms) {
2945527483fSTero Kristo 			dev_warn(dev, "time_left > heartbeat? Assuming last ping just before now.\n");
2955527483fSTero Kristo 			last_ping = 0;
2965527483fSTero Kristo 		}
2975527483fSTero Kristo 	}
2985527483fSTero Kristo 
299*f20ca595SLi Hua Qian 	node = of_parse_phandle(pdev->dev.of_node, "memory-region", 0);
300*f20ca595SLi Hua Qian 	if (node) {
301*f20ca595SLi Hua Qian 		ret = of_address_to_resource(node, 0, &res);
302*f20ca595SLi Hua Qian 		if (ret) {
303*f20ca595SLi Hua Qian 			dev_err(dev, "No memory address assigned to the region.\n");
304*f20ca595SLi Hua Qian 			goto err_iomap;
305*f20ca595SLi Hua Qian 		}
306*f20ca595SLi Hua Qian 
307*f20ca595SLi Hua Qian 		/*
308*f20ca595SLi Hua Qian 		 * If reserved memory is defined for watchdog reset cause.
309*f20ca595SLi Hua Qian 		 * Readout the Power-on(PON) reason and pass to bootstatus.
310*f20ca595SLi Hua Qian 		 */
311*f20ca595SLi Hua Qian 		paddr = res.start;
312*f20ca595SLi Hua Qian 		reserved_mem_size = resource_size(&res);
313*f20ca595SLi Hua Qian 		if (reserved_mem_size < RESERVED_MEM_MIN_SIZE) {
314*f20ca595SLi Hua Qian 			dev_err(dev, "The size of reserved memory is too small.\n");
315*f20ca595SLi Hua Qian 			ret = -EINVAL;
316*f20ca595SLi Hua Qian 			goto err_iomap;
317*f20ca595SLi Hua Qian 		}
318*f20ca595SLi Hua Qian 
319*f20ca595SLi Hua Qian 		vaddr = memremap(paddr, reserved_mem_size, MEMREMAP_WB);
320*f20ca595SLi Hua Qian 		if (!vaddr) {
321*f20ca595SLi Hua Qian 			dev_err(dev, "Failed to map memory-region.\n");
322*f20ca595SLi Hua Qian 			ret = -ENOMEM;
323*f20ca595SLi Hua Qian 			goto err_iomap;
324*f20ca595SLi Hua Qian 		}
325*f20ca595SLi Hua Qian 
326*f20ca595SLi Hua Qian 		if (vaddr[0] == PON_REASON_SOF_NUM &&
327*f20ca595SLi Hua Qian 		    vaddr[1] == PON_REASON_MAGIC_NUM &&
328*f20ca595SLi Hua Qian 		    vaddr[2] == PON_REASON_EOF_NUM) {
329*f20ca595SLi Hua Qian 			wdd->bootstatus |= WDIOF_CARDRESET;
330*f20ca595SLi Hua Qian 		}
331*f20ca595SLi Hua Qian 		memset(vaddr, 0, reserved_mem_size);
332*f20ca595SLi Hua Qian 		memunmap(vaddr);
333*f20ca595SLi Hua Qian 	}
334*f20ca595SLi Hua Qian 
3355527483fSTero Kristo 	watchdog_init_timeout(wdd, heartbeat, dev);
3365527483fSTero Kristo 
3372d63908bSTero Kristo 	ret = watchdog_register_device(wdd);
3382d63908bSTero Kristo 	if (ret) {
3392d63908bSTero Kristo 		dev_err(dev, "cannot register watchdog device\n");
3402d63908bSTero Kristo 		goto err_iomap;
3412d63908bSTero Kristo 	}
3422d63908bSTero Kristo 
3435527483fSTero Kristo 	if (last_ping)
3445527483fSTero Kristo 		watchdog_set_last_hw_keepalive(wdd, last_ping);
3455527483fSTero Kristo 
3462d63908bSTero Kristo 	return 0;
3472d63908bSTero Kristo 
3482d63908bSTero Kristo err_iomap:
3492d63908bSTero Kristo 	pm_runtime_put_sync(&pdev->dev);
350d5b29c2cSTero Kristo 	pm_runtime_disable(&pdev->dev);
3512d63908bSTero Kristo 
3522d63908bSTero Kristo 	return ret;
3532d63908bSTero Kristo }
3542d63908bSTero Kristo 
3554ead88bfSUwe Kleine-König static void rti_wdt_remove(struct platform_device *pdev)
3562d63908bSTero Kristo {
3572d63908bSTero Kristo 	struct rti_wdt_device *wdt = platform_get_drvdata(pdev);
3582d63908bSTero Kristo 
3592d63908bSTero Kristo 	watchdog_unregister_device(&wdt->wdd);
3602d63908bSTero Kristo 	pm_runtime_put(&pdev->dev);
361d5b29c2cSTero Kristo 	pm_runtime_disable(&pdev->dev);
3622d63908bSTero Kristo }
3632d63908bSTero Kristo 
3642d63908bSTero Kristo static const struct of_device_id rti_wdt_of_match[] = {
3652d63908bSTero Kristo 	{ .compatible = "ti,j7-rti-wdt", },
3662d63908bSTero Kristo 	{},
3672d63908bSTero Kristo };
3682d63908bSTero Kristo MODULE_DEVICE_TABLE(of, rti_wdt_of_match);
3692d63908bSTero Kristo 
3702d63908bSTero Kristo static struct platform_driver rti_wdt_driver = {
3712d63908bSTero Kristo 	.driver = {
3722d63908bSTero Kristo 		.name = "rti-wdt",
3732d63908bSTero Kristo 		.of_match_table = rti_wdt_of_match,
3742d63908bSTero Kristo 	},
3752d63908bSTero Kristo 	.probe = rti_wdt_probe,
3764ead88bfSUwe Kleine-König 	.remove_new = rti_wdt_remove,
3772d63908bSTero Kristo };
3782d63908bSTero Kristo 
3792d63908bSTero Kristo module_platform_driver(rti_wdt_driver);
3802d63908bSTero Kristo 
3812d63908bSTero Kristo MODULE_AUTHOR("Tero Kristo <t-kristo@ti.com>");
3822d63908bSTero Kristo MODULE_DESCRIPTION("K3 RTI Watchdog Driver");
3832d63908bSTero Kristo 
3842d63908bSTero Kristo module_param(heartbeat, int, 0);
3852d63908bSTero Kristo MODULE_PARM_DESC(heartbeat,
3862d63908bSTero Kristo 		 "Watchdog heartbeat period in seconds from 1 to "
3872d63908bSTero Kristo 		 __MODULE_STRING(MAX_HEARTBEAT) ", default "
3882d63908bSTero Kristo 		 __MODULE_STRING(DEFAULT_HEARTBEAT));
3892d63908bSTero Kristo 
3902d63908bSTero Kristo MODULE_LICENSE("GPL");
3912d63908bSTero Kristo MODULE_ALIAS("platform:rti-wdt");
392