diff mbox

[U-Boot,v2,3/3] board: at91sam9n12ek: Enable early debug UART

Message ID 20170412090815.19944-4-wenyou.yang@atmel.com
State Accepted
Commit c1868adf6444e8fb600575affb634cad2f2ff8f5
Delegated to: Andreas Bießmann
Headers show

Commit Message

Wenyou Yang April 12, 2017, 9:08 a.m. UTC
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@atmel.com>
---

Changes in v2:
 - Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early
   debug UART.
 - Move out [PATCH 1/4] ARM: dts: at91: add dts files for at91sam9n12ek.

 board/atmel/at91sam9n12ek/at91sam9n12ek.c | 13 +++++++++++++
 configs/at91sam9n12ek_mmc_defconfig       |  6 ++++++
 configs/at91sam9n12ek_nandflash_defconfig |  6 ++++++
 configs/at91sam9n12ek_spiflash_defconfig  |  6 ++++++
 4 files changed, 31 insertions(+)

Comments

Simon Glass April 16, 2017, 7:31 p.m. UTC | #1
On 12 April 2017 at 03:08, Wenyou Yang <wenyou.yang@atmel.com> wrote:
> 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@atmel.com>
> ---
>
> Changes in v2:
>  - Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early
>    debug UART.
>  - Move out [PATCH 1/4] ARM: dts: at91: add dts files for at91sam9n12ek.
>
>  board/atmel/at91sam9n12ek/at91sam9n12ek.c | 13 +++++++++++++
>  configs/at91sam9n12ek_mmc_defconfig       |  6 ++++++
>  configs/at91sam9n12ek_nandflash_defconfig |  6 ++++++
>  configs/at91sam9n12ek_spiflash_defconfig  |  6 ++++++
>  4 files changed, 31 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

Suggestion below.

> diff --git a/board/atmel/at91sam9n12ek/at91sam9n12ek.c b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
> index 02b7790627..1105428986 100644
> --- a/board/atmel/at91sam9n12ek/at91sam9n12ek.c
> +++ b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
> @@ -13,6 +13,7 @@
>  #include <asm/arch/at91_rstc.h>
>  #include <asm/arch/at91_pio.h>
>  #include <asm/arch/clk.h>
> +#include <debug_uart.h>
>  #include <lcd.h>
>  #include <atmel_hlcdc.h>
>  #include <netdev.h>
> @@ -162,10 +163,22 @@ void at91sam9n12ek_usb_hw_init(void)
>  }
>  #endif
>
> +#ifdef CONFIG_DEBUG_UART_BOARD_INIT
> +void board_debug_uart_init(void)

Perhaps this could become a common function across AT91?

> +{
> +       at91_seriald_hw_init();
> +}
> +#endif
> +
diff mbox

Patch

diff --git a/board/atmel/at91sam9n12ek/at91sam9n12ek.c b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
index 02b7790627..1105428986 100644
--- a/board/atmel/at91sam9n12ek/at91sam9n12ek.c
+++ b/board/atmel/at91sam9n12ek/at91sam9n12ek.c
@@ -13,6 +13,7 @@ 
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/at91_pio.h>
 #include <asm/arch/clk.h>
+#include <debug_uart.h>
 #include <lcd.h>
 #include <atmel_hlcdc.h>
 #include <netdev.h>
@@ -162,10 +163,22 @@  void at91sam9n12ek_usb_hw_init(void)
 }
 #endif
 
+#ifdef CONFIG_DEBUG_UART_BOARD_INIT
+void board_debug_uart_init(void)
+{
+	at91_seriald_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/at91sam9n12ek_mmc_defconfig b/configs/at91sam9n12ek_mmc_defconfig
index abb07260be..e7e8a014c6 100644
--- a/configs/at91sam9n12ek_mmc_defconfig
+++ b/configs/at91sam9n12ek_mmc_defconfig
@@ -35,6 +35,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=0xfffff200
+CONFIG_DEBUG_UART_CLOCK=132000000
+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/at91sam9n12ek_nandflash_defconfig b/configs/at91sam9n12ek_nandflash_defconfig
index 1b420e62b8..e626805591 100644
--- a/configs/at91sam9n12ek_nandflash_defconfig
+++ b/configs/at91sam9n12ek_nandflash_defconfig
@@ -35,6 +35,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=0xfffff200
+CONFIG_DEBUG_UART_CLOCK=132000000
+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/at91sam9n12ek_spiflash_defconfig b/configs/at91sam9n12ek_spiflash_defconfig
index 9048b14de4..a5abcd1f3b 100644
--- a/configs/at91sam9n12ek_spiflash_defconfig
+++ b/configs/at91sam9n12ek_spiflash_defconfig
@@ -35,6 +35,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=0xfffff200
+CONFIG_DEBUG_UART_CLOCK=132000000
+CONFIG_DEBUG_UART_BOARD_INIT=y
+CONFIG_DEBUG_UART_ANNOUNCE=y
 CONFIG_ATMEL_USART=y
 CONFIG_DM_SPI=y
 CONFIG_ATMEL_SPI=y