Lines Matching full:wdt
35 { .compatible = "aspeed,ast2400-wdt", .data = &ast2400_config },
36 { .compatible = "aspeed,ast2500-wdt", .data = &ast2500_config },
37 { .compatible = "aspeed,ast2600-wdt", .data = &ast2500_config },
104 static void aspeed_wdt_enable(struct aspeed_wdt *wdt, int count) in aspeed_wdt_enable() argument
106 wdt->ctrl |= WDT_CTRL_ENABLE; in aspeed_wdt_enable()
108 writel(0, wdt->base + WDT_CTRL); in aspeed_wdt_enable()
109 writel(count, wdt->base + WDT_RELOAD_VALUE); in aspeed_wdt_enable()
110 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_enable()
111 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_enable()
116 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_start() local
118 aspeed_wdt_enable(wdt, wdd->timeout * WDT_RATE_1MHZ); in aspeed_wdt_start()
125 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_stop() local
127 wdt->ctrl &= ~WDT_CTRL_ENABLE; in aspeed_wdt_stop()
128 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_stop()
135 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_ping() local
137 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_ping()
145 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_set_timeout() local
152 writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE); in aspeed_wdt_set_timeout()
153 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_set_timeout()
161 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_restart() local
163 wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY; in aspeed_wdt_restart()
164 aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000); in aspeed_wdt_restart()
175 struct aspeed_wdt *wdt = dev_get_drvdata(dev); in access_cs0_show() local
176 u32 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in access_cs0_show()
186 struct aspeed_wdt *wdt = dev_get_drvdata(dev); in access_cs0_store() local
194 wdt->base + WDT_CLEAR_TIMEOUT_STATUS); in access_cs0_store()
246 struct aspeed_wdt *wdt; in aspeed_wdt_probe() local
253 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in aspeed_wdt_probe()
254 if (!wdt) in aspeed_wdt_probe()
257 wdt->base = devm_platform_ioremap_resource(pdev, 0); in aspeed_wdt_probe()
258 if (IS_ERR(wdt->base)) in aspeed_wdt_probe()
259 return PTR_ERR(wdt->base); in aspeed_wdt_probe()
261 wdt->wdd.info = &aspeed_wdt_info; in aspeed_wdt_probe()
262 wdt->wdd.ops = &aspeed_wdt_ops; in aspeed_wdt_probe()
263 wdt->wdd.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT_MS; in aspeed_wdt_probe()
264 wdt->wdd.parent = dev; in aspeed_wdt_probe()
266 wdt->wdd.timeout = WDT_DEFAULT_TIMEOUT; in aspeed_wdt_probe()
267 watchdog_init_timeout(&wdt->wdd, 0, dev); in aspeed_wdt_probe()
278 * - ast2400 wdt can run at PCLK, or 1MHz in aspeed_wdt_probe()
284 if (of_device_is_compatible(np, "aspeed,ast2400-wdt")) in aspeed_wdt_probe()
285 wdt->ctrl = WDT_CTRL_1MHZ_CLK; in aspeed_wdt_probe()
293 wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | WDT_CTRL_RESET_SYSTEM; in aspeed_wdt_probe()
296 wdt->ctrl |= WDT_CTRL_RESET_MODE_ARM_CPU | in aspeed_wdt_probe()
299 wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | in aspeed_wdt_probe()
302 wdt->ctrl |= WDT_CTRL_RESET_MODE_FULL_CHIP | in aspeed_wdt_probe()
308 wdt->ctrl |= WDT_CTRL_WDT_EXT; in aspeed_wdt_probe()
310 wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY; in aspeed_wdt_probe()
312 if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) { in aspeed_wdt_probe()
315 * write wdt->ctrl to WDT_CTRL to ensure the watchdog's in aspeed_wdt_probe()
319 aspeed_wdt_start(&wdt->wdd); in aspeed_wdt_probe()
320 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in aspeed_wdt_probe()
323 if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) || in aspeed_wdt_probe()
324 (of_device_is_compatible(np, "aspeed,ast2600-wdt"))) { in aspeed_wdt_probe()
325 u32 reg = readl(wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
333 writel(reg, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
341 writel(reg, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
367 writel(duration - 1, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
370 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in aspeed_wdt_probe()
372 wdt->wdd.bootstatus = WDIOF_CARDRESET; in aspeed_wdt_probe()
374 if (of_device_is_compatible(np, "aspeed,ast2400-wdt") || in aspeed_wdt_probe()
375 of_device_is_compatible(np, "aspeed,ast2500-wdt")) in aspeed_wdt_probe()
376 wdt->wdd.groups = bswitch_groups; in aspeed_wdt_probe()
379 dev_set_drvdata(dev, wdt); in aspeed_wdt_probe()
381 return devm_watchdog_register_device(dev, &wdt->wdd); in aspeed_wdt_probe()