Patchwork [U-Boot] spl:falcon:trats Update Trats default board configuration file to support FALCON MODE

login
register
mail settings
Submitter Łukasz Majewski
Date Dec. 6, 2012, 3:22 p.m.
Message ID <1354807369-9029-1-git-send-email-l.majewski@samsung.com>
Download mbox | patch
Permalink /patch/204280/
State Changes Requested
Delegated to: Minkyu Kang
Headers show

Comments

Łukasz Majewski - Dec. 6, 2012, 3:22 p.m.
Support for a new command (defined at envs) - spl_export generates
the ATAGS image necessary for fast boot. Afterwards, it is stored
at ext4 partition.

Generated image format:
CRC [4B] SIZE [4B] PAYLOAD(ATAGS/DT) [SIZE]

Remarks:
- CRC is calculated only for PAYLOAD
- SIZE is the size of PAYLOAD

It is important to adjust ${splsize} when large image is generated.
It is defined as hex, since ext4 related commands expect it.

The ${spladdr} environment variable corresponds to
CONFIG_SYS_SPL_ARGS_ADDR

Additionally definitions for DFU have been refactored and support for
EFI has been added as well.

Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Cc: Minkyu Kang <mk7.kang@samsung.com>
---
 board/samsung/trats/trats.c |    2 +-
 include/configs/trats.h     |   45 +++++++++++++++++++++++++++++++++---------
 2 files changed, 36 insertions(+), 11 deletions(-)
Łukasz Majewski - Jan. 2, 2013, 9:40 a.m.
Hi Minkyu,

> Support for a new command (defined at envs) - spl_export generates
> the ATAGS image necessary for fast boot. Afterwards, it is stored
> at ext4 partition.
> 
> Generated image format:
> CRC [4B] SIZE [4B] PAYLOAD(ATAGS/DT) [SIZE]
> 
> Remarks:
> - CRC is calculated only for PAYLOAD
> - SIZE is the size of PAYLOAD
> 
> It is important to adjust ${splsize} when large image is generated.
> It is defined as hex, since ext4 related commands expect it.
> 
> The ${spladdr} environment variable corresponds to
> CONFIG_SYS_SPL_ARGS_ADDR
> 
> Additionally definitions for DFU have been refactored and support for
> EFI has been added as well.
> 

Could this patch be added to u-boot-samsung tree? It brings many
updates for trats configuration and it would be nice to bring it to
2013.01 u-boot release.

> Signed-off-by: Lukasz Majewski <l.majewski@samsung.com>
> Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
> Cc: Minkyu Kang <mk7.kang@samsung.com>
> ---
>  board/samsung/trats/trats.c |    2 +-
>  include/configs/trats.h     |   45
> +++++++++++++++++++++++++++++++++--------- 2 files changed, 36
> insertions(+), 11 deletions(-)
> 
> diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
> index e540190..4738043 100644
> --- a/board/samsung/trats/trats.c
> +++ b/board/samsung/trats/trats.c
> @@ -66,7 +66,7 @@ struct s3c_plat_otg_data s5pc210_otg_data;
>  
>  int board_init(void)
>  {
> -	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
> +	gd->bd->bi_boot_params = CONFIG_SYS_SPL_ARGS_ADDR;
>  
>  	check_hw_revision();
>  	printf("HW Revision:\t0x%x\n", board_rev);
> diff --git a/include/configs/trats.h b/include/configs/trats.h
> index 355029e..52fe77d 100644
> --- a/include/configs/trats.h
> +++ b/include/configs/trats.h
> @@ -98,6 +98,7 @@
>  #undef CONFIG_CMD_MTDPARTS
>  #define CONFIG_CMD_MMC
>  #define CONFIG_CMD_DFU
> +#define CONFIG_CMD_SETEXPR
>  
>  /* FAT */
>  #define CONFIG_CMD_FAT
> @@ -123,9 +124,8 @@
>  #define CONFIG_ENV_COMMON_BOOT		"${console} ${meminfo}"
>  
>  #define CONFIG_DFU_ALT \
> -	"dfu_alt_info=" \
>  	"u-boot mmc 80 400;" \
> -	"uImage fat 0 2\0" \
> +	"uImage ext4 0 2\0" \
>  
>  #define CONFIG_ENV_OVERWRITE
>  #define CONFIG_SYS_CONSOLE_INFO_QUIET
> @@ -144,20 +144,20 @@
>  		"mmc read 0 0x42100000 0x80 0x200; run
> updatebackup\0" \ "lpj=lpj=3981312\0" \
>  	"nfsboot=" \
> -		"set bootargs root=/dev/nfs rw " \
> +		"setenv bootargs root=/dev/nfs rw " \
>  		"nfsroot=${nfsroot},nolock,tcp " \
>  		"ip=${ipaddr}:${serverip}:${gatewayip}:" \
>  		"${netmask}:generic:usb0:off "
> CONFIG_ENV_COMMON_BOOT \ "; run bootk\0" \
>  	"ramfsboot=" \
> -		"set bootargs root=/dev/ram0 rw rootfstype=ext2 " \
> +		"setenv bootargs root=/dev/ram0 rw rootfstype=ext2 "
> \ "${console} ${meminfo} " \
>  		"initrd=0x43000000,8M ramdisk=8192\0" \
>  	"mmcboot=" \
> -		"set bootargs
> root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
> +		"setenv bootargs
> root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \ "${lpj} rootwait
> ${console} ${meminfo} ${opts} ${lcdinfo}; " \ "run loaduimage; bootm
> 0x40007FC0\0" \
> -	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
> +	"bootchart=setenv opts init=/sbin/bootchartd; run bootcmd\0"
> \ "boottrace=setenv opts initcall_debug; run bootcmd\0" \
>  	"mmcoops=mmc read 0 0x40000000 0x40 8; md 0x40000000
> 0x400\0" \ "verify=n\0" \
> @@ -166,12 +166,30 @@
>  	"meminfo=crashkernel=32M@0x50000000\0" \
>  	"nfsroot=/nfsroot/arm\0" \
>  	"bootblock=" CONFIG_BOOTBLOCK "\0" \
> -	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x40007FC0
> uImage\0" \
> +	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0
> uImage\0" \ "mmcdev=0\0" \
>  	"mmcbootpart=2\0" \
> -	"mmcrootpart=3\0" \
> +	"mmcrootpart=5\0" \
>  	"opts=always_resume=1\0" \
> -	CONFIG_DFU_ALT
> +	"dfu_alt_info=" CONFIG_DFU_ALT \
> +	"spladdr=0x40000100\0" \
> +	"splsize=0x200\0" \
> +	"splfile=falcon.bin\0" \
> +	"spl_export=" \
> +		   "setexpr spl_imgsize ${splsize} + 8 ;" \
> +		   "setexpr spl_imgaddr ${spladdr} - 8 ;" \
> +		   "setexpr spl_addr_tmp ${spladdr} - 4 ;" \
> +		   "mw.b ${spl_imgaddr} 0x00 ${spl_imgsize};run
> loaduimage;" \
> +		   "setenv bootargs
> root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
> +		   "${lpj} rootwait ${console} ${meminfo} ${opts}
> ${lcdinfo};" \
> +		   "spl export atags 0x40007FC0;" \
> +		   "crc32 ${spladdr} ${splsize} ${spl_imgaddr};" \
> +		   "mw.l ${spl_addr_tmp} ${splsize};" \
> +		   "ext4write mmc ${mmcdev}:${mmcbootpart}" \
> +		   " /${splfile} ${spl_imgaddr} ${spl_imgsize};" \
> +		   "setenv spl_imgsize;" \
> +		   "setenv spl_imgaddr;" \
> +		   "setenv spl_addr_tmp;\0"
>  
>  /* Miscellaneous configurable options */
>  #define CONFIG_SYS_LONGHELP		/* undef to save memory */
> @@ -207,11 +225,18 @@
>  #define CONFIG_ENV_OFFSET		((32 - 4) << 10) /* 32KiB -
> 4KiB */ 
>  #define CONFIG_DOS_PARTITION
> +#define CONFIG_EFI_PARTITION
> +
> +/* EXT4 */
> +#define CONFIG_CMD_EXT4
> +#define CONFIG_CMD_EXT4_WRITE
> +/* Falcon mode definitions */
> +#define CONFIG_CMD_SPL
> +#define CONFIG_SYS_SPL_ARGS_ADDR        PHYS_SDRAM_1 + 0x100
>  
>  #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR -
> GENERATED_GBL_DATA_SIZE) #define CONFIG_SYS_CACHELINE_SIZE       32
>  
> -
>  #define CONFIG_SOFT_I2C
>  #define CONFIG_SOFT_I2C_READ_REPEATED_START
>  #define CONFIG_SYS_I2C_INIT_BOARD

Patch

diff --git a/board/samsung/trats/trats.c b/board/samsung/trats/trats.c
index e540190..4738043 100644
--- a/board/samsung/trats/trats.c
+++ b/board/samsung/trats/trats.c
@@ -66,7 +66,7 @@  struct s3c_plat_otg_data s5pc210_otg_data;
 
 int board_init(void)
 {
-	gd->bd->bi_boot_params = PHYS_SDRAM_1 + 0x100;
+	gd->bd->bi_boot_params = CONFIG_SYS_SPL_ARGS_ADDR;
 
 	check_hw_revision();
 	printf("HW Revision:\t0x%x\n", board_rev);
diff --git a/include/configs/trats.h b/include/configs/trats.h
index 355029e..52fe77d 100644
--- a/include/configs/trats.h
+++ b/include/configs/trats.h
@@ -98,6 +98,7 @@ 
 #undef CONFIG_CMD_MTDPARTS
 #define CONFIG_CMD_MMC
 #define CONFIG_CMD_DFU
+#define CONFIG_CMD_SETEXPR
 
 /* FAT */
 #define CONFIG_CMD_FAT
@@ -123,9 +124,8 @@ 
 #define CONFIG_ENV_COMMON_BOOT		"${console} ${meminfo}"
 
 #define CONFIG_DFU_ALT \
-	"dfu_alt_info=" \
 	"u-boot mmc 80 400;" \
-	"uImage fat 0 2\0" \
+	"uImage ext4 0 2\0" \
 
 #define CONFIG_ENV_OVERWRITE
 #define CONFIG_SYS_CONSOLE_INFO_QUIET
@@ -144,20 +144,20 @@ 
 		"mmc read 0 0x42100000 0x80 0x200; run updatebackup\0" \
 	"lpj=lpj=3981312\0" \
 	"nfsboot=" \
-		"set bootargs root=/dev/nfs rw " \
+		"setenv bootargs root=/dev/nfs rw " \
 		"nfsroot=${nfsroot},nolock,tcp " \
 		"ip=${ipaddr}:${serverip}:${gatewayip}:" \
 		"${netmask}:generic:usb0:off " CONFIG_ENV_COMMON_BOOT \
 		"; run bootk\0" \
 	"ramfsboot=" \
-		"set bootargs root=/dev/ram0 rw rootfstype=ext2 " \
+		"setenv bootargs root=/dev/ram0 rw rootfstype=ext2 " \
 		"${console} ${meminfo} " \
 		"initrd=0x43000000,8M ramdisk=8192\0" \
 	"mmcboot=" \
-		"set bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		"setenv bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
 		"${lpj} rootwait ${console} ${meminfo} ${opts} ${lcdinfo}; " \
 		"run loaduimage; bootm 0x40007FC0\0" \
-	"bootchart=set opts init=/sbin/bootchartd; run bootcmd\0" \
+	"bootchart=setenv opts init=/sbin/bootchartd; run bootcmd\0" \
 	"boottrace=setenv opts initcall_debug; run bootcmd\0" \
 	"mmcoops=mmc read 0 0x40000000 0x40 8; md 0x40000000 0x400\0" \
 	"verify=n\0" \
@@ -166,12 +166,30 @@ 
 	"meminfo=crashkernel=32M@0x50000000\0" \
 	"nfsroot=/nfsroot/arm\0" \
 	"bootblock=" CONFIG_BOOTBLOCK "\0" \
-	"loaduimage=fatload mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage\0" \
+	"loaduimage=ext4load mmc ${mmcdev}:${mmcbootpart} 0x40007FC0 uImage\0" \
 	"mmcdev=0\0" \
 	"mmcbootpart=2\0" \
-	"mmcrootpart=3\0" \
+	"mmcrootpart=5\0" \
 	"opts=always_resume=1\0" \
-	CONFIG_DFU_ALT
+	"dfu_alt_info=" CONFIG_DFU_ALT \
+	"spladdr=0x40000100\0" \
+	"splsize=0x200\0" \
+	"splfile=falcon.bin\0" \
+	"spl_export=" \
+		   "setexpr spl_imgsize ${splsize} + 8 ;" \
+		   "setexpr spl_imgaddr ${spladdr} - 8 ;" \
+		   "setexpr spl_addr_tmp ${spladdr} - 4 ;" \
+		   "mw.b ${spl_imgaddr} 0x00 ${spl_imgsize};run loaduimage;" \
+		   "setenv bootargs root=/dev/mmcblk${mmcdev}p${mmcrootpart} " \
+		   "${lpj} rootwait ${console} ${meminfo} ${opts} ${lcdinfo};" \
+		   "spl export atags 0x40007FC0;" \
+		   "crc32 ${spladdr} ${splsize} ${spl_imgaddr};" \
+		   "mw.l ${spl_addr_tmp} ${splsize};" \
+		   "ext4write mmc ${mmcdev}:${mmcbootpart}" \
+		   " /${splfile} ${spl_imgaddr} ${spl_imgsize};" \
+		   "setenv spl_imgsize;" \
+		   "setenv spl_imgaddr;" \
+		   "setenv spl_addr_tmp;\0"
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP		/* undef to save memory */
@@ -207,11 +225,18 @@ 
 #define CONFIG_ENV_OFFSET		((32 - 4) << 10) /* 32KiB - 4KiB */
 
 #define CONFIG_DOS_PARTITION
+#define CONFIG_EFI_PARTITION
+
+/* EXT4 */
+#define CONFIG_CMD_EXT4
+#define CONFIG_CMD_EXT4_WRITE
+/* Falcon mode definitions */
+#define CONFIG_CMD_SPL
+#define CONFIG_SYS_SPL_ARGS_ADDR        PHYS_SDRAM_1 + 0x100
 
 #define CONFIG_SYS_INIT_SP_ADDR	(CONFIG_SYS_LOAD_ADDR - GENERATED_GBL_DATA_SIZE)
 #define CONFIG_SYS_CACHELINE_SIZE       32
 
-
 #define CONFIG_SOFT_I2C
 #define CONFIG_SOFT_I2C_READ_REPEATED_START
 #define CONFIG_SYS_I2C_INIT_BOARD