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

Wenyou Yang wenyou.yang at atmel.com
Thu Mar 23 06:11:06 UTC 2017


Enable the 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 v4:
 - Convert the macb to support DM and clean up macb init code.
 - Remain the SPI speed macros.
 - Update the config options for SPL.
 - Update the commit log.
 - Remove the unneeded dbgu init during board_early_init_f stage.
 - Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early
   debug uart.
 - Drop [PATCH] configs: sama5d4: move CONFIG_SYS_NO_FLASH to *defconfig
 - Rebase on v2017.03.

Changes in v3:
 - add the Reviewed-by tags.
 - rebase on the patch:
        [PATCH v2] ARM: dts: at91: add device tree files for at91sam9x5ek
        http://lists.denx.de/pipermail/u-boot/2017-February/280504.html

Changes in v2: None

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

diff --git a/board/atmel/sama5d4ek/sama5d4ek.c b/board/atmel/sama5d4ek/sama5d4ek.c
index f2d0a472e1..ffb4a50a72 100644
--- a/board/atmel/sama5d4ek/sama5d4ek.c
+++ b/board/atmel/sama5d4ek/sama5d4ek.c
@@ -15,6 +15,7 @@
 #include <asm/arch/sama5d3_smc.h>
 #include <asm/arch/sama5d4.h>
 #include <atmel_hlcdc.h>
+#include <debug_uart.h>
 #include <lcd.h>
 #include <nand.h>
 #include <version.h>
@@ -161,6 +162,7 @@ void lcd_show_board_info(void)
 
 #endif /* CONFIG_LCD */
 
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
 static void sama5d4ek_serial3_hw_init(void)
 {
 	at91_pio3_set_b_periph(AT91_PIO_PORTE, 17, 1);	/* TXD3 */
@@ -170,12 +172,21 @@ static void sama5d4ek_serial3_hw_init(void)
 	at91_periph_clk_enable(ATMEL_ID_USART3);
 }
 
-int board_early_init_f(void)
+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();
+#endif
 	return 0;
 }
+#endif
 
 int board_init(void)
 {
diff --git a/configs/sama5d4ek_mmc_defconfig b/configs/sama5d4ek_mmc_defconfig
index cf376d00d1..8601d5622b 100644
--- a/configs/sama5d4ek_mmc_defconfig
+++ b/configs/sama5d4ek_mmc_defconfig
@@ -56,6 +56,12 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_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=88000000
+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 3e4c0a32b2..a9bcabf182 100644
--- a/configs/sama5d4ek_nandflash_defconfig
+++ b/configs/sama5d4ek_nandflash_defconfig
@@ -54,6 +54,12 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_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=88000000
+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 ca3aae37fc..b56fd631f5 100644
--- a/configs/sama5d4ek_spiflash_defconfig
+++ b/configs/sama5d4ek_spiflash_defconfig
@@ -53,6 +53,12 @@ CONFIG_PINCTRL=y
 CONFIG_SPL_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=88000000
+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