diff options
author | Simon Glass <sjg@chromium.org> | 2015-10-18 19:51:24 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-10-21 07:46:50 -0600 |
commit | 0e977bc1455699fd8a9303ee3e8fd66a3c8eaced (patch) | |
tree | 858bf46693800745dbc70f7916a8e3eb43acd18c /include/debug_uart.h | |
parent | 97b059730218824a1455f030aadd78ef51729ec0 (diff) |
debug_uart: Support board-specific UART initialisation
Some boards need to set things up before the debug UART can be used. On
these boards a call to debug_uart_init() is insufficient. When this option
is enabled, the function board_debug_uart_init() will be called when
debug_uart_init() is called. You can put any code here that is needed to
set up the UART ready for use, such as set pin multiplexing or enable
clocks.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'include/debug_uart.h')
-rw-r--r-- | include/debug_uart.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/debug_uart.h b/include/debug_uart.h index 257ba004d6e..a6b7ce8e6ee 100644 --- a/include/debug_uart.h +++ b/include/debug_uart.h @@ -42,6 +42,11 @@ * - Define _debug_uart_putc() as static inline (avoiding stack usage) * - Immediately afterwards, add DEBUG_UART_FUNCS to define the rest of the * functionality (printch(), etc.) + * + * If your board needs additional init for the UART to work, enable + * CONFIG_DEBUG_UART_BOARD_INIT and write a function called + * board_debug_uart_init() to perform that init. When debug_uart_init() is + * called, the init will happen automatically. */ /** @@ -57,6 +62,14 @@ */ void debug_uart_init(void); +#ifdef CONFIG_DEBUG_UART_BOARD_INIT +void board_debug_uart_init(void); +#else +static inline void board_debug_uart_init(void) +{ +} +#endif + /** * printch() - Output a character to the debug UART * @@ -136,6 +149,7 @@ void printhex8(uint value); \ void debug_uart_init(void) \ { \ + board_debug_uart_init(); \ _debug_uart_init(); \ } \ |