Lines Matching +full:rt2880 +full:- +full:timer
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Ralink RT288x/RT3xxx/MT76xx built-in hardware watchdog timer
20 #include <asm/mach-ralink/ralink_regs.h>
71 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1LOAD, w->timeout * drvdata->freq); in rt288x_wdt_ping()
81 t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); in rt288x_wdt_start()
86 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); in rt288x_wdt_start()
90 t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); in rt288x_wdt_start()
92 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); in rt288x_wdt_start()
104 t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); in rt288x_wdt_stop()
106 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); in rt288x_wdt_stop()
113 w->timeout = t; in rt288x_wdt_set_timeout()
142 struct device *dev = &pdev->dev; in rt288x_wdt_probe()
149 return -ENOMEM; in rt288x_wdt_probe()
151 drvdata->base = devm_platform_ioremap_resource(pdev, 0); in rt288x_wdt_probe()
152 if (IS_ERR(drvdata->base)) in rt288x_wdt_probe()
153 return PTR_ERR(drvdata->base); in rt288x_wdt_probe()
155 drvdata->clk = devm_clk_get(dev, NULL); in rt288x_wdt_probe()
156 if (IS_ERR(drvdata->clk)) in rt288x_wdt_probe()
157 return PTR_ERR(drvdata->clk); in rt288x_wdt_probe()
159 drvdata->rst = devm_reset_control_get_exclusive(dev, NULL); in rt288x_wdt_probe()
160 if (!IS_ERR(drvdata->rst)) in rt288x_wdt_probe()
161 reset_control_deassert(drvdata->rst); in rt288x_wdt_probe()
163 drvdata->freq = clk_get_rate(drvdata->clk) / RALINK_WDT_PRESCALE; in rt288x_wdt_probe()
165 wdt = &drvdata->wdt; in rt288x_wdt_probe()
166 wdt->info = &rt288x_wdt_info; in rt288x_wdt_probe()
167 wdt->ops = &rt288x_wdt_ops; in rt288x_wdt_probe()
168 wdt->min_timeout = 1; in rt288x_wdt_probe()
169 wdt->max_timeout = (0xfffful / drvdata->freq); in rt288x_wdt_probe()
170 wdt->parent = dev; in rt288x_wdt_probe()
171 wdt->bootstatus = rt288x_wdt_bootcause(); in rt288x_wdt_probe()
173 watchdog_init_timeout(wdt, wdt->max_timeout, dev); in rt288x_wdt_probe()
178 ret = devm_watchdog_register_device(dev, &drvdata->wdt); in rt288x_wdt_probe()
186 { .compatible = "ralink,rt2880-wdt" },