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

Andreas Bießmann andreas.devel at googlemail.com
Wed Aug 19 09:40:57 CEST 2015


Hi Josh,

On 07/07/2015 01:08 PM, Josh Wu wrote:
> As almost all sama5 sd/mmc env configurations are same, so move them to
> at91-sama5_common.h.
> 
> Also we define a KERNEL_DTB_FILE_NAME as dtb file name for different
> board.

I don't like this new variable. At least we need some documentation in
README or even better Kconfig for it!
But I think we do not need it, let's see ...

> 
> Signed-off-by: Josh Wu <josh.wu at atmel.com>
> ---
> Hi, 
> 
> Those patches depends on the patch: http://patchwork.ozlabs.org/patch/485339/
> 
> Best Regards,
> Josh Wu
> 
>  include/configs/at91-sama5_common.h | 17 +++++++++++++++++
>  include/configs/sama5d3_xplained.h  | 12 +++---------
>  include/configs/sama5d3xek.h        | 10 +---------
>  include/configs/sama5d4_xplained.h  | 20 +++-----------------
>  include/configs/sama5d4ek.h         | 18 +++---------------
>  5 files changed, 27 insertions(+), 50 deletions(-)
> 
> diff --git a/include/configs/at91-sama5_common.h b/include/configs/at91-sama5_common.h
> index 9289964..99fa0b1 100644
> --- a/include/configs/at91-sama5_common.h
> +++ b/include/configs/at91-sama5_common.h
> @@ -56,6 +56,23 @@
>  #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
> +
> +#ifdef KERNEL_DTB_FILE_NAME
> +#define CONFIG_BOOT_DTB_COMMAND	"fatload mmc 0:1 0x21000000 " KERNEL_DTB_FILE_NAME  "; "
> +#else
> +#define CONFIG_BOOT_DTB_COMMAND	"fatload mmc 0:1 0x21000000 ${ek_name}.dtb; "
> +#endif
> +
> +#define CONFIG_BOOTCOMMAND	CONFIG_BOOT_DTB_COMMAND			\
> +				"fatload mmc 0:1 0x22000000 zImage; "	\
> +				"bootz 0x22000000 - 0x21000000"
>  #define CONFIG_BOOTARGS							\
>  	"console=ttyS0,115200 earlyprintk "				\
>  	"root=/dev/mmcblk0p2 rw rootwait"
> diff --git a/include/configs/sama5d3_xplained.h b/include/configs/sama5d3_xplained.h
> index c4141a0..e5de24b 100644
> --- a/include/configs/sama5d3_xplained.h
> +++ b/include/configs/sama5d3_xplained.h
> @@ -13,6 +13,8 @@
>  /* No NOR flash, this definition should put before common header */
>  #define CONFIG_SYS_NO_FLASH
>  
> +#define KERNEL_DTB_FILE_NAME	"at91-sama5d3_xplained.dtb"

This is "at91-" + $CONFIG_SYS_BOARD + ".dtb"

> +
>  #include "at91-sama5_common.h"
>  
>  /* serial console */
> @@ -124,15 +126,7 @@
>  				"nand read 0x22000000 0x200000 0x600000;" \
>  				"bootz 0x22000000 - 0x21000000"
>  #elif CONFIG_SYS_USE_MMC
> -/* bootstrap + u-boot + env in sd card */
> -#define CONFIG_ENV_IS_IN_FAT
> -#define FAT_ENV_INTERFACE	"mmc"
> -#define FAT_ENV_FILE		"uboot.env"
> -#define FAT_ENV_DEVICE_AND_PART	"0"
> -#define CONFIG_ENV_SIZE		0x4000
> -#define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d3_xplained.dtb; " \
> -				"fatload mmc 0:1 0x22000000 zImage; " \
> -				"bootz 0x22000000 - 0x21000000"
> +/* override the bootcmd, bootargs and other configuration for sd/mmc env */
>  #else
>  #define CONFIG_ENV_IS_NOWHERE
>  #endif
> diff --git a/include/configs/sama5d3xek.h b/include/configs/sama5d3xek.h
> index 344ae9c..71441a4 100644
> --- a/include/configs/sama5d3xek.h
> +++ b/include/configs/sama5d3xek.h
> @@ -176,15 +176,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 ${ek_name}.dtb; " \
> -				"fatload mmc 0:1 0x22000000 zImage; " \
> -				"bootm 0x22000000 - 0x21000000"
> +/* override the bootcmd, bootargs and other configuration for sd/mmc env */
>  #else
>  #define CONFIG_ENV_IS_NOWHERE
>  #endif
> diff --git a/include/configs/sama5d4_xplained.h b/include/configs/sama5d4_xplained.h
> index 5fb621e..a7d9e78 100644
> --- a/include/configs/sama5d4_xplained.h
> +++ b/include/configs/sama5d4_xplained.h
> @@ -13,6 +13,8 @@
>  /* No NOR flash, this definition should put before common header */
>  #define CONFIG_SYS_NO_FLASH
>  
> +#define KERNEL_DTB_FILE_NAME		"at91-sama5d4_xplained.dtb"

This is also "at91-" + $CONFIG_SYS_BOARD + ".dtb"

> +
>  #include "at91-sama5_common.h"
>  
>  /* serial console */
> @@ -139,25 +141,9 @@
>  				"nand read 0x22000000 0x200000 0x600000;" \
>  				"bootz 0x22000000 - 0x21000000"
>  #elif CONFIG_SYS_USE_MMC
> -/* bootstrap + u-boot + env in sd card */
> -#define CONFIG_ENV_IS_IN_FAT
> -#define CONFIG_FAT_WRITE
> -#define FAT_ENV_INTERFACE	"mmc"
> -/*
> - * We don't specify the part number, if device 0 has partition table, it means
> - * the first partition; it no partition table, then take whole device as a
> - * FAT file system.
> - */
> -#define FAT_ENV_DEVICE_AND_PART	"0"
> -#define FAT_ENV_FILE		"uboot.env"
> -#define CONFIG_ENV_SIZE		0x4000
> -#define CONFIG_BOOTCOMMAND	"fatload mmc 0:1 0x21000000 at91-sama5d4_xplained.dtb; " \
> -				"fatload mmc 0:1 0x22000000 zImage; " \
> -				"bootz 0x22000000 - 0x21000000"
> +/* override the bootcmd, bootargs and other configuration for sd/mmc env */
>  #endif
>  
> -
> -
>  /* SPL */
>  #define CONFIG_SPL_FRAMEWORK
>  #define CONFIG_SPL_TEXT_BASE		0x200000
> diff --git a/include/configs/sama5d4ek.h b/include/configs/sama5d4ek.h
> index 546d7a3..8ecb6d3 100644
> --- a/include/configs/sama5d4ek.h
> +++ b/include/configs/sama5d4ek.h
> @@ -13,6 +13,8 @@
>  /* No NOR flash, this definition should put before common header */
>  #define CONFIG_SYS_NO_FLASH
>  
> +#define KERNEL_DTB_FILE_NAME	"sama5d4ek.dtb"

Damn ... this lacks the presiding 'at91-'

So a solution could be to rename some board's with presiding 'at91-' and
just use the $board_name everywhere. Some board's may adopt the
$board_name at runtime.
What do you think about?

Andreas

> +
>  #include "at91-sama5_common.h"
>  
>  /* serial console */
> @@ -137,21 +139,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 */
> 



More information about the U-Boot mailing list