Lines Matching +full:watchdog +full:- +full:enable

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Watchdog driver for Faraday Technology FTWDT010
7 * Inspired by the out-of-tree drivers from OpenWRT:
20 #include <linux/watchdog.h>
54 u32 enable; in ftwdt010_enable() local
56 writel(timeout * WDT_CLOCK, gwdt->base + FTWDT010_WDLOAD); in ftwdt010_enable()
57 writel(WDRESTART_MAGIC, gwdt->base + FTWDT010_WDRESTART); in ftwdt010_enable()
59 enable = WDCR_CLOCK_5MHZ | WDCR_SYS_RST; in ftwdt010_enable()
60 writel(enable, gwdt->base + FTWDT010_WDCR); in ftwdt010_enable()
62 enable |= WDCR_WDINTR; in ftwdt010_enable()
63 enable |= WDCR_ENABLE; in ftwdt010_enable()
64 writel(enable, gwdt->base + FTWDT010_WDCR); in ftwdt010_enable()
71 ftwdt010_enable(gwdt, wdd->timeout, gwdt->has_irq); in ftwdt010_wdt_start()
79 writel(0, gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_stop()
88 writel(WDRESTART_MAGIC, gwdt->base + FTWDT010_WDRESTART); in ftwdt010_wdt_ping()
96 wdd->timeout = timeout; in ftwdt010_wdt_set_timeout()
114 watchdog_notify_pretimeout(&gwdt->wdd); in ftwdt010_wdt_interrupt()
138 struct device *dev = &pdev->dev; in ftwdt010_wdt_probe()
146 return -ENOMEM; in ftwdt010_wdt_probe()
148 gwdt->base = devm_platform_ioremap_resource(pdev, 0); in ftwdt010_wdt_probe()
149 if (IS_ERR(gwdt->base)) in ftwdt010_wdt_probe()
150 return PTR_ERR(gwdt->base); in ftwdt010_wdt_probe()
152 gwdt->dev = dev; in ftwdt010_wdt_probe()
153 gwdt->wdd.info = &ftwdt010_wdt_info; in ftwdt010_wdt_probe()
154 gwdt->wdd.ops = &ftwdt010_wdt_ops; in ftwdt010_wdt_probe()
155 gwdt->wdd.min_timeout = 1; in ftwdt010_wdt_probe()
156 gwdt->wdd.max_timeout = 0xFFFFFFFF / WDT_CLOCK; in ftwdt010_wdt_probe()
157 gwdt->wdd.parent = dev; in ftwdt010_wdt_probe()
160 * If 'timeout-sec' unspecified in devicetree, assume a 13 second in ftwdt010_wdt_probe()
163 gwdt->wdd.timeout = 13U; in ftwdt010_wdt_probe()
164 watchdog_init_timeout(&gwdt->wdd, 0, dev); in ftwdt010_wdt_probe()
166 reg = readw(gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_probe()
168 /* Watchdog was enabled by the bootloader, disable it. */ in ftwdt010_wdt_probe()
170 writel(reg, gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_probe()
176 "watchdog bark", gwdt); in ftwdt010_wdt_probe()
179 gwdt->has_irq = true; in ftwdt010_wdt_probe()
182 ret = devm_watchdog_register_device(dev, &gwdt->wdd); in ftwdt010_wdt_probe()
188 dev_info(dev, "FTWDT010 watchdog driver enabled\n"); in ftwdt010_wdt_probe()
198 reg = readw(gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_suspend()
200 writel(reg, gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_suspend()
210 if (watchdog_active(&gwdt->wdd)) { in ftwdt010_wdt_resume()
211 reg = readw(gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_resume()
213 writel(reg, gwdt->base + FTWDT010_WDCR); in ftwdt010_wdt_resume()
226 { .compatible = "cortina,gemini-watchdog" },
234 .name = "ftwdt010-wdt",
241 MODULE_DESCRIPTION("Watchdog driver for Faraday Technology FTWDT010");