U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Wenyou Yang <wenyou.yang@atmel.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 4/4] board: sama5d2_xplained: Enable an early debug UART
Date: Tue, 13 Sep 2016 10:49:05 +0800	[thread overview]
Message-ID: <1473734945-23975-5-git-send-email-wenyou.yang@atmel.com> (raw)
In-Reply-To: <1473734945-23975-1-git-send-email-wenyou.yang@atmel.com>

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>
---

Changes in v2:
 - Collect Reviewed-by tags.

 board/atmel/sama5d2_xplained/sama5d2_xplained.c | 14 ++++++++++++++
 configs/sama5d2_xplained_mmc_defconfig          |  6 ++++++
 configs/sama5d2_xplained_spiflash_defconfig     |  6 ++++++
 include/configs/sama5d2_xplained.h              |  2 ++
 4 files changed, 28 insertions(+)

diff --git a/board/atmel/sama5d2_xplained/sama5d2_xplained.c b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
index c94574b..0ae6a7d 100644
--- a/board/atmel/sama5d2_xplained/sama5d2_xplained.c
+++ b/board/atmel/sama5d2_xplained/sama5d2_xplained.c
@@ -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)
 {
diff --git a/configs/sama5d2_xplained_mmc_defconfig b/configs/sama5d2_xplained_mmc_defconfig
index ab1b58b..ba36c8f 100644
--- a/configs/sama5d2_xplained_mmc_defconfig
+++ b/configs/sama5d2_xplained_mmc_defconfig
@@ -44,6 +44,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
diff --git a/configs/sama5d2_xplained_spiflash_defconfig b/configs/sama5d2_xplained_spiflash_defconfig
index ecba5ef..85f3f9c 100644
--- a/configs/sama5d2_xplained_spiflash_defconfig
+++ b/configs/sama5d2_xplained_spiflash_defconfig
@@ -44,6 +44,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
diff --git a/include/configs/sama5d2_xplained.h b/include/configs/sama5d2_xplained.h
index cada04f..51fabbe 100644
--- a/include/configs/sama5d2_xplained.h
+++ b/include/configs/sama5d2_xplained.h
@@ -15,6 +15,8 @@
 
 #include "at91-sama5_common.h"
 
+#define CONFIG_BOARD_EARLY_INIT_F
+
 #define CONFIG_MISC_INIT_R
 
 /* SDRAM */
-- 
2.7.4

  parent reply	other threads:[~2016-09-13  2:49 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-13  2:49 [U-Boot] [PATCH v2 0/4] board: sama5d2_xplained: Convert to use device tree and drivers with DM Wenyou Yang
2016-09-13  2:49 ` [U-Boot] [PATCH v2 1/4] board: sama5d2_xplained: Move config options to defconfigs Wenyou Yang
2016-10-16 20:11   ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-09-13  2:49 ` [U-Boot] [PATCH v2 2/4] board: sama5d2_xplained: Clean up code Wenyou Yang
2016-10-16 20:17   ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-09-13  2:49 ` [U-Boot] [PATCH v2 3/4] board: sama5d2_xplained: Set 'ethaddr' got from AT24MAC Wenyou Yang
2016-10-16 20:18   ` [U-Boot] [U-Boot, v2, " Andreas Bießmann
2016-10-16 21:42   ` Andreas Bießmann
2016-10-16 22:03     ` Tom Rini
2016-09-13  2:49 ` Wenyou Yang [this message]
2016-10-16 20:20   ` [U-Boot] [U-Boot, v2, 4/4] board: sama5d2_xplained: Enable an early debug UART Andreas Bießmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1473734945-23975-5-git-send-email-wenyou.yang@atmel.com \
    --to=wenyou.yang@atmel.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox