Skip to content

Commit ccc26a5

Browse files
hfakkizfabiobaltieri
authored andcommitted
drivers: watchdog: Update driver to enable WDT for MAX32650 SoC
This commit changes clock property of watchdog to optional and updates driver according to this change. Signed-off-by: Furkan Akkiz <hasanfurkan.akkiz@analog.com>
1 parent 46ab3b4 commit ccc26a5

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

drivers/watchdog/wdt_max32.c

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,9 +219,11 @@ static int wdt_max32_init(const struct device *dev)
219219
mxc_wdt_regs_t *regs = cfg->regs;
220220

221221
/* Enable clock */
222-
ret = clock_control_on(cfg->clock, (clock_control_subsys_t)&cfg->perclk);
223-
if (ret) {
224-
return ret;
222+
if (cfg->clock != NULL) {
223+
ret = clock_control_on(cfg->clock, (clock_control_subsys_t)&cfg->perclk);
224+
if (ret) {
225+
return ret;
226+
}
225227
}
226228

227229
ret = Wrap_MXC_WDT_SelectClockSource(regs, cfg->perclk.clk_src);
@@ -259,11 +261,11 @@ static DEVICE_API(wdt, max32_wdt_api) = {
259261
static struct max32_wdt_data max32_wdt_data##_num; \
260262
static const struct max32_wdt_config max32_wdt_config##_num = { \
261263
.regs = (mxc_wdt_regs_t *)DT_INST_REG_ADDR(_num), \
262-
.clock = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(_num)), \
264+
.clock = DEVICE_DT_GET_OR_NULL(DT_INST_CLOCKS_CTLR(_num)), \
263265
.perclk.clk_src = \
264266
DT_INST_PROP_OR(_num, clock_source, ADI_MAX32_PRPH_CLK_SRC_PCLK), \
265-
.perclk.bus = DT_INST_CLOCKS_CELL(_num, offset), \
266-
.perclk.bit = DT_INST_CLOCKS_CELL(_num, bit), \
267+
.perclk.bus = DT_PHA_BY_IDX_OR(DT_DRV_INST(_num), clocks, 0, offset, 0), \
268+
.perclk.bit = DT_PHA_BY_IDX_OR(DT_DRV_INST(_num), clocks, 0, bit, 0), \
267269
.irq_func = &wdt_max32_irq_init_##_num, \
268270
}; \
269271
DEVICE_DT_INST_DEFINE(_num, wdt_max32_init, NULL, &max32_wdt_data##_num, \

dts/bindings/watchdog/adi,max32-watchdog.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@ properties:
1111
reg:
1212
required: true
1313

14-
clocks:
15-
required: true
16-
1714
clock-source:
1815
type: int
1916
enum: [0, 1, 2, 3, 4, 5]

0 commit comments

Comments
 (0)