Lines Matching +full:window +full:- +full:mode
4 * SPDX-License-Identifier: Apache-2.0
65 ((const struct wdt_sifive_device_config *const)(dev)->config)->regs)
77 t = wdt->wdogcfg; in wdt_sifive_set_max_timeout()
80 wdt->wdogkey = WDOG_KEY; in wdt_sifive_set_max_timeout()
81 wdt->wdogcfg = t; in wdt_sifive_set_max_timeout()
82 wdt->wdogkey = WDOG_KEY; in wdt_sifive_set_max_timeout()
83 wdt->wdogcmp0 = WDOGCMP_MAX; in wdt_sifive_set_max_timeout()
89 struct wdt_sifive_dev_data *data = dev->data; in wdt_sifive_isr()
94 t = wdt->wdogcfg; in wdt_sifive_isr()
97 wdt->wdogkey = WDOG_KEY; in wdt_sifive_isr()
98 wdt->wdogcfg = t; in wdt_sifive_isr()
100 if (data->enable_cb && data->cb) { in wdt_sifive_isr()
101 data->enable_cb = false; in wdt_sifive_isr()
102 data->cb(dev, 0); in wdt_sifive_isr()
108 struct wdt_sifive_dev_data *data = dev->data; in wdt_sifive_disable()
112 data->enable_cb = false; in wdt_sifive_disable()
120 struct wdt_sifive_dev_data *data = dev->data; in wdt_sifive_setup()
121 uint32_t t, mode; in wdt_sifive_setup() local
123 if (!data->timeout_valid) { in wdt_sifive_setup()
125 return -EINVAL; in wdt_sifive_setup()
128 mode = WDOGCFG_ENALWAYS; in wdt_sifive_setup()
131 mode = WDOGCFG_COREAWAKE; in wdt_sifive_setup()
135 mode = WDOGCFG_COREAWAKE; in wdt_sifive_setup()
138 t = wdt->wdogcfg; in wdt_sifive_setup()
140 t |= mode; in wdt_sifive_setup()
142 wdt->wdogkey = WDOG_KEY; in wdt_sifive_setup()
143 wdt->wdogcfg = t; in wdt_sifive_setup()
189 struct wdt_sifive_dev_data *data = dev->data; in wdt_sifive_install_timeout()
190 uint32_t mode = 0, t; in wdt_sifive_install_timeout() local
193 if (data->timeout_valid) { in wdt_sifive_install_timeout()
195 return -ENOMEM; in wdt_sifive_install_timeout()
197 if (cfg->window.min != 0U || cfg->window.max == 0U) { in wdt_sifive_install_timeout()
198 return -EINVAL; in wdt_sifive_install_timeout()
202 * Freedom watchdog does not support window timeout config. in wdt_sifive_install_timeout()
203 * So use max field of window. in wdt_sifive_install_timeout()
205 cmp = wdt_sifive_convtime(cfg->window.max, WDOG_CLK, &scaler); in wdt_sifive_install_timeout()
208 return -EINVAL; in wdt_sifive_install_timeout()
211 switch (cfg->flags) { in wdt_sifive_install_timeout()
214 mode = WDOGCFG_RSTEN | WDOGCFG_ZEROCMP; in wdt_sifive_install_timeout()
218 mode = WDOGCFG_ZEROCMP; in wdt_sifive_install_timeout()
225 return -ENOTSUP; in wdt_sifive_install_timeout()
228 t = wdt->wdogcfg; in wdt_sifive_install_timeout()
230 t |= mode | scaler; in wdt_sifive_install_timeout()
232 wdt->wdogkey = WDOG_KEY; in wdt_sifive_install_timeout()
233 wdt->wdogcfg = t; in wdt_sifive_install_timeout()
234 wdt->wdogkey = WDOG_KEY; in wdt_sifive_install_timeout()
235 wdt->wdogcmp0 = cmp; in wdt_sifive_install_timeout()
237 data->cb = cfg->callback; in wdt_sifive_install_timeout()
238 data->enable_cb = true; in wdt_sifive_install_timeout()
239 data->timeout_valid = true; in wdt_sifive_install_timeout()
248 wdt->wdogkey = WDOG_KEY; in wdt_sifive_feed()
249 wdt->wdogfeed = WDOG_FEED; in wdt_sifive_feed()