Lines Matching +full:wdt +full:- +full:enable +full:- +full:once

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Ralink MT7621/MT7628 built-in hardware watchdog timer
38 struct watchdog_device wdt; member
44 "Watchdog cannot be stopped once started (default="
61 rt_wdt_w32(drvdata->base, TIMER_REG_TMRSTAT, TMR1CTL_RESTART); in mt7621_wdt_ping()
70 w->timeout = t; in mt7621_wdt_set_timeout()
71 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1LOAD, t * 1000); in mt7621_wdt_set_timeout()
83 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, 1000 << TMR1CTL_PRESCALE_SHIFT); in mt7621_wdt_start()
85 mt7621_wdt_set_timeout(w, w->timeout); in mt7621_wdt_start()
87 t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); in mt7621_wdt_start()
89 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); in mt7621_wdt_start()
101 t = rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL); in mt7621_wdt_stop()
103 rt_wdt_w32(drvdata->base, TIMER_REG_TMR1CTL, t); in mt7621_wdt_stop()
112 regmap_read(d->sysc, SYSC_RSTSTAT, &val); in mt7621_wdt_bootcause()
123 return !!(rt_wdt_r32(drvdata->base, TIMER_REG_TMR1CTL) & TMR1CTL_ENABLE); in mt7621_wdt_is_running()
141 struct device_node *np = pdev->dev.of_node; in mt7621_wdt_probe()
142 struct device *dev = &pdev->dev; in mt7621_wdt_probe()
149 return -ENOMEM; in mt7621_wdt_probe()
151 drvdata->sysc = syscon_regmap_lookup_by_phandle(np, "mediatek,sysctl"); in mt7621_wdt_probe()
152 if (IS_ERR(drvdata->sysc)) { in mt7621_wdt_probe()
153 drvdata->sysc = syscon_regmap_lookup_by_compatible("mediatek,mt7621-sysc"); in mt7621_wdt_probe()
154 if (IS_ERR(drvdata->sysc)) in mt7621_wdt_probe()
155 return PTR_ERR(drvdata->sysc); in mt7621_wdt_probe()
158 drvdata->base = devm_platform_ioremap_resource(pdev, 0); in mt7621_wdt_probe()
159 if (IS_ERR(drvdata->base)) in mt7621_wdt_probe()
160 return PTR_ERR(drvdata->base); in mt7621_wdt_probe()
162 drvdata->rst = devm_reset_control_get_exclusive(dev, NULL); in mt7621_wdt_probe()
163 if (!IS_ERR(drvdata->rst)) in mt7621_wdt_probe()
164 reset_control_deassert(drvdata->rst); in mt7621_wdt_probe()
166 mt7621_wdt = &drvdata->wdt; in mt7621_wdt_probe()
167 mt7621_wdt->info = &mt7621_wdt_info; in mt7621_wdt_probe()
168 mt7621_wdt->ops = &mt7621_wdt_ops; in mt7621_wdt_probe()
169 mt7621_wdt->min_timeout = 1; in mt7621_wdt_probe()
170 mt7621_wdt->max_timeout = 0xfffful / 1000; in mt7621_wdt_probe()
171 mt7621_wdt->parent = dev; in mt7621_wdt_probe()
173 mt7621_wdt->bootstatus = mt7621_wdt_bootcause(drvdata); in mt7621_wdt_probe()
175 watchdog_init_timeout(mt7621_wdt, mt7621_wdt->max_timeout, dev); in mt7621_wdt_probe()
187 * and timeout, and then re-enable the watchdog. in mt7621_wdt_probe()
191 set_bit(WDOG_HW_RUNNING, &mt7621_wdt->status); in mt7621_wdt_probe()
194 err = devm_watchdog_register_device(dev, &drvdata->wdt); in mt7621_wdt_probe()
207 mt7621_wdt_stop(&drvdata->wdt); in mt7621_wdt_shutdown()
211 { .compatible = "mediatek,mt7621-wdt" },