Lines Matching full:wdt

57 	{ .compatible = "aspeed,ast2400-wdt", .data = &ast2400_config },
58 { .compatible = "aspeed,ast2500-wdt", .data = &ast2500_config },
59 { .compatible = "aspeed,ast2600-wdt", .data = &ast2600_config },
129 static void aspeed_wdt_enable(struct aspeed_wdt *wdt, int count) in aspeed_wdt_enable() argument
131 wdt->ctrl |= WDT_CTRL_ENABLE; in aspeed_wdt_enable()
133 writel(0, wdt->base + WDT_CTRL); in aspeed_wdt_enable()
134 writel(count, wdt->base + WDT_RELOAD_VALUE); in aspeed_wdt_enable()
135 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_enable()
136 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_enable()
141 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_start() local
143 aspeed_wdt_enable(wdt, wdd->timeout * WDT_RATE_1MHZ); in aspeed_wdt_start()
150 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_stop() local
152 wdt->ctrl &= ~WDT_CTRL_ENABLE; in aspeed_wdt_stop()
153 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_stop()
160 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_ping() local
162 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_ping()
170 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_set_timeout() local
177 writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE); in aspeed_wdt_set_timeout()
178 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_set_timeout()
186 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_set_pretimeout() local
188 u32 s = wdt->cfg->irq_shift; in aspeed_wdt_set_pretimeout()
189 u32 m = wdt->cfg->irq_mask; in aspeed_wdt_set_pretimeout()
192 wdt->ctrl &= ~m; in aspeed_wdt_set_pretimeout()
194 wdt->ctrl |= ((actual << s) & m) | WDT_CTRL_WDT_INTR; in aspeed_wdt_set_pretimeout()
196 wdt->ctrl &= ~WDT_CTRL_WDT_INTR; in aspeed_wdt_set_pretimeout()
198 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_set_pretimeout()
206 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_restart() local
208 wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY; in aspeed_wdt_restart()
209 aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000); in aspeed_wdt_restart()
220 struct aspeed_wdt *wdt = dev_get_drvdata(dev); in access_cs0_show() local
221 u32 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in access_cs0_show()
231 struct aspeed_wdt *wdt = dev_get_drvdata(dev); in access_cs0_store() local
239 wdt->base + WDT_CLEAR_TIMEOUT_STATUS); in access_cs0_store()
298 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_irq() local
299 u32 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in aspeed_wdt_irq()
311 struct aspeed_wdt *wdt; in aspeed_wdt_probe() local
318 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in aspeed_wdt_probe()
319 if (!wdt) in aspeed_wdt_probe()
327 wdt->cfg = ofdid->data; in aspeed_wdt_probe()
329 wdt->base = devm_platform_ioremap_resource(pdev, 0); in aspeed_wdt_probe()
330 if (IS_ERR(wdt->base)) in aspeed_wdt_probe()
331 return PTR_ERR(wdt->base); in aspeed_wdt_probe()
333 wdt->wdd.info = &aspeed_wdt_info; in aspeed_wdt_probe()
335 if (wdt->cfg->irq_mask) { in aspeed_wdt_probe()
341 wdt); in aspeed_wdt_probe()
345 wdt->wdd.info = &aspeed_wdt_pretimeout_info; in aspeed_wdt_probe()
349 wdt->wdd.ops = &aspeed_wdt_ops; in aspeed_wdt_probe()
350 wdt->wdd.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT_MS; in aspeed_wdt_probe()
351 wdt->wdd.parent = dev; in aspeed_wdt_probe()
353 wdt->wdd.timeout = WDT_DEFAULT_TIMEOUT; in aspeed_wdt_probe()
354 watchdog_init_timeout(&wdt->wdd, 0, dev); in aspeed_wdt_probe()
356 watchdog_set_nowayout(&wdt->wdd, nowayout); in aspeed_wdt_probe()
360 * - ast2400 wdt can run at PCLK, or 1MHz in aspeed_wdt_probe()
366 if (of_device_is_compatible(np, "aspeed,ast2400-wdt")) in aspeed_wdt_probe()
367 wdt->ctrl = WDT_CTRL_1MHZ_CLK; in aspeed_wdt_probe()
375 wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | WDT_CTRL_RESET_SYSTEM; in aspeed_wdt_probe()
378 wdt->ctrl |= WDT_CTRL_RESET_MODE_ARM_CPU | in aspeed_wdt_probe()
381 wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | in aspeed_wdt_probe()
384 wdt->ctrl |= WDT_CTRL_RESET_MODE_FULL_CHIP | in aspeed_wdt_probe()
390 wdt->ctrl |= WDT_CTRL_WDT_EXT; in aspeed_wdt_probe()
392 wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY; in aspeed_wdt_probe()
394 if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) { in aspeed_wdt_probe()
397 * write wdt->ctrl to WDT_CTRL to ensure the watchdog's in aspeed_wdt_probe()
401 aspeed_wdt_start(&wdt->wdd); in aspeed_wdt_probe()
402 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in aspeed_wdt_probe()
405 if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) || in aspeed_wdt_probe()
406 (of_device_is_compatible(np, "aspeed,ast2600-wdt"))) { in aspeed_wdt_probe()
408 size_t nrstmask = of_device_is_compatible(np, "aspeed,ast2600-wdt") ? 2 : 1; in aspeed_wdt_probe()
409 u32 reg = readl(wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
411 reg &= wdt->cfg->ext_pulse_width_mask; in aspeed_wdt_probe()
417 writel(reg, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
419 reg &= wdt->cfg->ext_pulse_width_mask; in aspeed_wdt_probe()
425 writel(reg, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
429 writel(reset_mask[0], wdt->base + WDT_RESET_MASK1); in aspeed_wdt_probe()
431 writel(reset_mask[1], wdt->base + WDT_RESET_MASK2); in aspeed_wdt_probe()
436 u32 max_duration = wdt->cfg->ext_pulse_width_mask + 1; in aspeed_wdt_probe()
458 writel(duration - 1, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
461 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in aspeed_wdt_probe()
463 wdt->wdd.bootstatus = WDIOF_CARDRESET; in aspeed_wdt_probe()
465 if (of_device_is_compatible(np, "aspeed,ast2400-wdt") || in aspeed_wdt_probe()
466 of_device_is_compatible(np, "aspeed,ast2500-wdt")) in aspeed_wdt_probe()
467 wdt->wdd.groups = bswitch_groups; in aspeed_wdt_probe()
470 dev_set_drvdata(dev, wdt); in aspeed_wdt_probe()
472 return devm_watchdog_register_device(dev, &wdt->wdd); in aspeed_wdt_probe()