Lines Matching +full:timer +full:- +full:watchdog
1 // SPDX-License-Identifier: GPL-2.0
2 /* Copyright (C) 2022 Hewlett-Packard Enterprise Development Company, L.P. */
9 #include <linux/watchdog.h>
33 val = readb(drvdata->base + GXP_WDT_CTRL_OFS); in gxp_wdt_enable_reload()
35 writeb(val, drvdata->base + GXP_WDT_CTRL_OFS); in gxp_wdt_enable_reload()
42 writew(SECS_TO_WDOG_TICKS(wdd->timeout), drvdata->base + GXP_WDT_CNT_OFS); in gxp_wdt_start()
52 val = readb_relaxed(drvdata->base + GXP_WDT_CTRL_OFS); in gxp_wdt_stop()
54 writeb(val, drvdata->base + GXP_WDT_CTRL_OFS); in gxp_wdt_stop()
64 wdd->timeout = timeout; in gxp_wdt_set_timeout()
65 actual = min(timeout * 100, wdd->max_hw_heartbeat_ms / 10); in gxp_wdt_set_timeout()
66 writew(actual, drvdata->base + GXP_WDT_CNT_OFS); in gxp_wdt_set_timeout()
74 u32 val = readw(drvdata->base + GXP_WDT_CNT_OFS); in gxp_wdt_get_timeleft()
92 writew(1, drvdata->base + GXP_WDT_CNT_OFS); in gxp_restart()
110 .identity = "HPE GXP Watchdog timer",
115 struct device *dev = &pdev->dev; in gxp_wdt_probe()
122 return -ENOMEM; in gxp_wdt_probe()
125 * The register area where the timer and watchdog reside is disarranged. in gxp_wdt_probe()
126 * Hence mapping individual register blocks for the timer and watchdog in gxp_wdt_probe()
128 * registers. Based on feedback the watchdog is no longer part of the in gxp_wdt_probe()
129 * device tree file and the timer driver now creates the watchdog as a in gxp_wdt_probe()
130 * child device. During the watchdogs creation, the timer driver passes in gxp_wdt_probe()
131 * the base address to the watchdog over the private interface. in gxp_wdt_probe()
134 drvdata->base = (void __iomem *)dev->platform_data; in gxp_wdt_probe()
136 drvdata->wdd.info = &gxp_wdt_info; in gxp_wdt_probe()
137 drvdata->wdd.ops = &gxp_wdt_ops; in gxp_wdt_probe()
138 drvdata->wdd.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT_MS; in gxp_wdt_probe()
139 drvdata->wdd.parent = dev; in gxp_wdt_probe()
140 drvdata->wdd.timeout = WDT_DEFAULT_TIMEOUT; in gxp_wdt_probe()
142 watchdog_set_drvdata(&drvdata->wdd, drvdata); in gxp_wdt_probe()
143 watchdog_set_nowayout(&drvdata->wdd, WATCHDOG_NOWAYOUT); in gxp_wdt_probe()
145 val = readb(drvdata->base + GXP_WDT_CTRL_OFS); in gxp_wdt_probe()
148 set_bit(WDOG_HW_RUNNING, &drvdata->wdd.status); in gxp_wdt_probe()
150 watchdog_set_restart_priority(&drvdata->wdd, 128); in gxp_wdt_probe()
152 watchdog_stop_on_reboot(&drvdata->wdd); in gxp_wdt_probe()
153 err = devm_watchdog_register_device(dev, &drvdata->wdd); in gxp_wdt_probe()
155 dev_err(dev, "Failed to register watchdog device"); in gxp_wdt_probe()
159 dev_info(dev, "HPE GXP watchdog timer"); in gxp_wdt_probe()
167 .name = "gxp-wdt",
173 MODULE_AUTHOR("Jean-Marie Verdun <verdun@hpe.com>");
174 MODULE_DESCRIPTION("Driver for GXP watchdog timer");