Commit graph

28 commits

Author SHA1 Message Date
Francois Ramu f9d04d0958 drivers: watchdog stm32 independent wdg when enable at boot
When the CONFIG_WDT_DISABLE_AT_BOOT is not set, the iwdg
should be configured by iwdg_stm32_install_timeout
and started by iwdg_stm32_setup

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2024-04-30 14:31:43 -04:00
Benjamin Björnsson b308d83d45 drivers: watchdog: add watchdog support on STM32C0-series
Add support for independent watchdog and window watchdog
on the STM32C0-series.

Signed-off-by: Benjamin Björnsson <benjamin.bjornsson@gmail.com>
2023-03-20 10:19:29 +00:00
Francois Ramu 842a6ba02d drivers: watchdog: stm32 iwdt enable and update during setup
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>
2023-01-30 15:05:39 +00:00
Wojciech Slenska fdae56dc6a drivers: watchdog: stm32 iwdg: max prescaler value
In some stm32 MUCs maximum prescaler value can be 1024.

Signed-off-by: Wojciech Slenska <wsl@trackunit.com>
2023-01-20 16:11:39 +01:00
Francois Ramu 9400de333e drivers: watchdog: stm32 iwdg starts with wdt_setup()
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>
2023-01-18 09:56:14 +01:00
Gerard Marull-Paretas ac63bca423 include: add missing sys_clock.h include
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>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas 6a0f554ffa include: add missing kernel.h include
Some files make use of Kernel APIs without including kernel.h, fix this
problem.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-10-11 18:05:17 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
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>
2022-05-06 19:58:21 +02:00
Francois Ramu c2db84ee8a drivers: watchdog: stm32 iwdg starts with timeout install
It Follows the sequence to configure and launch the IWDG watchdog
for the stm32 mcus

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2022-05-02 10:27:44 -05:00
Julien D'Ascenzio 2a510361a3 drivers: watchdog: iwdg_stm32: fix wdg install timeout
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>
2022-04-08 09:59:34 -04:00
Yong Cong Sin 900757c3e2 drivers: watchdog: STM32G0X: clock DBGMCU before configuring
Enable the clock for the DBGMCU peripherals so that it can be
configured.

Signed-off-by: Yong Cong Sin <yongcong.sin@gmail.com>
2022-01-04 09:08:00 -05:00
Gerard Marull-Paretas 621d1d45f2 drivers: watchdog: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04:00
Harry Jiang 5adaba0760 drivers: watchdog: iwdg_stm32: Add support for STM32H7xx SoC
Add the IWDG driver support for STM32H7xx SoC.

Signed-off-by: Harry Jiang <explora26@gmail.com>
2021-02-17 16:19:21 -06:00
Kumar Gala e376b9417b drivers: watchdog: Convert drivers to new DT device macros
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>
2020-12-11 08:14:23 -06:00
Martin Jäger 916dd0f6c4 drivers: watchdog: iwdg_stm32: Fix timeout calculation
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>
2020-12-04 23:09:42 -05:00
Martin Jäger d73bfcbdc8 drivers: iwdg: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Xavier Chapron 824f423e54 misc: Replace assert include and calls by sys/__assert.h equivalent
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>
2020-10-02 11:42:40 +02:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
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>
2020-09-02 13:48:13 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Kumar Gala 989484b4bf drivers: stm32: Convert STM32 drivers to new DT_INST macros
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>
2020-03-26 12:22:12 -05:00
Francois Ramu 3dfceded48 drivers: watchdog: disable iwdg at boot on stm32
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>
2020-03-10 15:12:20 +02:00
Francois Ramu 0b4fbb916e driver: watchdog: stm32 install watchdog
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>
2020-02-26 12:19:07 -06:00
Philémon Jaermann a1aabbb08a drivers: watchdog: Pass timeout in ms if iwdg is started at boot
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>
2019-09-12 08:46:34 -05:00
Björn Stenberg b6454d5f3f STM32 wdg: Remove use of float
Using int avoids pulling in several kilobytes of float math code.

Signed-off-by: Björn Stenberg <bjorn@haxx.se>
2019-09-12 08:43:33 -05:00
Anas Nashif d4d20677ac cleanup: include/: move watchdog.h to drivers/watchdog.h
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>
2019-06-27 22:55:49 -04:00
Anas Nashif f2cb20c772 docs: fix misspelling across the tree
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>
2019-06-19 15:34:13 -05:00
Kumar Gala a2693975d7 dts: Convert from DT_<COMPAT>_<INSTANCE>_<PROP> to DT_INST...
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>
2019-06-14 08:02:15 -05:00
Tomasz Bursztyka 1b28cb0ff1 drivers/wdt: Rename STM32 IWDG files to follow naming rules
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>
2019-06-04 15:34:55 -04:00
Renamed from drivers/watchdog/iwdg_stm32.c (Browse further)