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

Move the NXP Kinetis KW4xZ watchdog initialization code to
z_arm_watchdog_init() and make it optional based on CONFIG_WDOG_INIT.

This brings the KW4xZ 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-28 22:39:57 +01:00 committed by Maureen Helm
commit 9523f792da
2 changed files with 8 additions and 5 deletions

View file

@ -111,6 +111,8 @@ config KW2XD_FLASH_CLOCK_DIVIDER
This option specifies the divide value for the KW2xD flash clock from This option specifies the divide value for the KW2xD flash clock from
the system clock. the system clock.
endif # SOC_MKW24D5 || SOC_MKW22D5
config WDOG_INIT config WDOG_INIT
def_bool y def_bool y
help help
@ -118,6 +120,4 @@ config WDOG_INIT
upon reset. Therefore, this requires that the watchdog be configured upon reset. Therefore, this requires that the watchdog be configured
during reset handling. during reset handling.
endif # SOC_MKW24D5 || SOC_MKW22D5
endif # SOC_SERIES_KINETIS_KWX endif # SOC_SERIES_KINETIS_KWX

View file

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