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 },
127 static void aspeed_wdt_enable(struct aspeed_wdt *wdt, int count) in aspeed_wdt_enable() argument
129 wdt->ctrl |= WDT_CTRL_ENABLE; in aspeed_wdt_enable()
131 writel(0, wdt->base + WDT_CTRL); in aspeed_wdt_enable()
132 writel(count, wdt->base + WDT_RELOAD_VALUE); in aspeed_wdt_enable()
133 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_enable()
134 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_enable()
139 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_start() local
141 aspeed_wdt_enable(wdt, wdd->timeout * WDT_RATE_1MHZ); in aspeed_wdt_start()
148 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_stop() local
150 wdt->ctrl &= ~WDT_CTRL_ENABLE; in aspeed_wdt_stop()
151 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_stop()
158 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_ping() local
160 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_ping()
168 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_set_timeout() local
175 writel(actual * WDT_RATE_1MHZ, wdt->base + WDT_RELOAD_VALUE); in aspeed_wdt_set_timeout()
176 writel(WDT_RESTART_MAGIC, wdt->base + WDT_RESTART); in aspeed_wdt_set_timeout()
184 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_set_pretimeout() local
186 u32 s = wdt->cfg->irq_shift; in aspeed_wdt_set_pretimeout()
187 u32 m = wdt->cfg->irq_mask; in aspeed_wdt_set_pretimeout()
190 wdt->ctrl &= ~m; in aspeed_wdt_set_pretimeout()
192 wdt->ctrl |= ((actual << s) & m) | WDT_CTRL_WDT_INTR; in aspeed_wdt_set_pretimeout()
194 wdt->ctrl &= ~WDT_CTRL_WDT_INTR; in aspeed_wdt_set_pretimeout()
196 writel(wdt->ctrl, wdt->base + WDT_CTRL); in aspeed_wdt_set_pretimeout()
204 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_restart() local
206 wdt->ctrl &= ~WDT_CTRL_BOOT_SECONDARY; in aspeed_wdt_restart()
207 aspeed_wdt_enable(wdt, 128 * WDT_RATE_1MHZ / 1000); in aspeed_wdt_restart()
218 struct aspeed_wdt *wdt = dev_get_drvdata(dev); in access_cs0_show() local
219 u32 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in access_cs0_show()
229 struct aspeed_wdt *wdt = dev_get_drvdata(dev); in access_cs0_store() local
237 wdt->base + WDT_CLEAR_TIMEOUT_STATUS); in access_cs0_store()
296 struct aspeed_wdt *wdt = to_aspeed_wdt(wdd); in aspeed_wdt_irq() local
297 u32 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in aspeed_wdt_irq()
309 struct aspeed_wdt *wdt; in aspeed_wdt_probe() local
316 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in aspeed_wdt_probe()
317 if (!wdt) in aspeed_wdt_probe()
325 wdt->cfg = ofdid->data; in aspeed_wdt_probe()
327 wdt->base = devm_platform_ioremap_resource(pdev, 0); in aspeed_wdt_probe()
328 if (IS_ERR(wdt->base)) in aspeed_wdt_probe()
329 return PTR_ERR(wdt->base); in aspeed_wdt_probe()
331 wdt->wdd.info = &aspeed_wdt_info; in aspeed_wdt_probe()
333 if (wdt->cfg->irq_mask) { in aspeed_wdt_probe()
339 wdt); in aspeed_wdt_probe()
343 wdt->wdd.info = &aspeed_wdt_pretimeout_info; in aspeed_wdt_probe()
347 wdt->wdd.ops = &aspeed_wdt_ops; in aspeed_wdt_probe()
348 wdt->wdd.max_hw_heartbeat_ms = WDT_MAX_TIMEOUT_MS; in aspeed_wdt_probe()
349 wdt->wdd.parent = dev; in aspeed_wdt_probe()
351 wdt->wdd.timeout = WDT_DEFAULT_TIMEOUT; in aspeed_wdt_probe()
352 watchdog_init_timeout(&wdt->wdd, 0, dev); in aspeed_wdt_probe()
354 watchdog_set_nowayout(&wdt->wdd, nowayout); in aspeed_wdt_probe()
358 * - ast2400 wdt can run at PCLK, or 1MHz in aspeed_wdt_probe()
364 if (of_device_is_compatible(np, "aspeed,ast2400-wdt")) in aspeed_wdt_probe()
365 wdt->ctrl = WDT_CTRL_1MHZ_CLK; in aspeed_wdt_probe()
373 wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | WDT_CTRL_RESET_SYSTEM; in aspeed_wdt_probe()
376 wdt->ctrl |= WDT_CTRL_RESET_MODE_ARM_CPU | in aspeed_wdt_probe()
379 wdt->ctrl |= WDT_CTRL_RESET_MODE_SOC | in aspeed_wdt_probe()
382 wdt->ctrl |= WDT_CTRL_RESET_MODE_FULL_CHIP | in aspeed_wdt_probe()
388 wdt->ctrl |= WDT_CTRL_WDT_EXT; in aspeed_wdt_probe()
390 wdt->ctrl |= WDT_CTRL_BOOT_SECONDARY; in aspeed_wdt_probe()
392 if (readl(wdt->base + WDT_CTRL) & WDT_CTRL_ENABLE) { in aspeed_wdt_probe()
395 * write wdt->ctrl to WDT_CTRL to ensure the watchdog's in aspeed_wdt_probe()
399 aspeed_wdt_start(&wdt->wdd); in aspeed_wdt_probe()
400 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in aspeed_wdt_probe()
403 if ((of_device_is_compatible(np, "aspeed,ast2500-wdt")) || in aspeed_wdt_probe()
404 (of_device_is_compatible(np, "aspeed,ast2600-wdt"))) { in aspeed_wdt_probe()
405 u32 reg = readl(wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
407 reg &= wdt->cfg->ext_pulse_width_mask; in aspeed_wdt_probe()
413 writel(reg, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
415 reg &= wdt->cfg->ext_pulse_width_mask; in aspeed_wdt_probe()
421 writel(reg, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
425 u32 max_duration = wdt->cfg->ext_pulse_width_mask + 1; in aspeed_wdt_probe()
447 writel(duration - 1, wdt->base + WDT_RESET_WIDTH); in aspeed_wdt_probe()
450 status = readl(wdt->base + WDT_TIMEOUT_STATUS); in aspeed_wdt_probe()
452 wdt->wdd.bootstatus = WDIOF_CARDRESET; in aspeed_wdt_probe()
454 if (of_device_is_compatible(np, "aspeed,ast2400-wdt") || in aspeed_wdt_probe()
455 of_device_is_compatible(np, "aspeed,ast2500-wdt")) in aspeed_wdt_probe()
456 wdt->wdd.groups = bswitch_groups; in aspeed_wdt_probe()
459 dev_set_drvdata(dev, wdt); in aspeed_wdt_probe()
461 return devm_watchdog_register_device(dev, &wdt->wdd); in aspeed_wdt_probe()