Skip to content

Commit

Permalink
soc: nxp: kinetis: kl2x: move watchdog init to z_arm_watchdog_init
Browse files Browse the repository at this point in the history
Move the NXP Kinetis KL2x watchdog initialization code to
z_arm_watchdog_init() and make it optional based on
CONFIG_WDOG_INIT.

This brings the KL2x in line with the other NXP Kinetis series SoC
implementations.

Signed-off-by: Henrik Brix Andersen <[email protected]>
  • Loading branch information
henrikbrixandersen authored and MaureenHelm committed Jan 29, 2020
1 parent 971c27a commit f9f7379
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
8 changes: 8 additions & 0 deletions soc/arm/nxp_kinetis/kl2x/Kconfig.soc
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,12 @@ config SOC_PART_NUMBER_KINETIS_KL2X
that you should not set directly. The part number selection choice defines
the default value for this string.

config WDOG_INIT
def_bool y
help
This processor enables the watchdog timer with a short
window for configuration upon reset. Therefore, this
requires that the watchdog be configured during reset
handling.

endif # SOC_SERIES_KINETIS_KL2X
9 changes: 6 additions & 3 deletions soc/arm/nxp_kinetis/kl2x/soc.c
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,6 @@ static int kl2x_init(struct device *arg)
/* disable interrupts */
oldLevel = irq_lock();

/* Disable the watchdog */
SIM->COPC = 0;

/* Initialize system clock to 48 MHz */
clock_init();

Expand All @@ -98,4 +95,10 @@ static int kl2x_init(struct device *arg)
return 0;
}

void z_arm_watchdog_init(void)
{
/* Disable the watchdog */
SIM->COPC = 0;
}

SYS_INIT(kl2x_init, PRE_KERNEL_1, 0);

0 comments on commit f9f7379

Please sign in to comment.