Lines Matching +full:max +full:- +full:x

4  * SPDX-License-Identifier: Apache-2.0
35 const struct wdt_ot_aontimer_cfg *const cfg = dev->config; in ot_aontimer_setup()
36 volatile uintptr_t regs = cfg->regs; in ot_aontimer_setup()
40 if (cfg->wdog_lock) { in ot_aontimer_setup()
50 const struct wdt_ot_aontimer_cfg *const cfg = dev->config; in ot_aontimer_disable()
51 volatile uintptr_t regs = cfg->regs; in ot_aontimer_disable()
54 LOG_ERR("Cannot disable - watchdog settings locked."); in ot_aontimer_disable()
55 return -EPERM; in ot_aontimer_disable()
61 return -EFAULT; in ot_aontimer_disable()
69 * The OpenTitan AON Timer includes a multi-level watchdog timer.
77 * The bark interrupt occurs at max (or if the timeout is too long to be
78 * supported, the value x s.t. min < x < max and x is the largest valid timeout)
80 * Minimum must be >= bark.min, and maximum >= bark.max. If the timeout is too
81 * long to fit, it tries to find the value x s.t. min < x < max where x is the
83 * The bite action occurs max.
88 struct wdt_ot_aontimer_data *data = dev->data; in ot_aontimer_install_timeout()
89 const struct wdt_ot_aontimer_cfg *const dev_cfg = dev->config; in ot_aontimer_install_timeout()
90 volatile uintptr_t reg_base = dev_cfg->regs; in ot_aontimer_install_timeout()
91 const uint64_t max_window = (uint64_t) UINT32_MAX * 1000 / dev_cfg->clk_freq; in ot_aontimer_install_timeout()
96 struct wdt_timeout_cfg *bite = cfg->next; in ot_aontimer_install_timeout()
98 if (bite == NULL || bite->window.max < cfg->window.max || in ot_aontimer_install_timeout()
99 (uint64_t) bite->window.min > max_window) { in ot_aontimer_install_timeout()
100 return -EINVAL; in ot_aontimer_install_timeout()
106 if (cfg->flags != WDT_FLAG_RESET_NONE || bite->flags != WDT_FLAG_RESET_SOC) { in ot_aontimer_install_timeout()
107 return -ENOTSUP; in ot_aontimer_install_timeout()
111 if (cfg->window.min > cfg->window.max || (uint64_t) cfg->window.min > max_window) { in ot_aontimer_install_timeout()
112 return -EINVAL; in ot_aontimer_install_timeout()
116 LOG_ERR("Cannot install timeout - watchdog settings locked."); in ot_aontimer_install_timeout()
117 return -ENOMEM; in ot_aontimer_install_timeout()
122 return -EBUSY; in ot_aontimer_install_timeout()
126 /* Force 64-bit ops to ensure thresholds fits in the timer reg. */ in ot_aontimer_install_timeout()
127 bark_thold = ((uint64_t) cfg->window.max * dev_cfg->clk_freq / 1000); in ot_aontimer_install_timeout()
128 bite_thold = ((uint64_t) bite->window.max * dev_cfg->clk_freq / 1000); in ot_aontimer_install_timeout()
136 data->bark = cfg->callback; in ot_aontimer_install_timeout()
140 bite_thold = ((uint64_t) cfg->window.max * dev_cfg->clk_freq / 1000); in ot_aontimer_install_timeout()
145 if (cfg->flags == WDT_FLAG_RESET_NONE) { in ot_aontimer_install_timeout()
146 /* Set bite -> bark, so we generate an interrupt instead of resetting */ in ot_aontimer_install_timeout()
148 /* Disable bite by writing it to max. Edge case is the bark = max. */ in ot_aontimer_install_timeout()
150 data->bark = cfg->callback; in ot_aontimer_install_timeout()
152 data->bark = NULL; in ot_aontimer_install_timeout()
153 /* Effectively disable bark by setting it to max */ in ot_aontimer_install_timeout()
165 const struct wdt_ot_aontimer_cfg *const cfg = dev->config; in ot_aontimer_feed()
166 volatile uintptr_t regs = cfg->regs; in ot_aontimer_feed()
177 const struct wdt_ot_aontimer_cfg *const cfg = dev->config; in wdt_ot_isr()
178 struct wdt_ot_aontimer_data *data = dev->data; in wdt_ot_isr()
179 volatile uintptr_t regs = cfg->regs; in wdt_ot_isr()
181 if (data->bark != NULL) { in wdt_ot_isr()
182 data->bark(dev, 0); in wdt_ot_isr()