drivers: console: Refactor drivers to use shared init priority
Refactors all of the console drivers to use a shared driver class initialization priority configuration, CONFIG_CONSOLE_INIT_PRIORITY, to allow configuring console drivers separately from other devices. This is similar to other driver classes like I2C and SPI. The default is set to CONFIG_KERNEL_INIT_PRIORITY_DEFAULT to preserve the existing default initialization priority for most drivers. The driver-specific option, CONFIG_NATIVE_POSIX_CONSOLE_INIT_PRIORITY, is left intact because the native posix console driver needs to initialize after the UART console driver when both drivers are enabled. Signed-off-by: Maureen Helm <maureen.helm@intel.com>
This commit is contained in:
parent
165963c115
commit
43fa7ce53f
8 changed files with 16 additions and 32 deletions
|
@ -32,6 +32,14 @@ config CONSOLE_HANDLER
|
|||
This option enables console input handler allowing to write simple
|
||||
interaction between serial console and the OS.
|
||||
|
||||
config CONSOLE_INIT_PRIORITY
|
||||
int "Console init priority"
|
||||
default 95 if USB_UART_CONSOLE || UART_MUX
|
||||
default 60 if UART_CONSOLE || XTENSA_SIM_CONSOLE
|
||||
default KERNEL_INIT_PRIORITY_DEFAULT
|
||||
help
|
||||
Console driver device initialization priority.
|
||||
|
||||
config UART_CONSOLE
|
||||
bool "Use UART for console"
|
||||
depends on SERIAL && SERIAL_HAS_DRIVER
|
||||
|
@ -39,16 +47,6 @@ config UART_CONSOLE
|
|||
help
|
||||
Enable this option to use one UART for console.
|
||||
|
||||
config UART_CONSOLE_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 95 if USB_UART_CONSOLE
|
||||
default 60
|
||||
depends on UART_CONSOLE
|
||||
help
|
||||
Device driver initialization priority.
|
||||
Console has to be initialized after the UART driver
|
||||
it uses.
|
||||
|
||||
config UART_CONSOLE_DEBUG_SERVER_HOOKS
|
||||
bool "Debug server hooks in debug console"
|
||||
depends on UART_CONSOLE
|
||||
|
@ -290,13 +288,6 @@ config NATIVE_POSIX_STDOUT_CONSOLE
|
|||
help
|
||||
Zephyr's printk messages will be directed to the host terminal stdout.
|
||||
|
||||
config XTENSA_CONSOLE_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 60
|
||||
depends on XTENSA_SIM_CONSOLE
|
||||
help
|
||||
Device driver initialization priority.
|
||||
|
||||
config NATIVE_POSIX_CONSOLE_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 99
|
||||
|
@ -335,13 +326,6 @@ config UART_MUX
|
|||
|
||||
if UART_MUX
|
||||
|
||||
config UART_MUX_INIT_PRIORITY
|
||||
int "Init priority"
|
||||
default 95
|
||||
help
|
||||
Device driver initialization priority. UART mux has to be
|
||||
initialized after the UART driver it uses.
|
||||
|
||||
config UART_MUX_DEVICE_NAME
|
||||
string "UART mux device name template"
|
||||
default "GSM"
|
||||
|
|
|
@ -88,4 +88,4 @@ static int ipm_console_init(const struct device *dev)
|
|||
}
|
||||
|
||||
/* Need to be initialized after IPM */
|
||||
SYS_INIT(ipm_console_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
SYS_INIT(ipm_console_init, POST_KERNEL, CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
|
@ -35,4 +35,4 @@ static int ram_console_init(const struct device *d)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(ram_console_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
SYS_INIT(ram_console_init, PRE_KERNEL_1, CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
|
@ -88,4 +88,4 @@ static int rtt_console_init(const struct device *d)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(rtt_console_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
SYS_INIT(rtt_console_init, PRE_KERNEL_1, CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
|
@ -51,4 +51,4 @@ static int semihost_console_init(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(semihost_console_init, PRE_KERNEL_1, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
||||
SYS_INIT(semihost_console_init, PRE_KERNEL_1, CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
|
@ -613,4 +613,4 @@ SYS_INIT(uart_console_init,
|
|||
#else
|
||||
POST_KERNEL,
|
||||
#endif
|
||||
CONFIG_UART_CONSOLE_INIT_PRIORITY);
|
||||
CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
|
@ -890,7 +890,7 @@ void uart_mux_foreach(uart_mux_cb_t cb, void *user_data)
|
|||
&uart_mux_dev_data_##x, \
|
||||
&uart_mux_config_##x, \
|
||||
POST_KERNEL, \
|
||||
CONFIG_KERNEL_INIT_PRIORITY_DEVICE, \
|
||||
CONFIG_CONSOLE_INIT_PRIORITY, \
|
||||
&uart_mux_driver_api);
|
||||
|
||||
UTIL_LISTIFY(CONFIG_UART_MUX_DEVICE_COUNT, DEFINE_UART_MUX_CFG_DATA, _)
|
||||
|
@ -909,4 +909,4 @@ static int init_uart_mux(const struct device *dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
SYS_INIT(init_uart_mux, POST_KERNEL, CONFIG_UART_MUX_INIT_PRIORITY);
|
||||
SYS_INIT(init_uart_mux, POST_KERNEL, CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
|
@ -77,4 +77,4 @@ SYS_INIT(xt_sim_console_init,
|
|||
#else
|
||||
POST_KERNEL,
|
||||
#endif
|
||||
CONFIG_XTENSA_CONSOLE_INIT_PRIORITY);
|
||||
CONFIG_CONSOLE_INIT_PRIORITY);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue