Lines Matching full:wdt

69 	struct apple_wdt *wdt = to_apple_wdt(wdd);  in apple_wdt_start()  local
71 writel_relaxed(0, wdt->regs + APPLE_WDT_WD1_CUR_TIME); in apple_wdt_start()
72 writel_relaxed(APPLE_WDT_CTRL_RESET_EN, wdt->regs + APPLE_WDT_WD1_CTRL); in apple_wdt_start()
79 struct apple_wdt *wdt = to_apple_wdt(wdd); in apple_wdt_stop() local
81 writel_relaxed(0, wdt->regs + APPLE_WDT_WD1_CTRL); in apple_wdt_stop()
88 struct apple_wdt *wdt = to_apple_wdt(wdd); in apple_wdt_ping() local
90 writel_relaxed(0, wdt->regs + APPLE_WDT_WD1_CUR_TIME); in apple_wdt_ping()
97 struct apple_wdt *wdt = to_apple_wdt(wdd); in apple_wdt_set_timeout() local
99 writel_relaxed(0, wdt->regs + APPLE_WDT_WD1_CUR_TIME); in apple_wdt_set_timeout()
100 writel_relaxed(wdt->clk_rate * s, wdt->regs + APPLE_WDT_WD1_BITE_TIME); in apple_wdt_set_timeout()
109 struct apple_wdt *wdt = to_apple_wdt(wdd); in apple_wdt_get_timeleft() local
112 cur_time = readl_relaxed(wdt->regs + APPLE_WDT_WD1_CUR_TIME); in apple_wdt_get_timeleft()
113 reset_time = readl_relaxed(wdt->regs + APPLE_WDT_WD1_BITE_TIME); in apple_wdt_get_timeleft()
115 return (reset_time - cur_time) / wdt->clk_rate; in apple_wdt_get_timeleft()
121 struct apple_wdt *wdt = to_apple_wdt(wdd); in apple_wdt_restart() local
123 writel_relaxed(APPLE_WDT_CTRL_RESET_EN, wdt->regs + APPLE_WDT_WD1_CTRL); in apple_wdt_restart()
124 writel_relaxed(0, wdt->regs + APPLE_WDT_WD1_BITE_TIME); in apple_wdt_restart()
125 writel_relaxed(0, wdt->regs + APPLE_WDT_WD1_CUR_TIME); in apple_wdt_restart()
133 (void)readl_relaxed(wdt->regs + APPLE_WDT_WD1_CUR_TIME); in apple_wdt_restart()
157 struct apple_wdt *wdt; in apple_wdt_probe() local
161 wdt = devm_kzalloc(dev, sizeof(*wdt), GFP_KERNEL); in apple_wdt_probe()
162 if (!wdt) in apple_wdt_probe()
165 wdt->regs = devm_platform_ioremap_resource(pdev, 0); in apple_wdt_probe()
166 if (IS_ERR(wdt->regs)) in apple_wdt_probe()
167 return PTR_ERR(wdt->regs); in apple_wdt_probe()
172 wdt->clk_rate = clk_get_rate(clk); in apple_wdt_probe()
173 if (!wdt->clk_rate) in apple_wdt_probe()
176 wdt->wdd.ops = &apple_wdt_ops; in apple_wdt_probe()
177 wdt->wdd.info = &apple_wdt_info; in apple_wdt_probe()
178 wdt->wdd.max_timeout = U32_MAX / wdt->clk_rate; in apple_wdt_probe()
179 wdt->wdd.timeout = APPLE_WDT_TIMEOUT_DEFAULT; in apple_wdt_probe()
181 wdt_ctrl = readl_relaxed(wdt->regs + APPLE_WDT_WD1_CTRL); in apple_wdt_probe()
183 set_bit(WDOG_HW_RUNNING, &wdt->wdd.status); in apple_wdt_probe()
185 watchdog_init_timeout(&wdt->wdd, 0, dev); in apple_wdt_probe()
186 apple_wdt_set_timeout(&wdt->wdd, wdt->wdd.timeout); in apple_wdt_probe()
187 watchdog_stop_on_unregister(&wdt->wdd); in apple_wdt_probe()
188 watchdog_set_restart_priority(&wdt->wdd, 128); in apple_wdt_probe()
190 return devm_watchdog_register_device(dev, &wdt->wdd); in apple_wdt_probe()
194 { .compatible = "apple,wdt" },