init: Implement fine-grained initialization policy

Put initialization priorities as device driver Kconfig
parameter.

Initialization priority value for each platform is defined
in the platform Kconfig file.

Drivers and platform code use SYS_DEFINE_DEVICE to add
and initialization function.

Change-Id: I2f4f3c7370dac02408a1b50a0a1bade8b427a282
Signed-off-by: Dmitriy Korovkin <dmitriy.korovkin@windriver.com>
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Dmitriy Korovkin 2015-10-26 15:56:02 -04:00 committed by Anas Nashif
commit 57f2741e4f
66 changed files with 447 additions and 115 deletions

View file

@ -37,4 +37,14 @@ config RAM_SIZE
default 80 default 80
endmenu endmenu
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
endif endif

View file

@ -52,4 +52,5 @@ static int generic_arc_init(struct device *arg)
return 0; return 0;
} }
DECLARE_DEVICE_INIT_CONFIG(generic_arc_0, "", generic_arc_init, NULL); DECLARE_DEVICE_INIT_CONFIG(generic_arc_0, "", generic_arc_init, NULL);
pre_kernel_core_init(generic_arc_0, NULL); SYS_DEFINE_DEVICE(generic_arc_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -93,4 +93,22 @@ config I2C_QUARK_SE_SS_1_DEFAULT_CFG
endif endif
endif config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config IPI_CONSOLE_PRIORITY
default 60
config UART_CONSOLE_PRIORITY
default 60
config GPIO_DW_INIT_PRIORITY
default 60
config I2C_INIT_PRIORITY
default 60
endif #PLATFORM_QUARK_SE_ARC

View file

@ -38,7 +38,8 @@ static struct quark_se_ipi_controller_config_info ipi_controller_config = {
}; };
DECLARE_DEVICE_INIT_CONFIG(quark_se_ipi, "", quark_se_ipi_controller_initialize, DECLARE_DEVICE_INIT_CONFIG(quark_se_ipi, "", quark_se_ipi_controller_initialize,
&ipi_controller_config); &ipi_controller_config);
pre_kernel_late_init(quark_se_ipi, NULL); SYS_DEFINE_DEVICE(quark_se_ipi, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#if CONFIG_IPI_CONSOLE_SENDER #if CONFIG_IPI_CONSOLE_SENDER
#include <console/ipi_console.h> #include <console/ipi_console.h>
@ -51,7 +52,7 @@ struct ipi_console_sender_config_info quark_se_ipi_sender_config = {
DECLARE_DEVICE_INIT_CONFIG(ipi_console, "ipi_console", DECLARE_DEVICE_INIT_CONFIG(ipi_console, "ipi_console",
ipi_console_sender_init, ipi_console_sender_init,
&quark_se_ipi_sender_config); &quark_se_ipi_sender_config);
nano_early_init(ipi_console, NULL); SYS_DEFINE_DEVICE(ipi_console, NULL, SECONDARY, CONFIG_IPI_CONSOLE_PRIORITY);
#endif /* CONFIG_IPI_CONSOLE_SENDER */ #endif /* CONFIG_IPI_CONSOLE_SENDER */
#endif /* CONFIG_IPI_QUARK_SE */ #endif /* CONFIG_IPI_QUARK_SE */

View file

@ -50,4 +50,5 @@ static int quark_se_arc_init(struct device *arg)
return 0; return 0;
} }
DECLARE_DEVICE_INIT_CONFIG(quark_se_arc_0, "", quark_se_arc_init, NULL); DECLARE_DEVICE_INIT_CONFIG(quark_se_arc_0, "", quark_se_arc_init, NULL);
pre_kernel_early_init(quark_se_arc_0, NULL); SYS_DEFINE_DEVICE(quark_se_arc_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -45,4 +45,13 @@ 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.
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
endif endif

View file

@ -175,7 +175,8 @@ DECLARE_DEVICE_INIT_CONFIG(k20_uart0,
&uart_platform_init, &uart_platform_init,
&k20_uart_dev_cfg[0]); &k20_uart_dev_cfg[0]);
pre_kernel_late_init(k20_uart0, &k20_uart_dev_data[0]); SYS_DEFINE_DEVICE(k20_uart0, &k20_uart_dev_data[0], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 1 */ /* UART 1 */
@ -184,7 +185,8 @@ DECLARE_DEVICE_INIT_CONFIG(k20_uart1,
&uart_platform_init, &uart_platform_init,
&k20_uart_dev_cfg[1]); &k20_uart_dev_cfg[1]);
pre_kernel_late_init(k20_uart1, &k20_uart_dev_data[1]); SYS_DEFINE_DEVICE(k20_uart1, &k20_uart_dev_data[1], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 2 */ /* UART 2 */
@ -193,7 +195,8 @@ DECLARE_DEVICE_INIT_CONFIG(k20_uart2,
&uart_platform_init, &uart_platform_init,
&k20_uart_dev_cfg[2]); &k20_uart_dev_cfg[2]);
pre_kernel_late_init(k20_uart2, &k20_uart_dev_data[2]); SYS_DEFINE_DEVICE(k20_uart2, &k20_uart_dev_data[2], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 3 */ /* UART 3 */
@ -202,7 +205,8 @@ DECLARE_DEVICE_INIT_CONFIG(k20_uart3,
&uart_platform_init, &uart_platform_init,
&k20_uart_dev_cfg[3]); &k20_uart_dev_cfg[3]);
pre_kernel_late_init(k20_uart3, &k20_uart_dev_data[3]); SYS_DEFINE_DEVICE(k20_uart3, &k20_uart_dev_data[3], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 4 */ /* UART 4 */
@ -211,7 +215,8 @@ DECLARE_DEVICE_INIT_CONFIG(k20_uart4,
&uart_platform_init, &uart_platform_init,
&k20_uart_dev_cfg[4]); &k20_uart_dev_cfg[4]);
pre_kernel_late_init(k20_uart4, &k20_uart_dev_data[4]); SYS_DEFINE_DEVICE(k20_uart4, &k20_uart_dev_data[4], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/**< UART Devices */ /**< UART Devices */

View file

@ -321,4 +321,5 @@ static int fsl_frdm_k64f_init(struct device *arg)
} }
DECLARE_DEVICE_INIT_CONFIG(fsl_frdm_0, "", fsl_frdm_k64f_init, NULL); DECLARE_DEVICE_INIT_CONFIG(fsl_frdm_0, "", fsl_frdm_k64f_init, NULL);
pre_kernel_core_init(fsl_frdm_0, NULL); SYS_DEFINE_DEVICE(fsl_frdm_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -43,4 +43,16 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
int int
default 12000000 default 12000000
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
config IPI_CONSOLE_PRIORITY
default 60
endif endif

View file

@ -177,7 +177,8 @@ DECLARE_DEVICE_INIT_CONFIG(stellaris_uart0,
&uart_platform_init, &uart_platform_init,
&stellaris_uart_dev_cfg[0]); &stellaris_uart_dev_cfg[0]);
pre_kernel_late_init(stellaris_uart0, NULL); SYS_DEFINE_DEVICE(stellaris_uart0, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 1 */ /* UART 1 */
@ -186,7 +187,8 @@ DECLARE_DEVICE_INIT_CONFIG(stellaris_uart1,
&uart_platform_init, &uart_platform_init,
&stellaris_uart_dev_cfg[1]); &stellaris_uart_dev_cfg[1]);
pre_kernel_late_init(stellaris_uart1, NULL); SYS_DEFINE_DEVICE(stellaris_uart1, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 2 */ /* UART 2 */
@ -195,7 +197,8 @@ DECLARE_DEVICE_INIT_CONFIG(stellaris_uart2,
&uart_platform_init, &uart_platform_init,
&stellaris_uart_dev_cfg[2]); &stellaris_uart_dev_cfg[2]);
pre_kernel_late_init(stellaris_uart2, NULL); SYS_DEFINE_DEVICE(stellaris_uart2, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/**< UART Devices */ /**< UART Devices */

View file

@ -57,4 +57,5 @@ static int ti_lm3s6965_init(struct device *arg)
} }
DECLARE_DEVICE_INIT_CONFIG(ti_lm3_0, "", ti_lm3s6965_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ti_lm3_0, "", ti_lm3s6965_init, NULL);
pre_kernel_core_init(ti_lm3_0, NULL); SYS_DEFINE_DEVICE(ti_lm3_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -108,6 +108,6 @@ static int init_cache(struct device *unused)
} }
DECLARE_DEVICE_INIT_CONFIG(cache, "", init_cache, NULL); DECLARE_DEVICE_INIT_CONFIG(cache, "", init_cache, NULL);
pre_kernel_early_init(cache, NULL); SYS_DEFINE_DEVICE(cache, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_CLFLUSH_DETECT || CONFIG_CACHE_LINE_SIZE_DETECT */ #endif /* CONFIG_CLFLUSH_DETECT || CONFIG_CACHE_LINE_SIZE_DETECT */

View file

@ -333,4 +333,59 @@ config ETH_DW_0_IRQ
config ETH_DW_0_IRQ_SHARED_NAME config ETH_DW_0_IRQ_SHARED_NAME
default SHARED_IRQ_0_NAME if SHARED_IRQ default SHARED_IRQ_0_NAME if SHARED_IRQ
endif endif
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config SHARED_IRQ_INIT_PRIORITY
default 50
# Any device driver should be initialized after
# shared IRQ driver, as it may use it
config KERNEL_INIT_PRIORITY_DEVICE
default 60
config GPIO_MMIO_INIT_PRIORITY
default 60
config GPIO_SCH_INIT_PRIORITY
default 60
config GPIO_DW_INIT_PRIORITY
default 60
# SPI uses GPIO pin, so it needs to be initialized after
# GPIO driver
config SPI_INTEL_INIT_PRIORITY
default 70
# TI ADC108S102 uses SPI bus, thus
# initialized after SPI driver
config ADC_TI_ADC108S102_INIT_PRIORITY
default 80
config I2C_INIT_PRIORITY
default 60
# PCAL9535A uses I2C, thus initialized after it
config GPIO_PCAL9535A_INIT_PRIORITY
default 70
# PCA9685 uses I2C, thus initialized after it
config PWM_PCA9685_INIT_PRIORITY
default 70
# Grove RGB LCD uses I2C, thus initialized after it
config GROVE_LCD_RGB_INIT_PRIORITY
default 70
# Pin multiplexer uses PCAL9535A, needs to be initialized after it
config PINMUX_INIT_PRIORITY
default 80
# Console driver has to be initialized after UART, that it uses
config UART_CONSOLE_PRIORITY
default 70
endif # PLATFORM_GALILEO endif # PLATFORM_GALILEO

View file

@ -71,24 +71,25 @@ static int pci_legacy_bridge_irq_config(struct device *unused)
} }
DECLARE_DEVICE_INIT_CONFIG(pci_legacy_bridge_0, "", pci_legacy_bridge_irq_config, NULL); DECLARE_DEVICE_INIT_CONFIG(pci_legacy_bridge_0, "", pci_legacy_bridge_irq_config, NULL);
pre_kernel_late_init(pci_legacy_bridge_0, NULL); SYS_DEFINE_DEVICE(pci_legacy_bridge_0, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_PCI_LEGACY_BRIDGE */ #endif /* CONFIG_PCI_LEGACY_BRIDGE */
#ifdef CONFIG_IOAPIC #ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pre_kernel_core_init(ioapic_0, NULL); SYS_DEFINE_DEVICE(ioapic_0, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_IOAPIC */ #endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC #ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pre_kernel_core_init(loapic_0, NULL); SYS_DEFINE_DEVICE(loapic_0, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_LOAPIC */ #endif /* CONFIG_LOAPIC */
#if defined(CONFIG_PIC_DISABLE) #if defined(CONFIG_PIC_DISABLE)
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL); DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
pre_kernel_core_init(pic_0, NULL); SYS_DEFINE_DEVICE(pic_0, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_PIC_DISABLE */ #endif /* CONFIG_PIC_DISABLE */

View file

@ -120,9 +120,11 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart0,
#if (defined(CONFIG_EARLY_CONSOLE) && \ #if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \ defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 0)) (CONFIG_UART_CONSOLE_INDEX == 0))
pre_kernel_core_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0], PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#else #else
pre_kernel_early_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_EARLY_CONSOLE */ #endif /* CONFIG_EARLY_CONSOLE */
@ -135,9 +137,11 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart1,
#if (defined(CONFIG_EARLY_CONSOLE) && \ #if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \ defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 1)) (CONFIG_UART_CONSOLE_INDEX == 1))
pre_kernel_core_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1], PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#else #else
pre_kernel_early_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_EARLY_CONSOLE */ #endif /* CONFIG_EARLY_CONSOLE */

View file

@ -758,4 +758,5 @@ struct galileo_data galileo_pinmux_driver = {
* 1 - PCA9535 and PCAL9685 * 1 - PCA9535 and PCAL9685
* 2 - pinmux * 2 - pinmux
*/ */
nano_early_init(pmux, &galileo_pinmux_driver); SYS_DEFINE_DEVICE(pmux, &galileo_pinmux_driver, SECONDARY,
CONFIG_PINMUX_INIT_PRIORITY);

View file

@ -42,4 +42,16 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
default 150000000 if LOAPIC_TIMER default 150000000 if LOAPIC_TIMER
default 25000000 if HPET_TIMER default 25000000 if HPET_TIMER
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
config IPI_CONSOLE_PRIORITY
default 60
endif endif

View file

@ -52,22 +52,26 @@ static int ia32_init(struct device *arg)
#ifdef CONFIG_IOAPIC #ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pre_kernel_core_init(ioapic_0, NULL); SYS_DEFINE_DEVICE(ioapic_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_IOAPIC */ #endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC #ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pre_kernel_core_init(loapic_0, NULL); SYS_DEFINE_DEVICE(loapic_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_LOAPIC */ #endif /* CONFIG_LOAPIC */
#if defined(CONFIG_PIC_DISABLE) #if defined(CONFIG_PIC_DISABLE)
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL); DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
pre_kernel_core_init(pic_0, NULL); SYS_DEFINE_DEVICE(pic_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_PIC_DISABLE */ #endif /* CONFIG_PIC_DISABLE */
DECLARE_DEVICE_INIT_CONFIG(ia32_0, "", ia32_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ia32_0, "", ia32_init, NULL);
pre_kernel_early_init(ia32_0, NULL); SYS_DEFINE_DEVICE(ia32_0, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -102,9 +102,11 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart0,
#if (defined(CONFIG_EARLY_CONSOLE) && \ #if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \ defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 0)) (CONFIG_UART_CONSOLE_INDEX == 0))
pre_kernel_core_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0], PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#else #else
pre_kernel_early_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_EARLY_CONSOLE */ #endif /* CONFIG_EARLY_CONSOLE */
@ -117,9 +119,11 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart1,
#if (defined(CONFIG_EARLY_CONSOLE) && \ #if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \ defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 1)) (CONFIG_UART_CONSOLE_INDEX == 1))
pre_kernel_core_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1], PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#else #else
pre_kernel_early_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_EARLY_CONSOLE */ #endif /* CONFIG_EARLY_CONSOLE */

View file

@ -45,4 +45,13 @@ config SYS_CLOCK_HW_CYCLES_PER_SEC
config UART_CONSOLE_INDEX config UART_CONSOLE_INDEX
default 1 default 1
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
endif endif

View file

@ -43,19 +43,22 @@
#ifdef CONFIG_IOAPIC #ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pre_kernel_core_init(ioapic_0, NULL); SYS_DEFINE_DEVICE(ioapic_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_IOAPIC */ #endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC #ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pre_kernel_core_init(loapic_0, NULL); SYS_DEFINE_DEVICE(loapic_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_LOAPIC */ #endif /* CONFIG_LOAPIC */
#if defined(CONFIG_PIC_DISABLE) #if defined(CONFIG_PIC_DISABLE)
DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL); DECLARE_DEVICE_INIT_CONFIG(pic_0, "", _i8259_init, NULL);
pre_kernel_core_init(pic_0, NULL); SYS_DEFINE_DEVICE(pic_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_PIC_DISABLE */ #endif /* CONFIG_PIC_DISABLE */

View file

@ -115,9 +115,11 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart0,
#if (defined(CONFIG_EARLY_CONSOLE) && \ #if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \ defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 0)) (CONFIG_UART_CONSOLE_INDEX == 0))
pre_kernel_early_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0], PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#else #else
pre_kernel_late_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_EARLY_CONSOLE */ #endif /* CONFIG_EARLY_CONSOLE */
@ -130,9 +132,11 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart1,
#if (defined(CONFIG_EARLY_CONSOLE) && \ #if (defined(CONFIG_EARLY_CONSOLE) && \
defined(CONFIG_UART_CONSOLE) && \ defined(CONFIG_UART_CONSOLE) && \
(CONFIG_UART_CONSOLE_INDEX == 1)) (CONFIG_UART_CONSOLE_INDEX == 1))
pre_kernel_early_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1], PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#else #else
pre_kernel_late_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1], SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_EARLY_CONSOLE */ #endif /* CONFIG_EARLY_CONSOLE */

View file

@ -50,4 +50,13 @@ config LOAPIC_TIMER_IRQ_PRIORITY
config PHYS_RAM_ADDR config PHYS_RAM_ADDR
default 0x00280000 default 0x00280000
config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
endif endif

View file

@ -97,7 +97,8 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart0,
&uart_platform_init, &uart_platform_init,
&ns16550_uart_dev_cfg[0]); &ns16550_uart_dev_cfg[0]);
pre_kernel_early_init(ns16550_uart0, &ns16550_uart_dev_data[0]); SYS_DEFINE_DEVICE(ns16550_uart0, &ns16550_uart_dev_data[0],
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/* UART 1 */ /* UART 1 */
@ -106,7 +107,8 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart1,
&uart_platform_init, &uart_platform_init,
&ns16550_uart_dev_cfg[1]); &ns16550_uart_dev_cfg[1]);
pre_kernel_early_init(ns16550_uart1, &ns16550_uart_dev_data[1]); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart_dev_data[1],
SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
struct device * const uart_devs[] = { struct device * const uart_devs[] = {

View file

@ -51,9 +51,10 @@ static int quark_d2000_init(struct device *arg)
return 0; return 0;
} }
DECLARE_DEVICE_INIT_CONFIG(quark_d2000_0, "", quark_d2000_init, NULL); DECLARE_DEVICE_INIT_CONFIG(quark_d2000_0, "", quark_d2000_init, NULL);
pre_kernel_core_init(quark_d2000_0, NULL); SYS_DEFINE_DEVICE(quark_d2000_0, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#ifdef CONFIG_MVIC #ifdef CONFIG_MVIC
DECLARE_DEVICE_INIT_CONFIG(mvic_0, "", _mvic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(mvic_0, "", _mvic_init, NULL);
pre_kernel_core_init(mvic_0, NULL); SYS_DEFINE_DEVICE(mvic_0, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_IOAPIC */ #endif /* CONFIG_IOAPIC */

View file

@ -169,4 +169,22 @@ config SPI_DW_PORT_1_IRQ
default 3 default 3
endif endif
endif config KERNEL_INIT_PRIORITY_DEFAULT
default 40
config KERNEL_INIT_PRIORITY_DEVICE
default 50
config UART_CONSOLE_PRIORITY
default 60
config IPI_CONSOLE_PRIORITY
default 60
config GPIO_DW_INIT_PRIORITY
default 60
config I2C_INIT_PRIORITY
default 60
endif #PLATFORM_QUARK_SE_X86

View file

@ -178,4 +178,4 @@ DECLARE_DEVICE_INIT_CONFIG(pmux, /* config name */
&pinmux_initialize, /* init function */ &pinmux_initialize, /* init function */
&board_pmux); /* config options*/ &board_pmux); /* config options*/
pre_kernel_late_init(pmux, NULL); SYS_DEFINE_DEVICE(pmux, NULL, SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -87,7 +87,8 @@ DECLARE_DEVICE_INIT_CONFIG(ns16550_uart1,
static struct uart_ns16550_dev_data_t ns16550_uart1_dev_data; static struct uart_ns16550_dev_data_t ns16550_uart1_dev_data;
pre_kernel_early_init(ns16550_uart1, &ns16550_uart1_dev_data); SYS_DEFINE_DEVICE(ns16550_uart1, &ns16550_uart1_dev_data,
PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
/** /**
@ -119,7 +120,8 @@ static struct quark_se_ipi_controller_config_info ipi_controller_config = {
}; };
DECLARE_DEVICE_INIT_CONFIG(quark_se_ipi, "", quark_se_ipi_controller_initialize, DECLARE_DEVICE_INIT_CONFIG(quark_se_ipi, "", quark_se_ipi_controller_initialize,
&ipi_controller_config); &ipi_controller_config);
pre_kernel_early_init(quark_se_ipi, NULL); SYS_DEFINE_DEVICE(quark_se_ipi, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#if defined(CONFIG_IPI_CONSOLE_RECEIVER) && defined(CONFIG_PRINTK) #if defined(CONFIG_IPI_CONSOLE_RECEIVER) && defined(CONFIG_PRINTK)
#include <console/ipi_console.h> #include <console/ipi_console.h>
@ -146,7 +148,8 @@ struct ipi_console_receiver_runtime_data quark_se_ipi_receiver_driver_data;
DECLARE_DEVICE_INIT_CONFIG(ipi_console0, "ipi_console0", DECLARE_DEVICE_INIT_CONFIG(ipi_console0, "ipi_console0",
ipi_console_receiver_init, ipi_console_receiver_init,
&quark_se_ipi_receiver_config); &quark_se_ipi_receiver_config);
nano_early_init(ipi_console0, &quark_se_ipi_receiver_driver_data); SYS_DEFINE_DEVICE(ipi_console0, &quark_se_ipi_receiver_driver_data,
SECONDARY, CONFIG_IPI_CONSOLE_PRIORITY);
#endif /* CONFIG_PRINTK && CONFIG_IPI_CONSOLE_RECEIVER */ #endif /* CONFIG_PRINTK && CONFIG_IPI_CONSOLE_RECEIVER */
#endif /* CONFIG_IPI_QUARK_SE */ #endif /* CONFIG_IPI_QUARK_SE */

View file

@ -89,19 +89,20 @@ static int arc_init(struct device *arg)
} }
DECLARE_DEVICE_INIT_CONFIG(quark_se_ss_0, "", arc_init, NULL); DECLARE_DEVICE_INIT_CONFIG(quark_se_ss_0, "", arc_init, NULL);
pre_kernel_late_init(quark_se_ss_0, NULL); SYS_DEFINE_DEVICE(quark_se_ss_0, NULL, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /*CONFIG_ARC_INIT*/ #endif /*CONFIG_ARC_INIT*/
#ifdef CONFIG_IOAPIC #ifdef CONFIG_IOAPIC
DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ioapic_0, "", _ioapic_init, NULL);
pre_kernel_early_init(ioapic_0, NULL); SYS_DEFINE_DEVICE(ioapic_0, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_IOAPIC */ #endif /* CONFIG_IOAPIC */
#ifdef CONFIG_LOAPIC #ifdef CONFIG_LOAPIC
DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL); DECLARE_DEVICE_INIT_CONFIG(loapic_0, "", _loapic_init, NULL);
pre_kernel_early_init(loapic_0, NULL); SYS_DEFINE_DEVICE(loapic_0, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* CONFIG_LOAPIC */ #endif /* CONFIG_LOAPIC */

View file

@ -42,6 +42,15 @@ config ADC_TI_ADC108S102
help help
Enable support for TI's ADC chip adc108s102 driver. Enable support for TI's ADC chip adc108s102 driver.
config ADC_TI_ADC108S102_INIT_PRIORITY
int
depends on ADC_TI_ADC108S102
prompt "Init priority"
help
Device driver initialization priority.
Device is connected to SPI bus, it has to
be initialized after SPI driver.
config ADC_TI_ADC108S102_0 config ADC_TI_ADC108S102_0
bool "First instance of TI's adc108s102 chip" bool "First instance of TI's adc108s102 chip"
depends on ADC_TI_ADC108S102 depends on ADC_TI_ADC108S102

View file

@ -318,7 +318,8 @@ DECLARE_DEVICE_INIT_CONFIG(adc_dw_0, /* config name*/
&adc_dw_init, /* init function*/ &adc_dw_init, /* init function*/
&adc_config_dev_0); /* config options*/ &adc_config_dev_0); /* config options*/
pre_kernel_late_init(adc_dw_0, &adc_info_dev_0); SYS_DEFINE_DEVICE(adc_dw_0, &adc_info_dev_0, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
struct device *adc_dw_isr_0_device = SYS_GET_DEVICE(adc_dw_0); struct device *adc_dw_isr_0_device = SYS_GET_DEVICE(adc_dw_0);
IRQ_CONNECT_STATIC(adc_dw_0, IRQ_CONNECT_STATIC(adc_dw_0,

View file

@ -289,6 +289,7 @@ struct ti_adc108s102_config adc108s102_0_config = {
DECLARE_DEVICE_INIT_CONFIG(adc108s102_0, CONFIG_ADC_TI_ADC108S102_0_DRV_NAME, DECLARE_DEVICE_INIT_CONFIG(adc108s102_0, CONFIG_ADC_TI_ADC108S102_0_DRV_NAME,
ti_adc108s102_init, &adc108s102_0_config); ti_adc108s102_init, &adc108s102_0_config);
nano_early_init(adc108s102_0, &adc108s102_0_data); SYS_DEFINE_DEVICE(adc108s102_0, &adc108s102_0_data, SECONDARY,
CONFIG_ADC_TI_ADC108S102_INIT_PRIORITY);
#endif /* CONFIG_ADC_TI_ADC108S102_0 */ #endif /* CONFIG_ADC_TI_ADC108S102_0 */

View file

@ -217,7 +217,8 @@ struct dw_aio_cmp_dev_data_t dw_aio_cmp_dev_data = {
.num_cmp = AIO_DW_CMP_COUNT, .num_cmp = AIO_DW_CMP_COUNT,
}; };
micro_early_init(dw_aio_cmp, &dw_aio_cmp_dev_data); SYS_DEFINE_DEVICE(dw_aio_cmp, &dw_aio_cmp_dev_data, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
struct device *dw_aio_cmp_device = SYS_GET_DEVICE(dw_aio_cmp); struct device *dw_aio_cmp_device = SYS_GET_DEVICE(dw_aio_cmp);

View file

@ -273,4 +273,5 @@ static int _bt_uart_init(struct device *unused)
} }
DECLARE_DEVICE_INIT_CONFIG(bt_uart, "", _bt_uart_init, NULL); DECLARE_DEVICE_INIT_CONFIG(bt_uart, "", _bt_uart_init, NULL);
nano_late_init(bt_uart, NULL); SYS_DEFINE_DEVICE(bt_uart, NULL, NANOKERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);

View file

@ -106,7 +106,8 @@ DECLARE_DEVICE_INIT_CONFIG(clock_quark_se_peripheral,
&quark_se_clock_control_init, &quark_se_clock_control_init,
&clock_quark_se_peripheral_config); &clock_quark_se_peripheral_config);
pre_kernel_early_init(clock_quark_se_peripheral, NULL); SYS_DEFINE_DEVICE(clock_quark_se_peripheral, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_CLOCK_CONTROL_QUARK_SE_PERIPHERAL */ #endif /* CONFIG_CLOCK_CONTROL_QUARK_SE_PERIPHERAL */
#ifdef CONFIG_CLOCK_CONTROL_QUARK_SE_EXTERNAL #ifdef CONFIG_CLOCK_CONTROL_QUARK_SE_EXTERNAL
@ -120,7 +121,8 @@ DECLARE_DEVICE_INIT_CONFIG(clock_quark_se_external,
&quark_se_clock_control_init, &quark_se_clock_control_init,
&clock_quark_se_external_config); &clock_quark_se_external_config);
pre_kernel_early_init(clock_quark_se_external, NULL); SYS_DEFINE_DEVICE(clock_quark_se_external, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_CLOCK_CONTROL_QUARK_SE_EXTERNAL */ #endif /* CONFIG_CLOCK_CONTROL_QUARK_SE_EXTERNAL */
#ifdef CONFIG_CLOCK_CONTROL_QUARK_SE_SENSOR #ifdef CONFIG_CLOCK_CONTROL_QUARK_SE_SENSOR
@ -134,5 +136,6 @@ DECLARE_DEVICE_INIT_CONFIG(clock_quark_se_sensor,
&quark_se_clock_control_init, &quark_se_clock_control_init,
&clock_quark_se_sensor_config); &clock_quark_se_sensor_config);
pre_kernel_early_init(clock_quark_se_sensor, NULL); SYS_DEFINE_DEVICE(clock_quark_se_sensor, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif /* CONFIG_CLOCK_CONTROL_QUARK_SE_SENSOR */ #endif /* CONFIG_CLOCK_CONTROL_QUARK_SE_SENSOR */

View file

@ -67,6 +67,15 @@ config UART_CONSOLE_BAUDRATE
Default is 115200, which should be usable for most RS232 Default is 115200, which should be usable for most RS232
and USB adapters. and USB adapters.
config UART_CONSOLE_PRIORITY
int
prompt "Init priority"
depends on UART_CONSOLE
help
Device driver initialization priority.
Console has to be initialized after the UART driver
it uses.
config RAM_CONSOLE config RAM_CONSOLE
bool bool
prompt "Use RAM console" prompt "Use RAM console"
@ -101,6 +110,16 @@ config IPI_CONSOLE_RECEIVER
help help
Enable the receiving side of IPI console Enable the receiving side of IPI console
config IPI_CONSOLE_PRIORITY
int
prompt "IPI console init priority"
default 60
depends on IPI_CONSOLE_SENDER || IPI_CONSOLE_RECEIVER
help
Device driver initialization priority.
Console has to be initialized after the IPI subsystem
it uses.
config UART_PIPE config UART_PIPE
bool bool
prompt "Enable pipe UART driver" prompt "Enable pipe UART driver"

View file

@ -46,5 +46,5 @@ static int ram_console_init(struct device *d)
} }
DECLARE_DEVICE_INIT_CONFIG(ram_console, "", ram_console_init, NULL); DECLARE_DEVICE_INIT_CONFIG(ram_console, "", ram_console_init, NULL);
pre_kernel_early_init(ram_console, NULL); SYS_DEFINE_DEVICE(ram_console, NULL, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -239,4 +239,10 @@ static int uart_console_init(struct device *arg)
return DEV_OK; return DEV_OK;
} }
DECLARE_DEVICE_INIT_CONFIG(uart_console, "", uart_console_init, NULL); DECLARE_DEVICE_INIT_CONFIG(uart_console, "", uart_console_init, NULL);
pre_kernel_late_init(uart_console, NULL);
/* UART consloe initializes after the UART device itself */
#if defined(CONFIG_EARLY_CONSOLE)
SYS_DEFINE_DEVICE(uart_console, NULL, PRIMARY, CONFIG_UART_CONSOLE_PRIORITY);
#else
SYS_DEFINE_DEVICE(uart_console, NULL, SECONDARY, CONFIG_UART_CONSOLE_PRIORITY);
#endif

View file

@ -305,7 +305,8 @@ static struct eth_runtime eth_0_runtime;
DECLARE_DEVICE_INIT_CONFIG(eth_dw_0, CONFIG_ETH_DW_0_NAME, DECLARE_DEVICE_INIT_CONFIG(eth_dw_0, CONFIG_ETH_DW_0_NAME,
eth_initialize, &eth_config_0); eth_initialize, &eth_config_0);
nano_late_init(eth_dw_0, &eth_0_runtime); SYS_DEFINE_DEVICE(eth_dw_0, &eth_0_runtime, NANOKERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
static int eth_net_tx(struct net_buf *buf) static int eth_net_tx(struct net_buf *buf)
{ {

View file

@ -73,6 +73,12 @@ config GPIO_DW_CLASS
depends on GPIO_DW && PCI depends on GPIO_DW && PCI
default 0x0C default 0x0C
config GPIO_DW_INIT_PRIORITY
int
prompt "Init priority"
help
Device driver initialization priority.
config GPIO_DW_0 config GPIO_DW_0
bool "Designware GPIO block 0" bool "Designware GPIO block 0"
depends on GPIO_DW depends on GPIO_DW
@ -295,6 +301,12 @@ config GPIO_PCAL9535A_DEBUG
help help
Enable debugging for PCAL9535A driver. Enable debugging for PCAL9535A driver.
config GPIO_PCAL9535A_INIT_PRIORITY
int
prompt "Init priority"
help
Device driver initialization priority.
config GPIO_PCAL9535A_0 config GPIO_PCAL9535A_0
bool "PCAL9535A GPIO chip #0" bool "PCAL9535A GPIO chip #0"
depends on GPIO_PCAL9535A depends on GPIO_PCAL9535A
@ -419,6 +431,13 @@ config GPIO_MMIO
help help
Enable driver for MMIO-based GPIOs. Enable driver for MMIO-based GPIOs.
config GPIO_MMIO_INIT_PRIORITY
int
depends on GPIO_MMIO
prompt "Init priority"
help
Device driver initialization priority.
config GPIO_MMIO_0 config GPIO_MMIO_0
bool "MMIO-based GPIO Port #0" bool "MMIO-based GPIO Port #0"
depends on GPIO_MMIO depends on GPIO_MMIO
@ -554,6 +573,13 @@ config GPIO_SCH
help help
Enable the SCH GPIO driver found on Intel platforms Enable the SCH GPIO driver found on Intel platforms
config GPIO_SCH_INIT_PRIORITY
int
depends on GPIO_SCH
prompt "Init priority"
help
Device driver initialization priority.
config GPIO_SCH_LEGACY_IO_PORTS_ACCESS config GPIO_SCH_LEGACY_IO_PORTS_ACCESS
bool "SCH registers accessed through legacy I/O ports" bool "SCH registers accessed through legacy I/O ports"
depends on GPIO_SCH depends on GPIO_SCH

View file

@ -358,7 +358,8 @@ struct gpio_dw_runtime gpio_0_runtime;
DECLARE_DEVICE_INIT_CONFIG(gpio_0, CONFIG_GPIO_DW_0_NAME, DECLARE_DEVICE_INIT_CONFIG(gpio_0, CONFIG_GPIO_DW_0_NAME,
gpio_dw_initialize, &gpio_config_0); gpio_dw_initialize, &gpio_config_0);
pre_kernel_late_init(gpio_0, &gpio_0_runtime); SYS_DEFINE_DEVICE(gpio_0, &gpio_0_runtime, SECONDARY,
CONFIG_GPIO_DW_INIT_PRIORITY);
#ifdef CONFIG_GPIO_DW_0_IRQ_DIRECT #ifdef CONFIG_GPIO_DW_0_IRQ_DIRECT
struct device *gpio_dw_isr_0 = SYS_GET_DEVICE(gpio_0); struct device *gpio_dw_isr_0 = SYS_GET_DEVICE(gpio_0);
@ -416,8 +417,9 @@ struct gpio_dw_config gpio_dw_config_1 = {
struct gpio_dw_runtime gpio_1_runtime; struct gpio_dw_runtime gpio_1_runtime;
DECLARE_DEVICE_INIT_CONFIG(gpio_1, CONFIG_GPIO_DW_1_NAME, DECLARE_DEVICE_INIT_CONFIG(gpio_1, CONFIG_GPIO_DW_1_NAME,
gpio_dw_initialize, &gpio_dw_config_1); gpio_dw_initialize, &gpio_config_1);
pre_kernel_late_init(gpio_1, &gpio_1_runtime); SYS_DEFINE_DEVICE(gpio_1, &gpio_1_runtime, SECONDARY,
CONFIG_GPIO_DW_INIT_PRIORITY);
#ifdef CONFIG_GPIO_DW_1_IRQ_DIRECT #ifdef CONFIG_GPIO_DW_1_IRQ_DIRECT
struct device *gpio_dw_isr_1 = SYS_GET_DEVICE(gpio_1); struct device *gpio_dw_isr_1 = SYS_GET_DEVICE(gpio_1);

View file

@ -342,7 +342,8 @@ DECLARE_DEVICE_INIT_CONFIG(gpio_mmio_0,
CONFIG_GPIO_MMIO_0_DEV_NAME, CONFIG_GPIO_MMIO_0_DEV_NAME,
gpio_mmio_init, gpio_mmio_init,
&gpio_mmio_0_cfg); &gpio_mmio_0_cfg);
pre_kernel_late_init(gpio_mmio_0, (void *)0); SYS_DEFINE_DEVICE(gpio_mmio_0, (void *)0, SECONDARY,
CONFIG_GPIO_MMIO_INIT_PRIORITY);
#endif /* CONFIG_GPIO_MMIO_0 */ #endif /* CONFIG_GPIO_MMIO_0 */
@ -374,6 +375,7 @@ DECLARE_DEVICE_INIT_CONFIG(gpio_mmio_1,
CONFIG_GPIO_MMIO_1_DEV_NAME, CONFIG_GPIO_MMIO_1_DEV_NAME,
gpio_mmio_init, gpio_mmio_init,
&gpio_mmio_1_cfg); &gpio_mmio_1_cfg);
pre_kernel_late_init(gpio_mmio_1, (void *)0); SYS_DEFINE_DEVICE(gpio_mmio_1, (void *)0, SECONDARY,
CONFIG_GPIO_MMIO_INIT_PRIORITY);
#endif /* CONFIG_GPIO_MMIO_1 */ #endif /* CONFIG_GPIO_MMIO_1 */

View file

@ -625,7 +625,8 @@ DECLARE_DEVICE_INIT_CONFIG(gpio_pcal9535a_0,
gpio_pcal9535a_init, &gpio_pcal9535a_0_cfg); gpio_pcal9535a_init, &gpio_pcal9535a_0_cfg);
/* This has to init after I2C master */ /* This has to init after I2C master */
nano_early_init(gpio_pcal9535a_0, &gpio_pcal9535a_0_drvdata); SYS_DEFINE_DEVICE(gpio_pcal9535a_0, &gpio_pcal9535a_0_drvdata, SECONDARY,
CONFIG_GPIO_PCAL9535A_INIT_PRIORITY);
#endif /* CONFIG_GPIO_PCAL9535A_0 */ #endif /* CONFIG_GPIO_PCAL9535A_0 */
@ -653,7 +654,8 @@ DECLARE_DEVICE_INIT_CONFIG(gpio_pcal9535a_1,
gpio_pcal9535a_init, &gpio_pcal9535a_1_cfg); gpio_pcal9535a_init, &gpio_pcal9535a_1_cfg);
/* This has to init after I2C master */ /* This has to init after I2C master */
nano_early_init(gpio_pcal9535a_1, &gpio_pcal9535a_1_drvdata); SYS_DEFINE_DEVICE(gpio_pcal9535a_1, &gpio_pcal9535a_1_drvdata, SECONDARY,
CONFIG_GPIO_PCAL9535A_INIT_PRIORITY);
#endif /* CONFIG_GPIO_PCAL9535A_1 */ #endif /* CONFIG_GPIO_PCAL9535A_1 */
@ -681,7 +683,8 @@ DECLARE_DEVICE_INIT_CONFIG(gpio_pcal9535a_2,
gpio_pcal9535a_init, &gpio_pcal9535a_2_cfg); gpio_pcal9535a_init, &gpio_pcal9535a_2_cfg);
/* This has to init after I2C master */ /* This has to init after I2C master */
nano_early_init(gpio_pcal9535a_2, &gpio_pcal9535a_2_drvdata); SYS_DEFINE_DEVICE(gpio_pcal9535a_2, &gpio_pcal9535a_2_drvdata, SECONDARY,
CONFIG_GPIO_PCAL9535A_INIT_PRIORITY);
#endif /* CONFIG_GPIO_PCAL9535A_2 */ #endif /* CONFIG_GPIO_PCAL9535A_2 */
@ -709,6 +712,7 @@ DECLARE_DEVICE_INIT_CONFIG(gpio_pcal9535a_3,
gpio_pcal9535a_init, &gpio_pcal9535a_3_cfg); gpio_pcal9535a_init, &gpio_pcal9535a_3_cfg);
/* This has to init after I2C master */ /* This has to init after I2C master */
nano_early_init(gpio_pcal9535a_3, &gpio_pcal9535a_3_drvdata); SYS_DEFINE_DEVICE(gpio_pcal9535a_3, &gpio_pcal9535a_3_drvdata, SECONDARY,
CONFIG_GPIO_PCAL9535A_INIT_PRIORITY);
#endif /* CONFIG_GPIO_PCAL9535A_3 */ #endif /* CONFIG_GPIO_PCAL9535A_3 */

View file

@ -361,7 +361,8 @@ struct gpio_sch_data gpio_data_0;
DECLARE_DEVICE_INIT_CONFIG(gpio_0, CONFIG_GPIO_SCH_0_DEV_NAME, DECLARE_DEVICE_INIT_CONFIG(gpio_0, CONFIG_GPIO_SCH_0_DEV_NAME,
gpio_sch_init, &gpio_sch_0_config); gpio_sch_init, &gpio_sch_0_config);
pre_kernel_late_init(gpio_0, &gpio_data_0); SYS_DEFINE_DEVICE(gpio_0, &gpio_data_0, SECONDARY,
CONFIG_GPIO_SCH_INIT_PRIORITY);
#endif /* CONFIG_GPIO_SCH_0 */ #endif /* CONFIG_GPIO_SCH_0 */
#if CONFIG_GPIO_SCH_1 #if CONFIG_GPIO_SCH_1
@ -375,6 +376,7 @@ struct gpio_sch_data gpio_data_1;
DECLARE_DEVICE_INIT_CONFIG(gpio_1, CONFIG_GPIO_SCH_1_DEV_NAME, DECLARE_DEVICE_INIT_CONFIG(gpio_1, CONFIG_GPIO_SCH_1_DEV_NAME,
gpio_sch_init, &gpio_sch_1_config); gpio_sch_init, &gpio_sch_1_config);
pre_kernel_late_init(gpio_1, &gpio_data_1); SYS_DEFINE_DEVICE(gpio_1, &gpio_data_1, SECONDARY,
CONFIG_GPIO_SCH_INIT_PRIORITY);
#endif /* CONFIG_GPIO_SCH_1 */ #endif /* CONFIG_GPIO_SCH_1 */

View file

@ -38,3 +38,12 @@ config GROVE_LCD_RGB
help help
Setting this value will enable driver support for the Groove-LCD RGB Setting this value will enable driver support for the Groove-LCD RGB
Backlight. Backlight.
config GROVE_LCD_RGB_INIT_PRIORITY
int
prompt "Init priority"
depends on GROVE_LCD_RGB
help
Device driver initialization priority.
As the device is connected to I2C bus, its driver has
to be initialized after the I2C one.

View file

@ -358,4 +358,5 @@ DECLARE_DEVICE_INIT_CONFIG(grove_lcd,
glcd_initialize, glcd_initialize,
&grove_lcd_config); &grove_lcd_config);
app_early_init(grove_lcd, &grove_lcd_driver); SYS_DEFINE_DEVICE(grove_lcd, &grove_lcd_driver, SECONDARY,
CONFIG_GROVE_LCD_RGB_INIT_PRIORITY);

View file

@ -26,6 +26,13 @@ menuconfig I2C
help help
Enable I2C Driver Configuration Enable I2C Driver Configuration
config I2C_INIT_PRIORITY
int
depends on I2C
prompt "Init priority"
help
I2C device driver initialization priority.
config I2C_DW config I2C_DW
bool "Design Ware I2C support" bool "Design Ware I2C support"
depends on I2C depends on I2C

View file

@ -837,7 +837,7 @@ DECLARE_DEVICE_INIT_CONFIG(i2c_0,
&i2c_dw_initialize, &i2c_dw_initialize,
&i2c_config_dw_0); &i2c_config_dw_0);
pre_kernel_late_init(i2c_0, &i2c_0_runtime); SYS_DEFINE_DEVICE(i2c_0, &i2c_0_runtime, SECONDARY, CONFIG_I2C_INIT_PRIORITY);
struct device *i2c_dw_isr_0_device = SYS_GET_DEVICE(i2c_0); struct device *i2c_dw_isr_0_device = SYS_GET_DEVICE(i2c_0);
#ifdef CONFIG_I2C_DW_0_IRQ_DIRECT #ifdef CONFIG_I2C_DW_0_IRQ_DIRECT
@ -889,7 +889,8 @@ DECLARE_DEVICE_INIT_CONFIG(i2c_1,
&i2c_dw_initialize, &i2c_dw_initialize,
&i2c_config_dw_1); &i2c_config_dw_1);
pre_kernel_late_init(i2c_1, &i2c_1_runtime); SYS_DEFINE_DEVICE(i2c_1, &i2c_1_runtime, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
struct device *i2c_dw_isr_1_device = SYS_GET_DEVICE(i2c_1); struct device *i2c_dw_isr_1_device = SYS_GET_DEVICE(i2c_1);
IRQ_CONNECT_STATIC(i2c_dw_1, IRQ_CONNECT_STATIC(i2c_dw_1,

View file

@ -751,7 +751,8 @@ DECLARE_DEVICE_INIT_CONFIG(i2c_ss_0,
&i2c_qse_ss_initialize, &i2c_qse_ss_initialize,
&i2c_config_ss_0); &i2c_config_ss_0);
pre_kernel_late_init(i2c_ss_0, &i2c_ss_0_runtime); SYS_DEFINE_DEVICE(i2c_ss_0, &i2c_ss_0_runtime,
SECONDARY, CONFIG_I2C_INIT_PRIORITY);
#endif /* CONFIG_I2C_QUARK_SE_SS_0 */ #endif /* CONFIG_I2C_QUARK_SE_SS_0 */
@ -785,6 +786,7 @@ DECLARE_DEVICE_INIT_CONFIG(i2c_ss_1,
&i2c_qse_ss_initialize, &i2c_qse_ss_initialize,
&i2c_config_ss_1); &i2c_config_ss_1);
pre_kernel_late_init(i2c_ss_1, &i2c_qse_ss_1_runtime); SYS_DEFINE_DEVICE(i2c_ss_1, &i2c_qse_ss_1_runtime,
SECONDARY, CONFIG_I2C_INIT_PRIORITY);
#endif /* CONFIG_I2C_QUARK_SE_SS_1 */ #endif /* CONFIG_I2C_QUARK_SE_SS_1 */

View file

@ -135,7 +135,8 @@ int quark_se_ipi_controller_initialize(struct device *d);
DECLARE_DEVICE_INIT_CONFIG(name, _STRINGIFY(name), \ DECLARE_DEVICE_INIT_CONFIG(name, _STRINGIFY(name), \
quark_se_ipi_initialize, \ quark_se_ipi_initialize, \
&quark_se_ipi_config_##name); \ &quark_se_ipi_config_##name); \
pre_kernel_late_init(name, &quark_se_ipi_runtime_##name); SYS_DEFINE_DEVICE(name, &quark_se_ipi_runtime_##name, SECONDARY, \
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
#endif /* __INCquark_se_mailboxh */ #endif /* __INCquark_se_mailboxh */

View file

@ -45,6 +45,16 @@ config PINMUX_DEV
prototyping on new hardware. WARNING: When using these options, it prototyping on new hardware. WARNING: When using these options, it
is possible to permanently damage the hardware. is possible to permanently damage the hardware.
config PINMUX_INIT_PRIORITY
int
prompt "Init priority"
default 60
depends on PINMUX
help
Device driver initialization priority.
The device needs to be initialized after all the devices it
uses.
config PINMUX_GALILEO_EXP0_NAME config PINMUX_GALILEO_EXP0_NAME
string "Name of the GPIO expander 0" string "Name of the GPIO expander 0"
depends on PINMUX && PLATFORM_GALILEO depends on PINMUX && PLATFORM_GALILEO

View file

@ -29,6 +29,13 @@ config PWM_PCA9685
help help
Enable driver for PCA9685 I2C-based PWM chip. Enable driver for PCA9685 I2C-based PWM chip.
config PWM_PCA9685_INIT_PRIORITY
int
depends on PWM_PCA9685
prompt "Init priority"
help
Device driver initialization priority.
config PWM_PCA9685_0 config PWM_PCA9685_0
bool "PCA9685 PWM chip #0" bool "PCA9685 PWM chip #0"
depends on PWM_PCA9685 depends on PWM_PCA9685

View file

@ -235,6 +235,7 @@ DECLARE_DEVICE_INIT_CONFIG(pwm_pca9685_0,
pwm_pca9685_init, &pwm_pca9685_0_cfg); pwm_pca9685_init, &pwm_pca9685_0_cfg);
/* This has to init after I2C master */ /* This has to init after I2C master */
nano_early_init(pwm_pca9685_0, &pwm_pca9685_0_drvdata); SYS_DEFINE_DEVICE(pwm_pca9685_0, &pwm_pca9685_0_drvdata, SECONDARY,
CONFIG_PWM_PCA9685_INIT_PRIORITY);
#endif /* CONFIG_PWM_PCA9685_0 */ #endif /* CONFIG_PWM_PCA9685_0 */

View file

@ -152,5 +152,5 @@ struct rtc_dw_dev_config rtc_dev = {
#ifdef CONFIG_RTC_DW #ifdef CONFIG_RTC_DW
DECLARE_DEVICE_INIT_CONFIG(rtc, RTC_DRV_NAME, &rtc_dw_init, &rtc_dev); DECLARE_DEVICE_INIT_CONFIG(rtc, RTC_DRV_NAME, &rtc_dw_init, &rtc_dev);
nano_early_init(rtc, NULL); SYS_DEFINE_DEVICE(rtc, NULL, SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);
#endif #endif

View file

@ -34,6 +34,14 @@ config SHARED_IRQ_NUM_CLIENTS
instance of the shared interrupt driver. To conserve RAM set instance of the shared interrupt driver. To conserve RAM set
this value to the lowest practical value. this value to the lowest practical value.
config SHARED_IRQ_INIT_PRIORITY
int
depends on SHARED_IRQ
prompt "Shared IRQ init priority"
help
Shared IRQ are initialized on SECONDARY init level. They
have to be initialized before any device that uses them.
config SHARED_IRQ_0 config SHARED_IRQ_0
bool "Shared interrupt instance 0" bool "Shared interrupt instance 0"
depends on SHARED_IRQ depends on SHARED_IRQ

View file

@ -142,7 +142,8 @@ struct shared_irq_runtime shared_irq_0_runtime;
DECLARE_DEVICE_INIT_CONFIG(shared_irq_0, CONFIG_SHARED_IRQ_0_NAME, DECLARE_DEVICE_INIT_CONFIG(shared_irq_0, CONFIG_SHARED_IRQ_0_NAME,
shared_irq_initialize, &shared_irq_config_0); shared_irq_initialize, &shared_irq_config_0);
pre_kernel_early_init(shared_irq_0, &shared_irq_0_runtime); SYS_DEFINE_DEVICE(shared_irq_0, &shared_irq_0_runtime, SECONDARY,
CONFIG_SHARED_IRQ_INIT_PRIORITY);
IRQ_CONNECT_STATIC(shared_irq_0, CONFIG_SHARED_IRQ_0_IRQ, IRQ_CONNECT_STATIC(shared_irq_0, CONFIG_SHARED_IRQ_0_IRQ,
CONFIG_SHARED_IRQ_0_PRI, shared_irq_isr_0, 0, CONFIG_SHARED_IRQ_0_PRI, shared_irq_isr_0, 0,
@ -175,7 +176,8 @@ struct shared_irq_runtime shared_irq_1_runtime;
DECLARE_DEVICE_INIT_CONFIG(shared_irq_1, CONFIG_SHARED_IRQ_1_NAME, DECLARE_DEVICE_INIT_CONFIG(shared_irq_1, CONFIG_SHARED_IRQ_1_NAME,
shared_irq_initialize, &shared_irq_config_1); shared_irq_initialize, &shared_irq_config_1);
pre_kernel_early_init(shared_irq_1, &shared_irq_1_runtime); SYS_DEFINE_DEVICE(shared_irq_1, &shared_irq_1_runtime, SECONDARY,
CONFIG_SHARED_IRQ_INIT_PRIORITY);
IRQ_CONNECT_STATIC(shared_irq_1, CONFIG_SHARED_IRQ_1_IRQ, IRQ_CONNECT_STATIC(shared_irq_1, CONFIG_SHARED_IRQ_1_IRQ,
CONFIG_SHARED_IRQ_1_PRI, shared_irq_isr_1, 0, CONFIG_SHARED_IRQ_1_PRI, shared_irq_isr_1, 0,

View file

@ -91,6 +91,12 @@ config SPI_INTEL_CS_GPIO
depends on SPI_INTEL && GPIO depends on SPI_INTEL && GPIO
default n default n
config SPI_INTEL_INIT_PRIORITY
int
prompt "Init priority"
help
Device driver initialization priority.
config SPI_INTEL_PORT_0 config SPI_INTEL_PORT_0
bool bool
prompt "Intel SPI port 0" prompt "Intel SPI port 0"

View file

@ -459,7 +459,8 @@ struct spi_dw_config spi_dw_config_0 = {
DECLARE_DEVICE_INIT_CONFIG(spi_dw_port_0, CONFIG_SPI_DW_PORT_0_DRV_NAME, DECLARE_DEVICE_INIT_CONFIG(spi_dw_port_0, CONFIG_SPI_DW_PORT_0_DRV_NAME,
spi_dw_init, &spi_dw_config_0); spi_dw_init, &spi_dw_config_0);
pre_kernel_late_init(spi_dw_port_0, &spi_dw_data_port_0); SYS_DEFINE_DEVICE(spi_dw_port_0, &spi_dw_data_port_0, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
struct device *spi_dw_isr_port_0 = SYS_GET_DEVICE(spi_dw_port_0); struct device *spi_dw_isr_port_0 = SYS_GET_DEVICE(spi_dw_port_0);
IRQ_CONNECT_STATIC(spi_dw_irq_port_0, CONFIG_SPI_DW_PORT_0_IRQ, IRQ_CONNECT_STATIC(spi_dw_irq_port_0, CONFIG_SPI_DW_PORT_0_IRQ,
@ -494,7 +495,8 @@ struct spi_dw_config spi_dw_config_1 = {
DECLARE_DEVICE_INIT_CONFIG(spi_dw_port_1, CONFIG_SPI_DW_PORT_1_DRV_NAME, DECLARE_DEVICE_INIT_CONFIG(spi_dw_port_1, CONFIG_SPI_DW_PORT_1_DRV_NAME,
spi_dw_init, &spi_dw_config_1); spi_dw_init, &spi_dw_config_1);
pre_kernel_late_init(spi_dw_port_1, &spi_dw_data_port_1); SYS_DEFINE_DEVICE(spi_dw_port_1, &spi_dw_data_port_1, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
struct device *spi_dw_isr_port_1 = SYS_GET_DEVICE(spi_dw_port_1); struct device *spi_dw_isr_port_1 = SYS_GET_DEVICE(spi_dw_port_1);
IRQ_CONNECT_STATIC(spi_dw_irq_port_1, CONFIG_SPI_DW_PORT_1_IRQ, IRQ_CONNECT_STATIC(spi_dw_irq_port_1, CONFIG_SPI_DW_PORT_1_IRQ,

View file

@ -455,7 +455,9 @@ struct spi_intel_config spi_intel_config_0 = {
DECLARE_DEVICE_INIT_CONFIG(spi_intel_port_0, CONFIG_SPI_INTEL_PORT_0_DRV_NAME, DECLARE_DEVICE_INIT_CONFIG(spi_intel_port_0, CONFIG_SPI_INTEL_PORT_0_DRV_NAME,
spi_intel_init, &spi_intel_config_0); spi_intel_init, &spi_intel_config_0);
nano_late_init(spi_intel_port_0, &spi_intel_data_port_0); /* SPI may use GPIO pin for CS, thus it needs to be initialized after GPIO */
SYS_DEFINE_DEVICE(spi_intel_port_0, &spi_intel_data_port_0, SECONDARY,
CONFIG_SPI_INTEL_INIT_PRIORITY);
struct device *spi_intel_isr_port_0 = SYS_GET_DEVICE(spi_intel_port_0); struct device *spi_intel_isr_port_0 = SYS_GET_DEVICE(spi_intel_port_0);
IRQ_CONNECT_STATIC(spi_intel_irq_port_0, CONFIG_SPI_INTEL_PORT_0_IRQ, IRQ_CONNECT_STATIC(spi_intel_irq_port_0, CONFIG_SPI_INTEL_PORT_0_IRQ,
@ -497,7 +499,9 @@ struct spi_intel_config spi_intel_config_1 = {
DECLARE_DEVICE_INIT_CONFIG(spi_intel_port_1, CONFIG_SPI_INTEL_PORT_1_DRV_NAME, DECLARE_DEVICE_INIT_CONFIG(spi_intel_port_1, CONFIG_SPI_INTEL_PORT_1_DRV_NAME,
spi_intel_init, &spi_intel_config_1); spi_intel_init, &spi_intel_config_1);
nano_late_init(spi_intel_port_1, &spi_intel_data_port_1); /* SPI may use GPIO pin for CS, thus it needs to be initialized after GPIO */
SYS_DEFINE_DEVICE(spi_intel_port_1, &spi_intel_data_port_1, SECONDARY,
CONFIG_SPI_INTEL_INIT_PRIORITY);
struct device *spi_intel_isr_port_1 = SYS_GET_DEVICE(spi_intel_port_1); struct device *spi_intel_isr_port_1 = SYS_GET_DEVICE(spi_intel_port_1);
IRQ_CONNECT_STATIC(spi_intel_irq_port_1, CONFIG_SPI_INTEL_PORT_1_IRQ, IRQ_CONNECT_STATIC(spi_intel_irq_port_1, CONFIG_SPI_INTEL_PORT_1_IRQ,

View file

@ -35,4 +35,5 @@
DECLARE_DEVICE_INIT_CONFIG(sys_clock, "sys_clock", DECLARE_DEVICE_INIT_CONFIG(sys_clock, "sys_clock",
_sys_clock_driver_init, NULL); _sys_clock_driver_init, NULL);
nano_late_init(sys_clock, NULL); SYS_DEFINE_DEVICE(sys_clock, NULL, NANOKERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEVICE);

View file

@ -122,4 +122,4 @@ struct wdt_dw_dev_config wdt_dev = {
DECLARE_DEVICE_INIT_CONFIG(wdt, WDT_DRV_NAME, &wdt_dw_init, &wdt_dev); DECLARE_DEVICE_INIT_CONFIG(wdt, WDT_DRV_NAME, &wdt_dw_init, &wdt_dev);
micro_early_init(wdt, NULL); SYS_DEFINE_DEVICE(wdt, NULL, SECONDARY, CONFIG_KERNEL_INIT_PRIORITY_DEVICE);

View file

@ -103,25 +103,4 @@
#define SYS_GET_DEVICE(name) (&(_PASTE(__initconfig_, name))) #define SYS_GET_DEVICE(name) (&(_PASTE(__initconfig_, name)))
/* The following legacy APIs are provided for backwards compatibility */
#define pre_kernel_core_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, PRIMARY, 0)
#define pre_kernel_early_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, SECONDARY, 0)
#define pre_kernel_late_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, SECONDARY, 50)
#define nano_early_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, NANOKERNEL, 0)
#define nano_late_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, NANOKERNEL, 50)
#define micro_early_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, MICROKERNEL, 0)
#define micro_late_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, MICROKERNEL, 50)
#define app_early_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, APPLICATION, 0)
#define app_late_init(cfg, data) \
SYS_DEFINE_DEVICE(cfg, data, APPLICATION, 50)
#endif /* _INIT_H_ */ #endif /* _INIT_H_ */

View file

@ -111,6 +111,19 @@ config KERNEL_EVENT_LOGGER_BUFFER_SIZE
help help
Buffer size in 32-bit words. Buffer size in 32-bit words.
config KERNEL_INIT_PRIORITY_DEFAULT
int
prompt "Default init priority"
help
Defaut minimal init priority for each init level.
config KERNEL_INIT_PRIORITY_DEVICE
int
prompt "Default init priority for device drivers"
help
Device driver, that depends on common components, such as
interrupt controller, but does not depend on other devices,
uses this init priority.
menu "Kernel event logging points" menu "Kernel event logging points"
depends on KERNEL_EVENT_LOGGER depends on KERNEL_EVENT_LOGGER

View file

@ -55,7 +55,8 @@ static int _sys_k_event_logger_init(struct device *arg)
} }
DECLARE_DEVICE_INIT_CONFIG(kernel_event_logger_0, "", DECLARE_DEVICE_INIT_CONFIG(kernel_event_logger_0, "",
_sys_k_event_logger_init, NULL); _sys_k_event_logger_init, NULL);
nano_early_init(kernel_event_logger_0, NULL); SYS_DEFINE_DEVICE(kernel_event_logger_0, NULL, NANOKERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
void sys_k_event_logger_put_timed(uint16_t event_id) void sys_k_event_logger_put_timed(uint16_t event_id)

View file

@ -279,4 +279,5 @@ static int init(struct device *unused)
} }
DECLARE_DEVICE_INIT_CONFIG(mem_safe, "", init, NULL); DECLARE_DEVICE_INIT_CONFIG(mem_safe, "", init, NULL);
pre_kernel_early_init(mem_safe, NULL); SYS_DEFINE_DEVICE(mem_safe, NULL, PRIMARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);

View file

@ -36,6 +36,8 @@
#define DEST IPI_CONSOLE_STDOUT #define DEST IPI_CONSOLE_STDOUT
#endif #endif
#define INIT_PRIO_IPI_SEND 50
/* Set up the dummy IPI driver */ /* Set up the dummy IPI driver */
struct ipi_dummy_config_info ipi_dummy0_config_info = { struct ipi_dummy_config_info ipi_dummy0_config_info = {
.sw_irq = 0 .sw_irq = 0
@ -43,7 +45,8 @@ struct ipi_dummy_config_info ipi_dummy0_config_info = {
struct ipi_dummy_driver_data ipi_dummy0_driver_data; struct ipi_dummy_driver_data ipi_dummy0_driver_data;
DECLARE_DEVICE_INIT_CONFIG(ipi_dummy0, "ipi_dummy0", ipi_dummy_init, DECLARE_DEVICE_INIT_CONFIG(ipi_dummy0, "ipi_dummy0", ipi_dummy_init,
&ipi_dummy0_config_info); &ipi_dummy0_config_info);
pre_kernel_late_init(ipi_dummy0, &ipi_dummy0_driver_data); SYS_DEFINE_DEVICE(ipi_dummy0, &ipi_dummy0_driver_data, SECONDARY,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
/* Sending side of the console IPI driver, will forward anything sent /* Sending side of the console IPI driver, will forward anything sent
* to printf() since we selected IPI_CONSOLE_STDOUT */ * to printf() since we selected IPI_CONSOLE_STDOUT */
@ -53,7 +56,8 @@ struct ipi_console_sender_config_info sender_config = {
}; };
DECLARE_DEVICE_INIT_CONFIG(ipi_console_send0, "ipi_send0", DECLARE_DEVICE_INIT_CONFIG(ipi_console_send0, "ipi_send0",
ipi_console_sender_init, &sender_config); ipi_console_sender_init, &sender_config);
nano_late_init(ipi_console_send0, NULL); SYS_DEFINE_DEVICE(ipi_console_send0, NULL, NANOKERNEL,
INIT_PRIO_IPI_SEND);
/* Receiving side of the console IPI driver. These numbers are /* Receiving side of the console IPI driver. These numbers are
* more or less arbitrary */ * more or less arbitrary */
@ -77,7 +81,8 @@ struct ipi_console_receiver_config_info receiver_config = {
struct ipi_console_receiver_runtime_data receiver_data; struct ipi_console_receiver_runtime_data receiver_data;
DECLARE_DEVICE_INIT_CONFIG(ipi_console_recv0, "ipi_recv0", DECLARE_DEVICE_INIT_CONFIG(ipi_console_recv0, "ipi_recv0",
ipi_console_receiver_init, &receiver_config); ipi_console_receiver_init, &receiver_config);
nano_early_init(ipi_console_recv0, &receiver_data); SYS_DEFINE_DEVICE(ipi_console_recv0, &receiver_data, NANOKERNEL,
CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
static const char thestr[] = "everything is awesome\n"; static const char thestr[] = "everything is awesome\n";