arm/nxp_kinetis/k6x: simplify uart init
The UART console init should be done after UART init. So it can be folded into general UART init, thus one fewer SYS_INIT(). Change-Id: Ifb18c5308dfef790325e6bff5bc7b5976fcd421e Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
ad6ed299b7
commit
8f0ab3038c
1 changed files with 9 additions and 7 deletions
|
@ -39,8 +39,8 @@
|
||||||
|
|
||||||
#ifdef CONFIG_UART_K20
|
#ifdef CONFIG_UART_K20
|
||||||
|
|
||||||
#if defined(CONFIG_UART_CONSOLE)
|
#if defined(CONFIG_UART_CONSOLE) && \
|
||||||
#if defined(CONFIG_PRINTK) || defined(CONFIG_STDOUT_CONSOLE)
|
(defined(CONFIG_PRINTK) || defined(CONFIG_STDOUT_CONSOLE))
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Initialize K20 serial port as console
|
* @brief Initialize K20 serial port as console
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
*
|
*
|
||||||
* @return 0 if successful, otherwise failed.
|
* @return 0 if successful, otherwise failed.
|
||||||
*/
|
*/
|
||||||
static int uart_k20_console_init(struct device *dev)
|
static ALWAYS_INLINE int uart_k20_console_init(void)
|
||||||
{
|
{
|
||||||
uint32_t port;
|
uint32_t port;
|
||||||
uint32_t rxPin;
|
uint32_t rxPin;
|
||||||
|
@ -76,10 +76,9 @@ static int uart_k20_console_init(struct device *dev)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SYS_INIT(uart_k20_console_init, PRIMARY, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT);
|
#else
|
||||||
|
#define uart_k20_console_init(...)
|
||||||
#endif
|
#endif /* CONFIG_UART_CONSOLE && (CONFIG_PRINTK || CONFIG_STDOUT_CONSOLE) */
|
||||||
#endif /* CONFIG_UART_CONSOLE */
|
|
||||||
|
|
||||||
static int uart_k20_init(struct device *dev)
|
static int uart_k20_init(struct device *dev)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +116,9 @@ static int uart_k20_init(struct device *dev)
|
||||||
sim->scgc1.field.uart4_clk_en = 1;
|
sim->scgc1.field.uart4_clk_en = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Initialize UART port for console if needed */
|
||||||
|
uart_k20_console_init();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue