drivers: watchdog: gecko: Add support for Gecko Series 2 SoC
The EFR32MG21 uses a different kind of clock for watchdogs. It requires an additional peripheral-id parameter in the dts to get the proper clock as it is based on the watchdog's ID i.e., cmuClock_WDOG#. Signed-off-by: Steven Lemaire <steven.lemaire@zii.aero>
This commit is contained in:
parent
36dc92601b
commit
fc64f2c522
6 changed files with 26 additions and 1 deletions
|
@ -15,6 +15,13 @@
|
|||
#include <logging/log.h>
|
||||
LOG_MODULE_REGISTER(wdt_gecko, CONFIG_WDT_LOG_LEVEL);
|
||||
|
||||
#ifdef cmuClock_CORELE
|
||||
#define CLOCK_DEF(id) cmuClock_CORELE
|
||||
#else
|
||||
#define CLOCK_DEF(id) cmuClock_WDOG##id
|
||||
#endif /* cmuClock_CORELE */
|
||||
#define CLOCK_ID(id) CLOCK_DEF(id)
|
||||
|
||||
/* Defines maximum WDOG_CTRL.PERSEL value which is used by the watchdog module
|
||||
* to select its timeout period.
|
||||
*/
|
||||
|
@ -23,6 +30,7 @@ LOG_MODULE_REGISTER(wdt_gecko, CONFIG_WDT_LOG_LEVEL);
|
|||
/* Device constant configuration parameters */
|
||||
struct wdt_gecko_cfg {
|
||||
WDOG_TypeDef *base;
|
||||
CMU_Clock_TypeDef clock;
|
||||
void (*irq_cfg_func)(void);
|
||||
};
|
||||
|
||||
|
@ -251,8 +259,12 @@ static int wdt_gecko_init(struct device *dev)
|
|||
/* Enable ULFRCO (1KHz) oscillator */
|
||||
CMU_OscillatorEnable(cmuOsc_ULFRCO, true, false);
|
||||
|
||||
#if !defined(_SILICON_LABS_32B_SERIES_2)
|
||||
/* Ensure LE modules are clocked */
|
||||
CMU_ClockEnable(cmuClock_CORELE, true);
|
||||
CMU_ClockEnable(config->clock, true);
|
||||
#else
|
||||
CMU_ClockSelectSet(config->clock, cmuSelect_ULFRCO);
|
||||
#endif
|
||||
|
||||
/* Enable IRQs */
|
||||
config->irq_cfg_func();
|
||||
|
@ -276,6 +288,7 @@ static const struct wdt_driver_api wdt_gecko_driver_api = {
|
|||
static const struct wdt_gecko_cfg wdt_gecko_cfg_##index = { \
|
||||
.base = (WDOG_TypeDef *) \
|
||||
DT_INST_REG_ADDR(index),\
|
||||
.clock = CLOCK_ID(DT_INST_PROP(index, peripheral_id)), \
|
||||
.irq_cfg_func = wdt_gecko_cfg_func_##index, \
|
||||
}; \
|
||||
static struct wdt_gecko_data wdt_gecko_data_##index; \
|
||||
|
|
|
@ -229,6 +229,7 @@
|
|||
wdog0: wdog@40052000 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052000 0x2C>;
|
||||
peripheral-id = <0>;
|
||||
label = "WDOG0";
|
||||
interrupts = <2 0>;
|
||||
status = "disabled";
|
||||
|
@ -237,6 +238,7 @@
|
|||
wdog1: wdog@40052400 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052400 0x2C>;
|
||||
peripheral-id = <1>;
|
||||
label = "WDOG1";
|
||||
interrupts = <3 0>;
|
||||
status = "disabled";
|
||||
|
|
|
@ -182,6 +182,7 @@
|
|||
wdog0: wdog@40052000 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052000 0x2C>;
|
||||
peripheral-id = <0>;
|
||||
label = "WDOG0";
|
||||
interrupts = <2 0>;
|
||||
status = "disabled";
|
||||
|
@ -190,6 +191,7 @@
|
|||
wdog1: wdog@40052400 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052400 0x2C>;
|
||||
peripheral-id = <1>;
|
||||
label = "WDOG1";
|
||||
interrupts = <3 0>;
|
||||
status = "disabled";
|
||||
|
|
|
@ -167,6 +167,7 @@
|
|||
wdog0: wdog@40052000 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052000 0x2C>;
|
||||
peripheral-id = <0>;
|
||||
label = "WDOG0";
|
||||
interrupts = <2 0>;
|
||||
status = "disabled";
|
||||
|
|
|
@ -219,6 +219,7 @@
|
|||
wdog0: wdog@40052000 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052000 0x2C>;
|
||||
peripheral-id = <0>;
|
||||
label = "WDOG0";
|
||||
interrupts = <2 0>;
|
||||
status = "disabled";
|
||||
|
@ -227,6 +228,7 @@
|
|||
wdog1: wdog@40052400 {
|
||||
compatible = "silabs,gecko-wdog";
|
||||
reg = <0x40052400 0x2C>;
|
||||
peripheral-id = <1>;
|
||||
label = "WDOG1";
|
||||
interrupts = <3 0>;
|
||||
status = "disabled";
|
||||
|
|
|
@ -17,3 +17,8 @@ properties:
|
|||
|
||||
interrupts:
|
||||
required: true
|
||||
|
||||
peripheral-id:
|
||||
type: int
|
||||
description: peripheral ID
|
||||
required: true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue