From 9523f792da52ab8bbc65168951371f3672c51bf3 Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 28 Jan 2020 22:39:57 +0100 Subject: [PATCH] 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 --- soc/arm/nxp_kinetis/kwx/Kconfig.soc | 4 ++-- soc/arm/nxp_kinetis/kwx/soc_kw4xz.c | 9 ++++++--- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/soc/arm/nxp_kinetis/kwx/Kconfig.soc b/soc/arm/nxp_kinetis/kwx/Kconfig.soc index a5cad9fab1e..35cf3a0a9d1 100644 --- a/soc/arm/nxp_kinetis/kwx/Kconfig.soc +++ b/soc/arm/nxp_kinetis/kwx/Kconfig.soc @@ -111,6 +111,8 @@ config KW2XD_FLASH_CLOCK_DIVIDER This option specifies the divide value for the KW2xD flash clock from the system clock. +endif # SOC_MKW24D5 || SOC_MKW22D5 + config WDOG_INIT def_bool y help @@ -118,6 +120,4 @@ config WDOG_INIT upon reset. Therefore, this requires that the watchdog be configured during reset handling. -endif # SOC_MKW24D5 || SOC_MKW22D5 - endif # SOC_SERIES_KINETIS_KWX diff --git a/soc/arm/nxp_kinetis/kwx/soc_kw4xz.c b/soc/arm/nxp_kinetis/kwx/soc_kw4xz.c index 921d6bcd139..3d815b6b599 100644 --- a/soc/arm/nxp_kinetis/kwx/soc_kw4xz.c +++ b/soc/arm/nxp_kinetis/kwx/soc_kw4xz.c @@ -80,9 +80,6 @@ static int kwx_init(struct device *arg) /* disable interrupts */ oldLevel = irq_lock(); - /* Disable the watchdog */ - SIM->COPC = 0; - /* Initialize system clock to 40 MHz */ clock_init(); @@ -97,4 +94,10 @@ static int kwx_init(struct device *arg) return 0; } +void z_arm_watchdog_init(void) +{ + /* Disable the watchdog */ + SIM->COPC = 0; +} + SYS_INIT(kwx_init, PRE_KERNEL_1, 0);