board: sama5d2_xplained: Enable an early debug UART
authorWenyou Yang <wenyou.yang@atmel.com>
Mon, 17 Oct 2016 01:55:26 +0000 (09:55 +0800)
committerAndreas Bießmann <andreas@biessmann.org>
Fri, 28 Oct 2016 16:37:15 +0000 (18:37 +0200)
Enable an early debug UART to debug problems when an ICE or other
debug mechanism is not available.

Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Andreas Bießmann <andreas.devel@googlemail.com>
board/atmel/sama5d2_xplained/sama5d2_xplained.c
configs/sama5d2_xplained_mmc_defconfig
configs/sama5d2_xplained_spiflash_defconfig
include/configs/sama5d2_xplained.h

index cceccd2ac459adc794e9c4fdb3572ac92aea8478..c5337af4de6fa16e6e22d0aa48f19f3be8b69891 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <common.h>
 #include <atmel_hlcdc.h>
+#include <debug_uart.h>
 #include <dm.h>
 #include <i2c.h>
 #include <lcd.h>
@@ -141,12 +142,25 @@ static void board_uart1_hw_init(void)
        at91_periph_clk_enable(ATMEL_ID_UART1);
 }
 
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+       board_uart1_hw_init();
+}
+#endif
+
+#ifdef CONFIG_BOARD_EARLY_INIT_F
 int board_early_init_f(void)
 {
+#ifdef CONFIG_DEBUG_UART
+       debug_uart_init();
+#else
        board_uart1_hw_init();
+#endif
 
        return 0;
 }
+#endif
 
 int board_init(void)
 {
index 08ecea640115412b9b4731b826966772d053995a..8a786f1a062d664824f3ae4948484c6a770a34a6 100644 (file)
@@ -52,6 +52,12 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91PIO4=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_ATMEL=y
+CONFIG_DEBUG_UART_BASE=0xf8020000
+CONFIG_DEBUG_UART_CLOCK=0
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
 CONFIG_DM_SPI=y
 CONFIG_ATMEL_SPI=y
index b49d2adf676a58f0c75cc1527019a2b217862486..51594e71f71678aaff168f6adc86a1798dcab24a 100644 (file)
@@ -51,6 +51,12 @@ CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91PIO4=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_ATMEL=y
+CONFIG_DEBUG_UART_BASE=0xf8020000
+CONFIG_DEBUG_UART_CLOCK=0
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
 CONFIG_DM_SPI=y
 CONFIG_ATMEL_SPI=y
index 7fb2bdcd4c2ca2ab4d945b24f4a998fc58d177c8..f6946453e5df9c584c198022810d2e2ff3eaf94f 100644 (file)
@@ -15,6 +15,8 @@
 
 #include "at91-sama5_common.h"
 
+#define CONFIG_BOARD_EARLY_INIT_F
+
 #define CONFIG_MISC_INIT_R
 
 /* SDRAM */