From fb713aa062bf3e78ef235a1f8409175ba9d90ea8 Mon Sep 17 00:00:00 2001 From: Ioannis Glaropoulos Date: Wed, 15 May 2019 09:51:21 +0200 Subject: [PATCH] soc: arm: move z_clearfaults() in kernel_arch_init() In kernel_arch_init() we initialize the ARM core (interrupt setup, fault init, etc.) so we can also move z_clearfaults() in the same function and skip invoking it in the SoC init functions. Signed-off-by: Ioannis Glaropoulos --- arch/arm/include/kernel_arch_func.h | 1 + soc/arm/atmel_sam/sam3x/soc.c | 2 -- soc/arm/atmel_sam/sam4s/soc.c | 3 --- soc/arm/atmel_sam/same70/soc.c | 3 --- soc/arm/atmel_sam0/common/soc_samd2x.c | 2 -- soc/arm/microchip_mec/mec1501/soc.c | 2 -- soc/arm/nordic_nrf/nrf52/soc.c | 2 -- soc/arm/nordic_nrf/nrf91/soc.c | 2 -- soc/arm/nxp_imx/mcimx6x_m4/soc.c | 2 -- soc/arm/nxp_imx/rt/soc.c | 2 -- soc/arm/nxp_kinetis/k6x/soc.c | 2 -- soc/arm/nxp_kinetis/ke1xf/soc.c | 2 -- soc/arm/nxp_kinetis/kwx/soc_kw2xd.c | 2 -- soc/arm/nxp_lpc/lpc54xxx/soc.c | 2 -- soc/arm/silabs_exx32/common/soc.c | 2 -- soc/arm/st_stm32/stm32f0/soc.c | 2 -- soc/arm/st_stm32/stm32f1/soc.c | 2 -- soc/arm/st_stm32/stm32f2/soc.c | 2 -- soc/arm/st_stm32/stm32f3/soc.c | 2 -- soc/arm/st_stm32/stm32f4/soc.c | 2 -- soc/arm/st_stm32/stm32f7/soc.c | 2 -- soc/arm/st_stm32/stm32l0/soc.c | 2 -- soc/arm/st_stm32/stm32l1/soc.c | 2 -- soc/arm/st_stm32/stm32l4/soc.c | 2 -- soc/arm/st_stm32/stm32mp1/soc.c | 2 -- soc/arm/st_stm32/stm32wb/soc.c | 2 -- 26 files changed, 1 insertion(+), 52 deletions(-) diff --git a/arch/arm/include/kernel_arch_func.h b/arch/arm/include/kernel_arch_func.h index c2936329eba..e23c28a1d0b 100644 --- a/arch/arm/include/kernel_arch_func.h +++ b/arch/arm/include/kernel_arch_func.h @@ -40,6 +40,7 @@ static ALWAYS_INLINE void kernel_arch_init(void) z_ExcSetup(); z_FaultInit(); z_CpuIdleInit(); + z_clearfaults(); } static ALWAYS_INLINE void diff --git a/soc/arm/atmel_sam/sam3x/soc.c b/soc/arm/atmel_sam/sam3x/soc.c index 9bcaad2b95f..6a04b348031 100644 --- a/soc/arm/atmel_sam/sam3x/soc.c +++ b/soc/arm/atmel_sam/sam3x/soc.c @@ -209,8 +209,6 @@ static int atmel_sam3x_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* * Set FWS (Flash Wait State) value before increasing Master Clock * (MCK) frequency. diff --git a/soc/arm/atmel_sam/sam4s/soc.c b/soc/arm/atmel_sam/sam4s/soc.c index 6bc8d7233f9..ec431179c56 100644 --- a/soc/arm/atmel_sam/sam4s/soc.c +++ b/soc/arm/atmel_sam/sam4s/soc.c @@ -196,9 +196,6 @@ static int atmel_sam4s_init(struct device *arg) key = irq_lock(); - /* Clear all faults. */ - z_clearfaults(); - /* * Set FWS (Flash Wait State) value before increasing Master Clock * (MCK) frequency. Look at table 44.73 in the SAM4S datasheet. diff --git a/soc/arm/atmel_sam/same70/soc.c b/soc/arm/atmel_sam/same70/soc.c index e2fb3549a70..3da8cc9fbf0 100644 --- a/soc/arm/atmel_sam/same70/soc.c +++ b/soc/arm/atmel_sam/same70/soc.c @@ -237,9 +237,6 @@ static int atmel_same70_init(struct device *arg) SCB_EnableDCache(); } - /* Clear all faults */ - z_clearfaults(); - /* * Set FWS (Flash Wait State) value before increasing Master Clock * (MCK) frequency. diff --git a/soc/arm/atmel_sam0/common/soc_samd2x.c b/soc/arm/atmel_sam0/common/soc_samd2x.c index 89404e6fbc0..4c9db13b097 100644 --- a/soc/arm/atmel_sam0/common/soc_samd2x.c +++ b/soc/arm/atmel_sam0/common/soc_samd2x.c @@ -180,8 +180,6 @@ static int atmel_samd_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - flash_waitstates_init(); osc8m_init(); osc32k_init(); diff --git a/soc/arm/microchip_mec/mec1501/soc.c b/soc/arm/microchip_mec/mec1501/soc.c index e9748b3a742..b13986b8e70 100644 --- a/soc/arm/microchip_mec/mec1501/soc.c +++ b/soc/arm/microchip_mec/mec1501/soc.c @@ -136,8 +136,6 @@ static int soc_init(struct device *dev) isave = __get_PRIMASK(); __disable_irq(); - z_clearfaults(); - soc_pcr_init(); soc_clk32_init(); diff --git a/soc/arm/nordic_nrf/nrf52/soc.c b/soc/arm/nordic_nrf/nrf52/soc.c index ba96a200f9e..c09adafbb72 100644 --- a/soc/arm/nordic_nrf/nrf52/soc.c +++ b/soc/arm/nordic_nrf/nrf52/soc.c @@ -71,8 +71,6 @@ static int nordicsemi_nrf52_init(struct device *arg) nrf_power_dcdcen_set(true); #endif - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/nordic_nrf/nrf91/soc.c b/soc/arm/nordic_nrf/nrf91/soc.c index 72a53db8b02..b4bdebe362b 100644 --- a/soc/arm/nordic_nrf/nrf91/soc.c +++ b/soc/arm/nordic_nrf/nrf91/soc.c @@ -50,8 +50,6 @@ static int nordicsemi_nrf91_init(struct device *arg) NRF_NVMC->ICACHECNF = NVMC_ICACHECNF_CACHEEN_Msk; #endif - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/nxp_imx/mcimx6x_m4/soc.c b/soc/arm/nxp_imx/mcimx6x_m4/soc.c index f22e1699329..ee6425fa79e 100644 --- a/soc/arm/nxp_imx/mcimx6x_m4/soc.c +++ b/soc/arm/nxp_imx/mcimx6x_m4/soc.c @@ -187,8 +187,6 @@ static int mcimx6x_m4_init(struct device *arg) /* Initialize Cache */ SOC_CacheInit(); - z_clearfaults(); - /* Initialize clock */ SOC_ClockInit(); diff --git a/soc/arm/nxp_imx/rt/soc.c b/soc/arm/nxp_imx/rt/soc.c index 71e21a590c4..c86991f7cb7 100644 --- a/soc/arm/nxp_imx/rt/soc.c +++ b/soc/arm/nxp_imx/rt/soc.c @@ -235,8 +235,6 @@ static int imxrt_init(struct device *arg) SCB_EnableDCache(); } - z_clearfaults(); - /* Initialize system clock */ clkInit(); diff --git a/soc/arm/nxp_kinetis/k6x/soc.c b/soc/arm/nxp_kinetis/k6x/soc.c index 179ec6667e8..f327fc046c8 100644 --- a/soc/arm/nxp_kinetis/k6x/soc.c +++ b/soc/arm/nxp_kinetis/k6x/soc.c @@ -180,8 +180,6 @@ static int fsl_frdm_k64f_init(struct device *arg) SYSMPU->CESR = temp_reg; #endif /* !CONFIG_ARM_MPU */ - z_clearfaults(); - /* Initialize PLL/system clock to 120 MHz */ clkInit(); diff --git a/soc/arm/nxp_kinetis/ke1xf/soc.c b/soc/arm/nxp_kinetis/ke1xf/soc.c index 818f3c147a5..6155c9fe446 100644 --- a/soc/arm/nxp_kinetis/ke1xf/soc.c +++ b/soc/arm/nxp_kinetis/ke1xf/soc.c @@ -232,8 +232,6 @@ static int ke1xf_init(struct device *arg) SYSMPU->CESR = temp_reg; #endif /* !CONFIG_ARM_MPU */ - z_clearfaults(); - /* Initialize system clocks and PLL */ clk_init(); diff --git a/soc/arm/nxp_kinetis/kwx/soc_kw2xd.c b/soc/arm/nxp_kinetis/kwx/soc_kw2xd.c index 9c7962e8ec4..21c03a676f1 100644 --- a/soc/arm/nxp_kinetis/kwx/soc_kw2xd.c +++ b/soc/arm/nxp_kinetis/kwx/soc_kw2xd.c @@ -189,8 +189,6 @@ static int kw2xd_init(struct device *arg) /* release I/O power hold to allow normal run state */ PMC->REGSC |= PMC_REGSC_ACKISO_MASK; - z_clearfaults(); - /* Initialize PLL/system clock to 48 MHz */ clkInit(); diff --git a/soc/arm/nxp_lpc/lpc54xxx/soc.c b/soc/arm/nxp_lpc/lpc54xxx/soc.c index ee526d8532d..354094ce899 100644 --- a/soc/arm/nxp_lpc/lpc54xxx/soc.c +++ b/soc/arm/nxp_lpc/lpc54xxx/soc.c @@ -87,8 +87,6 @@ static int nxp_lpc54114_init(struct device *arg) /* disable interrupts */ oldLevel = irq_lock(); - z_clearfaults(); - /* Initialize FRO/system clock to 48 MHz */ clkInit(); diff --git a/soc/arm/silabs_exx32/common/soc.c b/soc/arm/silabs_exx32/common/soc.c index 24d83347343..447e9f272e6 100644 --- a/soc/arm/silabs_exx32/common/soc.c +++ b/soc/arm/silabs_exx32/common/soc.c @@ -119,8 +119,6 @@ static int silabs_exx32_init(struct device *arg) /* handle chip errata */ CHIP_Init(); - z_clearfaults(); - #ifdef CONFIG_SOC_GECKO_EMU_DCDC dcdc_init(); #endif diff --git a/soc/arm/st_stm32/stm32f0/soc.c b/soc/arm/st_stm32/stm32f0/soc.c index b652909816e..902b44ac231 100644 --- a/soc/arm/st_stm32/stm32f0/soc.c +++ b/soc/arm/st_stm32/stm32f0/soc.c @@ -62,8 +62,6 @@ static int stm32f0_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32f1/soc.c b/soc/arm/st_stm32/stm32f1/soc.c index 714eb3b0c1a..aa83f741b70 100644 --- a/soc/arm/st_stm32/stm32f1/soc.c +++ b/soc/arm/st_stm32/stm32f1/soc.c @@ -30,8 +30,6 @@ static int stm32f1_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32f2/soc.c b/soc/arm/st_stm32/stm32f2/soc.c index 78fbc782143..61dd4421df8 100644 --- a/soc/arm/st_stm32/stm32f2/soc.c +++ b/soc/arm/st_stm32/stm32f2/soc.c @@ -34,8 +34,6 @@ static int stm32f2_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32f3/soc.c b/soc/arm/st_stm32/stm32f3/soc.c index 042d31c55fe..f70d15e4613 100644 --- a/soc/arm/st_stm32/stm32f3/soc.c +++ b/soc/arm/st_stm32/stm32f3/soc.c @@ -30,8 +30,6 @@ static int stm32f3_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32f4/soc.c b/soc/arm/st_stm32/stm32f4/soc.c index 952efbd2095..335090870a6 100644 --- a/soc/arm/st_stm32/stm32f4/soc.c +++ b/soc/arm/st_stm32/stm32f4/soc.c @@ -31,8 +31,6 @@ static int st_stm32f4_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32f7/soc.c b/soc/arm/st_stm32/stm32f7/soc.c index 2e6a711008a..f93d9b6be23 100644 --- a/soc/arm/st_stm32/stm32f7/soc.c +++ b/soc/arm/st_stm32/stm32f7/soc.c @@ -37,8 +37,6 @@ static int st_stm32f7_init(struct device *arg) SCB_EnableDCache(); } - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32l0/soc.c b/soc/arm/st_stm32/stm32l0/soc.c index 2cce2a7f135..fe8619dc7ec 100644 --- a/soc/arm/st_stm32/stm32l0/soc.c +++ b/soc/arm/st_stm32/stm32l0/soc.c @@ -32,8 +32,6 @@ static int stm32l0_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32l1/soc.c b/soc/arm/st_stm32/stm32l1/soc.c index 543e753ab92..ef08ec698f2 100644 --- a/soc/arm/st_stm32/stm32l1/soc.c +++ b/soc/arm/st_stm32/stm32l1/soc.c @@ -32,8 +32,6 @@ static int stm32l1_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32l4/soc.c b/soc/arm/st_stm32/stm32l4/soc.c index 01ffd2844ab..45f3e7b865f 100644 --- a/soc/arm/st_stm32/stm32l4/soc.c +++ b/soc/arm/st_stm32/stm32l4/soc.c @@ -31,8 +31,6 @@ static int stm32l4_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32mp1/soc.c b/soc/arm/st_stm32/stm32mp1/soc.c index aa1f74d67b5..870b1052a7e 100644 --- a/soc/arm/st_stm32/stm32mp1/soc.c +++ b/soc/arm/st_stm32/stm32mp1/soc.c @@ -32,8 +32,6 @@ static int stm32m4_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */ diff --git a/soc/arm/st_stm32/stm32wb/soc.c b/soc/arm/st_stm32/stm32wb/soc.c index ae4de3e40ca..359389bee29 100644 --- a/soc/arm/st_stm32/stm32wb/soc.c +++ b/soc/arm/st_stm32/stm32wb/soc.c @@ -30,8 +30,6 @@ static int stm32wb_init(struct device *arg) key = irq_lock(); - z_clearfaults(); - /* Install default handler that simply resets the CPU * if configured in the kernel, NOP otherwise */