[U-Boot] [PATCH 01/11] ARM: atmel: Rename MA5D4EVK

The board is now manufactured by Aries Embedded GmbH , rename it.
Signed-off-by: Marek Vasut marex@denx.de --- arch/arm/mach-at91/Kconfig | 4 ++-- board/{denx => aries}/ma5d4evk/Kconfig | 2 +- board/{denx => aries}/ma5d4evk/MAINTAINERS | 4 ++-- board/{denx => aries}/ma5d4evk/Makefile | 0 board/{denx => aries}/ma5d4evk/ma5d4evk.c | 0 include/configs/ma5d4evk.h | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) rename board/{denx => aries}/ma5d4evk/Kconfig (88%) rename board/{denx => aries}/ma5d4evk/MAINTAINERS (71%) rename board/{denx => aries}/ma5d4evk/Makefile (100%) rename board/{denx => aries}/ma5d4evk/ma5d4evk.c (100%)
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig index 99b88d1785..033c1efd2b 100644 --- a/arch/arm/mach-at91/Kconfig +++ b/arch/arm/mach-at91/Kconfig @@ -124,7 +124,7 @@ config TARGET_SAMA5D4EK select BOARD_EARLY_INIT_F
config TARGET_MA5D4EVK - bool "DENX MA5D4EVK Evaluation Kit" + bool "Aries MA5D4EVK Evaluation Kit" select CPU_V7 select SUPPORT_SPL
@@ -169,6 +169,7 @@ endchoice config SYS_SOC default "at91"
+source "board/aries/ma5d4evk/Kconfig" source "board/atmel/at91rm9200ek/Kconfig" source "board/atmel/at91sam9260ek/Kconfig" source "board/atmel/at91sam9261ek/Kconfig" @@ -186,7 +187,6 @@ source "board/atmel/sama5d4ek/Kconfig" source "board/bluewater/gurnard/Kconfig" source "board/bluewater/snapper9260/Kconfig" source "board/calao/usb_a9263/Kconfig" -source "board/denx/ma5d4evk/Kconfig" source "board/egnite/ethernut5/Kconfig" source "board/esd/meesc/Kconfig" source "board/l+g/vinco/Kconfig" diff --git a/board/denx/ma5d4evk/Kconfig b/board/aries/ma5d4evk/Kconfig similarity index 88% rename from board/denx/ma5d4evk/Kconfig rename to board/aries/ma5d4evk/Kconfig index b4ef106532..56b4f4a1a8 100644 --- a/board/denx/ma5d4evk/Kconfig +++ b/board/aries/ma5d4evk/Kconfig @@ -4,7 +4,7 @@ config SYS_BOARD default "ma5d4evk"
config SYS_VENDOR - default "denx" + default "aries"
config SYS_CONFIG_NAME default "ma5d4evk" diff --git a/board/denx/ma5d4evk/MAINTAINERS b/board/aries/ma5d4evk/MAINTAINERS similarity index 71% rename from board/denx/ma5d4evk/MAINTAINERS rename to board/aries/ma5d4evk/MAINTAINERS index bb25a9ca94..664a29a0df 100644 --- a/board/denx/ma5d4evk/MAINTAINERS +++ b/board/aries/ma5d4evk/MAINTAINERS @@ -1,6 +1,6 @@ -DENX MA5D4EVK BOARD +Aries MA5D4EVK BOARD M: Marek Vasut marek.vasut@gmail.com S: Maintained -F: board/denx/ma5d4evk/ +F: board/aries/ma5d4evk/ F: include/configs/ma5d4evk.h F: configs/ma5d4evk_defconfig diff --git a/board/denx/ma5d4evk/Makefile b/board/aries/ma5d4evk/Makefile similarity index 100% rename from board/denx/ma5d4evk/Makefile rename to board/aries/ma5d4evk/Makefile diff --git a/board/denx/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c similarity index 100% rename from board/denx/ma5d4evk/ma5d4evk.c rename to board/aries/ma5d4evk/ma5d4evk.c diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h index db58f735bc..24c73bccd1 100644 --- a/include/configs/ma5d4evk.h +++ b/include/configs/ma5d4evk.h @@ -1,5 +1,5 @@ /* - * DENX MA5D4 configuration + * Aries MA5D4 configuration * Copyright (C) 2015 Marek Vasut marex@denx.de * * SPDX-License-Identifier: GPL-2.0+ @@ -109,7 +109,7 @@ /* USB device */ #define CONFIG_USB_ETHER #define CONFIG_USB_ETH_RNDIS -#define CONFIG_USBNET_MANUFACTURER "DENX" +#define CONFIG_USBNET_MANUFACTURER "AriesEmbedded" #endif
/*

According to the datasheet, sequential mapping is used for DDR SDRAM, while interleaved mapping is used for regular SDRAM. Incorrect configuration of this bit does indeed cause sporadic memory instability.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com Cc: Wenyou Yang wenyou.yang@atmel.com --- board/aries/ma5d4evk/ma5d4evk.c | 1 - 1 file changed, 1 deletion(-)
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index 81463712fa..dd74e29b8e 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -349,7 +349,6 @@ static void ddr2_conf(struct atmel_mpddrc_config *ddr2) ATMEL_MPDDRC_CR_CAS_DDR_CAS3 | ATMEL_MPDDRC_CR_NB_8BANKS | ATMEL_MPDDRC_CR_NDQS_DISABLED | - ATMEL_MPDDRC_CR_DECOD_INTERLEAVED | ATMEL_MPDDRC_CR_UNAL_SUPPORTED);
ddr2->rtr = 0x2b0;

On Tue, May 02, 2017 at 08:27:41PM +0200, Marek Vasut wrote:
According to the datasheet, sequential mapping is used for DDR SDRAM, while interleaved mapping is used for regular SDRAM. Incorrect configuration of this bit does indeed cause sporadic memory instability.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com Cc: Wenyou Yang wenyou.yang@atmel.com
Applied to u-boot/master, thanks!

The CAN controllers need slight delay between toggling of their reset line. Move this action into board_init(), otherwise timer will not be initialized and the board might hang.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- board/aries/ma5d4evk/ma5d4evk.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index dd74e29b8e..aa02b8a34b 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -269,12 +269,6 @@ int board_early_init_f(void) at91_set_pio_output(AT91_PIO_PORTD, 29, 0); at91_set_pio_output(AT91_PIO_PORTD, 30, 0);
- /* Reset CAN controllers */ - at91_set_pio_output(AT91_PIO_PORTB, 21, 0); - udelay(100); - at91_set_pio_output(AT91_PIO_PORTB, 21, 1); - at91_pio3_set_pio_pulldown(AT91_PIO_PORTB, 21, 0); - ma5d4evk_serial_hw_init();
return 0; @@ -305,6 +299,12 @@ int board_init(void) at91_udp_hw_init(); #endif
+ /* Reset CAN controllers */ + at91_set_pio_output(AT91_PIO_PORTB, 21, 0); + udelay(100); + at91_set_pio_output(AT91_PIO_PORTB, 21, 1); + at91_pio3_set_pio_pulldown(AT91_PIO_PORTB, 21, 0); + return 0; }

On Tue, May 02, 2017 at 08:27:42PM +0200, Marek Vasut wrote:
The CAN controllers need slight delay between toggling of their reset line. Move this action into board_init(), otherwise timer will not be initialized and the board might hang.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

Enable DFU and USB mass storage support for the DENX MA5D4 SoM.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- configs/ma5d4evk_defconfig | 8 ++++++++ include/configs/ma5d4evk.h | 4 ++++ 2 files changed, 12 insertions(+)
diff --git a/configs/ma5d4evk_defconfig b/configs/ma5d4evk_defconfig index adeab1a0e9..8f8ce9b935 100644 --- a/configs/ma5d4evk_defconfig +++ b/configs/ma5d4evk_defconfig @@ -41,3 +41,11 @@ CONFIG_USB_GADGET=y CONFIG_USB_GADGET_ATMEL_USBA=y CONFIG_OF_LIBFDT=y # CONFIG_EFI_LOADER is not set +CONFIG_CMD_DFU=y +CONFIG_CMD_USB_MASS_STORAGE=y +CONFIG_DFU_MMC=y +CONFIG_DFU_SF=y +CONFIG_USB_GADGET_DOWNLOAD=y +CONFIG_G_DNL_MANUFACTURER="AriesEmbedded" +CONFIG_G_DNL_VENDOR_NUM=0x0525 +CONFIG_G_DNL_PRODUCT_NUM=0xa4a5 diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h index 24c73bccd1..f317f07d80 100644 --- a/include/configs/ma5d4evk.h +++ b/include/configs/ma5d4evk.h @@ -110,6 +110,9 @@ #define CONFIG_USB_ETHER #define CONFIG_USB_ETH_RNDIS #define CONFIG_USBNET_MANUFACTURER "AriesEmbedded" +#define CONFIG_USB_FUNCTION_MASS_STORAGE +#define CONFIG_SYS_DFU_DATA_BUF_SIZE (1 * 1024 * 1024) +#define DFU_DEFAULT_POLL_TIMEOUT 300 #endif
/* @@ -138,6 +141,7 @@ "bootpart=1:1\0" \ "rootdev=/dev/mmcblk1p2\0" \ "netdev=eth0\0" \ + "dfu_alt_info=mmc raw 0 3867148288\0" \ "kernel_addr_r=0x22000000\0" \ "update_spi_firmware_spl_addr=0x21000000\0" \ "update_spi_firmware_spl_filename=boot.bin\0" \

On Tue, May 02, 2017 at 08:27:43PM +0200, Marek Vasut wrote:
Enable DFU and USB mass storage support for the DENX MA5D4 SoM.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

Init the controllers, otherwise the board cannot boot from SD/MMC. This boot option is new on rev. 2.1 SoM .
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- board/aries/ma5d4evk/ma5d4evk.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index aa02b8a34b..9c1ba58166 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -337,7 +337,13 @@ int board_eth_init(bd_t *bis) #ifdef CONFIG_SPL_BUILD void spl_board_init(void) { +#ifdef CONFIG_ATMEL_SPI ma5d4evk_spi0_hw_init(); +#endif +#ifdef CONFIG_GENERIC_ATMEL_MCI + ma5d4evk_mci0_hw_init(); + ma5d4evk_mci1_hw_init(); +#endif }
static void ddr2_conf(struct atmel_mpddrc_config *ddr2)

On Tue, May 02, 2017 at 08:27:44PM +0200, Marek Vasut wrote:
Init the controllers, otherwise the board cannot boot from SD/MMC. This boot option is new on rev. 2.1 SoM .
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

The SDHCI1 is the primary boot controller on rev. 2.1 SoM, which is the version available on the market. Swap the controller order to match this and future versions of the SoM.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- board/aries/ma5d4evk/ma5d4evk.c | 5 ++--- include/configs/ma5d4evk.h | 10 +++++----- 2 files changed, 7 insertions(+), 8 deletions(-)
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index 9c1ba58166..0293b29d0e 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -205,14 +205,13 @@ int board_mmc_init(bd_t *bis) at91_set_pio_output(AT91_PIO_PORTE, 15, 1); at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 15, 0);
- ret = atmel_mci_init((void *)ATMEL_BASE_MCI0); + ret = atmel_mci_init((void *)ATMEL_BASE_MCI1); if (ret) /* eMMC init failed, skip it. */ at91_set_pio_output(AT91_PIO_PORTE, 15, 0);
/* Enable the power supply to On-board MicroSD */ at91_set_pio_output(AT91_PIO_PORTE, 17, 0); - - ret = atmel_mci_init((void *)ATMEL_BASE_MCI1); + ret = atmel_mci_init((void *)ATMEL_BASE_MCI0); if (ret) /* uSD init failed, power it down. */ at91_set_pio_output(AT91_PIO_PORTE, 17, 1);
diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h index f317f07d80..f6c883dd70 100644 --- a/include/configs/ma5d4evk.h +++ b/include/configs/ma5d4evk.h @@ -137,9 +137,9 @@ "consdev=ttyS3\0" \ "baudrate=115200\0" \ "bootscript=boot.scr\0" \ - "bootdev=/dev/mmcblk1p1\0" \ - "bootpart=1:1\0" \ - "rootdev=/dev/mmcblk1p2\0" \ + "bootdev=/dev/mmcblk0p1\0" \ + "bootpart=0:1\0" \ + "rootdev=/dev/mmcblk0p2\0" \ "netdev=eth0\0" \ "dfu_alt_info=mmc raw 0 3867148288\0" \ "kernel_addr_r=0x22000000\0" \ @@ -196,8 +196,8 @@ "bootm ${kernel_addr_r}\0" \ "try_bootscript=" \ "mmc rescan;" \ - "if test -e mmc ${bootpart} ${bootscript} ; then " \ - "if load mmc ${bootpart} ${kernel_addr_r} ${bootscript};"\ + "if test -e mmc 1:1 ${bootscript} ; then " \ + "if load mmc 1:1 ${kernel_addr_r} ${bootscript};" \ "then ; " \ "echo Running bootscript... ; " \ "source ${kernel_addr_r} ; " \

On Tue, May 02, 2017 at 08:27:45PM +0200, Marek Vasut wrote:
The SDHCI1 is the primary boot controller on rev. 2.1 SoM, which is the version available on the market. Swap the controller order to match this and future versions of the SoM.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

The SoM has been redesigned to work around bug in the SoC and is now capable of booting from the eMMC. Add support for booting from eMMC.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- include/configs/ma5d4evk.h | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h index f6c883dd70..d65ac43096 100644 --- a/include/configs/ma5d4evk.h +++ b/include/configs/ma5d4evk.h @@ -218,4 +218,13 @@ #define CONFIG_SPL_SPI_LOAD #define CONFIG_SYS_SPI_U_BOOT_OFFS 0x10000
+#define CONFIG_SYS_USE_MMC +#define CONFIG_SPL_LDSCRIPT arch/arm/mach-at91/armv7/u-boot-spl.lds +#define CONFIG_SPL_MMC_SUPPORT +#define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR 0x200 +#define CONFIG_SYS_MMCSD_FS_BOOT_PARTITION 1 +#define CONFIG_SPL_FS_LOAD_PAYLOAD_NAME "u-boot.img" +#define CONFIG_SPL_FAT_SUPPORT +#define CONFIG_SPL_LIBDISK_SUPPORT + #endif /* __MA5D4EVK_CONFIG_H__ */

On Tue, May 02, 2017 at 08:27:46PM +0200, Marek Vasut wrote:
The SoM has been redesigned to work around bug in the SoC and is now capable of booting from the eMMC. Add support for booting from eMMC.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

Continue loading U-Boot from MMC2 when the SPL was loaded using SAM-BA loader. This allows the board to boot system from the removable media instead of the eMMC, which is useful for commissioning purposes. When booting from the eMMC, always boot from it as it is not possible to boot from the SD interface directly.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- board/aries/ma5d4evk/ma5d4evk.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index 0293b29d0e..6393948c49 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -22,6 +22,7 @@ #include <net.h> #include <netdev.h> #include <spi.h> +#include <spl.h> #include <version.h>
DECLARE_GLOBAL_DATA_PTR; @@ -345,6 +346,23 @@ void spl_board_init(void) #endif }
+void board_boot_order(u32 *spl_boot_list) +{ + spl_boot_list[0] = spl_boot_device(); + + switch (spl_boot_list[0]) { + case BOOT_DEVICE_MMC1: + case BOOT_DEVICE_MMC2: + spl_boot_list[0] = BOOT_DEVICE_MMC1; + break; + case BOOT_DEVICE_SPI: + break; + case BOOT_DEVICE_USB: + spl_boot_list[0] = BOOT_DEVICE_MMC2; + break; + } +} + static void ddr2_conf(struct atmel_mpddrc_config *ddr2) { ddr2->md = (ATMEL_MPDDRC_MD_DBW_32_BITS | ATMEL_MPDDRC_MD_DDR2_SDRAM);

On Tue, May 02, 2017 at 08:27:47PM +0200, Marek Vasut wrote:
Continue loading U-Boot from MMC2 when the SPL was loaded using SAM-BA loader. This allows the board to boot system from the removable media instead of the eMMC, which is useful for commissioning purposes. When booting from the eMMC, always boot from it as it is not possible to boot from the SD interface directly.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

The redesigned version of the SoM which was released onto the market does no longer contain SPI flash, but boots from the eMMC. Move the environment storage to the eMMC.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- include/configs/ma5d4evk.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h index d65ac43096..3c2ef99b8e 100644 --- a/include/configs/ma5d4evk.h +++ b/include/configs/ma5d4evk.h @@ -36,13 +36,12 @@ /* * Environment */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_SYS_REDUNDAND_ENVIRONMENT -#define CONFIG_ENV_OFFSET 0x8000 +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE +#define CONFIG_SYS_CONSOLE_ENV_OVERWRITE #define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_ENV_OFFSET_REDUND (CONFIG_ENV_OFFSET + CONFIG_ENV_SIZE) -#define CONFIG_ENV_SIZE_REDUND CONFIG_ENV_SIZE -#define CONFIG_ENV_SECT_SIZE 0x1000 +#define CONFIG_SYS_MMC_ENV_DEV 0 /* eMMC */ +#define CONFIG_ENV_OFFSET 512 /* just after the MBR */
/* * U-Boot general configurations

On Tue, May 02, 2017 at 08:27:48PM +0200, Marek Vasut wrote:
The redesigned version of the SoM which was released onto the market does no longer contain SPI flash, but boots from the eMMC. Move the environment storage to the eMMC.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

Use random ethaddr by default in case no ethaddr is set.
Signed-off-by: Marek Vasut marex@denx.de --- configs/ma5d4evk_defconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/configs/ma5d4evk_defconfig b/configs/ma5d4evk_defconfig index 8f8ce9b935..654193831c 100644 --- a/configs/ma5d4evk_defconfig +++ b/configs/ma5d4evk_defconfig @@ -15,6 +15,7 @@ CONFIG_VERSION_VARIABLE=y CONFIG_BOARD_EARLY_INIT_F=y CONFIG_SPL=y CONFIG_HUSH_PARSER=y +CONFIG_NET_RANDOM_ETHADDR=y CONFIG_CMD_BOOTZ=y # CONFIG_CMD_IMI is not set # CONFIG_CMD_IMLS is not set

On Tue, May 02, 2017 at 08:27:49PM +0200, Marek Vasut wrote:
Use random ethaddr by default in case no ethaddr is set.
Signed-off-by: Marek Vasut marex@denx.de
Applied to u-boot/master, thanks!

Discern the SoMs based on the presence of SPI flash to support both variants of the SoM, one booting from SPI NOR and one booting from eMMC.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com --- board/aries/ma5d4evk/ma5d4evk.c | 26 ++++++++++++++++++++++++-- include/configs/ma5d4evk.h | 22 ++++++++++++++-------- 2 files changed, 38 insertions(+), 10 deletions(-)
diff --git a/board/aries/ma5d4evk/ma5d4evk.c b/board/aries/ma5d4evk/ma5d4evk.c index 6393948c49..b9294fc881 100644 --- a/board/aries/ma5d4evk/ma5d4evk.c +++ b/board/aries/ma5d4evk/ma5d4evk.c @@ -22,11 +22,14 @@ #include <net.h> #include <netdev.h> #include <spi.h> +#include <spi_flash.h> #include <spl.h> #include <version.h>
DECLARE_GLOBAL_DATA_PTR;
+static u8 boot_mode_sf; + #ifdef CONFIG_ATMEL_SPI int spi_cs_is_valid(unsigned int bus, unsigned int cs) { @@ -201,18 +204,20 @@ void ma5d4evk_mci1_hw_init(void) int board_mmc_init(bd_t *bis) { int ret; + void *mci0 = (void *)ATMEL_BASE_MCI0; + void *mci1 = (void *)ATMEL_BASE_MCI1;
/* De-assert reset on On-SoM eMMC */ at91_set_pio_output(AT91_PIO_PORTE, 15, 1); at91_pio3_set_pio_pulldown(AT91_PIO_PORTE, 15, 0);
- ret = atmel_mci_init((void *)ATMEL_BASE_MCI1); + ret = atmel_mci_init(boot_mode_sf ? mci0 : mci1); if (ret) /* eMMC init failed, skip it. */ at91_set_pio_output(AT91_PIO_PORTE, 15, 0);
/* Enable the power supply to On-board MicroSD */ at91_set_pio_output(AT91_PIO_PORTE, 17, 0); - ret = atmel_mci_init((void *)ATMEL_BASE_MCI0); + ret = atmel_mci_init(boot_mode_sf ? mci1 : mci0); if (ret) /* uSD init failed, power it down. */ at91_set_pio_output(AT91_PIO_PORTE, 17, 1);
@@ -274,6 +279,14 @@ int board_early_init_f(void) return 0; }
+static void board_identify(void) +{ + struct spi_flash *sf; + sf = spi_flash_probe(CONFIG_SF_DEFAULT_BUS, CONFIG_SF_DEFAULT_CS, + CONFIG_SF_DEFAULT_SPEED, CONFIG_SF_DEFAULT_MODE); + boot_mode_sf = (sf != NULL); +} + int board_init(void) { /* adress of boot parameters */ @@ -299,6 +312,8 @@ int board_init(void) at91_udp_hw_init(); #endif
+ board_identify(); + /* Reset CAN controllers */ at91_set_pio_output(AT91_PIO_PORTB, 21, 0); udelay(100); @@ -308,6 +323,12 @@ int board_init(void) return 0; }
+int board_late_init(void) +{ + setenv("bootmode", boot_mode_sf ? "sf" : "emmc"); + return 0; +} + int dram_init(void) { gd->ram_size = get_ram_size((void *)CONFIG_SYS_SDRAM_BASE, @@ -344,6 +365,7 @@ void spl_board_init(void) ma5d4evk_mci0_hw_init(); ma5d4evk_mci1_hw_init(); #endif + board_identify(); }
void board_boot_order(u32 *spl_boot_list) diff --git a/include/configs/ma5d4evk.h b/include/configs/ma5d4evk.h index 3c2ef99b8e..3abbbaf980 100644 --- a/include/configs/ma5d4evk.h +++ b/include/configs/ma5d4evk.h @@ -13,6 +13,7 @@ #include "at91-sama5_common.h" #undef CONFIG_BOOTARGS #define CONFIG_SYS_USE_SERIALFLASH 1 +#define CONFIG_BOARD_LATE_INIT
/* * U-Boot Commands @@ -181,18 +182,23 @@ "nfsargs=" \ "setenv bootargs root=/dev/nfs rw " \ "nfsroot=${serverip}:${rootpath},v3,tcp\0" \ + "fdtimg=if test ${bootmode} = "sf" ; then " \ + "setenv kernel_fdt 1 ; " \ + "else ; " \ + "setenv kernel_fdt 2 ; " \ + "fi\0" \ "mmc_mmc=" \ - "run mmcload mmcargs addargs ; " \ - "bootm ${kernel_addr_r}\0" \ + "run fdtimg mmcload mmcargs addargs ; " \ + "bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \ "mmc_nfs=" \ - "run mmcload nfsargs addip addargs ; " \ - "bootm ${kernel_addr_r}\0" \ + "run fdtimg mmcload nfsargs addip addargs ; " \ + "bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \ "net_mmc=" \ - "run netload mmcargs addargs ; " \ - "bootm ${kernel_addr_r}\0" \ + "run fdtimg netload mmcargs addargs ; " \ + "bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \ "net_nfs=" \ - "run netload nfsargs addip addargs ; " \ - "bootm ${kernel_addr_r}\0" \ + "run fdtimg netload nfsargs addip addargs ; " \ + "bootm ${kernel_addr_r}:kernel@1 - ${kernel_addr_r}:fdt@${kernel_fdt}\0" \ "try_bootscript=" \ "mmc rescan;" \ "if test -e mmc 1:1 ${bootscript} ; then " \

On Tue, May 02, 2017 at 08:27:50PM +0200, Marek Vasut wrote:
Discern the SoMs based on the presence of SPI flash to support both variants of the SoM, one booting from SPI NOR and one booting from eMMC.
Signed-off-by: Marek Vasut marex@denx.de Cc: Andreas Bießmann andreas.devel@googlemail.com
Applied to u-boot/master, thanks!

On Tue, May 02, 2017 at 08:27:40PM +0200, Marek Vasut wrote:
The board is now manufactured by Aries Embedded GmbH , rename it.
Signed-off-by: Marek Vasut marex@denx.de
Applied to u-boot/master, thanks!
participants (2)
-
Marek Vasut
-
Tom Rini