Commit Graph

259 Commits

Author SHA1 Message Date
Kumar Gala bdff3e76e5 drivers: watchdog: Update drivers to use devicetree Kconfig symbol
Update watchdog drivers to use DT_HAS_<compat>_ENABLED Kconfig symbol
to expose the driver and enable it by default based on devicetree.

We remove 'depend on' Kconfig for symbols that would be implied by
the devicetree node existing.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-07-22 14:06:00 +00:00
Anas Nashif 49b36ead95 drivers: add mising braces to single line if statements
Following zephyr's style guideline, all if statements, including single
line statements shall have braces.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2022-07-06 11:00:45 -04:00
Jamie McCrae a20eb66742 drivers: watchdog: Add Raspberry Pi Pico watchdog driver
This adds basic support for the watchdog timer on the RP2040 MCU and
Raspberry Pi Pico development board

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2022-07-06 10:52:29 +02:00
Chay Guo c846537820 boards: arm: Add wdog support on mimxrt595_evk
Add watchdog support to the mimxrt595 platform.
The mimxrt595 platform is excluded from the watchdog
test case because the test case uses variables in the
noinit section that need to be retained through a reset
but the rt595 does not retain this memory through a
reset.

Signed-off-by: Chay Guo <changyi.guo@nxp.com>
2022-06-13 12:10:57 +02:00
Moritz Fischer 8f16b05999 drivers: watchdog: cmsdk_apb: Drop dependency
The Kconfig encodes a dependency on SOC_FAMILY_ARM
even though there is no actual dependency.

This is generic ARM IP and can be used in any SoC.

Signed-off-by: Moritz Fischer <moritzf@google.com>
2022-06-08 15:57:01 -05:00
Kumar Gala 23bcc0d107 drivers: watchdog: remove unused HAS_DTS_WDT Kconfig symbol
All the watchdog drivers are based on devicetree and we dont utilize
HAS_DTS_WDT anywhere so we can remove it.

Signed-off-by: Kumar Gala <galak@kernel.org>
2022-06-08 16:44:01 -04: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
Jamie McCrae 9a50c70113 drivers: watchdog: it8xxx2: Prevent Kconfig option being wrongly shown
The it8xxx2 watchdog Kconfig options are always shown, for every type
of device, they should only be shown when an it8xxx2 device is being
targeted.

Signed-off-by: Jamie McCrae <spam@helper3000.net>
2022-04-28 14:18:16 +02:00
Ruibin Chang 7b43deedd5 ITE drivers/watchdog: clean up the #ifdef
Use if(IS_ENABLED(...)) {...} instead.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-04-15 10:35:35 -07:00
Bartosz Bilas 6f6ef91fa7 drivers: watchdog: it8xxx2: remove superfluous default n for boolean
bool symbols implicitly default to n so
there is no need to redundant those values.

Signed-off-by: Bartosz Bilas <bartosz.bilas@hotmail.com>
2022-04-15 10:32:24 -07: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
Andrzej Głąbek 586e26e8fc soc: nrf: Use data from DTS to populate HAS_HW_NRF_* Kconfig options
Instead of selecting appropriate HAS_HW_NRF_* options for particular
nRF SoCs (and simulated nRF52 target), set their values basing on
information from devicetree.
Correct also semantics of those options so that they are set only when
a corresponding DT node is enabled. This allows using them directly in
Kconfig dependencies of Zephyr drivers for nRF peripherals. Update
appropriately these dependencies.

Signed-off-by: Andrzej Głąbek <andrzej.glabek@nordicsemi.no>
2022-04-02 15:14:38 +02:00
Nazar Kazakov f483b1bc4c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-18 13:24:08 -04:00
Tomasz Bursztyka 9a18fdea3f drivers: Check and fix device const qualifier on ISR
Re-running the script that checks for the const qualifier missing on
struct device ISR's parameter.

The script also changes the parameter 'arg' to 'dev' when relevant.

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2022-03-16 12:33:12 +01:00
Gerard Marull-Paretas 9953c194b9 drivers: remove redundant DEV_NAME helpers
Just use dev->name. This change follow same principles applied when
DEV_CFG and DEV_DATA macros were removed.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-15 17:31:51 -04:00
Nazar Kazakov 9713f0d47c everywhere: fix typos
Fix a lot of typos

Signed-off-by: Nazar Kazakov <nazar.kazakov.work@gmail.com>
2022-03-14 20:22:24 -04:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Jay Vasanth 4120a889a4 Microchip: MEC172x: watchdog driver
Update wdt driver to support MEC172x device

Signed-off-by: Jay Vasanth <jay.vasanth@microchip.com>
2022-02-21 20:42:18 -05:00
Sylvio Alves 6ba6894580 drivers: wdt: esp32: code refactor to use hal calls
Update WDT driver to use hal calls, which
brings proper unification among socs.

Signed-off-by: Sylvio Alves <sylvio.alves@espressif.com>
2022-02-21 19:40:17 -05:00
Daniel DeGrasse 41a63f48fd samples: task_wdt: Increase min watchdog timeout
MCUX watchdog timer supports min window of 500ms. Increase maximum task
watchdog timeout window to 500ms by default, so that this sample can run
on iMX RT SOCs. Also update iMX RT watchdog driver to reject timeout
maximums under 500ms with a useful error message

Fixes #40153

Signed-off-by: Daniel DeGrasse <daniel.degrasse@nxp.com>
2022-02-09 14:07:26 -06:00
Wealian Liao 6d6c5e1155 drivers: npcx: Drop DRV_CONFIG/DRV_DATA usage
Stop using DRV_CONFIG/DRV_DATA macros and use dev->data and dev->config
instead.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Wealian Liao 3565f71a72 drivers: npcx: Correct the macro parentheses
This corrects the following:
1. The priority of type cast is lower than member access. So don't need
the redundant parentheses.
2. The macro should be added to the parentheses.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2022-01-28 10:06:05 +01:00
Gerard Marull-Paretas 8398105d82 drivers: fix style issues
Fix issues reported by checkpatch.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas ee434ebdee drivers: watchdog: drop get_dev_data/get_dev_config usage
Replace all get_dev_data()/get_dev_config() accessor utilities with
dev->data and dev->config.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Gerard Marull-Paretas b00150339a drivers: watchdog: drop DEV_DATA/DEV_CFG usage
Stop using redundant DEV_DATA/DEV_CFG macros and use dev->data and
dev->config instead.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-01-19 18:16:02 +01:00
Ruibin Chang 40bb3d808a ITE drivers/watchdog: cleanup it8xxx2 watchdog driver
Stop using DRV_CONFIG, DRV_DATA, DRV_REG macros.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-18 12:14:26 -05:00
Ruibin Chang 1a11a3362e ITE drivers/watchdog: support tests/drivers/watchdog/wdt_basic_api
Add watchdog0 to support tests/drivers/watchdog/wdt_basic_api.

Solve tests code runtime error on it8xxx2_evb:

1.When run the wdt tests api, we shouldn't reduce the warning
timer time, so I add config WDT_ITE_REDUCE_WARNING_LEADING_TIME,
this config will be enabled only on platform EC.

2.Upper limit window timeouts can't be 0 when we install timeout.

3.Since we support wdt_it8xxx2_disable(), then we should support
flag WDT_OPT_PAUSE_HALTED_BY_DBG, too. Watchdog can be stopped
by IT8XXX2_WDT_EWDSCEN bit of ETWCTRL reg.

Signed-off-by: Ruibin Chang <Ruibin.Chang@ite.com.tw>
2022-01-18 12:14:26 -05: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
Francois Ramu 701d6bd087 drivers: watchdog: stm32G0 window watchdog during debug
This commit is enabling the Debug support clock
like the stm32L0 or F0, the APB peripheral clock enable register 1
has a bit to clock DBGMCU before use.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Francois Ramu 4145c83c82 drivers: watchdog: stm32MP1 window watchdog during debug
This commit is controlling the WWDG during the Stop mode in debug.
WWDG1 is frozen while the core is in Debug mode, setting the bit
of the DBGMCU APB1 peripheral freeze register (DBGMCU_APB1FZ2)
for the stm32MP1 soc devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Francois Ramu 0d84e7b2bc drivers: watchdog: stm32H7 window watchdog during debug
This commit is controlling the WWDG during the Stop mode in debug.
WWDG1 is frozen while the core is in Debug mode, setting the bit
of the DBGMCU APB3 peripheral freeze register (DBGMCU_APB3FZ1)
for the stm32H7 soc devices.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2021-11-29 18:26:47 -05:00
Felipe Neves 857a188c76 drivers: watchdog: esp32: enabled esp32c3
support for the unified esp32 wdt driver.

Signed-off-by: Felipe Neves <felipe.neves@espressif.com>
2021-11-08 10:56:28 -05:00
Krzysztof Chruscinski 9174cd8dbc drivers: watchdog: Add software watchdog based on counter
Added watchdog implementation which is using counter device
to implement watchdog driver API. Watchdog timeout is called from
counter interrupt context. Some counter implementations support
using ZLI interrupt level which can be use here as well. Watchdog
like this can be used along hardware watchdog to cover for its
limitations, i.e. Nordic watchdog resets unconditionally after
62uS after triggering watchdog interrupt. It is not enough time
to dump logging data.

Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
2021-11-02 13:22:58 +01:00
Pavlo Hamov 39d6d0db4e drivers: watchdog: esp32s2 add support
Add support of esp32s2 WDT1 & WDT2 using base esp32 driver

Use dts to determine WDT driver state

Signed-off-by: Pavlo Hamov <p.hamov@venstar.com>
2021-10-13 10:14:35 -04:00
Nick Ward ecbfc1172a drivers: watchdog: fix missing stm32 LOG_LEVEL macro
Without this a user can't enable logging for the STM32 wdt driver.

Signed-off-by: Nick Ward <nick.ward@setec.com.au>
2021-09-10 10:57:57 -04:00
Ruibin Chang 2877bdcdfe ITE drivers/watchdog: reduce interval of warning timer
Reduce interval of warning timer, so we can print more
warning messages (ex. MEPC, task ID...) before watchdog reset.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-08-24 07:31:08 -04:00
Daniel Leung 94514726b2 drivers: watchdog: build as static library
Instead of putting object files inside libzephyr.a,
simply build a separate static library as most other
driver types are doing this already.

Signed-off-by: Daniel Leung <daniel.leung@intel.com>
2021-08-17 06:06:03 -04:00
David Leach bdd536a09e watchdog: add watchdog driver support to mimxrt685 platform
Add watchdog support to the mimxrt685 platform.

The mimxrt685 platform is excluded from the watchdog
test case because the test case uses variables in the
noinit section that need to be retained through a reset
but the rt685 does not retain this memory through a
reset.

Signed-off-by: David Leach <david.leach@nxp.com>
2021-08-02 13:21:20 -05:00
Glauber Maroto Ferreira 0cf0830ead esp32: drivers: interrupt_controller: review WDT interrupt usage
Review WDT interrupt allocation usage.

Signed-off-by: Glauber Maroto Ferreira <glauber.ferreira@espressif.com>
2021-07-16 07:19:28 -04:00
Ruibin Chang d45668480a ITE driver/watchdog: add watchdog timer for it8xxx2
Add watchdog timer for it8xxx2.

Signed-off-by: Ruibin Chang <ruibin.chang@ite.com.tw>
2021-06-18 11:21:53 +02:00
Gerard Marull-Paretas f163bdb280 power: move reboot functionality to os lib
Reboot functionality has nothing to do with PM, so move it out to the
subsys/os folder.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 20:34:00 -04:00
Gerard Marull-Paretas 942cb4ea81 drivers: watchdog: wdt_esp32: fix coding style issues
Some lines were unnecessarily > 100 columns. They produced compliance
failures.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 12:25:39 -04: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
Mulin Chao 1a2e59b2e9 driver: wdt: npcx: replace critical sections with timeout mechanism.
TWDT0 is loaded with a new value and the counter restarts counting with
it by written RST bit in Timer Control register (T0CSR) to 1. Then, the
RST bit in T0CSR register is cleared automatically on the 2nd rising
edge of T0IN clock. Since TWCP is set to 1:32, the maximum time that RST
bit is unset is 32 * (1 / 32768) ~= 980us.

Polling this bit within a critical section in current npcx watchdog
driver isn't a good approach since it might block the other interrupts
need to service them in time. This CL introduces a timeout mechanism and
removes the critical section to improve this disadvantage. Consider the
clock tolerance, 2 ms is a suitable timeout value for RST bit. We also
remove polling for WD_RUN bit in T0CSR. Npcx watchdog needs serval LFCLK
(32k Hz) clocks to stop watchdog. 1 ms is long enough for the timeout
mechanism.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-23 15:03:15 -05:00
Mulin Chao 13b9f8aa52 driver: wdt: npcx: correct the drawing of npcx watchdog module.
The source clock of the watchdog module is selected to the input of T0
timer, not output. Correct the drawing in case confusing the users.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-04-09 14:50:37 -04:00
Wealian Liao 7b7129ba9f driver: wdt: npcx: Remove watchdog reset waiting loop in ISR
NPCX watchdog driver has a WDT_NPCX_DELAY_CYCLES for delay the watchdog
reset time after the watchdog timeout. For some systems, users would
like to use the watchdog timeout ISR but don't reset the chip
immediately. Let the system have the final chance to ongoing the system
before the real hardware reset time. Removing the watchdog reset
waiting loop in ISR lets users decide whether wait for watchdog reset
by themself.

Signed-off-by: Wealian Liao <WHLIAO@nuvoton.com>
2021-04-09 14:50:05 -04:00
Thomas Stranger 980fb6c0df drivers/watchdog: wwdg stm32: fix to support all available prescalers
As older series supported only 4 different prescaler values the
highest prescaler value was hardcoded. Newer series support 8
programmable prescaler values, therefore take the allowed values from
ll_wwdg header file.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-09 13:23:38 +02:00
Thomas Stranger e85b929cc6 drivers/watchdog: wwdg stm32: fix prescaler setup for newer series.
Series STM32G0, STM32G4, STM32H7, STM32L5, STM32WB, STM32WL have
a newer wwdg ip and store the prescaler value not in bits[8:7],
but bits bits[13:11], use the definitions from ll to account for that.

Remove IS_WWDG_PRESCALER, this is not required as the prescaler
is not calculated, but known valid prescaler values are tested until a
valid counter is found.

Signed-off-by: Thomas Stranger <thomas.stranger@outlook.com>
2021-04-09 13:23:38 +02:00
Christian Taedcke ebcc316e1c drivers: watchdog: mcux_wwdt: fix validating window min vs max
The comparison was inverted before so configuring a valid window
providing min and max was not possible.

Now the comparison is corrected and only done if the watchdog is used in
windowed mode.

Signed-off-by: Christian Taedcke <christian.taedcke@lemonbeat.com>
2021-03-31 14:15:27 -05:00