To follow the IWDG configuration sequence, the timeout install is
just preparing the reload and prescaler parameters.
Then during the iwdg setup the watchdog is enabled and configured
at the same time.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
the watchdog is enabled by the wdt_setup()
coming after the wdt_install_timeout.
Due to PR #44972, the code did not follow that.
This PR fixes the correct other in the sequence.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
Some headers made use of types defined in sys_clock.h (e.g. k_timeout_t)
without including it.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
In the function iwdg_stm32_install_timeout, the test on watchdog ready
was inverted. So, if 2 successive calls were made to this function, the
value of the prescaler or counter reload was not taken into account.
Signed-off-by: Julien D'Ascenzio <julien.dascenzio@paratronic.fr>
Convert watchdog drivers to use new DT variants of the DEVICE APIs.
DEVICE_AND_API_INIT -> DEVICE_DT_DEFINE
DEVICE_GET -> DEVICE_DT_GET
DEVICE_DECLARE -> DEVICE_DT_INST_DECLARE
etc..
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
CONFIG_IWDG_STM32_TIMEOUT allowed values of 100 us for initial watchdog
timeout, which was actually rounded to zero in the driver, which uses
milliseconds resolution for timeouts. This resulted in the reload value
being set to maximum possible (calculation: 0U - 1).
This commit updates the calculation of timeout minimum and maximum
values considering the actual LSI frequency of the used MCU.
As the resolution of CONFIG_IWDG_STM32_TIMEOUT in microseconds doesn't
make sense if the driver supports only milliseconds, it is renamed to
IWDG_STM32_INITIAL_TIMEOUT (this prevents accidental wrong settings in
existing firmware) and the unit is changed to ms.
Signed-off-by: Martin Jäger <martin@libre.solar>
Replace all calls to the assert macro that comes from libc by calls to
__ASSERT_NO_MSG(). This is usefull as the former might be different
depending on the libc used and the later can be customized to reduce
flash footprint.
Signed-off-by: Xavier Chapron <xavier.chapron@stimio.fr>
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.
A coccinelle rule is used for this:
@r_const_dev_1
disable optional_qualifier
@
@@
-struct device *
+const struct device *
@r_const_dev_2
disable optional_qualifier
@
@@
-struct device * const
+const struct device *
Fixes#27399
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Convert older DT_INST_ macro use in STM32 drivers to the new
include/devicetree.h DT_INST macro APIs.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
With this patch, the specific flag IWDG_STM32_START_AT_BOOT
is replaced by the zephyr generic WDT_DISABLE_AT_BOOT.
Signed-off-by: Francois Ramu <francois.ramu@st.com>
This patches add a delay after setting the watchdog
to wait for the register (Prescaler and Counter registers)
to be updated before leaving (until LL_IWDG_IsReady is true)
Signed-off-by: Francois Ramu <francois.ramu@st.com>
iwdg_stm32_install_timeout expects a timeout passed in
milli seconds. As the timeout is defined in micro
seconds in Kconfig.stm32, we need to divide by
USEC_PER_MSEC when CONFIG_IWDG_START_AT_BOOT is
activated because iwdg_stm32_install_timeout makes
the multiplication by USEC_PER_MSEC.
Fixes#18695
Signed-off-by: Philémon Jaermann <p.jaermann@gmail.com>
move watchdog.h to drivers/watchdog.h and
create a shim for backward-compatibility.
No functional changes to the headers.
A warning in the shim can be controlled with CONFIG_COMPAT_INCLUDES.
Related to #16539
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Found a few annoying typos and figured I better run script and
fix anything it can find, here are the results...
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Change code from using now deprecated DT_<COMPAT>_<INSTANCE>_<PROP>
defines to using DT_INST_<INSTANCE>_<COMPAT>_<PROP>.
Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
Basically, all driver file names should start with the driver type as
prefix: wdt_ in case of watchdogs here.
Maybe 'iwdg' keyword could be removed entirely, and also in function
names. However that is not the scope of this patch.
Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>