soc: nxp: kinetis: kl2x: move watchdog init to z_arm_watchdog_init

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 <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2020-01-25 23:25:14 +01:00 committed by Maureen Helm
commit f9f7379549
2 changed files with 14 additions and 3 deletions

View file

@ -77,4 +77,12 @@ config SOC_PART_NUMBER_KINETIS_KL2X
that you should not set directly. The part number selection choice defines that you should not set directly. The part number selection choice defines
the default value for this string. 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 endif # SOC_SERIES_KINETIS_KL2X

View file

@ -81,9 +81,6 @@ static int kl2x_init(struct device *arg)
/* disable interrupts */ /* disable interrupts */
oldLevel = irq_lock(); oldLevel = irq_lock();
/* Disable the watchdog */
SIM->COPC = 0;
/* Initialize system clock to 48 MHz */ /* Initialize system clock to 48 MHz */
clock_init(); clock_init();
@ -98,4 +95,10 @@ static int kl2x_init(struct device *arg)
return 0; return 0;
} }
void z_arm_watchdog_init(void)
{
/* Disable the watchdog */
SIM->COPC = 0;
}
SYS_INIT(kl2x_init, PRE_KERNEL_1, 0); SYS_INIT(kl2x_init, PRE_KERNEL_1, 0);