[U-Boot] [PATCH 0/6] ARM: at91: SAMA5: extract the common sama5 chip configurations to a common header

This patch series reorganized the configurations for SAMA5 chips. Make the common part into one file. That way we don't need to have many copy of the same configurations.
Josh Wu (6): ARM: at91: sama5d3_xplained: spl: enable PMECC header generation ARM: at91: sama5: move the common part of configurations to at91-sama5_common.h ARM: at91: sama5d3_xplained: set ENV_FAT_DEVICE_AND_PART intead of using number ARM: at91: sama5d3: mmc: save enviroment as a fat file (uboot.env) ARM: at91: sama5: move the bootcmd definition to the common header ARM: at91: at91sam9x5: mmc: save environment as a file in FAT partition.
include/configs/at91-sama5_common.h | 126 ++++++++++++++++++++++++++++++++++++ include/configs/at91sam9x5ek.h | 12 ++-- include/configs/sama5d3_xplained.h | 100 ++-------------------------- include/configs/sama5d3xek.h | 114 ++------------------------------ include/configs/sama5d4_xplained.h | 116 ++------------------------------- include/configs/sama5d4ek.h | 116 ++------------------------------- 6 files changed, 153 insertions(+), 431 deletions(-) create mode 100644 include/configs/at91-sama5_common.h

As sama5d3 xplained support the PMECC. So add the PMECC header for spl binary. That make ROM loader can use PMECC to avoid error flips in spl code in nandflash.
Signed-off-by: Josh Wu josh.wu@atmel.com --- include/configs/sama5d3_xplained.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 5b77db2..d24d600 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -246,6 +246,7 @@ #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE 0x20000 #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0x0 +#define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER
#endif

Hi Josh,
On 11/19/2014 07:03 PM, Josh Wu wrote:
As sama5d3 xplained support the PMECC. So add the PMECC header for spl binary. That make ROM loader can use PMECC to avoid error flips in spl code in nandflash.
Signed-off-by: Josh Wu josh.wu@atmel.com
Thanks. Acked-by: Bo Shen voice.shen@atmel.com
include/configs/sama5d3_xplained.h | 1 + 1 file changed, 1 insertion(+)
diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 5b77db2..d24d600 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -246,6 +246,7 @@ #define CONFIG_SYS_NAND_OOBSIZE 64 #define CONFIG_SYS_NAND_BLOCK_SIZE 0x20000 #define CONFIG_SYS_NAND_BAD_BLOCK_POS 0x0 +#define CONFIG_SPL_GENERATE_ATMEL_PMECC_HEADER
#endif
Best Regards, Bo Shen

Dear Josh Wu,
Josh Wu Josh.wu@atmel.com writes:
As sama5d3 xplained support the PMECC. So add the PMECC header for spl binary. That make ROM loader can use PMECC to avoid error flips in spl code in nandflash.
Signed-off-by: Josh Wu josh.wu@atmel.com Acked-by: Bo Shen voice.shen@atmel.com
include/configs/sama5d3_xplained.h | 1 + 1 file changed, 1 insertion(+)
applied to u-boot-atmel/master, thanks!
Best regards, Andreas Bießmann

Create a new configuration file: at91-sama5_common.h. Which include the configurations that reused by all SAMA5 chips.
In the command header, we add the CMD_SETEXPR.
NOTE: NOR flash definition should be put before including the common header.
Signed-off-by: Josh Wu josh.wu@atmel.com --- include/configs/at91-sama5_common.h | 87 +++++++++++++++++++++++++++++++++++++ include/configs/sama5d3_xplained.h | 77 ++------------------------------ include/configs/sama5d3xek.h | 83 +++-------------------------------- include/configs/sama5d4_xplained.h | 74 ++----------------------------- include/configs/sama5d4ek.h | 75 ++------------------------------ 5 files changed, 103 insertions(+), 293 deletions(-) create mode 100644 include/configs/at91-sama5_common.h
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h new file mode 100644 index 0000000..4fab41d --- /dev/null +++ b/include/configs/at91-sama5_common.h @@ -0,0 +1,87 @@ +/* + * Common part of configuration settings for the SAMA5 board. + * + * Copyright (C) 2014 Atmel Corporation + * Josh Wu josh.wu@atmel.com + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#ifndef __CONFIG_AT91_SAMA5_H +#define __CONFIG_AT91_SAMA5_H + +#include <asm/hardware.h> + +#define CONFIG_SYS_TEXT_BASE 0x26f00000 + +/* ARM asynchronous clock */ +#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 +#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ + +#define CONFIG_ARCH_CPU_INIT + +#ifndef CONFIG_SPL_BUILD +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif + +#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_DISPLAY_CPUINFO + +#define CONFIG_CMD_BOOTZ +#define CONFIG_OF_LIBFDT /* Device Tree support */ + +#define CONFIG_SYS_GENERIC_BOARD + +/* general purpose I/O */ +#define CONFIG_AT91_GPIO + +#define CONFIG_BOOTDELAY 3 + +/* + * BOOTP options + */ +#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME + +/* + * Command line configuration. + */ +#include <config_cmd_default.h> +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_IMI +#undef CONFIG_CMD_LOADS +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_SETEXPR + +#ifdef CONFIG_SYS_USE_MMC +#define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk " \ + "root=/dev/mmcblk0p2 rw rootwait" +#else +#define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk " \ + "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ + "256K(env),256k(evn_redundent),256k(spare)," \ + "512k(dtb),6M(kernel)ro,-(rootfs) " \ + "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" +#endif + +#define CONFIG_BAUDRATE 115200 + +#define CONFIG_SYS_PROMPT "U-Boot> " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ + sizeof(CONFIG_SYS_PROMPT) + 16) +#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER + +/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) + +#endif \ No newline at end of file diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index d24d600..75c3be6 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -10,30 +10,10 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h> - -#define CONFIG_SYS_TEXT_BASE 0x26f00000 - -/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ - -#define CONFIG_ARCH_CPU_INIT - -#ifndef CONFIG_SPL_BUILD -#define CONFIG_SKIP_LOWLEVEL_INIT -#endif - -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO - -#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */ - -#define CONFIG_SYS_GENERIC_BOARD +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART @@ -51,29 +31,6 @@ */ #define ATMEL_PMC_UHP AT91SAM926x_PMC_UHP
-#define CONFIG_BOOTDELAY 3 - -/* - * BOOTP options - */ -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - -/* No NOR flash */ -#define CONFIG_SYS_NO_FLASH - -/* - * Command line configuration. - */ -#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP - /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -180,34 +137,6 @@ #define CONFIG_ENV_IS_NOWHERE #endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "root=/dev/mmcblk0p2 rw rootwait" -#else -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(evn_redundent),256k(spare)," \ - "512k(dtb),6M(kernel)ro,-(rootfs) " \ - "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" -#endif - -#define CONFIG_BAUDRATE 115200 - -#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ - sizeof(CONFIG_SYS_PROMPT) + 16) -#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER - -/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index dfbf3cb..ee0fddb 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -13,30 +13,11 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h> - -#define CONFIG_SYS_TEXT_BASE 0x26f00000 - -/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ - -#define CONFIG_ARCH_CPU_INIT - -#ifndef CONFIG_SPL_BUILD -#define CONFIG_SKIP_LOWLEVEL_INIT -#endif - -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO - -#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */ - -#define CONFIG_SYS_GENERIC_BOARD - -/* general purpose I/O */ -#define CONFIG_AT91_GPIO +/* + * If has No NOR flash, please put the definition: CONFIG_SYS_NO_FLASH + * before the common header. + */ +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART @@ -69,40 +50,16 @@ /* board specific (not enough SRAM) */ #define CONFIG_SAMA5D3_LCD_BASE 0x23E00000
-#define CONFIG_BOOTDELAY 3 - -/* - * BOOTP options - */ -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - /* NOR flash */ -#define CONFIG_CMD_FLASH - -#ifdef CONFIG_CMD_FLASH +#ifndef CONFIG_SYS_NO_FLASH #define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_CFI #define CONFIG_SYS_FLASH_PROTECTION #define CONFIG_SYS_FLASH_BASE 0x10000000 #define CONFIG_SYS_MAX_FLASH_SECT 131 #define CONFIG_SYS_MAX_FLASH_BANKS 1 -#else -#define CONFIG_SYS_NO_FLASH #endif
-/* - * Command line configuration. - */ -#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP - /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -226,34 +183,6 @@ #define CONFIG_ENV_IS_NOWHERE #endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "root=/dev/mmcblk0p2 rw rootwait" -#else -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(evn_redundent),256k(spare)," \ - "512k(dtb),6M(kernel)ro,-(rootfs) " \ - "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" -#endif - -#define CONFIG_BAUDRATE 115200 - -#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ - sizeof(CONFIG_SYS_PROMPT) + 16) -#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER - -/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (1024 * 1024) - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index 104edef..26af695 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -10,57 +10,16 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h> - -#define CONFIG_SYS_TEXT_BASE 0x26f00000 - -/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ - -#define CONFIG_ARCH_CPU_INIT - -#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO - -#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */ - -#define CONFIG_SYS_GENERIC_BOARD +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_USART3 #define CONFIG_USART_ID ATMEL_ID_USART3
-#define CONFIG_BOOTDELAY 3 - -/* - * BOOTP options - */ -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - -/* No NOR flash */ -#define CONFIG_SYS_NO_FLASH - -/* - * Command line configuration. - */ -#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_SETEXPR - /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -185,32 +144,5 @@ "bootz 0x22000000 - 0x21000000" #endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "root=/dev/mmcblk0p2 rw rootwait" -#else -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(evn_redundent),256k(spare)," \ - "512k(dtb),6M(kernel)ro,-(rootfs) " \ - "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" -#endif - -#define CONFIG_BAUDRATE 115200 - -#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ - sizeof(CONFIG_SYS_PROMPT) + 16) -#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER - -/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
#endif diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index cbdb3a2..15a92af 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -10,57 +10,16 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h> - -#define CONFIG_SYS_TEXT_BASE 0x26f00000 - -/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */ - -#define CONFIG_ARCH_CPU_INIT - -#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO - -#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */ - -#define CONFIG_SYS_GENERIC_BOARD +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_USART3 #define CONFIG_USART_ID ATMEL_ID_USART3
-#define CONFIG_BOOTDELAY 3 - -/* - * BOOTP options - */ -#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME - -/* No NOR flash */ -#define CONFIG_SYS_NO_FLASH - -/* - * Command line configuration. - */ -#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_SETEXPR - /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -181,34 +140,8 @@ #define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 sama5d4ek.dtb; " \ "fatload mmc 0:1 0x22000000 zImage; " \ "bootz 0x22000000 - 0x21000000" -#endif - -#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "root=/dev/mmcblk0p2 rw rootwait" #else -#define CONFIG_BOOTARGS \ - "console=ttyS0,115200 earlyprintk " \ - "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \ - "256K(env),256k(evn_redundent),256k(spare)," \ - "512k(dtb),6M(kernel)ro,-(rootfs) " \ - "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" +#define CONFIG_ENV_IS_NOWHERE #endif
-#define CONFIG_BAUDRATE 115200 - -#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \ - sizeof(CONFIG_SYS_PROMPT) + 16) -#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER - -/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024) - #endif

Hi Josh,
sorry for beeing late. I'd like to apply this one but it does not cleanly. Could you please rebase on current master?
Andreas
On 19.11.14 12:03, Josh Wu wrote:
Create a new configuration file: at91-sama5_common.h. Which include the configurations that reused by all SAMA5 chips.
In the command header, we add the CMD_SETEXPR.
NOTE: NOR flash definition should be put before including the common header.
Signed-off-by: Josh Wu josh.wu@atmel.com
include/configs/at91-sama5_common.h | 87 +++++++++++++++++++++++++++++++++++++ include/configs/sama5d3_xplained.h | 77 ++------------------------------ include/configs/sama5d3xek.h | 83 +++-------------------------------- include/configs/sama5d4_xplained.h | 74 ++----------------------------- include/configs/sama5d4ek.h | 75 ++------------------------------ 5 files changed, 103 insertions(+), 293 deletions(-) create mode 100644 include/configs/at91-sama5_common.h
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h new file mode 100644 index 0000000..4fab41d --- /dev/null +++ b/include/configs/at91-sama5_common.h @@ -0,0 +1,87 @@ +/*
- Common part of configuration settings for the SAMA5 board.
- Copyright (C) 2014 Atmel Corporation
Josh Wu <josh.wu@atmel.com>
- SPDX-License-Identifier: GPL-2.0+
- */
+#ifndef __CONFIG_AT91_SAMA5_H +#define __CONFIG_AT91_SAMA5_H
+#include <asm/hardware.h>
+#define CONFIG_SYS_TEXT_BASE 0x26f00000
+/* ARM asynchronous clock */ +#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 +#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */
+#define CONFIG_ARCH_CPU_INIT
+#ifndef CONFIG_SPL_BUILD +#define CONFIG_SKIP_LOWLEVEL_INIT +#endif
+#define CONFIG_BOARD_EARLY_INIT_F +#define CONFIG_DISPLAY_CPUINFO
+#define CONFIG_CMD_BOOTZ +#define CONFIG_OF_LIBFDT /* Device Tree support */
+#define CONFIG_SYS_GENERIC_BOARD
+/* general purpose I/O */ +#define CONFIG_AT91_GPIO
+#define CONFIG_BOOTDELAY 3
+/*
- BOOTP options
- */
+#define CONFIG_BOOTP_BOOTFILESIZE +#define CONFIG_BOOTP_BOOTPATH +#define CONFIG_BOOTP_GATEWAY +#define CONFIG_BOOTP_HOSTNAME
+/*
- Command line configuration.
- */
+#include <config_cmd_default.h> +#undef CONFIG_CMD_FPGA +#undef CONFIG_CMD_IMI +#undef CONFIG_CMD_LOADS +#define CONFIG_CMD_PING +#define CONFIG_CMD_DHCP +#define CONFIG_CMD_SETEXPR
+#ifdef CONFIG_SYS_USE_MMC +#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "root=/dev/mmcblk0p2 rw rootwait"
+#else +#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \
- "256K(env),256k(evn_redundent),256k(spare)," \
- "512k(dtb),6M(kernel)ro,-(rootfs) " \
- "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
+#endif
+#define CONFIG_BAUDRATE 115200
+#define CONFIG_SYS_PROMPT "U-Boot> " +#define CONFIG_SYS_CBSIZE 256 +#define CONFIG_SYS_MAXARGS 16 +#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
+#define CONFIG_SYS_LONGHELP +#define CONFIG_CMDLINE_EDITING +#define CONFIG_AUTO_COMPLETE +#define CONFIG_SYS_HUSH_PARSER
+/* Size of malloc() pool */ +#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
+#endif \ No newline at end of file diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index d24d600..75c3be6 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -10,30 +10,10 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h>
-#define CONFIG_SYS_TEXT_BASE 0x26f00000
-/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */
-#define CONFIG_ARCH_CPU_INIT
-#ifndef CONFIG_SPL_BUILD -#define CONFIG_SKIP_LOWLEVEL_INIT -#endif
-#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */
-#define CONFIG_SYS_GENERIC_BOARD +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART @@ -51,29 +31,6 @@ */ #define ATMEL_PMC_UHP AT91SAM926x_PMC_UHP
-#define CONFIG_BOOTDELAY 3
-/*
- BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME
-/* No NOR flash */ -#define CONFIG_SYS_NO_FLASH
-/*
- Command line configuration.
- */
-#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP
/* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -180,34 +137,6 @@ #define CONFIG_ENV_IS_NOWHERE #endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "root=/dev/mmcblk0p2 rw rootwait"
-#else -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \
- "256K(env),256k(evn_redundent),256k(spare)," \
- "512k(dtb),6M(kernel)ro,-(rootfs) " \
- "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
-#endif
-#define CONFIG_BAUDRATE 115200
-#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER
-/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
/* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index dfbf3cb..ee0fddb 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -13,30 +13,11 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h>
-#define CONFIG_SYS_TEXT_BASE 0x26f00000
-/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */
-#define CONFIG_ARCH_CPU_INIT
-#ifndef CONFIG_SPL_BUILD -#define CONFIG_SKIP_LOWLEVEL_INIT -#endif
-#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */
-#define CONFIG_SYS_GENERIC_BOARD
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +/*
- If has No NOR flash, please put the definition: CONFIG_SYS_NO_FLASH
- before the common header.
- */
+#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART @@ -69,40 +50,16 @@ /* board specific (not enough SRAM) */ #define CONFIG_SAMA5D3_LCD_BASE 0x23E00000
-#define CONFIG_BOOTDELAY 3
-/*
- BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME
/* NOR flash */ -#define CONFIG_CMD_FLASH
-#ifdef CONFIG_CMD_FLASH +#ifndef CONFIG_SYS_NO_FLASH #define CONFIG_FLASH_CFI_DRIVER #define CONFIG_SYS_FLASH_CFI #define CONFIG_SYS_FLASH_PROTECTION #define CONFIG_SYS_FLASH_BASE 0x10000000 #define CONFIG_SYS_MAX_FLASH_SECT 131 #define CONFIG_SYS_MAX_FLASH_BANKS 1 -#else -#define CONFIG_SYS_NO_FLASH #endif
-/*
- Command line configuration.
- */
-#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP
/* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -226,34 +183,6 @@ #define CONFIG_ENV_IS_NOWHERE #endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "root=/dev/mmcblk0p2 rw rootwait"
-#else -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \
- "256K(env),256k(evn_redundent),256k(spare)," \
- "512k(dtb),6M(kernel)ro,-(rootfs) " \
- "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
-#endif
-#define CONFIG_BAUDRATE 115200
-#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER
-/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (1024 * 1024)
/* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index 104edef..26af695 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -10,57 +10,16 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h>
-#define CONFIG_SYS_TEXT_BASE 0x26f00000
-/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */
-#define CONFIG_ARCH_CPU_INIT
-#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */
-#define CONFIG_SYS_GENERIC_BOARD +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_USART3 #define CONFIG_USART_ID ATMEL_ID_USART3
-#define CONFIG_BOOTDELAY 3
-/*
- BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME
-/* No NOR flash */ -#define CONFIG_SYS_NO_FLASH
-/*
- Command line configuration.
- */
-#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_SETEXPR
/* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -185,32 +144,5 @@ "bootz 0x22000000 - 0x21000000" #endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "root=/dev/mmcblk0p2 rw rootwait"
-#else -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \
- "256K(env),256k(evn_redundent),256k(spare)," \
- "512k(dtb),6M(kernel)ro,-(rootfs) " \
- "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
-#endif
-#define CONFIG_BAUDRATE 115200
-#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER
-/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
#endif diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index cbdb3a2..15a92af 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -10,57 +10,16 @@ #ifndef __CONFIG_H #define __CONFIG_H
-#include <asm/hardware.h>
-#define CONFIG_SYS_TEXT_BASE 0x26f00000
-/* ARM asynchronous clock */ -#define CONFIG_SYS_AT91_SLOW_CLOCK 32768 -#define CONFIG_SYS_AT91_MAIN_CLOCK 12000000 /* from 12 MHz crystal */
-#define CONFIG_ARCH_CPU_INIT
-#define CONFIG_SKIP_LOWLEVEL_INIT -#define CONFIG_BOARD_EARLY_INIT_F -#define CONFIG_DISPLAY_CPUINFO
-#define CONFIG_CMD_BOOTZ -#define CONFIG_OF_LIBFDT /* Device Tree support */
-#define CONFIG_SYS_GENERIC_BOARD +/* No NOR flash, this definition should put before common header */ +#define CONFIG_SYS_NO_FLASH
-/* general purpose I/O */ -#define CONFIG_AT91_GPIO +#include "at91-sama5_common.h"
/* serial console */ #define CONFIG_ATMEL_USART #define CONFIG_USART_BASE ATMEL_BASE_USART3 #define CONFIG_USART_ID ATMEL_ID_USART3
-#define CONFIG_BOOTDELAY 3
-/*
- BOOTP options
- */
-#define CONFIG_BOOTP_BOOTFILESIZE -#define CONFIG_BOOTP_BOOTPATH -#define CONFIG_BOOTP_GATEWAY -#define CONFIG_BOOTP_HOSTNAME
-/* No NOR flash */ -#define CONFIG_SYS_NO_FLASH
-/*
- Command line configuration.
- */
-#include <config_cmd_default.h> -#undef CONFIG_CMD_FPGA -#undef CONFIG_CMD_IMI -#undef CONFIG_CMD_LOADS -#define CONFIG_CMD_PING -#define CONFIG_CMD_DHCP -#define CONFIG_CMD_SETEXPR
/* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE ATMEL_BASE_DDRCS @@ -181,34 +140,8 @@ #define CONFIG_BOOTCOMMAND "fatload mmc 0:1 0x21000000 sama5d4ek.dtb; " \ "fatload mmc 0:1 0x22000000 zImage; " \ "bootz 0x22000000 - 0x21000000" -#endif
-#ifdef CONFIG_SYS_USE_MMC -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "root=/dev/mmcblk0p2 rw rootwait"
#else -#define CONFIG_BOOTARGS \
- "console=ttyS0,115200 earlyprintk " \
- "mtdparts=atmel_nand:256k(bootstrap)ro,512k(uboot)ro," \
- "256K(env),256k(evn_redundent),256k(spare)," \
- "512k(dtb),6M(kernel)ro,-(rootfs) " \
- "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs"
+#define CONFIG_ENV_IS_NOWHERE #endif
-#define CONFIG_BAUDRATE 115200
-#define CONFIG_SYS_PROMPT "U-Boot> " -#define CONFIG_SYS_CBSIZE 256 -#define CONFIG_SYS_MAXARGS 16 -#define CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE + \
sizeof(CONFIG_SYS_PROMPT) + 16)
-#define CONFIG_SYS_LONGHELP -#define CONFIG_CMDLINE_EDITING -#define CONFIG_AUTO_COMPLETE -#define CONFIG_SYS_HUSH_PARSER
-/* Size of malloc() pool */ -#define CONFIG_SYS_MALLOC_LEN (4 * 1024 * 1024)
#endif

Hi, Andreas
On 3/30/2015 4:52 AM, Andreas Bießmann wrote:
Hi Josh,
sorry for beeing late. I'd like to apply this one but it does not cleanly. Could you please rebase on current master?
Thanks for the remind, I just sent out the v2 of the patch. now it's rebased and also add missed CONFIG_CMD_FLASH vs previous version.
Andreas
Best Regards, Josh Wu

We set ENV_FAT_DEVICE_AND_PART to "0". That specify the device number and not specify the partition number. So when 1. no partition table: take device 0 as a FAT file system. 2. has parttion table: use device 0 partition 1.
For more details, please refer to the commit: 10a37fd7a4
Signed-off-by: Josh Wu josh.wu@atmel.com --- include/configs/sama5d3_xplained.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index 75c3be6..f9e9010 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -126,13 +126,15 @@ "bootz 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_MMC /* bootstrap + u-boot + env in sd card */ -#define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET 0x2000 -#define CONFIG_ENV_SIZE 0x1000 +#define CONFIG_ENV_IS_IN_FAT +#define CONFIG_FAT_WRITE +#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" -#define CONFIG_SYS_MMC_ENV_DEV 0 #else #define CONFIG_ENV_IS_NOWHERE #endif

Signed-off-by: Josh Wu josh.wu@atmel.com --- include/configs/sama5d3xek.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index ee0fddb..39aa75b 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -172,13 +172,15 @@ "bootm 0x22000000 - 0x21000000" #elif CONFIG_SYS_USE_MMC /* bootstrap + u-boot + env in sd card */ -#define CONFIG_ENV_IS_IN_MMC -#define CONFIG_ENV_OFFSET 0x2000 -#define CONFIG_ENV_SIZE 0x1000 +#define CONFIG_ENV_IS_IN_FAT +#define CONFIG_FAT_WRITE +#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" -#define CONFIG_SYS_MMC_ENV_DEV 0 #else #define CONFIG_ENV_IS_NOWHERE #endif

All the SAMA5 chips has almost same bootcmd except SAMA5D3X-EK board. SAMA5D3X-EK has old serial flash boot command. So just updated to following same boot command as SAMA5D4EK.
Another point is the mmc bootcmd's dtb name. Which should changed according to boards. In this patch I just use "dtb" for the name. In future it should be add variable for the dtb name.
Signed-off-by: Josh Wu josh.wu@atmel.com --- include/configs/at91-sama5_common.h | 39 +++++++++++++++++++++++++++++++++ include/configs/sama5d3_xplained.h | 24 --------------------- include/configs/sama5d3xek.h | 33 ---------------------------- include/configs/sama5d4_xplained.h | 42 ++---------------------------------- include/configs/sama5d4ek.h | 43 ++----------------------------------- 5 files changed, 43 insertions(+), 138 deletions(-)
diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h index 4fab41d..c08bff9 100644 --- a/include/configs/at91-sama5_common.h +++ b/include/configs/at91-sama5_common.h @@ -69,6 +69,45 @@ "rootfstype=ubifs ubi.mtd=7 root=ubi0:rootfs" #endif
+#ifdef CONFIG_SYS_USE_SERIALFLASH +/* bootstrap + u-boot + env + linux in serial flash */ +#define CONFIG_ENV_IS_IN_SPI_FLASH +#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" +#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" +#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 dtb; " \ + "fatload mmc 0:1 0x22000000 zImage; " \ + "bootz 0x22000000 - 0x21000000" +#else +#define CONFIG_ENV_IS_NOWHERE +#endif + #define CONFIG_BAUDRATE 115200
#define CONFIG_SYS_PROMPT "U-Boot> " diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h index f9e9010..0dd40c9 100644 --- a/include/configs/sama5d3_xplained.h +++ b/include/configs/sama5d3_xplained.h @@ -115,30 +115,6 @@
#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" -#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" -#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" -#else -#define CONFIG_ENV_IS_NOWHERE -#endif - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h index 39aa75b..13ff18f 100644 --- a/include/configs/sama5d3xek.h +++ b/include/configs/sama5d3xek.h @@ -152,39 +152,6 @@
#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" -#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" -#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" -#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" -#else -#define CONFIG_ENV_IS_NOWHERE -#endif - /* SPL */ #define CONFIG_SPL_FRAMEWORK #define CONFIG_SPL_TEXT_BASE 0x300000 diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h index 26af695..163d777 100644 --- a/include/configs/sama5d4_xplained.h +++ b/include/configs/sama5d4_xplained.h @@ -41,6 +41,8 @@ #define CONFIG_SF_DEFAULT_BUS 0 #define CONFIG_SF_DEFAULT_CS 0 #define CONFIG_SF_DEFAULT_SPEED 30000000 +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS #endif
/* NAND flash */ @@ -105,44 +107,4 @@ #define CONFIG_SYS_CONSOLE_IS_IN_ENV #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" -#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" -#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" -#endif - - #endif diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h index 15a92af..6236980 100644 --- a/include/configs/sama5d4ek.h +++ b/include/configs/sama5d4ek.h @@ -41,6 +41,8 @@ #define CONFIG_SF_DEFAULT_BUS 0 #define CONFIG_SF_DEFAULT_CS 0 #define CONFIG_SF_DEFAULT_SPEED 30000000 +#define CONFIG_ENV_SPI_BUS CONFIG_SF_DEFAULT_BUS +#define CONFIG_ENV_SPI_CS CONFIG_SF_DEFAULT_CS #endif
/* NAND flash */ @@ -103,45 +105,4 @@ #define CONFIG_ATMEL_LCD_RGB565 #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" -#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" -#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" -#else -#define CONFIG_ENV_IS_NOWHERE -#endif - #endif

This patch will save U-Boot environment as a file: uboot.env, in FAT partition instead of saving it in raw sector of SD card. Since saving environment in raw sector has risk of corrupting the SD card and only can use very small size. Save as a FAT file has no above limitation.
Signed-off-by: Josh Wu josh.wu@atmel.com --- include/configs/at91sam9x5ek.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h index b1d4baa..73a126b 100644 --- a/include/configs/at91sam9x5ek.h +++ b/include/configs/at91sam9x5ek.h @@ -203,11 +203,13 @@ "bootm 0x22000000" #else /* CONFIG_SYS_USE_MMC */ /* bootstrap + u-boot + env + linux in mmc */ -#define CONFIG_ENV_IS_IN_MMC -/* For FAT system, most cases it should be in the reserved sector */ -#define CONFIG_ENV_OFFSET 0x2000 -#define CONFIG_ENV_SIZE 0x1000 -#define CONFIG_SYS_MMC_ENV_DEV 0 +#define CONFIG_ENV_IS_IN_FAT +#define CONFIG_FAT_WRITE +#define FAT_ENV_INTERFACE "mmc" +#define FAT_ENV_FILE "uboot.env" +#define FAT_ENV_DEVICE 0 +#define FAT_ENV_PART 1 +#define CONFIG_ENV_SIZE 0x4000 #endif
#ifdef CONFIG_SYS_USE_MMC

Hi Josh,
On 11/19/2014 07:02 PM, Josh Wu wrote:
This patch series reorganized the configurations for SAMA5 chips. Make the common part into one file. That way we don't need to have many copy of the same configurations.
Thanks for this patch. However, the u-boot is switching to Kconfig, so in the following time, the configuration option will move to Kconfig. So I think now we keep it as is.
I think at this phase, we can move the configuration in header file to Kconfig, maybe this is a good choice.
Josh Wu (6): ARM: at91: sama5d3_xplained: spl: enable PMECC header generation ARM: at91: sama5: move the common part of configurations to at91-sama5_common.h ARM: at91: sama5d3_xplained: set ENV_FAT_DEVICE_AND_PART intead of using number ARM: at91: sama5d3: mmc: save enviroment as a fat file (uboot.env) ARM: at91: sama5: move the bootcmd definition to the common header ARM: at91: at91sam9x5: mmc: save environment as a file in FAT partition.
include/configs/at91-sama5_common.h | 126 ++++++++++++++++++++++++++++++++++++ include/configs/at91sam9x5ek.h | 12 ++-- include/configs/sama5d3_xplained.h | 100 ++-------------------------- include/configs/sama5d3xek.h | 114 ++------------------------------ include/configs/sama5d4_xplained.h | 116 ++------------------------------- include/configs/sama5d4ek.h | 116 ++------------------------------- 6 files changed, 153 insertions(+), 431 deletions(-) create mode 100644 include/configs/at91-sama5_common.h
Best Regards, Bo Shen

Hi, Bo
On 11/20/2014 9:12 AM, Bo Shen wrote:
Hi Josh,
On 11/19/2014 07:02 PM, Josh Wu wrote:
This patch series reorganized the configurations for SAMA5 chips. Make the common part into one file. That way we don't need to have many copy of the same configurations.
Thanks for this patch. However, the u-boot is switching to Kconfig, so in the following time, the configuration option will move to Kconfig. So I think now we keep it as is.
yes, I understand we'll switch to Kconfig. But the better way is switch to Kconfig step by step. So I think it is a good start to extract the common part of the configuration to one file. Next step, we can move the common part of configuration to the Kconfig. And other different configuration to the _defconfig.
I think at this phase, we can move the configuration in header file to Kconfig, maybe this is a good choice.
Like I said in above, I prefer to do this step by step. So what do you think?
Best Regards, Josh Wu
Josh Wu (6): ARM: at91: sama5d3_xplained: spl: enable PMECC header generation ARM: at91: sama5: move the common part of configurations to at91-sama5_common.h ARM: at91: sama5d3_xplained: set ENV_FAT_DEVICE_AND_PART intead of using number ARM: at91: sama5d3: mmc: save enviroment as a fat file (uboot.env) ARM: at91: sama5: move the bootcmd definition to the common header ARM: at91: at91sam9x5: mmc: save environment as a file in FAT partition.
include/configs/at91-sama5_common.h | 126 ++++++++++++++++++++++++++++++++++++ include/configs/at91sam9x5ek.h | 12 ++-- include/configs/sama5d3_xplained.h | 100 ++-------------------------- include/configs/sama5d3xek.h | 114 ++------------------------------ include/configs/sama5d4_xplained.h | 116 ++------------------------------- include/configs/sama5d4ek.h | 116 ++------------------------------- 6 files changed, 153 insertions(+), 431 deletions(-) create mode 100644 include/configs/at91-sama5_common.h
Best Regards, Bo Shen

Hello Josh,
On 11/20/2014 11:22 AM, Josh Wu wrote:
Hi, Bo
On 11/20/2014 9:12 AM, Bo Shen wrote:
Hi Josh,
On 11/19/2014 07:02 PM, Josh Wu wrote:
This patch series reorganized the configurations for SAMA5 chips. Make the common part into one file. That way we don't need to have many copy of the same configurations.
Thanks for this patch. However, the u-boot is switching to Kconfig, so in the following time, the configuration option will move to Kconfig. So I think now we keep it as is.
yes, I understand we'll switch to Kconfig. But the better way is switch to Kconfig step by step.
Yes, do it step by step.
So I think it is a good start to extract the common part of the configuration to one file. Next step, we can move the common part of configuration to the Kconfig. And other different configuration to the _defconfig.
I think won't create new files, just do minus operation till 0. This will be easy to track. So, really need new files.
I think at this phase, we can move the configuration in header file to Kconfig, maybe this is a good choice.
Like I said in above, I prefer to do this step by step. So what do you think?
Best Regards, Josh Wu
Best Regards, Bo Shen
participants (3)
-
Andreas Bießmann
-
Bo Shen
-
Josh Wu