[U-Boot] [PATCH v2 1/4] ARM: at91: sama5: move the sd/mmc env config to at91-sama5_common.h

As almost all sama5 sd/mmc env configurations are same, so move them to at91-sama5_common.h.
Also define CONFIG_ENV_VARS_UBOOT_CONFIG to have the varaible: $board_name. Then we can use 'at91-${board_name}.dtb' as the dtb name.
TODO: since sama5d3xek has different dtb name, we need to some extra stuff to make it work on sama5d3xek boards.
Signed-off-by: Josh Wu josh.wu@atmel.com ---
Changes in v2: - use CONFIG_ENV_VARS_UBOOT_CONFIG instead thanks to Andreas.
include/configs/at91-sama5_common.h | 12 ++++++++++++ include/configs/sama5d3_xplained.h | 10 +--------- include/configs/sama5d3xek.h | 10 +--------- include/configs/sama5d4_xplained.h | 18 +----------------- include/configs/sama5d4ek.h | 16 +--------------- 5 files changed, 16 insertions(+), 50 deletions(-)
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 2bded45..bb737a1 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -27,6 +27,7 @@ #define CONFIG_BOARD_EARLY_INIT_F #define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_ENV_VARS_UBOOT_CONFIG #define CONFIG_CMD_BOOTZ #define CONFIG_OF_LIBFDT /* Device Tree support */
@@ -52,6 +53,17 @@ #define CONFIG_CMD_DHCP
#ifdef CONFIG_SYS_USE_MMC +/* u-boot env in sd/mmc card */ +#define CONFIG_ENV_IS_IN_FAT +#define CONFIG_FAT_WRITE +#define FAT_ENV_INTERFACE "mmc" +#define FAT_ENV_DEVICE_AND_PART "0" +#define FAT_ENV_FILE "uboot.env" +#define CONFIG_ENV_SIZE 0x4000 + +#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 at91-${board_name}.dtb; " \ + "fatload mmc 0:1 0x22000000 zImage; " \ + "bootz 0x22000000 - 0x21000000" #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ "root=/dev/mmcblk0p2 rw rootwait" diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index c4141a0..91ef123 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -124,15 +124,7 @@ "nand read 0x22000000 0x200000 0x600000;" \ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_MMC -/* bootstrap + u-boot + env in sd card */ -#define CONFIG_ENV_IS_IN_FAT -#define FAT_ENV_INTERFACE "mmc" -#define FAT_ENV_FILE "uboot.env" -#define FAT_ENV_DEVICE_AND_PART "0" -#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 at91-sama5d3_xplained.dtb; " \ - "fatload mmc 0:1 0x22000000 zImage; " \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for sd/mmc env */ #else #define CONFIG_ENV_IS_NOWHERE #endif diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index 9497bea..5c7b722 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -171,15 +171,7 @@ "nand read 0x22000000 0x200000 0x600000;" \ "bootm 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_MMC -/* bootstrap + u-boot + env in sd card */ -#define CONFIG_ENV_IS_IN_FAT -#define FAT_ENV_INTERFACE "mmc" -#define FAT_ENV_FILE "uboot.env" -#define FAT_ENV_DEVICE_AND_PART "0" -#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 dtb; " \ - "fatload mmc 0:1 0x22000000 uImage; " \ - "bootm 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for sd/mmc env */ #else #define CONFIG_ENV_IS_NOWHERE #endif diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index e06dfc9..fe585c4 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -138,25 +138,9 @@ "nand read 0x22000000 0x200000 0x600000;" \ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_MMC -/* bootstrap + u-boot + env in sd card */ -#define CONFIG_ENV_IS_IN_FAT -#define CONFIG_FAT_WRITE -#define FAT_ENV_INTERFACE "mmc" -/* - * We don't specify the part number, if device 0 has partition table, it means - * the first partition; it no partition table, then take whole device as a - * FAT file system. - */ -#define FAT_ENV_DEVICE_AND_PART "0" -#define FAT_ENV_FILE "uboot.env" -#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 at91-sama5d4_xplained.dtb; " \ - "fatload mmc 0:1 0x22000000 zImage; " \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for sd/mmc env */ #endif
- - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x200000 diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index eadccc1..ee31e9d 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -136,21 +136,7 @@ "nand read 0x22000000 0x200000 0x600000;" \ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_MMC -/* bootstrap + u-boot + env in sd card */ -#define CONFIG_ENV_IS_IN_FAT -#define CONFIG_FAT_WRITE -#define FAT_ENV_INTERFACE "mmc" -/* - * We don't specify the part number, if device 0 has partition table, it means - * the first partition; it no partition table, then take whole device as a - * FAT file system. - */ -#define FAT_ENV_DEVICE_AND_PART "0" -#define FAT_ENV_FILE "uboot.env" -#define CONFIG_ENV_SIZE 0x4000 -#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 sama5d4ek.dtb; " \ - "fatload mmc 0:1 0x22000000 zImage; " \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for sd/mmc env */ #endif
/* SPL */

Since sama5d3xek boards has different type of dtb blobs, so we need to detect the cpu type in runtime.
So we add a new variable $dtb_name. if $dtb_name is not defined, we just use at91-${board_name}.dtb
as the $dtb_name. Otherwise, we will just load the dtb with $dtb_name.
For sama5d3xek, we will detect cpu type and make up $dtb_name in runtime.
Signed-off-by: Josh Wu josh.wu@atmel.com ---
Changes in v2: - fix bug on tolower loop. - use setenv dtb_name instead
board/atmel/sama5d3xek/sama5d3xek.c | 20 ++++++++++++++++++++ include/configs/at91-sama5_common.h | 5 ++++- include/configs/sama5d3xek.h | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-)
diff --git a/board/atmel/sama5d3xek/sama5d3xek.c b/board/atmel/sama5d3xek/sama5d3xek.c index cf6ed8b..8711cc6 100644 --- a/board/atmel/sama5d3xek/sama5d3xek.c +++ b/board/atmel/sama5d3xek/sama5d3xek.c @@ -15,6 +15,7 @@ #include <asm/arch/gpio.h> #include <asm/arch/clk.h> #include <lcd.h> +#include <linux/ctype.h> #include <atmel_hlcdc.h> #include <atmel_mci.h> #include <phy.h> @@ -369,6 +370,25 @@ void spi_cs_deactivate(struct spi_slave *slave) } #endif /* CONFIG_ATMEL_SPI */
+#ifdef CONFIG_BOARD_LATE_INIT +int board_late_init(void) +{ +#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + const int MAX_STR_LEN = 32; + char name[MAX_STR_LEN], *p; + int i; + + strncpy(name, get_cpu_name(), MAX_STR_LEN); + for (i = 0, p = name; (*p) && (i < MAX_STR_LEN); p++, i++) + *p = tolower(*p); + + strcat(name, "ek.dtb"); + setenv("dtb_name", name); +#endif + return 0; +} +#endif + /* SPL */ #ifdef CONFIG_SPL_BUILD void spl_board_init(void) diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index bb737a1..0fe0852 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -61,7 +61,10 @@ #define FAT_ENV_FILE "uboot.env" #define CONFIG_ENV_SIZE 0x4000
-#define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 at91-${board_name}.dtb; " \ +#define CONFIG_BOOTCOMMAND "if test ! -n ${dtb_name}; then " \ + "setenv dtb_name at91-${board_name}.dtb; " \ + "fi; " \ + "fatload mmc 0:1 0x21000000 ${dtb_name}; " \ "fatload mmc 0:1 0x22000000 zImage; " \ "bootz 0x22000000 - 0x21000000" #define CONFIG_BOOTARGS \ diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index 5c7b722..7b2f69a 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -19,6 +19,9 @@ */ #include "at91-sama5_common.h"
+#define CONFIG_BOARD_LATE_INIT +#define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG + /* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_DBGU

Dear "Wu, Josh",
Josh Wu Josh.wu@atmel.com writes:
Since sama5d3xek boards has different type of dtb blobs, so we need to detect the cpu type in runtime.
So we add a new variable $dtb_name. if $dtb_name is not defined, we just use at91-${board_name}.dtb
as the $dtb_name. Otherwise, we will just load the dtb with $dtb_name.
For sama5d3xek, we will detect cpu type and make up $dtb_name in runtime.
Signed-off-by: Josh Wu josh.wu@atmel.com
Changes in v2:
- fix bug on tolower loop.
- use setenv dtb_name instead
board/atmel/sama5d3xek/sama5d3xek.c | 20 ++++++++++++++++++++ include/configs/at91-sama5_common.h | 5 ++++- include/configs/sama5d3xek.h | 3 +++ 3 files changed, 27 insertions(+), 1 deletion(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

As all sama5 nandflash env configurations are same, so move them to at91-sama5_common.h.
Signed-off-by: Josh Wu josh.wu@atmel.com ---
Changes in v2: None
include/configs/at91-sama5_common.h | 12 ++++++++++++ include/configs/sama5d3_xplained.h | 9 +-------- include/configs/sama5d3xek.h | 9 +-------- include/configs/sama5d4_xplained.h | 9 +-------- include/configs/sama5d4ek.h | 9 +-------- 5 files changed, 16 insertions(+), 32 deletions(-)
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 0fe0852..9c3ebd0 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -77,6 +77,18 @@ "256K(env),256k(env_redundent),256k(spare)," \ "512k(dtb),6M(kernel)ro,-(rootfs) " \ "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" + +#ifdef CONFIG_SYS_USE_NANDFLASH +/* u-boot env in nand flash */ +#define CONFIG_ENV_IS_IN_NAND +#define CONFIG_ENV_OFFSET 0xc0000 +#define CONFIG_ENV_OFFSET_REDUND 0x100000 +#define CONFIG_ENV_SIZE 0x20000 +#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ + "nand read 0x22000000 0x200000 0x600000;" \ + "bootz 0x22000000 - 0x21000000" +#endif + #endif
#define CONFIG_BAUDRATE 115200 diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 91ef123..73de62c 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -115,14 +115,7 @@ #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */
#if CONFIG_SYS_USE_NANDFLASH -/* bootstrap + u-boot + env in nandflash */ -#define CONFIG_ENV_IS_IN_NAND -#define CONFIG_ENV_OFFSET 0xc0000 -#define CONFIG_ENV_OFFSET_REDUND 0x100000 -#define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ - "nand read 0x22000000 0x200000 0x600000;" \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for nandflash env */ #elif CONFIG_SYS_USE_MMC /* override the bootcmd, bootargs and other configuration for sd/mmc env */ #else diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index 7b2f69a..dc26ba7 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -165,14 +165,7 @@ "sf read 0x22000000 0x42000 0x300000; " \ "bootm 0x22000000" #elif CONFIG_SYS_USE_NANDFLASH -/* bootstrap + u-boot + env in nandflash */ -#define CONFIG_ENV_IS_IN_NAND -#define CONFIG_ENV_OFFSET 0xc0000 -#define CONFIG_ENV_OFFSET_REDUND 0x100000 -#define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ - "nand read 0x22000000 0x200000 0x600000;" \ - "bootm 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration nandflash env */ #elif CONFIG_SYS_USE_MMC /* override the bootcmd, bootargs and other configuration for sd/mmc env */ #else diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index fe585c4..c5adf6d 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -129,14 +129,7 @@ "sf read 0x22000000 0x100000 0x300000; " \ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_NANDFLASH -/* bootstrap + u-boot + env in nandflash */ -#define CONFIG_ENV_IS_IN_NAND -#define CONFIG_ENV_OFFSET 0xc0000 -#define CONFIG_ENV_OFFSET_REDUND 0x100000 -#define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ - "nand read 0x22000000 0x200000 0x600000;" \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for nandflash env */ #elif CONFIG_SYS_USE_MMC /* override the bootcmd, bootargs and other configuration for sd/mmc env */ #endif diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index ee31e9d..be2c2ce 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -127,14 +127,7 @@ "sf read 0x22000000 0x100000 0x300000; " \ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_NANDFLASH -/* bootstrap + u-boot + env in nandflash */ -#define CONFIG_ENV_IS_IN_NAND -#define CONFIG_ENV_OFFSET 0xc0000 -#define CONFIG_ENV_OFFSET_REDUND 0x100000 -#define CONFIG_ENV_SIZE 0x20000 -#define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ - "nand read 0x22000000 0x200000 0x600000;" \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for nandflash env*/ #elif CONFIG_SYS_USE_MMC /* override the bootcmd, bootargs and other configuration for sd/mmc env */ #endif

Dear "Wu, Josh",
Josh Wu Josh.wu@atmel.com writes:
As all sama5 nandflash env configurations are same, so move them to at91-sama5_common.h.
Signed-off-by: Josh Wu josh.wu@atmel.com
Changes in v2: None
include/configs/at91-sama5_common.h | 12 ++++++++++++ include/configs/sama5d3_xplained.h | 9 +-------- include/configs/sama5d3xek.h | 9 +-------- include/configs/sama5d4_xplained.h | 9 +-------- include/configs/sama5d4ek.h | 9 +-------- 5 files changed, 16 insertions(+), 32 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

From: "Wu, Josh" Josh.wu@atmel.com
Also move the spi flash configurations to the at91-sama5_common.h.
Current at91 zImage size is about 3.3M, the old mapping is not suitable. So update the spi flash map as following: 0x0 ~ 0x004000: at91bootstrap(16k) 0x04000 ~ 0x008000: u-boot env(16k) 0x08000 ~ 0x060000: u-boot(352k) 0x60000 ~ 0x06c000: dtb (48k) 0x6c000 ~ 0x400000: kernel (3M+592k)
In AT91Bootstrap, the U-Boot in spi flash also update to 0x8000, refer to following commit in AT91Bootstrap: 3e91e54 Kconfig: fix spi flash address
So also update SPL's u-boot load address to 0x8000 in spi flash.
Signed-off-by: Josh Wu josh.wu@atmel.com Reviewed-by: Jagan Teki jteki@openedev.com ---
Changes in v2: - collect the reviewed-by tag from Jagan Teki.
include/configs/at91-sama5_common.h | 10 ++++++++++ include/configs/sama5d3xek.h | 11 ++--------- include/configs/sama5d4_xplained.h | 14 ++------------ include/configs/sama5d4ek.h | 14 ++------------ 4 files changed, 16 insertions(+), 33 deletions(-)
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 9c3ebd0..de5f12e 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -87,6 +87,16 @@ #define CONFIG_BOOTCOMMAND "nand read 0x21000000 0x180000 0x80000;" \ "nand read 0x22000000 0x200000 0x600000;" \ "bootz 0x22000000 - 0x21000000" +#elif CONFIG_SYS_USE_SERIALFLASH +/* u-boot env in serial flash, by default is bus 0 and cs 0 */ +#define CONFIG_ENV_IS_IN_SPI_FLASH +#define CONFIG_ENV_OFFSET 0x4000 +#define CONFIG_ENV_SIZE 0x4000 +#define CONFIG_ENV_SECT_SIZE 0x1000 +#define CONFIG_BOOTCOMMAND "sf probe 0; " \ + "sf read 0x21000000 0x60000 0xc000; " \ + "sf read 0x22000000 0x6c000 0x394000; " \ + "bootz 0x22000000 - 0x21000000" #endif
#endif diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index dc26ba7..61b4bda 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -156,14 +156,7 @@ #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */
#ifdef CONFIG_SYS_USE_SERIALFLASH -/* bootstrap + u-boot + env + linux in serial flash */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_OFFSET 0x5000 -#define CONFIG_ENV_SIZE 0x3000 -#define CONFIG_ENV_SECT_SIZE 0x1000 -#define CONFIG_BOOTCOMMAND "sf probe 0; " \ - "sf read 0x22000000 0x42000 0x300000; " \ - "bootm 0x22000000" +/* override the bootcmd, bootargs and other configuration for spi flash env*/ #elif CONFIG_SYS_USE_NANDFLASH /* override the bootcmd, bootargs and other configuration nandflash env */ #elif CONFIG_SYS_USE_MMC @@ -216,7 +209,7 @@ #define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SPL_SPI_FLASH_SUPPORT #define CONFIG_SPL_SPI_LOAD -#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8400 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000
#endif
diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index c5adf6d..139031d 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -117,17 +117,7 @@ #endif
#ifdef CONFIG_SYS_USE_SERIALFLASH -/* bootstrap + u-boot + env + linux in serial flash */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS -#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS -#define CONFIG_ENV_OFFSET 0x10000 -#define CONFIG_ENV_SIZE 0x10000 -#define CONFIG_ENV_SECT_SIZE 0x1000 -#define CONFIG_BOOTCOMMAND "sf probe 0; " \ - "sf read 0x21000000 0xa0000 0x60000; " \ - "sf read 0x22000000 0x100000 0x300000; " \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for spi flash env */ #elif CONFIG_SYS_USE_NANDFLASH /* override the bootcmd, bootargs and other configuration for nandflash env */ #elif CONFIG_SYS_USE_MMC @@ -180,7 +170,7 @@ #define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SPL_SPI_FLASH_SUPPORT #define CONFIG_SPL_SPI_LOAD -#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000
#endif #endif diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index be2c2ce..cde549a 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -115,17 +115,7 @@ #define CONFIG_SYS_CONSOLE_IS_IN_ENV
#ifdef CONFIG_SYS_USE_SERIALFLASH -/* bootstrap + u-boot + env + linux in serial flash */ -#define CONFIG_ENV_IS_IN_SPI_FLASH -#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS -#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS -#define CONFIG_ENV_OFFSET 0x10000 -#define CONFIG_ENV_SIZE 0x10000 -#define CONFIG_ENV_SECT_SIZE 0x1000 -#define CONFIG_BOOTCOMMAND "sf probe 0; " \ - "sf read 0x21000000 0xa0000 0x60000; " \ - "sf read 0x22000000 0x100000 0x300000; " \ - "bootz 0x22000000 - 0x21000000" +/* override the bootcmd, bootargs and other configuration for spi flash env*/ #elif CONFIG_SYS_USE_NANDFLASH /* override the bootcmd, bootargs and other configuration for nandflash env*/ #elif CONFIG_SYS_USE_MMC @@ -178,7 +168,7 @@ #define CONFIG_SPL_SPI_SUPPORT #define CONFIG_SPL_SPI_FLASH_SUPPORT #define CONFIG_SPL_SPI_LOAD -#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x20000 +#define CONFIG_SYS_SPI_U_BOOT_OFFS 0x8000
#endif #endif

Dear "Wu, Josh",
Josh Wu Josh.wu@atmel.com writes:
From: "Wu, Josh" Josh.wu@atmel.com
Also move the spi flash configurations to the at91-sama5_common.h.
Current at91 zImage size is about 3.3M, the old mapping is not suitable. So update the spi flash map as following: 0x0 ~ 0x004000: at91bootstrap(16k) 0x04000 ~ 0x008000: u-boot env(16k) 0x08000 ~ 0x060000: u-boot(352k) 0x60000 ~ 0x06c000: dtb (48k) 0x6c000 ~ 0x400000: kernel (3M+592k)
In AT91Bootstrap, the U-Boot in spi flash also update to 0x8000, refer to following commit in AT91Bootstrap: 3e91e54 Kconfig: fix spi flash address
So also update SPL's u-boot load address to 0x8000 in spi flash.
Signed-off-by: Josh Wu josh.wu@atmel.com Reviewed-by: Jagan Teki jteki@openedev.com
Changes in v2:
- collect the reviewed-by tag from Jagan Teki.
include/configs/at91-sama5_common.h | 10 ++++++++++ include/configs/sama5d3xek.h | 11 ++--------- include/configs/sama5d4_xplained.h | 14 ++------------ include/configs/sama5d4ek.h | 14 ++------------ 4 files changed, 16 insertions(+), 33 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Dear "Wu, Josh",
Josh Wu Josh.wu@atmel.com writes:
As almost all sama5 sd/mmc env configurations are same, so move them to at91-sama5_common.h.
Also define CONFIG_ENV_VARS_UBOOT_CONFIG to have the varaible: $board_name. Then we can use 'at91-${board_name}.dtb' as the dtb name.
TODO: since sama5d3xek has different dtb name, we need to some extra stuff to make it work on sama5d3xek boards.
Signed-off-by: Josh Wu josh.wu@atmel.com
Changes in v2:
- use CONFIG_ENV_VARS_UBOOT_CONFIG instead thanks to Andreas.
include/configs/at91-sama5_common.h | 12 ++++++++++++ include/configs/sama5d3_xplained.h | 10 +--------- include/configs/sama5d3xek.h | 10 +--------- include/configs/sama5d4_xplained.h | 18 +----------------- include/configs/sama5d4ek.h | 16 +--------------- 5 files changed, 16 insertions(+), 50 deletions(-)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann
participants (2)
-
Andreas Bießmann
-
Josh Wu