Patchwork [U-Boot,3/3] mx28evk: extend default environment

login
register
mail settings
Submitter Otavio Salvador
Date May 15, 2012, 8:59 p.m.
Message ID <1337115571-14115-3-git-send-email-otavio@ossystems.com.br>
Download mbox | patch
Permalink /patch/159451/
State Changes Requested
Headers show

Comments

Otavio Salvador - May 15, 2012, 8:59 p.m.
The environment has been based on mx53loco and m28evk but keeping the
possibility to easy change the default console device as Freescale and
mainline kernels differ on the device name.

Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Cc: Marek Vasut <marex@denx.de>
Cc: Stefano Babic <sbabic@denx.de>
Cc: Wolfgang Denk <wd@denx.de>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
---
 include/configs/mx28evk.h |   83 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 75 insertions(+), 8 deletions(-)
Fabio Estevam - May 15, 2012, 9:08 p.m.
On Tue, May 15, 2012 at 5:59 PM, Otavio Salvador
<otavio@ossystems.com.br> wrote:

> +       "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
> +       "mmcboot=echo Booting from mmc ...; " \
> +               "run mmcargs; " \
> +               "bootm\0" \
> +       "netargs=setenv bootargs console=ttymxc0,${baudrate} " \

No, ttymxc0 is wrong for mx28. You should use console=${console}.
Marek Vasut - May 15, 2012, 9:16 p.m.
Dear Otavio Salvador,

> The environment has been based on mx53loco and m28evk but keeping the
> possibility to easy change the default console device as Freescale and
> mainline kernels differ on the device name.

FSL kernel is dumb :-(

But I like this patch. On the other hand, can't this be made even more generic 
so everyone can use such a nice unified env?

> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Wolfgang Denk <wd@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  include/configs/mx28evk.h |   83
> ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 75
> insertions(+), 8 deletions(-)
> 
> diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
> index e98a746..6c2bf5f 100644
> --- a/include/configs/mx28evk.h
> +++ b/include/configs/mx28evk.h
> @@ -234,7 +234,6 @@
>  #define CONFIG_SETUP_MEMORY_TAGS
>  #define CONFIG_BOOTDELAY	3
>  #define CONFIG_BOOTFILE	"uImage"
> -#define CONFIG_BOOTCOMMAND	"run bootcmd_net"
>  #define CONFIG_LOADADDR	0x42000000
>  #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
>  #define CONFIG_OF_LIBFDT
> @@ -243,13 +242,81 @@
>   * Extra Environments
>   */
>  #define CONFIG_EXTRA_ENV_SETTINGS \
> -	"console_fsl=console=ttyAM0" \
> -	"console_mainline=console=ttyAMA0" \
> -	"netargs=setenv bootargs console=${console_mainline}" \
> +	"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 ${update_nand_fcb} ; " \
> +		"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_fsl=ttyAM0\0" \
> +	"console_mainline=ttyAMA0\0" \
> +	"console=${console_mainline}\0" \
> +	"mmcdev=0\0" \
> +	"mmcpart=2\0" \
> +	"mmcroot=/dev/mmcblk0p3 rw\0" \
> +	"mmcrootfstype=ext3 rootwait\0"	\
> +	"mmcargs=setenv bootargs console=${console},${baudrate} " \
> +		"root=${mmcroot} " \
> +		"rootfstype=${mmcrootfstype}\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" \
> +	"mmcboot=echo Booting from mmc ...; " \
> +		"run mmcargs; "	\
> +		"bootm\0" \
> +	"netargs=setenv bootargs console=ttymxc0,${baudrate} " \
>  		"root=/dev/nfs " \
> -		"ip=dhcp nfsroot=${serverip}:${nfsroot}\0" \
> -	"bootcmd_net=echo Booting from net ...; " \
> -		"run netargs; " \
> -		"dhcp ${uimage}; bootm\0" \
> +		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
> +	"netboot=echo Booting from net ...; " \
> +		"run netargs; "	\
> +		"dhcp ${uimage}; bootm\0"
> +
> +#define CONFIG_BOOTCOMMAND \
> +	"if mmc rescan ${mmcdev}; then " \
> +		"if run loadbootscript; then " \
> +			"run bootscript; " \
> +		"else " \
> +			"if run loaduimage; then " \
> +				"run mmcboot; " \
> +			"else run netboot; " \
> +			"fi; " \
> +		"fi; " \
> +	"else run netboot; fi"
> 
>  #endif /* __MX28EVK_CONFIG_H__ */

Best regards,
Marek Vasut
Otavio Salvador - May 15, 2012, 9:18 p.m.
On Tue, May 15, 2012 at 6:08 PM, Fabio Estevam <festevam@gmail.com> wrote:
> On Tue, May 15, 2012 at 5:59 PM, Otavio Salvador
> <otavio@ossystems.com.br> wrote:
>
>> +       "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
>> +       "mmcboot=echo Booting from mmc ...; " \
>> +               "run mmcargs; " \
>> +               "bootm\0" \
>> +       "netargs=setenv bootargs console=ttymxc0,${baudrate} " \
>
> No, ttymxc0 is wrong for mx28. You should use console=${console}.

My fault; when I redone it I forgot to fix it once again.
Marek Vasut - May 15, 2012, 9:21 p.m.
Dear Otavio Salvador,

> On Tue, May 15, 2012 at 6:16 PM, Marek Vasut <marex@denx.de> wrote:
> > But I like this patch. On the other hand, can't this be made even more
> > generic so everyone can use such a nice unified env?
> 
> I tried something in this direction but Wolfgang NACKed the patch. It
> wasn't clear to me what he wants so I preferred to go again with
> mx28evk patch only.

Well ... it might have been a good idea to discuss it with WD. I think we 
discussed some time ago that universal default env would be very cool.

Best regards,
Marek Vasut
Otavio Salvador - May 15, 2012, 9:27 p.m.
On Tue, May 15, 2012 at 6:21 PM, Marek Vasut <marex@denx.de> wrote:
> Dear Otavio Salvador,
>
>> I tried something in this direction but Wolfgang NACKed the patch. It
>> wasn't clear to me what he wants so I preferred to go again with
>> mx28evk patch only.
>
> Well ... it might have been a good idea to discuss it with WD. I think we
> discussed some time ago that universal default env would be very cool.

I can work on that as far as I know what people expect to have. In
meanwhile I'd prefer to have this in since it allow the default
environment to just work in our BSP layer for OpenEmbedded.
Wolfgang Denk - May 29, 2012, 8:52 p.m.
Dear Otavio Salvador,

In message <1337115571-14115-3-git-send-email-otavio@ossystems.com.br> you wrote:
> The environment has been based on mx53loco and m28evk but keeping the
> possibility to easy change the default console device as Freescale and
> mainline kernels differ on the device name.

NAK.

I will not acceept this.


Please accept that the configuration of the Freescale boards was done
by Freescale and is maintained by freescale, but it is not generally
considered to be the best of all possible solutions.

Freescale may use it on their boards if they like.  You may use it on
your boards if you like.

But I don't want to see this on any boards in my responsibility,
because I dislike it.

Please allow that we maintain the M28EVK configuration as we like it.

Thanks.

Best regards,

Wolfgang Denk
Wolfgang Denk - May 29, 2012, 8:55 p.m.
Dear Otavio Salvador,

In message <CAP9ODKqPY51QzdLPejC4GyO3H-S0jYwFxEipEhSebX74Jkg0aQ@mail.gmail.com> you wrote:
>
> I can work on that as far as I know what people expect to have. In
> meanwhile I'd prefer to have this in since it allow the default
> environment to just work in our BSP layer for OpenEmbedded.

There is no such thing as "the default environment".

The default environment is vendor specific at bets, and usualy board
specific.  As explained before, I will not accept the Freescale style
on boards maintained by DENX.

Not because I consider it inherently bad, but for example because it
is different from what we, our customers, our documentation and our
test scripts are used to.

Best regards,

Wolfgang Denk
Marek Vasut - May 29, 2012, 9:14 p.m.
Dear Wolfgang Denk,

> Dear Otavio Salvador,
> 
> In message <CAP9ODKqPY51QzdLPejC4GyO3H-
S0jYwFxEipEhSebX74Jkg0aQ@mail.gmail.com> you wrote:
> > I can work on that as far as I know what people expect to have. In
> > meanwhile I'd prefer to have this in since it allow the default
> > environment to just work in our BSP layer for OpenEmbedded.
> 
> There is no such thing as "the default environment".
> 
> The default environment is vendor specific at bets, and usualy board
> specific.  As explained before, I will not accept the Freescale style
> on boards maintained by DENX.
> 
> Not because I consider it inherently bad, but for example because it
> is different from what we, our customers, our documentation and our
> test scripts are used to.

Then I guess some kind of "common env" for all boards won't happen ?

> Best regards,
> 
> Wolfgang Denk

Best regards,
Marek Vasut
Wolfgang Denk - May 29, 2012, 9:30 p.m.
Dear Marek,

In message <201205292314.04143.marex@denx.de> you wrote:
> 
> > Not because I consider it inherently bad, but for example because it
> > is different from what we, our customers, our documentation and our
> > test scripts are used to.
> 
> Then I guess some kind of "common env" for all boards won't happen ?

I don't see a real chance. Pick any of the bigger vendors - say
Freescale: do you consider it a realistic chance that all their
boards (PPC, ARM, ColdFire, what else) get converted to a common
environment? Do you expect that TI and Samsung and Marvell and ...
agree with this approach and apply it on thier boards as ell? Or vice
versa?


I think the best we can do is factor out some parts we consider well
designed, and use these in the boards in our own responsibility.  Then
we can start pointing people at that and try to convince them to
accept this for new stuff added.

But reorganizing existing environents is basicly impossible - all the
bigger vendors will tell you how much effort it would take to update
just all the documentation, not to mention to update all the boards
and scrpts and handle the resulting board breakages / brickages.

Best regards,

Wolfgang Denk

Patch

diff --git a/include/configs/mx28evk.h b/include/configs/mx28evk.h
index e98a746..6c2bf5f 100644
--- a/include/configs/mx28evk.h
+++ b/include/configs/mx28evk.h
@@ -234,7 +234,6 @@ 
 #define CONFIG_SETUP_MEMORY_TAGS
 #define CONFIG_BOOTDELAY	3
 #define CONFIG_BOOTFILE	"uImage"
-#define CONFIG_BOOTCOMMAND	"run bootcmd_net"
 #define CONFIG_LOADADDR	0x42000000
 #define CONFIG_SYS_LOAD_ADDR	CONFIG_LOADADDR
 #define CONFIG_OF_LIBFDT
@@ -243,13 +242,81 @@ 
  * Extra Environments
  */
 #define CONFIG_EXTRA_ENV_SETTINGS \
-	"console_fsl=console=ttyAM0" \
-	"console_mainline=console=ttyAMA0" \
-	"netargs=setenv bootargs console=${console_mainline}" \
+	"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 ${update_nand_fcb} ; " \
+		"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_fsl=ttyAM0\0" \
+	"console_mainline=ttyAMA0\0" \
+	"console=${console_mainline}\0" \
+	"mmcdev=0\0" \
+	"mmcpart=2\0" \
+	"mmcroot=/dev/mmcblk0p3 rw\0" \
+	"mmcrootfstype=ext3 rootwait\0"	\
+	"mmcargs=setenv bootargs console=${console},${baudrate} " \
+		"root=${mmcroot} " \
+		"rootfstype=${mmcrootfstype}\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" \
+	"mmcboot=echo Booting from mmc ...; " \
+		"run mmcargs; "	\
+		"bootm\0" \
+	"netargs=setenv bootargs console=ttymxc0,${baudrate} " \
 		"root=/dev/nfs " \
-		"ip=dhcp nfsroot=${serverip}:${nfsroot}\0" \
-	"bootcmd_net=echo Booting from net ...; " \
-		"run netargs; " \
-		"dhcp ${uimage}; bootm\0" \
+		"ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
+	"netboot=echo Booting from net ...; " \
+		"run netargs; "	\
+		"dhcp ${uimage}; bootm\0"
+
+#define CONFIG_BOOTCOMMAND \
+	"if mmc rescan ${mmcdev}; then " \
+		"if run loadbootscript; then " \
+			"run bootscript; " \
+		"else " \
+			"if run loaduimage; then " \
+				"run mmcboot; " \
+			"else run netboot; " \
+			"fi; " \
+		"fi; " \
+	"else run netboot; fi"
 
 #endif /* __MX28EVK_CONFIG_H__ */