From 41634c82cc0338a1aa47e63e5a8b6c1b6e265d06 Mon Sep 17 00:00:00 2001 From: Maureen Helm Date: Fri, 11 Mar 2022 16:25:41 -0600 Subject: [PATCH] drivers: interrupt_controller: Refactor drivers to use shared init prio Refactors interrupt controller drivers to use the shared driver class initialization priority configuration, CONFIG_INTC_INIT_PRIORITY, to allow configuring interrupt controller drivers separately from other devices. This is similar to other driver classes. The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEFAULT to preserve the existing default initialization priority for most drivers. Signed-off-by: Maureen Helm --- drivers/interrupt_controller/Kconfig | 6 ++++++ drivers/interrupt_controller/intc_exti_stm32.c | 2 +- drivers/interrupt_controller/intc_gd32_exti.c | 2 +- drivers/interrupt_controller/intc_gic.c | 2 +- drivers/interrupt_controller/intc_gicv3.c | 2 +- drivers/interrupt_controller/intc_gicv3_its.c | 2 +- drivers/interrupt_controller/intc_ioapic.c | 2 +- drivers/interrupt_controller/intc_irqmp.c | 2 +- drivers/interrupt_controller/intc_loapic.c | 2 +- drivers/interrupt_controller/intc_mchp_ecia_xec.c | 4 ++-- drivers/interrupt_controller/intc_miwu.c | 2 +- drivers/interrupt_controller/intc_nuclei_eclic.c | 2 +- drivers/interrupt_controller/intc_plic.c | 2 +- drivers/interrupt_controller/intc_sam0_eic.c | 2 +- drivers/interrupt_controller/intc_swerv_pic.c | 2 +- drivers/interrupt_controller/intc_vexriscv_litex.c | 2 +- 16 files changed, 22 insertions(+), 16 deletions(-) diff --git a/drivers/interrupt_controller/Kconfig b/drivers/interrupt_controller/Kconfig index bbabc355356..3560ddee9fe 100644 --- a/drivers/interrupt_controller/Kconfig +++ b/drivers/interrupt_controller/Kconfig @@ -45,6 +45,12 @@ config LEON_IRQMP help GRLIB IRQMP and IRQAMP +config INTC_INIT_PRIORITY + int "Interrupt controller init priority" + default KERNEL_INIT_PRIORITY_DEFAULT + help + Interrupt controller device initialization priority. + source "drivers/interrupt_controller/Kconfig.multilevel" source "drivers/interrupt_controller/Kconfig.loapic" diff --git a/drivers/interrupt_controller/intc_exti_stm32.c b/drivers/interrupt_controller/intc_exti_stm32.c index c0e72c2931a..d25ae30e824 100644 --- a/drivers/interrupt_controller/intc_exti_stm32.c +++ b/drivers/interrupt_controller/intc_exti_stm32.c @@ -423,7 +423,7 @@ static struct stm32_exti_data exti_data; DEVICE_DT_DEFINE(EXTI_NODE, &stm32_exti_init, NULL, &exti_data, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEVICE, + PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); /** diff --git a/drivers/interrupt_controller/intc_gd32_exti.c b/drivers/interrupt_controller/intc_gd32_exti.c index 5db89a9773f..0298fc0898d 100644 --- a/drivers/interrupt_controller/intc_gd32_exti.c +++ b/drivers/interrupt_controller/intc_gd32_exti.c @@ -191,4 +191,4 @@ static int gd32_exti_init(const struct device *dev) static struct gd32_exti_data data; DEVICE_DT_INST_DEFINE(0, gd32_exti_init, NULL, &data, NULL, PRE_KERNEL_1, - CONFIG_KERNEL_INIT_PRIORITY_DEVICE, NULL); + CONFIG_INTC_INIT_PRIORITY, NULL); diff --git a/drivers/interrupt_controller/intc_gic.c b/drivers/interrupt_controller/intc_gic.c index 4650fcdf87e..28804dcd559 100644 --- a/drivers/interrupt_controller/intc_gic.c +++ b/drivers/interrupt_controller/intc_gic.c @@ -239,7 +239,7 @@ int arm_gic_init(const struct device *unused) return 0; } -SYS_INIT(arm_gic_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arm_gic_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY); #ifdef CONFIG_SMP void arm_gic_secondary_init(void) diff --git a/drivers/interrupt_controller/intc_gicv3.c b/drivers/interrupt_controller/intc_gicv3.c index a6b2b3b4f65..071ec40d048 100644 --- a/drivers/interrupt_controller/intc_gicv3.c +++ b/drivers/interrupt_controller/intc_gicv3.c @@ -487,7 +487,7 @@ int arm_gic_init(const struct device *unused) return 0; } -SYS_INIT(arm_gic_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(arm_gic_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY); #ifdef CONFIG_SMP void arm_gic_secondary_init(void) diff --git a/drivers/interrupt_controller/intc_gicv3_its.c b/drivers/interrupt_controller/intc_gicv3_its.c index 6eb948c3f79..b5aaff8d2d5 100644 --- a/drivers/interrupt_controller/intc_gicv3_its.c +++ b/drivers/interrupt_controller/intc_gicv3_its.c @@ -667,7 +667,7 @@ struct its_driver_api gicv3_its_api = { &gicv3_its_data##n, \ &gicv3_its_config##n, \ POST_KERNEL, \ - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + CONFIG_INTC_INIT_PRIORITY, \ &gicv3_its_api); DT_INST_FOREACH_STATUS_OKAY(GICV3_ITS_INIT) diff --git a/drivers/interrupt_controller/intc_ioapic.c b/drivers/interrupt_controller/intc_ioapic.c index 0eb362f085f..dd205f52641 100644 --- a/drivers/interrupt_controller/intc_ioapic.c +++ b/drivers/interrupt_controller/intc_ioapic.c @@ -545,4 +545,4 @@ static void IoApicRedUpdateLo(unsigned int irq, PM_DEVICE_DEFINE(ioapic, ioapic_pm_action); DEVICE_DEFINE(ioapic, "ioapic", ioapic_init, PM_DEVICE_GET(ioapic), NULL, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); diff --git a/drivers/interrupt_controller/intc_irqmp.c b/drivers/interrupt_controller/intc_irqmp.c index 30faa4e9274..982799d515f 100644 --- a/drivers/interrupt_controller/intc_irqmp.c +++ b/drivers/interrupt_controller/intc_irqmp.c @@ -122,4 +122,4 @@ static int irqmp_init(const struct device *dev) return 0; } -SYS_INIT(irqmp_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(irqmp_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY); diff --git a/drivers/interrupt_controller/intc_loapic.c b/drivers/interrupt_controller/intc_loapic.c index 4c1f6638534..0a36c906222 100644 --- a/drivers/interrupt_controller/intc_loapic.c +++ b/drivers/interrupt_controller/intc_loapic.c @@ -422,7 +422,7 @@ static int loapic_pm_action(const struct device *dev, PM_DEVICE_DEFINE(loapic, loapic_pm_action); DEVICE_DEFINE(loapic, "loapic", loapic_init, PM_DEVICE_GET(loapic), NULL, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, NULL); + PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); #if CONFIG_LOAPIC_SPURIOUS_VECTOR extern void z_loapic_spurious_handler(void); diff --git a/drivers/interrupt_controller/intc_mchp_ecia_xec.c b/drivers/interrupt_controller/intc_mchp_ecia_xec.c index 9f96f06d2db..7e9ed693c77 100644 --- a/drivers/interrupt_controller/intc_mchp_ecia_xec.c +++ b/drivers/interrupt_controller/intc_mchp_ecia_xec.c @@ -568,7 +568,7 @@ static int xec_ecia_init(const struct device *dev) \ DEVICE_DT_DEFINE(n, xec_girq_init_##n, \ NULL, &xec_data_girq_##n, &xec_config_girq_##n, \ - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, \ + PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, \ NULL); \ \ static int xec_girq_init_##n(const struct device *dev) \ @@ -606,7 +606,7 @@ static const struct xec_ecia_config xec_config_ecia = { DEVICE_DT_DEFINE(DT_NODELABEL(ecia), xec_ecia_init, NULL, NULL, &xec_config_ecia, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); /* look up GIRQ node handle from ECIA configuration */ diff --git a/drivers/interrupt_controller/intc_miwu.c b/drivers/interrupt_controller/intc_miwu.c index da720b686df..8b954d870fa 100644 --- a/drivers/interrupt_controller/intc_miwu.c +++ b/drivers/interrupt_controller/intc_miwu.c @@ -382,7 +382,7 @@ int npcx_miwu_manage_dev_callback(struct miwu_dev_callback *cb, bool set) NULL, \ NULL, &miwu_config_##inst, \ PRE_KERNEL_1, \ - CONFIG_KERNEL_INIT_PRIORITY_OBJECTS, NULL); \ + CONFIG_INTC_INIT_PRIORITY, NULL); \ \ NPCX_MIWU_ISR_FUNC_IMPL(inst) \ \ diff --git a/drivers/interrupt_controller/intc_nuclei_eclic.c b/drivers/interrupt_controller/intc_nuclei_eclic.c index 7ad35445335..8b36867448c 100644 --- a/drivers/interrupt_controller/intc_nuclei_eclic.c +++ b/drivers/interrupt_controller/intc_nuclei_eclic.c @@ -181,4 +181,4 @@ static int nuclei_eclic_init(const struct device *dev) return 0; } -SYS_INIT(nuclei_eclic_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(nuclei_eclic_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY); diff --git a/drivers/interrupt_controller/intc_plic.c b/drivers/interrupt_controller/intc_plic.c index 3c16e5ebf99..68c7ed11a05 100644 --- a/drivers/interrupt_controller/intc_plic.c +++ b/drivers/interrupt_controller/intc_plic.c @@ -208,4 +208,4 @@ static int plic_init(const struct device *dev) return 0; } -SYS_INIT(plic_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(plic_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY); diff --git a/drivers/interrupt_controller/intc_sam0_eic.c b/drivers/interrupt_controller/intc_sam0_eic.c index ab1af180fbd..b4f3f56bbd0 100644 --- a/drivers/interrupt_controller/intc_sam0_eic.c +++ b/drivers/interrupt_controller/intc_sam0_eic.c @@ -409,5 +409,5 @@ static int sam0_eic_init(const struct device *dev) static struct sam0_eic_data eic_data; DEVICE_DT_INST_DEFINE(0, sam0_eic_init, NULL, &eic_data, NULL, - PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT, + PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY, NULL); diff --git a/drivers/interrupt_controller/intc_swerv_pic.c b/drivers/interrupt_controller/intc_swerv_pic.c index 194201411a7..b3358c8013c 100644 --- a/drivers/interrupt_controller/intc_swerv_pic.c +++ b/drivers/interrupt_controller/intc_swerv_pic.c @@ -235,4 +235,4 @@ int arch_irq_is_enabled(unsigned int irq) return !!(mie & (1 << irq)); } -SYS_INIT(swerv_pic_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); +SYS_INIT(swerv_pic_init, PRE_KERNEL_1, CONFIG_INTC_INIT_PRIORITY); diff --git a/drivers/interrupt_controller/intc_vexriscv_litex.c b/drivers/interrupt_controller/intc_vexriscv_litex.c index 9d94252d541..7673c11a375 100644 --- a/drivers/interrupt_controller/intc_vexriscv_litex.c +++ b/drivers/interrupt_controller/intc_vexriscv_litex.c @@ -135,4 +135,4 @@ static int vexriscv_litex_irq_init(const struct device *dev) } SYS_INIT(vexriscv_litex_irq_init, PRE_KERNEL_2, - CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); + CONFIG_INTC_INIT_PRIORITY);