Skip to contentSkip to conversation

ARM: at91: sama5: move the sd/mmc env config to at91-sama5_common.h

PATCH New Josh Wu 2 participants 8 messages Aug 19, 2015 – Aug 21, 2015 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

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.

---

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(-)
include/configs/at91-sama5_common.h +12 -0
index 2bded45..bb737a1 100644
@@ -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"
include/configs/sama5d3_xplained.h +1 -9
index c4141a0..91ef123 100644
@@ -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
include/configs/sama5d3xek.h +1 -9
index 9497bea..5c7b722 100644
@@ -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
include/configs/sama5d4_xplained.h +1 -17
index e06dfc9..fe585c4 100644
@@ -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
include/configs/sama5d4ek.h +1 -15
index eadccc1..ee31e9d 100644
@@ -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 */
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH v2 2/4 ARM: at91: sama5d3xek: use a $dtb_name to load dtb

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.

---

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(-)
board/atmel/sama5d3xek/sama5d3xek.c +20 -0
index cf6ed8b..8711cc6 100644
@@ -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)
include/configs/at91-sama5_common.h +4 -1
index bb737a1..0fe0852 100644
@@ -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							\
include/configs/sama5d3xek.h +3 -0
index 5c7b722..7b2f69a 100644
@@ -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
Signature · 1 line
1.9.1
#2 lore raw

PATCH v2 2/4 ARM: at91: sama5d3xek: use a $dtb_name to load dtb

Dear "Wu, Josh",

Quoted 15 lines · Josh Wu

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.

---

Quoted 8 lines

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

author
#3 lore raw

PATCH v2 3/4 ARM: at91: sama5: move the nandflash env config to at91-sama5_common.h

In reply to Josh Wu

As all sama5 nandflash env configurations are same, so move them to at91-sama5_common.h.

---

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(-)
include/configs/at91-sama5_common.h +12 -0
index 0fe0852..9c3ebd0 100644
@@ -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
include/configs/sama5d3_xplained.h +1 -8
index 91ef123..73de62c 100644
@@ -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
include/configs/sama5d3xek.h +1 -8
index 7b2f69a..dc26ba7 100644
@@ -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
include/configs/sama5d4_xplained.h +1 -8
index fe585c4..c5adf6d 100644
@@ -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
include/configs/sama5d4ek.h +1 -8
index ee31e9d..be2c2ce 100644
@@ -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
Signature · 1 line
1.9.1
#4 lore raw

PATCH v2 3/4 ARM: at91: sama5: move the nandflash env config to at91-sama5_common.h

Dear "Wu, Josh",

Quoted 6 lines · Josh Wu

As all sama5 nandflash env configurations are same, so move them to at91-sama5_common.h.

---

Quoted 8 lines

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

author
#5 lore raw

PATCH v2 4/4 ARM: at91: sama5: update the spi flash mapping

In reply to Josh Wu

From: "Wu, Josh" <[email protected]>

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.

---

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(-)
include/configs/at91-sama5_common.h +10 -0
index 9c3ebd0..de5f12e 100644
@@ -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
include/configs/sama5d3xek.h +2 -9
index dc26ba7..61b4bda 100644
@@ -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
 
include/configs/sama5d4_xplained.h +2 -12
index c5adf6d..139031d 100644
@@ -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
include/configs/sama5d4ek.h +2 -12
index be2c2ce..cde549a 100644
@@ -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
Signature · 1 line
1.9.1
#6 lore raw

PATCH v2 4/4 ARM: at91: sama5: update the spi flash mapping

Dear "Wu, Josh",

Quoted 22 lines · Josh Wu

From: "Wu, Josh" <[email protected]>

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.

---

Quoted 8 lines

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

#7 lore raw

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

In reply to Josh Wu

Dear "Wu, Josh",

Quoted 15 lines · Josh Wu

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.

---

Changes in v2:
- use CONFIG_ENV_VARS_UBOOT_CONFIG instead thanks to Andreas.

Quoted 6 lines
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