Skip to contentSkip to conversation

ARM: at91: SAMA5: extract the common sama5 chip configurations to a common header

PATCH New Josh Wu 3 participants 14 messages Nov 19, 2014 – Mar 30, 2015 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore

Josh Wu

author
#0 lore raw

cover 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
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 1/6 ARM: at91: sama5d3_xplained: spl: enable PMECC header generation

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.

---
 include/configs/sama5d3_xplained.h | 1 +
 1 file changed, 1 insertion(+)
include/configs/sama5d3_xplained.h +1 -0
index 5b77db2..d24d600 100644
@@ -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
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/6 ARM: at91: sama5d3_xplained: spl: enable PMECC header generation

Hi Josh,

Quoted 5 lines · Josh Wu

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.

Thanks.

Quoted 9 lines
---
  include/configs/sama5d3_xplained.h | 1 +
  1 file changed, 1 insertion(+)
include/configs/sama5d3_xplained.h +0 -0
index 5b77db2..d24d600 100644

include/configs/sama5d3_xplained.h line 251

Quoted 6 lines
include/configs/sama5d3_xplained.h +1 -0
@@ -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

#3 lore raw

PATCH 1/6 ARM: at91: sama5d3_xplained: spl: enable PMECC header generation

In reply to Josh Wu

Dear Josh Wu,

Quoted 9 lines · Josh Wu

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.

---
include/configs/sama5d3_xplained.h | 1 +

1 file changed, 1 insertion(+)

applied to u-boot-atmel/master, thanks!

Best regards,
Andreas Bie?mann

author
#4 lore raw

PATCH 2/6 ARM: at91: sama5: move the common part of configurations to at91-sama5_common.h

In reply to Josh Wu

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.

---
 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
include/configs/at91-sama5_common.h new file +87 -0
new file mode 100644
index 0000000..4fab41d
@@ -0,0 +1,87 @@
+/*
+ * Common part of configuration settings for the SAMA5 board.
+ *
+ * Copyright (C) 2014 Atmel Corporation
+ *		      Josh Wu <[email protected]>
+ *
+ * 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
include/configs/sama5d3_xplained.h +3 -74

96 lines not on this page · raw message

include/configs/sama5d3xek.h +6 -77

110 lines not on this page · raw message

include/configs/sama5d4_xplained.h +3 -71

92 lines not on this page · raw message

include/configs/sama5d4ek.h +4 -71

95 lines not on this page · raw message

Signature · 1 line
1.9.1
#5 lore raw

PATCH 2/6 ARM: at91: sama5: move the common part of configurations to at91-sama5_common.h

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

Quoted 531 lines · Josh Wu

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.

---
 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
include/configs/at91-sama5_common.h new file +87 -0
new file mode 100644
index 0000000..4fab41d
@@ -0,0 +1,87 @@
+/*
+ * Common part of configuration settings for the SAMA5 board.
+ *
+ * Copyright (C) 2014 Atmel Corporation
+ *		      Josh Wu <[email protected]>
+ *
+ * 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
include/configs/sama5d3_xplained.h +3 -74
index d24d600..75c3be6 100644
@@ -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
include/configs/sama5d3xek.h +6 -77
index dfbf3cb..ee0fddb 100644
@@ -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
include/configs/sama5d4_xplained.h +3 -71
index 104edef..26af695 100644
@@ -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
include/configs/sama5d4ek.h +4 -71
index cbdb3a2..15a92af 100644
@@ -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
author
#6 lore raw

PATCH 2/6 ARM: at91: sama5: move the common part of configurations to at91-sama5_common.h

Hi, Andreas

Quoted 4 lines · Andreas Bie?mann

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.

Quoted 2 lines

Andreas

Best Regards,
Josh Wu

author
#7 lore raw

PATCH 3/6 ARM: at91: sama5d3_xplained: set ENV_FAT_DEVICE_AND_PART intead of using number

In reply to 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

---
 include/configs/sama5d3_xplained.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
include/configs/sama5d3_xplained.h +6 -4
index 75c3be6..f9e9010 100644
@@ -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
Signature · 1 line
1.9.1
author
#8 lore raw

PATCH 4/6 ARM: at91: sama5d3: mmc: save enviroment as a fat file (uboot.env)

In reply to Josh Wu
---
 include/configs/sama5d3xek.h | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
include/configs/sama5d3xek.h +6 -4
index ee0fddb..39aa75b 100644
@@ -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
Signature · 1 line
1.9.1
author
#9 lore raw

PATCH 5/6 ARM: at91: sama5: move the bootcmd definition to the common header

In reply to Josh Wu

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.

---
 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(-)
include/configs/at91-sama5_common.h +39 -0
index 4fab41d..c08bff9 100644
@@ -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> "
include/configs/sama5d3_xplained.h +0 -24
index f9e9010..0dd40c9 100644
@@ -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
include/configs/sama5d3xek.h +0 -33
index 39aa75b..13ff18f 100644
@@ -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
include/configs/sama5d4_xplained.h +2 -40

52 lines not on this page · raw message

include/configs/sama5d4ek.h +2 -41

53 lines not on this page · raw message

Signature · 1 line
1.9.1
author
#10 lore raw

PATCH 6/6 ARM: at91: at91sam9x5: mmc: save environment as a file in FAT partition.

In reply to Josh Wu

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.

---
 include/configs/at91sam9x5ek.h | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
include/configs/at91sam9x5ek.h +7 -5
index b1d4baa..73a126b 100644
@@ -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
Signature · 1 line
1.9.1
#11 lore raw

cover ARM: at91: SAMA5: extract the common sama5 chip configurations to a common header

In reply to Josh Wu

Hi Josh,

Quoted 3 lines · Josh Wu

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.

Quoted 11 lines

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.

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

author
#12 lore raw

cover ARM: at91: SAMA5: extract the common sama5 chip configurations to a common header

Hi, Bo

Quoted 12 lines · Bo Shen

Hi Josh,

Quoted 3 lines · Josh Wu

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.

Quoted 2 lines

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

Quoted 28 lines
Quoted 23 lines

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(-)
Quoted 2 lines

create mode 100644 include/configs/at91-sama5_common.h

Best Regards,
Bo Shen

#13 lore raw

cover ARM: at91: SAMA5: extract the common sama5 chip configurations to a common header

Hello Josh,

Quoted 10 lines · Josh Wu

Hi, Bo

Quoted 7 lines · Bo Shen

Hi Josh,

Quoted 3 lines · Josh Wu

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.

Quoted 7 lines
Quoted 5 lines

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.

Quoted 4 lines

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.

Quoted 7 lines
Quoted 2 lines

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