[U-Boot] [PATCH v3 7/8] board: sama5d4ek: enable early debug UART

Wenyou Yang wenyou.yang at atmel.com
Tue Feb 7 08:01:28 UTC 2017


Enable early debug UART to debug problems when an ICE or other
debug mechanism is not available.

Signed-off-by: Wenyou Yang <wenyou.yang at atmel.com>
Reviewed-by: Andreas Bießmann <andreas at biessmann.org>
---

Changes in v3: None
Changes in v2: None

 board/atmel/sama5d4ek/sama5d4ek.c     | 15 ++++++++++++++-
 configs/sama5d4ek_mmc_defconfig       |  6 ++++++
 configs/sama5d4ek_nandflash_defconfig |  6 ++++++
 configs/sama5d4ek_spiflash_defconfig  |  6 ++++++
 4 files changed, 32 insertions(+), 1 deletion(-)

diff --git a/board/atmel/sama5d4ek/sama5d4ek.c b/board/atmel/sama5d4ek/sama5d4ek.c
index c5479e7d7e..2c2036c496 100644
--- a/board/atmel/sama5d4ek/sama5d4ek.c
+++ b/board/atmel/sama5d4ek/sama5d4ek.c
@@ -17,6 +17,7 @@
 #include <asm/arch/sama5d4.h>
 #include <atmel_hlcdc.h>
 #include <lcd.h>
+#include <debug_uart.h>
 #include <net.h>
 #include <netdev.h>
 #include <nand.h>
@@ -192,12 +193,24 @@ static void sama5d4ek_serial3_hw_init(void)
 	at91_periph_clk_enable(ATMEL_ID_USART3);
 }
 
-int board_early_init_f(void)
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
 {
 	sama5d4ek_serial3_hw_init();
+}
+#endif
 
+#ifdef CONFIG_BOARD_EARLY_INIT_F
+int board_early_init_f(void)
+{
+#ifdef CONFIG_DEBUG_UART
+	debug_uart_init();
+#else
+	sama5d4ek_serial3_hw_init();
+#endif
 	return 0;
 }
+#endif
 
 int board_init(void)
 {
diff --git a/configs/sama5d4ek_mmc_defconfig b/configs/sama5d4ek_mmc_defconfig
index fd49b58ab6..76b785569e 100644
--- a/configs/sama5d4ek_mmc_defconfig
+++ b/configs/sama5d4ek_mmc_defconfig
@@ -48,6 +48,12 @@ CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_ATMEL=y
+CONFIG_DEBUG_UART_BASE=0xfc00c000
+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
diff --git a/configs/sama5d4ek_nandflash_defconfig b/configs/sama5d4ek_nandflash_defconfig
index 34f5234e54..1bef32227a 100644
--- a/configs/sama5d4ek_nandflash_defconfig
+++ b/configs/sama5d4ek_nandflash_defconfig
@@ -46,6 +46,12 @@ CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_ATMEL=y
+CONFIG_DEBUG_UART_BASE=0xfc00c000
+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
diff --git a/configs/sama5d4ek_spiflash_defconfig b/configs/sama5d4ek_spiflash_defconfig
index c7f4655950..bd7325efaf 100644
--- a/configs/sama5d4ek_spiflash_defconfig
+++ b/configs/sama5d4ek_spiflash_defconfig
@@ -47,6 +47,12 @@ CONFIG_SPI_FLASH_ATMEL=y
 CONFIG_PINCTRL=y
 CONFIG_PINCTRL_AT91=y
 CONFIG_DM_SERIAL=y
+CONFIG_DEBUG_UART=y
+CONFIG_DEBUG_UART_ATMEL=y
+CONFIG_DEBUG_UART_BASE=0xfc00c000
+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
-- 
2.11.0



More information about the U-Boot mailing list