Skip to contentSkip to conversation

board: at91sam9x5ek: Convert to support DM and DT

PATCH Superseded Wenyou Yang 3 participants 8 messages Apr 18, 2017 – Apr 22, 2017 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#0 lore raw

v5 cover board: at91sam9x5ek: Convert to support DM and DT

The purpose of the patch set is to convert the board to support the driver model and device tree.

It is based on the patch set:
1./ [PATCH v3 0/6] ARM: dts: at91: Add dts files for AT91 SoCs' boards

     https://lists.denx.de/pipermail/u-boot/2017-April/287845.html

Changes in v5:
- Adjust CONFIG_ENV_OFFSET for NAND to avoid the conflict caused by the increased binary size.
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v4:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v3:
- Convert Atmel mci driver to support the driver model.
- Remain the SPI_SPEED macro.
- Add the support of Atmel uart device be used in the board_init_f stage.
- Disable the SPL for nand config.
- Improve the commit log.
- Remove Atmel mci related code.
- Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early debug UART.
- Drop [PATCH 4/5] configs: at91sam9x5ek: move SYS_NO_FLASH to defconfig.

Changes in v2:
- Rebase on the patch set:
[RESEND PATCH v2] ARM: at91: add default config file for sama5d36ek CMP board
http://lists.denx.de/pipermail/u-boot/2017-February/280525.html

Wenyou Yang (3):
configs: at91sam9x5ek: Update to support DM/DT
board: at91sam9x5ek: Clean up code
board: at91sam9x5ek: Enable early debug UART

 board/atmel/at91sam9x5ek/at91sam9x5ek.c  | 82 ++++----------------------------
 configs/at91sam9x5ek_dataflash_defconfig | 29 ++++++++++-
 configs/at91sam9x5ek_mmc_defconfig       | 29 ++++++++++-
 configs/at91sam9x5ek_nandflash_defconfig | 35 +++++++++++---
 configs/at91sam9x5ek_spiflash_defconfig  | 36 ++++++++++----
 include/configs/at91sam9x5ek.h           | 27 ++---------
 6 files changed, 124 insertions(+), 114 deletions(-)
Signature · 1 line
2.11.0
#1 lore raw

PATCH v5 1/3 configs: at91sam9x5ek: Update to support DM/DT

Update the configuration files to support the device tree and driver model. The device clock and pins configuration are handled by the clock and the pinctrl drivers respectively.

Because the limitation of internal SRAM size, the SPL with driver model can't be supported, disable the SPL option.

---

Changes in v5:
- Adjust CONFIG_ENV_OFFSET for NAND to avoid the conflict caused by the increased binary size.

Changes in v4: None
Changes in v3:
- Convert Atmel mci driver to support the driver model.
- Remain the SPI_SPEED macro.
- Add the support of Atmel uart device be used in the board_init_f stage.
- Disable the SPL for nand config.
- Improve the commit log.

Changes in v2: None

 board/atmel/at91sam9x5ek/at91sam9x5ek.c  |  2 ++
 configs/at91sam9x5ek_dataflash_defconfig | 23 ++++++++++++++++++++++-
 configs/at91sam9x5ek_mmc_defconfig       | 23 ++++++++++++++++++++++-
 configs/at91sam9x5ek_nandflash_defconfig | 29 ++++++++++++++++++++++-------
 configs/at91sam9x5ek_spiflash_defconfig  | 30 ++++++++++++++++++++++--------
 include/configs/at91sam9x5ek.h           | 27 +++------------------------
 6 files changed, 93 insertions(+), 41 deletions(-)
board/atmel/at91sam9x5ek/at91sam9x5ek.c +2 -0
index cc81776f9b..0ae42dd158 100644
@@ -205,6 +205,7 @@ void lcd_show_board_info(void)
 #endif /* CONFIG_LCD_INFO */
 #endif /* CONFIG_LCD */
 
+#ifndef CONFIG_DM_SPI
 /* SPI chip select control */
 #ifdef CONFIG_ATMEL_SPI
 int spi_cs_is_valid(unsigned int bus, unsigned int cs)
@@ -238,6 +239,7 @@ void spi_cs_deactivate(struct spi_slave *slave)
 	}
 }
 #endif /* CONFIG_ATMEL_SPI */
+#endif
 
 #ifdef CONFIG_GENERIC_ATMEL_MCI
 int board_mmc_init(bd_t *bd)
configs/at91sam9x5ek_dataflash_defconfig +22 -1
index e07e2175e0..7850b994d5 100644
@@ -1,6 +1,8 @@
 CONFIG_ARM=y
 CONFIG_ARCH_AT91=y
 CONFIG_TARGET_AT91SAM9X5EK=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="at91sam9g35ek"
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_DATAFLASH"
 CONFIG_BOOTDELAY=3
 # CONFIG_CONSOLE_MUX is not set
@@ -21,9 +23,28 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_DM_GPIO=y
+CONFIG_AT91_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_DM_ETH=y
+CONFIG_MACB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91=y
+CONFIG_DM_SERIAL=y
+CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
-CONFIG_OF_LIBFDT=y
configs/at91sam9x5ek_mmc_defconfig +22 -1
index 9a95a0496a..5990778ada 100644
@@ -1,6 +1,8 @@
 CONFIG_ARM=y
 CONFIG_ARCH_AT91=y
 CONFIG_TARGET_AT91SAM9X5EK=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="at91sam9g35ek"
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_MMC"
 CONFIG_BOOTDELAY=3
 # CONFIG_CONSOLE_MUX is not set
@@ -21,9 +23,28 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_DM_GPIO=y
+CONFIG_AT91_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_DM_ETH=y
+CONFIG_MACB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91=y
+CONFIG_DM_SERIAL=y
+CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
-CONFIG_OF_LIBFDT=y
configs/at91sam9x5ek_nandflash_defconfig +22 -7
index d93f687508..816fe69834 100644
@@ -1,17 +1,13 @@
 CONFIG_ARM=y
 CONFIG_ARCH_AT91=y
 CONFIG_TARGET_AT91SAM9X5EK=y
-CONFIG_SPL_GPIO_SUPPORT=y
-CONFIG_SPL_LIBCOMMON_SUPPORT=y
-CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_SPL_SERIAL_SUPPORT=y
-CONFIG_SPL_NAND_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="at91sam9g35ek"
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_NANDFLASH"
 CONFIG_BOOTDELAY=3
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 # CONFIG_DISPLAY_BOARDINFO is not set
-CONFIG_SPL=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_BOOTZ=y
@@ -27,9 +23,28 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_DM_GPIO=y
+CONFIG_AT91_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_DM_ETH=y
+CONFIG_MACB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91=y
+CONFIG_DM_SERIAL=y
+CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
-CONFIG_OF_LIBFDT=y
configs/at91sam9x5ek_spiflash_defconfig +22 -8
index 5fc512b998..8574525bc2 100644
@@ -1,18 +1,13 @@
 CONFIG_ARM=y
 CONFIG_ARCH_AT91=y
 CONFIG_TARGET_AT91SAM9X5EK=y
-CONFIG_SPL_GPIO_SUPPORT=y
-CONFIG_SPL_LIBCOMMON_SUPPORT=y
-CONFIG_SPL_LIBGENERIC_SUPPORT=y
-CONFIG_SPL_SERIAL_SUPPORT=y
-CONFIG_SPL_SPI_FLASH_SUPPORT=y
-CONFIG_SPL_SPI_SUPPORT=y
+CONFIG_SYS_MALLOC_F_LEN=0x2000
+CONFIG_DEFAULT_DEVICE_TREE="at91sam9g35ek"
 CONFIG_SYS_EXTRA_OPTIONS="AT91SAM9X5,SYS_USE_SPIFLASH"
 CONFIG_BOOTDELAY=3
 # CONFIG_CONSOLE_MUX is not set
 CONFIG_SYS_CONSOLE_IS_IN_ENV=y
 # CONFIG_DISPLAY_BOARDINFO is not set
-CONFIG_SPL=y
 CONFIG_HUSH_PARSER=y
 CONFIG_SYS_PROMPT="U-Boot> "
 CONFIG_CMD_BOOTZ=y
@@ -28,9 +23,28 @@ CONFIG_CMD_DHCP=y
 CONFIG_CMD_PING=y
 CONFIG_CMD_FAT=y
 CONFIG_CMD_UBI=y
+CONFIG_OF_CONTROL=y
+CONFIG_DM=y
+CONFIG_CLK=y
+CONFIG_CLK_AT91=y
+CONFIG_AT91_UTMI=y
+CONFIG_DM_GPIO=y
+CONFIG_AT91_GPIO=y
+CONFIG_DM_MMC=y
+CONFIG_GENERIC_ATMEL_MCI=y
+CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH=y
 CONFIG_SPI_FLASH_ATMEL=y
+CONFIG_DM_ETH=y
+CONFIG_MACB=y
+CONFIG_PINCTRL=y
+CONFIG_PINCTRL_AT91=y
+CONFIG_DM_SERIAL=y
+CONFIG_ATMEL_USART=y
+CONFIG_DM_SPI=y
+CONFIG_ATMEL_SPI=y
 CONFIG_USB=y
+CONFIG_DM_USB=y
+CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_STORAGE=y
 CONFIG_LCD=y
-CONFIG_OF_LIBFDT=y
include/configs/at91sam9x5ek.h +3 -24
index c81003e311..89455af9f2 100644
@@ -26,12 +26,6 @@
 
 /* general purpose I/O */
 #define CONFIG_ATMEL_LEGACY		/* required until (g)pio is fixed */
-#define CONFIG_AT91_GPIO
-
-/* serial console */
-#define CONFIG_ATMEL_USART
-#define CONFIG_USART_BASE	ATMEL_BASE_DBGU
-#define CONFIG_USART_ID		ATMEL_ID_SYS
 
 /* LCD */
 #define LCD_BPP			LCD_COLOR16
@@ -68,11 +62,10 @@
 #define CONFIG_SYS_SDRAM_SIZE		0x08000000	/* 128 megs */
 
 #define CONFIG_SYS_INIT_SP_ADDR \
-	(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
+	(CONFIG_SYS_SDRAM_BASE + 16 * 1024 - GENERATED_GBL_DATA_SIZE)
 
 /* DataFlash */
 #ifdef CONFIG_CMD_SF
-#define CONFIG_ATMEL_SPI
 #define CONFIG_SF_DEFAULT_SPEED		30000000
 #endif
 
@@ -105,23 +98,9 @@
 #define CONFIG_CMD_UBIFS
 #endif
 
-/* MMC */
-#ifdef CONFIG_CMD_MMC
-#define CONFIG_GENERIC_ATMEL_MCI
-#endif
-
-/* Ethernet */
-#define CONFIG_MACB
-#define CONFIG_RMII
-#define CONFIG_NET_RETRY_COUNT		20
-#define CONFIG_MACB_SEARCH_PHY
-
 /* USB */
 #ifdef CONFIG_CMD_USB
-#ifdef CONFIG_USB_EHCI
-#define CONFIG_USB_EHCI_ATMEL
-#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS	2
-#else
+#ifndef CONFIG_USB_EHCI
 #define CONFIG_USB_ATMEL
 #define CONFIG_USB_ATMEL_CLK_SEL_UPLL
 #define CONFIG_USB_OHCI_NEW
@@ -140,7 +119,7 @@
 #ifdef CONFIG_SYS_USE_NANDFLASH
 /* bootstrap + u-boot + env + linux in nandflash */
 #define CONFIG_ENV_IS_IN_NAND
-#define CONFIG_ENV_OFFSET		0xc0000
+#define CONFIG_ENV_OFFSET		0x120000
 #define CONFIG_ENV_OFFSET_REDUND	0x100000
 #define CONFIG_ENV_SIZE		0x20000		/* 1 sector = 128 kB */
 #define CONFIG_BOOTCOMMAND	"nand read " \
Signature · 1 line
2.11.0
#2 lore raw

PATCH v5 1/3 configs: at91sam9x5ek: Update to support DM/DT

Update the configuration files to support the device tree and driver model. The device clock and pins configuration are handled by the clock and the pinctrl drivers respectively.

Because the limitation of internal SRAM size, the SPL with driver model can't be supported, disable the SPL option.

---

Changes in v5:
- Adjust CONFIG_ENV_OFFSET for NAND to avoid the conflict caused by the increased binary size.

Changes in v4: None
Changes in v3:
- Convert Atmel mci driver to support the driver model.
- Remain the SPI_SPEED macro.
- Add the support of Atmel uart device be used in the board_init_f stage.
- Disable the SPL for nand config.
- Improve the commit log.

Changes in v2: None

 board/atmel/at91sam9x5ek/at91sam9x5ek.c  |  2 ++
 configs/at91sam9x5ek_dataflash_defconfig | 23 ++++++++++++++++++++++-
 configs/at91sam9x5ek_mmc_defconfig       | 23 ++++++++++++++++++++++-
 configs/at91sam9x5ek_nandflash_defconfig | 29 ++++++++++++++++++++++-------
 configs/at91sam9x5ek_spiflash_defconfig  | 30 ++++++++++++++++++++++--------
 include/configs/at91sam9x5ek.h           | 27 +++------------------------
 6 files changed, 93 insertions(+), 41 deletions(-)

Applied to u-boot-dm/next, thanks!

#3 lore raw

PATCH v5 2/3 board: at91sam9x5ek: Clean up code

In reply to Wenyou Yang

Since the introduction of the pinctrl and clock driver and the device tree files, remove unneeded hard coded related code from the board file.

---

Changes in v5: None
Changes in v4: None
Changes in v3:
- Remove Atmel mci related code.

Changes in v2: None

 board/atmel/at91sam9x5ek/at91sam9x5ek.c | 78 ---------------------------------
 1 file changed, 78 deletions(-)
board/atmel/at91sam9x5ek/at91sam9x5ek.c +0 -78
index 0ae42dd158..235b33725d 100644
@@ -14,18 +14,10 @@
 #include <asm/arch/gpio.h>
 #include <lcd.h>
 #include <atmel_hlcdc.h>
-#include <atmel_mci.h>
-#ifdef CONFIG_MACB
-#include <net.h>
-#endif
-#include <netdev.h>
 #ifdef CONFIG_LCD_INFO
 #include <nand.h>
 #include <version.h>
 #endif
-#ifdef CONFIG_ATMEL_SPI
-#include <spi.h>
-#endif
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -92,21 +84,6 @@ static void at91sam9x5ek_nand_hw_init(void)
 }
 #endif
 
-int board_eth_init(bd_t *bis)
-{
-	int rc = 0;
-
-#ifdef CONFIG_MACB
-	if (has_emac0())
-		rc = macb_eth_initialize(0,
-			(void *)ATMEL_BASE_EMAC0, 0x00);
-	if (has_emac1())
-		rc = macb_eth_initialize(1,
-			(void *)ATMEL_BASE_EMAC1, 0x00);
-#endif
-	return rc;
-}
-
 #ifdef CONFIG_LCD
 vidinfo_t panel_info = {
 	.vl_col	= 800,
@@ -205,51 +182,6 @@ void lcd_show_board_info(void)
 #endif /* CONFIG_LCD_INFO */
 #endif /* CONFIG_LCD */
 
-#ifndef CONFIG_DM_SPI
-/* SPI chip select control */
-#ifdef CONFIG_ATMEL_SPI
-int spi_cs_is_valid(unsigned int bus, unsigned int cs)
-{
-	return bus == 0 && cs < 2;
-}
-
-void spi_cs_activate(struct spi_slave *slave)
-{
-	switch (slave->cs) {
-	case 1:
-		at91_set_pio_output(AT91_PIO_PORTA, 7, 0);
-		break;
-	case 0:
-	default:
-		at91_set_pio_output(AT91_PIO_PORTA, 14, 0);
-		break;
-	}
-}
-
-void spi_cs_deactivate(struct spi_slave *slave)
-{
-	switch (slave->cs) {
-	case 1:
-		at91_set_pio_output(AT91_PIO_PORTA, 7, 1);
-		break;
-	case 0:
-	default:
-		at91_set_pio_output(AT91_PIO_PORTA, 14, 1);
-		break;
-	}
-}
-#endif /* CONFIG_ATMEL_SPI */
-#endif
-
-#ifdef CONFIG_GENERIC_ATMEL_MCI
-int board_mmc_init(bd_t *bd)
-{
-	at91_mci_hw_init();
-
-	return atmel_mci_init((void *)ATMEL_BASE_HSMCI0);
-}
-#endif
-
 int board_early_init_f(void)
 {
 	at91_seriald_hw_init();
@@ -268,14 +200,6 @@ int board_init(void)
 	at91sam9x5ek_nand_hw_init();
 #endif
 
-#ifdef CONFIG_ATMEL_SPI
-	at91_spi0_hw_init(1 << 4);
-#endif
-
-#ifdef CONFIG_MACB
-	at91_macb_hw_init();
-#endif
-
 #if defined(CONFIG_USB_OHCI_NEW) || defined(CONFIG_USB_EHCI)
 	at91_uhp_hw_init();
 #endif
@@ -302,8 +226,6 @@ void at91_spl_board_init(void)
 	at91_mci_hw_init();
 #elif CONFIG_SYS_USE_NANDFLASH
 	at91sam9x5ek_nand_hw_init();
-#elif CONFIG_SYS_USE_SPIFLASH
-	at91_spi0_hw_init(1 << 4);
 #endif
 }
 
Signature · 1 line
2.11.0
#4 lore raw

PATCH v5 2/3 board: at91sam9x5ek: Clean up code

Since the introduction of the pinctrl and clock driver and the device tree files, remove unneeded hard coded related code from the board file.

---

Changes in v5: None
Changes in v4: None
Changes in v3:
- Remove Atmel mci related code.

Changes in v2: None

 board/atmel/at91sam9x5ek/at91sam9x5ek.c | 78 ---------------------------------
 1 file changed, 78 deletions(-)

Applied to u-boot-dm/next, thanks!

#5 lore raw

PATCH v5 3/3 board: at91sam9x5ek: Enable early debug UART

In reply to Wenyou Yang

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

---

Changes in v5:
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v4:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v3:
- Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early debug UART.
- Drop [PATCH 4/5] configs: at91sam9x5ek: move SYS_NO_FLASH to defconfig.

Changes in v2:
- Rebase on the patch set:
[RESEND PATCH v2] ARM: at91: add default config file for sama5d36ek CMP board
http://lists.denx.de/pipermail/u-boot/2017-February/280525.html

 board/atmel/at91sam9x5ek/at91sam9x5ek.c  | 14 +++++++++++++-
 configs/at91sam9x5ek_dataflash_defconfig |  6 ++++++
 configs/at91sam9x5ek_mmc_defconfig       |  6 ++++++
 configs/at91sam9x5ek_nandflash_defconfig |  6 ++++++
 configs/at91sam9x5ek_spiflash_defconfig  |  6 ++++++
 5 files changed, 37 insertions(+), 1 deletion(-)
board/atmel/at91sam9x5ek/at91sam9x5ek.c +13 -1
index 235b33725d..c661c77f83 100644
@@ -12,6 +12,7 @@
 #include <asm/arch/at91_rstc.h>
 #include <asm/arch/clk.h>
 #include <asm/arch/gpio.h>
+#include <debug_uart.h>
 #include <lcd.h>
 #include <atmel_hlcdc.h>
 #ifdef CONFIG_LCD_INFO
@@ -182,11 +183,22 @@ void lcd_show_board_info(void)
 #endif /* CONFIG_LCD_INFO */
 #endif /* CONFIG_LCD */
 
-int board_early_init_f(void)
+#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)
 {
configs/at91sam9x5ek_dataflash_defconfig +6 -0
index 7850b994d5..64707dbdaa 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
configs/at91sam9x5ek_mmc_defconfig +6 -0
index 5990778ada..ddeeeefa1e 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
configs/at91sam9x5ek_nandflash_defconfig +6 -0
index 816fe69834..a26b38f330 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
configs/at91sam9x5ek_spiflash_defconfig +6 -0
index 8574525bc2..75d25d8e61 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
Signature · 1 line
2.11.0
#6 lore raw

PATCH v5 3/3 board: at91sam9x5ek: Enable early debug UART

Hi Simon,

The patches has been rebased on the master branch of u-boot-dm git tree,

and you added Reviewed-by tag before.

Could you help take them?

Best Regards,

Wenyou Yang

Quoted 136 lines · Wenyou Yang

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

---

Changes in v5:
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v4:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v3:
- Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early debug UART.
- Drop [PATCH 4/5] configs: at91sam9x5ek: move SYS_NO_FLASH to defconfig.

Changes in v2:
- Rebase on the patch set:
[RESEND PATCH v2] ARM: at91: add default config file for sama5d36ek CMP board
http://lists.denx.de/pipermail/u-boot/2017-February/280525.html

  board/atmel/at91sam9x5ek/at91sam9x5ek.c  | 14 +++++++++++++-
  configs/at91sam9x5ek_dataflash_defconfig |  6 ++++++
  configs/at91sam9x5ek_mmc_defconfig       |  6 ++++++
  configs/at91sam9x5ek_nandflash_defconfig |  6 ++++++
  configs/at91sam9x5ek_spiflash_defconfig  |  6 ++++++
  5 files changed, 37 insertions(+), 1 deletion(-)
board/atmel/at91sam9x5ek/at91sam9x5ek.c +13 -1
index 235b33725d..c661c77f83 100644
@@ -12,6 +12,7 @@
  #include <asm/arch/at91_rstc.h>
  #include <asm/arch/clk.h>
  #include <asm/arch/gpio.h>
+#include <debug_uart.h>
  #include <lcd.h>
  #include <atmel_hlcdc.h>
  #ifdef CONFIG_LCD_INFO
@@ -182,11 +183,22 @@ void lcd_show_board_info(void)
  #endif /* CONFIG_LCD_INFO */
  #endif /* CONFIG_LCD */
 
-int board_early_init_f(void)
+#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)
  {
configs/at91sam9x5ek_dataflash_defconfig +6 -0
index 7850b994d5..64707dbdaa 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
configs/at91sam9x5ek_mmc_defconfig +6 -0
index 5990778ada..ddeeeefa1e 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
configs/at91sam9x5ek_nandflash_defconfig +6 -0
index 816fe69834..a26b38f330 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
configs/at91sam9x5ek_spiflash_defconfig +6 -0
index 8574525bc2..75d25d8e61 100644
@@ -40,6 +40,12 @@ CONFIG_MACB=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
#7 lore raw

PATCH v5 3/3 board: at91sam9x5ek: Enable early debug UART

Hi Simon,

The patches has been rebased on the master branch of u-boot-dm git tree,

and you added Reviewed-by tag before.

Could you help take them?

Best Regards,

Wenyou Yang

Quoted 25 lines · Wenyou Yang

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

---

Changes in v5:
- Rebase on the master branch(ad46af0e76) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v4:
- Rebase on the master branch (22e10be45) of u-boot-dm git tree.
- Update the cover-letter.

Changes in v3:
- Use CONFIG_DEBUG_UART_CLOCK as the input clock for the early debug UART.
- Drop [PATCH 4/5] configs: at91sam9x5ek: move SYS_NO_FLASH to defconfig.

Changes in v2:
- Rebase on the patch set:
[RESEND PATCH v2] ARM: at91: add default config file for sama5d36ek CMP board
http://lists.denx.de/pipermail/u-boot/2017-February/280525.html

Quoted 7 lines
  board/atmel/at91sam9x5ek/at91sam9x5ek.c  | 14 +++++++++++++-
  configs/at91sam9x5ek_dataflash_defconfig |  6 ++++++
  configs/at91sam9x5ek_mmc_defconfig       |  6 ++++++
  configs/at91sam9x5ek_nandflash_defconfig |  6 ++++++
  configs/at91sam9x5ek_spiflash_defconfig  |  6 ++++++
  5 files changed, 37 insertions(+), 1 deletion(-)

Applied to u-boot-dm/next, thanks!