Patchwork [U-Boot,7/9] mx23_olinuxino: Add default environment

login
register
mail settings
Submitter Otavio Salvador
Date Jan. 22, 2013, 1:47 a.m.
Message ID <1358819250-31625-8-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/214308/
State Not Applicable
Headers show

Comments

Otavio Salvador - Jan. 22, 2013, 1:47 a.m.
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
---
 include/configs/mx23_olinuxino.h | 90 +++++++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)
Marek Vasut - Jan. 22, 2013, 1:49 a.m.
Dear Otavio Salvador,

Description missing.

> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> ---
>  include/configs/mx23_olinuxino.h | 90
> +++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+),
> 1 deletion(-)
> 
> diff --git a/include/configs/mx23_olinuxino.h
> b/include/configs/mx23_olinuxino.h index a62e3a2..7d34168 100644
> --- a/include/configs/mx23_olinuxino.h
> +++ b/include/configs/mx23_olinuxino.h
> @@ -140,9 +140,97 @@
>  #define	CONFIG_SETUP_MEMORY_TAGS
>  #define	CONFIG_BOOTDELAY	3
>  #define	CONFIG_BOOTFILE		"uImage"
> -#define	CONFIG_BOOTARGS		"console=ttyAMA0,115200n8 "

No need to remove this.

>  #define	CONFIG_LOADADDR		0x42000000
>  #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
>  #define	CONFIG_OF_LIBFDT
> 
> +/*
> + * Extra Environments
> + */
> +#define CONFIG_EXTRA_ENV_SETTINGS \
> +	"update_sd_firmware_filename=u-boot.sd\0" \
> +	"update_nand_full_filename=u-boot.nand\0" \
> +	"update_nand_firmware_filename=u-boot.sb\0"	\
> +	"update_sd_firmware_filename=u-boot.sd\0" \
> +	"update_nand_firmware_maxsz=0x100000\0"	\
> +	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */ \
> +	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */ \
> +	"update_nand_get_fcb_size="	/* Get size of FCB blocks */ \

This board has no NAND.

Best regards,
Marek Vasut
Otavio Salvador - Jan. 22, 2013, 2 a.m.
On Mon, Jan 21, 2013 at 11:49 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
> Description missing.
>
>> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
>> ---
>>  include/configs/mx23_olinuxino.h | 90
>> +++++++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+),
>> 1 deletion(-)
>>
>> diff --git a/include/configs/mx23_olinuxino.h
>> b/include/configs/mx23_olinuxino.h index a62e3a2..7d34168 100644
>> --- a/include/configs/mx23_olinuxino.h
>> +++ b/include/configs/mx23_olinuxino.h
>> @@ -140,9 +140,97 @@
>>  #define      CONFIG_SETUP_MEMORY_TAGS
>>  #define      CONFIG_BOOTDELAY        3
>>  #define      CONFIG_BOOTFILE         "uImage"
>> -#define      CONFIG_BOOTARGS         "console=ttyAMA0,115200n8 "
>
> No need to remove this.

It has an extended version in the end.

>>  #define      CONFIG_LOADADDR         0x42000000
>>  #define      CONFIG_SYS_LOAD_ADDR    CONFIG_LOADADDR
>>  #define      CONFIG_OF_LIBFDT
>>
>> +/*
>> + * Extra Environments
>> + */
>> +#define CONFIG_EXTRA_ENV_SETTINGS \
>> +     "update_sd_firmware_filename=u-boot.sd\0" \
>> +     "update_nand_full_filename=u-boot.nand\0" \
>> +     "update_nand_firmware_filename=u-boot.sb\0"     \
>> +     "update_sd_firmware_filename=u-boot.sd\0" \
>> +     "update_nand_firmware_maxsz=0x100000\0" \
>> +     "update_nand_stride=0x40\0"     /* MX28 datasheet ch. 12.12 */ \
>> +     "update_nand_count=0x4\0"       /* MX28 datasheet ch. 12.12 */ \
>> +     "update_nand_get_fcb_size="     /* Get size of FCB blocks */ \
>
> This board has no NAND.

Good catch; will drop it for v2 after Stefano and Fabio's comments.

--
Otavio Salvador                             O.S. Systems
E-mail: otavio@ossystems.com.br  http://www.ossystems.com.br
Mobile: +55 53 9981-7854              http://projetos.ossystems.com.br
Fabio Estevam - Jan. 22, 2013, 2:34 a.m.
On Mon, Jan 21, 2013 at 11:47 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

> +       "script=boot.scr\0"     \
> +       "uimage=uImage\0" \
> +       "console=ttyAMA0\0" \
> +       "fdt_file=imx23-evk.dtb\0" \

The dtb file should be imx23-olinuxino.dtb instead.

Patch

diff --git a/include/configs/mx23_olinuxino.h b/include/configs/mx23_olinuxino.h
index a62e3a2..7d34168 100644
--- a/include/configs/mx23_olinuxino.h
+++ b/include/configs/mx23_olinuxino.h
@@ -140,9 +140,97 @@ 
 #define	CONFIG_SETUP_MEMORY_TAGS
 #define	CONFIG_BOOTDELAY	3
 #define	CONFIG_BOOTFILE		"uImage"
-#define	CONFIG_BOOTARGS		"console=ttyAMA0,115200n8 "
 #define	CONFIG_LOADADDR		0x42000000
 #define	CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 #define	CONFIG_OF_LIBFDT
 
+/*
+ * Extra Environments
+ */
+#define CONFIG_EXTRA_ENV_SETTINGS \
+	"update_sd_firmware_filename=u-boot.sd\0" \
+	"update_nand_full_filename=u-boot.nand\0" \
+	"update_nand_firmware_filename=u-boot.sb\0"	\
+	"update_sd_firmware_filename=u-boot.sd\0" \
+	"update_nand_firmware_maxsz=0x100000\0"	\
+	"update_nand_stride=0x40\0"	/* MX28 datasheet ch. 12.12 */ \
+	"update_nand_count=0x4\0"	/* MX28 datasheet ch. 12.12 */ \
+	"update_nand_get_fcb_size="	/* Get size of FCB blocks */ \
+		"nand device 0 ; " \
+		"nand info ; " \
+		"setexpr fcb_sz ${update_nand_stride} * ${update_nand_count};" \
+		"setexpr update_nand_fcb ${fcb_sz} * ${nand_writesize}\0" \
+	"update_nand_full="		    /* Update FCB, DBBT and FW */ \
+		"if tftp ${update_nand_full_filename} ; then " \
+		"run update_nand_get_fcb_size ; " \
+		"nand scrub -y 0x0 ${filesize} ; " \
+		"nand write.raw ${loadaddr} 0x0 ${fcb_sz} ; " \
+		"setexpr update_off ${loadaddr} + ${update_nand_fcb} ; " \
+		"setexpr update_sz ${filesize} - ${update_nand_fcb} ; " \
+		"nand write ${update_off} ${update_nand_fcb} ${update_sz} ; " \
+		"fi\0" \
+	"update_nand_firmware="		/* Update only firmware */ \
+		"if tftp ${update_nand_firmware_filename} ; then " \
+		"run update_nand_get_fcb_size ; " \
+		"setexpr fcb_sz ${update_nand_fcb} * 2 ; " /* FCB + DBBT */ \
+		"setexpr fw_sz ${update_nand_firmware_maxsz} * 2 ; " \
+		"setexpr fw_off ${fcb_sz} + ${update_nand_firmware_maxsz};" \
+		"nand erase ${fcb_sz} ${fw_sz} ; " \
+		"nand write ${loadaddr} ${fcb_sz} ${filesize} ; " \
+		"nand write ${loadaddr} ${fw_off} ${filesize} ; " \
+		"fi\0" \
+	"update_sd_firmware="		/* Update the SD firmware partition */ \
+		"if mmc rescan ; then "	\
+		"if tftp ${update_sd_firmware_filename} ; then " \
+		"setexpr fw_sz ${filesize} / 0x200 ; "	/* SD block size */ \
+		"setexpr fw_sz ${fw_sz} + 1 ; "	\
+		"mmc write ${loadaddr} 0x800 ${fw_sz} ; " \
+		"fi ; "	\
+		"fi\0" \
+	"script=boot.scr\0"	\
+	"uimage=uImage\0" \
+	"console=ttyAMA0\0" \
+	"fdt_file=imx23-evk.dtb\0" \
+	"fdt_addr=0x41000000\0" \
+	"boot_fdt=try\0" \
+	"mmcdev=0\0" \
+	"mmcpart=2\0" \
+	"mmcroot=/dev/mmcblk0p3 rw rootwait\0" \
+	"mmcargs=setenv bootargs console=${console},${baudrate} " \
+		"root=${mmcroot}\0" \
+	"loadbootscript="  \
+		"fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
+	"bootscript=echo Running bootscript from mmc ...; "	\
+		"source\0" \
+	"loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
+	"loadfdt=fatload mmc ${mmcdev}:${mmcpart} ${fdt_addr} ${fdt_file}\0" \
+	"mmcboot=echo Booting from mmc ...; " \
+		"run mmcargs; " \
+		"if test ${boot_fdt} = yes || test ${boot_fdt} = try; then " \
+			"if run loadfdt; then " \
+				"bootm ${loadaddr} - ${fdt_addr}; " \
+			"else " \
+				"if test ${boot_fdt} = try; then " \
+					"bootm; " \
+				"else " \
+					"echo WARN: Cannot load the DT; " \
+				"fi; " \
+			"fi; " \
+		"else " \
+			"bootm; " \
+		"fi;\0"
+
+#define CONFIG_BOOTCOMMAND \
+	"mmc dev ${mmcdev}; if mmc rescan; then " \
+		"if run loadbootscript; then " \
+			"run bootscript; " \
+		"else " \
+			"if run loaduimage; then " \
+				"run mmcboot; " \
+			"else " \
+				"echo ERR: Fail to boot from MMC; " \
+			"fi; " \
+		"fi; " \
+	"else exit; fi"
+
 #endif /* __MX23_OLINUXINO_CONFIG_H__ */