diff mbox

[U-Boot] armv8/ls1043a: Add MTD partition scheme

Message ID 1459502893-11399-1-git-send-email-wenbin.song@nxp.com
State Superseded
Delegated to: York Sun
Headers show

Commit Message

Wenbin song April 1, 2016, 9:28 a.m. UTC
Add and share the the MTD partition scheme with kernel by defualt bootargs.
And add the "mtdparts" env.

Signed-off-by: Wenbin Song <wenbin.song@nxp.com>
---
 include/configs/ls1043a_common.h | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Comments

York Sun April 5, 2016, 8:32 p.m. UTC | #1
On 04/01/2016 02:37 AM, Wenbin Song wrote:
> Add and share the the MTD partition scheme with kernel by defualt bootargs.
> And add the "mtdparts" env.
> 
> Signed-off-by: Wenbin Song <wenbin.song@nxp.com>
> ---
>  include/configs/ls1043a_common.h | 22 ++++++++++++++++++++--
>  1 file changed, 20 insertions(+), 2 deletions(-)
> 
> diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
> index fd243b1..6964873 100644
> --- a/include/configs/ls1043a_common.h
> +++ b/include/configs/ls1043a_common.h
> @@ -236,6 +236,21 @@
>  #define CONFIG_HWCONFIG
>  #define HWCONFIG_BUFFER_SIZE		128
>  
> +#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
> +#define MTDPARTS_DEFAULT "mtdparts=spi0.0:1m(uboot)," \
> +			"5m(kernel),1m(dtb),9m(file_system)"
> +#else
> +#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
> +			"1m(nor_bank0_uboot),1m(nor_bank0_uboot_env)," \
> +			"1m(nor_bank0_fman_uconde),40m(nor_bank0_fit)," \
> +			"1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
> +			"1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
> +			"40m(nor_bank4_fit);7e800000.flash:" \
> +			"1m(nand_uboot),1m(nand_uboot_env)," \
> +			"20m(nand_fit);spi0.0:1m(uboot)," \
> +			"5m(kernel),1m(dtb),9m(file_system)"
> +#endif
> +
>  /* Initial environment variables */
>  #define CONFIG_EXTRA_ENV_SETTINGS		\
>  	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
> @@ -248,10 +263,13 @@
>  	"kernel_start=0x61100000\0"		\
>  	"kernel_load=0xa0000000\0"		\
>  	"kernel_size=0x2800000\0"		\
> -	"console=ttyAMA0,38400n8\0"
> +	"console=ttyAMA0,38400n8\0"		\
> +	"mtdparts=" MTDPARTS_DEFAULT "\0"
>  
>  #define CONFIG_BOOTARGS			"console=ttyS0,115200 root=/dev/ram0 " \
> -					"earlycon=uart8250,mmio,0x21c0500"
> +					"earlycon=uart8250,mmio,0x21c0500 " \
> +					MTDPARTS_DEFAULT

You could use $mtdparts here so your bootcmd doesn't get too long.

York
York Sun April 5, 2016, 9:02 p.m. UTC | #2
On 04/05/2016 01:32 PM, York Sun wrote:
> On 04/01/2016 02:37 AM, Wenbin Song wrote:
>> Add and share the the MTD partition scheme with kernel by defualt bootargs.
>> And add the "mtdparts" env.
>>
>> Signed-off-by: Wenbin Song <wenbin.song@nxp.com>
>> ---
>>  include/configs/ls1043a_common.h | 22 ++++++++++++++++++++--
>>  1 file changed, 20 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
>> index fd243b1..6964873 100644
>> --- a/include/configs/ls1043a_common.h
>> +++ b/include/configs/ls1043a_common.h
>> @@ -236,6 +236,21 @@
>>  #define CONFIG_HWCONFIG
>>  #define HWCONFIG_BUFFER_SIZE		128
>>  
>> +#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
>> +#define MTDPARTS_DEFAULT "mtdparts=spi0.0:1m(uboot)," \
>> +			"5m(kernel),1m(dtb),9m(file_system)"
>> +#else
>> +#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
>> +			"1m(nor_bank0_uboot),1m(nor_bank0_uboot_env)," \
>> +			"1m(nor_bank0_fman_uconde),40m(nor_bank0_fit)," \
>> +			"1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
>> +			"1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
>> +			"40m(nor_bank4_fit);7e800000.flash:" \
>> +			"1m(nand_uboot),1m(nand_uboot_env)," \
>> +			"20m(nand_fit);spi0.0:1m(uboot)," \
>> +			"5m(kernel),1m(dtb),9m(file_system)"
>> +#endif
>> +
>>  /* Initial environment variables */
>>  #define CONFIG_EXTRA_ENV_SETTINGS		\
>>  	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
>> @@ -248,10 +263,13 @@
>>  	"kernel_start=0x61100000\0"		\
>>  	"kernel_load=0xa0000000\0"		\
>>  	"kernel_size=0x2800000\0"		\
>> -	"console=ttyAMA0,38400n8\0"
>> +	"console=ttyAMA0,38400n8\0"		\
>> +	"mtdparts=" MTDPARTS_DEFAULT "\0"
>>  
>>  #define CONFIG_BOOTARGS			"console=ttyS0,115200 root=/dev/ram0 " \
>> -					"earlycon=uart8250,mmio,0x21c0500"
>> +					"earlycon=uart8250,mmio,0x21c0500 " \
>> +					MTDPARTS_DEFAULT
> 
> You could use $mtdparts here so your bootcmd doesn't get too long.
> 

Wenbin,

A related question regarding MTD, how do you make NOR MTD device working on
these boards (ls1043aqds and ls1043ardb)? This is a common file for both RDB and
QDS. I presume you have verified on both. I have nand working on both, spi-nor
working on rdb only. I don't have NOR working on either of them. It may be not a
U-Boot issue though.

York
Wenbin song April 6, 2016, 3:24 a.m. UTC | #3
Hi: York

1, There is an issue for sdk2.0 kernel that the nor-flash can't be probed . we can fix it as follow:

$make menuconfig

  x     -> Device Drivers                                                                                                                                                                       
  x        -> Memory Technology Device (MTD) support 
  x          -> RAM/ROM/Flash chip drivers                                                                                                                
  x            -> Flash chip driver advanced configuration options 
  x                -> Flash cmd/query data swapping                                                                                         
       x x                  ( ) NO                                   
       x x                  (X) BIG_ENDIAN_BYTE                     
       x x                  ( ) LITTLE_ENDIAN_BYTE                   

Enable BIG_ENDIAN_BYTE .

2,  The  spi-nor flash can working on  ls1043aqds , and I use the sdk2.0 kernel (ce5a3841f3).
      [    1.598954] m25p80 spi0.0: n25q128a11 (16384 Kbytes)
[    1.603923] 4 cmdlinepart partitions found on MTD device spi0.0
[    1.609842] Creating 4 MTD partitions on "spi0.0":
[    1.614624] 0x000000000000-0x000000100000 : "uboot"
[    1.624205] ftl_cs: FTL header not found.
[    1.628421] 0x000000100000-0x000000600000 : "kernel"
[    1.638086] ftl_cs: FTL header not found.
[    1.642316] 0x000000600000-0x000000700000 : "dtb"
[    1.651702] ftl_cs: FTL header not found.
[    1.655932] 0x000000700000-0x000001000000 : "file_system"
[    1.666028] ftl_cs: FTL header not found.

Best Regards
Wenbin Song


> -----Original Message-----
> From: York Sun [mailto:york.sun@nxp.com]
> Sent: Wednesday, April 06, 2016 5:02 AM
> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu
> <mingkai.hu@nxp.com>; u-boot@lists.denx.de
> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie
> <shaohui.xie@nxp.com>; Zhiqiang Hou <zhiqiang.hou@nxp.com>
> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
> 
> On 04/05/2016 01:32 PM, York Sun wrote:
> > On 04/01/2016 02:37 AM, Wenbin Song wrote:
> >> Add and share the the MTD partition scheme with kernel by defualt
> bootargs.
> >> And add the "mtdparts" env.
> >>
> >> Signed-off-by: Wenbin Song <wenbin.song@nxp.com>
> >> ---
> >>  include/configs/ls1043a_common.h | 22 ++++++++++++++++++++--
> >>  1 file changed, 20 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/include/configs/ls1043a_common.h
> >> b/include/configs/ls1043a_common.h
> >> index fd243b1..6964873 100644
> >> --- a/include/configs/ls1043a_common.h
> >> +++ b/include/configs/ls1043a_common.h
> >> @@ -236,6 +236,21 @@
> >>  #define CONFIG_HWCONFIG
> >>  #define HWCONFIG_BUFFER_SIZE		128
> >>
> >> +#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
> >> +#define MTDPARTS_DEFAULT "mtdparts=spi0.0:1m(uboot)," \
> >> +			"5m(kernel),1m(dtb),9m(file_system)"
> >> +#else
> >> +#define MTDPARTS_DEFAULT
> "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
> >> +			"1m(nor_bank0_uboot),1m(nor_bank0_uboot_env),"
> \
> >> +			"1m(nor_bank0_fman_uconde),40m(nor_bank0_fit),"
> \
> >> +			"1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
> >> +
> 	"1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
> >> +			"40m(nor_bank4_fit);7e800000.flash:" \
> >> +			"1m(nand_uboot),1m(nand_uboot_env)," \
> >> +			"20m(nand_fit);spi0.0:1m(uboot)," \
> >> +			"5m(kernel),1m(dtb),9m(file_system)"
> >> +#endif
> >> +
> >>  /* Initial environment variables */
> >>  #define CONFIG_EXTRA_ENV_SETTINGS		\
> >>  	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
> >> @@ -248,10 +263,13 @@
> >>  	"kernel_start=0x61100000\0"		\
> >>  	"kernel_load=0xa0000000\0"		\
> >>  	"kernel_size=0x2800000\0"		\
> >> -	"console=ttyAMA0,38400n8\0"
> >> +	"console=ttyAMA0,38400n8\0"		\
> >> +	"mtdparts=" MTDPARTS_DEFAULT "\0"
> >>
> >>  #define CONFIG_BOOTARGS			"console=ttyS0,115200
> root=/dev/ram0 " \
> >> -					"earlycon=uart8250,mmio,0x21c0500"
> >> +					"earlycon=uart8250,mmio,0x21c0500 " \
> >> +					MTDPARTS_DEFAULT
> >
> > You could use $mtdparts here so your bootcmd doesn't get too long.
> >
> 
> Wenbin,
> 
> A related question regarding MTD, how do you make NOR MTD device working
> on these boards (ls1043aqds and ls1043ardb)? This is a common file for both
> RDB and QDS. I presume you have verified on both. I have nand working on
> both, spi-nor working on rdb only. I don't have NOR working on either of them.
> It may be not a U-Boot issue though.
> 
> York
>
Wenbin song April 6, 2016, 4:20 a.m. UTC | #4
Hi: York

Do you mean that I should use $mtdpart to instead of "MTDPARTS_DEFAULT" ?
 
As follows:	
       #define CONFIG_BOOTARGS                 "console=ttyS0,115200 root=/dev/ram0 " \
	                                         "earlycon=uart8250,mmio,0x21c0500 " \
	                                       "$mtdparts"

If so, the variable $mtdparts can't  be extend ,like that:

root@ls1043aqds:~# cat /proc/cmdline
console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 ${mtdparts}


Best Regards
Wenbin Song


> -----Original Message-----
> From: York Sun [mailto:york.sun@nxp.com]
> Sent: Wednesday, April 06, 2016 4:33 AM
> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu
> <mingkai.hu@nxp.com>; u-boot@lists.denx.de
> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie
> <shaohui.xie@nxp.com>; Zhiqiang Hou <zhiqiang.hou@nxp.com>
> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
> 
> On 04/01/2016 02:37 AM, Wenbin Song wrote:
> > Add and share the the MTD partition scheme with kernel by defualt bootargs.
> > And add the "mtdparts" env.
> >
> > Signed-off-by: Wenbin Song <wenbin.song@nxp.com>
> > ---
> >  include/configs/ls1043a_common.h | 22 ++++++++++++++++++++--
> >  1 file changed, 20 insertions(+), 2 deletions(-)
> >
> > diff --git a/include/configs/ls1043a_common.h
> > b/include/configs/ls1043a_common.h
> > index fd243b1..6964873 100644
> > --- a/include/configs/ls1043a_common.h
> > +++ b/include/configs/ls1043a_common.h
> > @@ -236,6 +236,21 @@
> >  #define CONFIG_HWCONFIG
> >  #define HWCONFIG_BUFFER_SIZE		128
> >
> > +#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
> #define
> > +MTDPARTS_DEFAULT "mtdparts=spi0.0:1m(uboot)," \
> > +			"5m(kernel),1m(dtb),9m(file_system)"
> > +#else
> > +#define MTDPARTS_DEFAULT
> "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
> > +			"1m(nor_bank0_uboot),1m(nor_bank0_uboot_env),"
> \
> > +			"1m(nor_bank0_fman_uconde),40m(nor_bank0_fit),"
> \
> > +			"1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
> > +
> 	"1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
> > +			"40m(nor_bank4_fit);7e800000.flash:" \
> > +			"1m(nand_uboot),1m(nand_uboot_env)," \
> > +			"20m(nand_fit);spi0.0:1m(uboot)," \
> > +			"5m(kernel),1m(dtb),9m(file_system)"
> > +#endif
> > +
> >  /* Initial environment variables */
> >  #define CONFIG_EXTRA_ENV_SETTINGS		\
> >  	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
> > @@ -248,10 +263,13 @@
> >  	"kernel_start=0x61100000\0"		\
> >  	"kernel_load=0xa0000000\0"		\
> >  	"kernel_size=0x2800000\0"		\
> > -	"console=ttyAMA0,38400n8\0"
> > +	"console=ttyAMA0,38400n8\0"		\
> > +	"mtdparts=" MTDPARTS_DEFAULT "\0"
> >
> >  #define CONFIG_BOOTARGS			"console=ttyS0,115200
> root=/dev/ram0 " \
> > -					"earlycon=uart8250,mmio,0x21c0500"
> > +					"earlycon=uart8250,mmio,0x21c0500 " \
> > +					MTDPARTS_DEFAULT
> 
> You could use $mtdparts here so your bootcmd doesn't get too long.
> 
> York
York Sun April 6, 2016, 4:39 a.m. UTC | #5
On 04/05/2016 09:20 PM, Wenbin Song wrote:
> Hi: York
> 
> Do you mean that I should use $mtdpart to instead of "MTDPARTS_DEFAULT" ?
>  
> As follows:	
>        #define CONFIG_BOOTARGS                 "console=ttyS0,115200 root=/dev/ram0 " \
> 	                                         "earlycon=uart8250,mmio,0x21c0500 " \
> 	                                       "$mtdparts"
> 
> If so, the variable $mtdparts can't  be extend ,like that:
> 
> root@ls1043aqds:~# cat /proc/cmdline
> console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 ${mtdparts}
> 

What do you see "print bootargs" under U-Boot?
I thought the variable can be extended when U-Boot runs the command. Like we
used to have $consoledev, $othbootargs, etc.

York
Wenbin song April 6, 2016, 7:11 a.m. UTC | #6
Hi: York

I set bootargs  as the following steps:

=> env default mtdparts
=> printenv mtdparts
mtdparts=mtdparts=60000000.nor:1m(nor_bank0_rcw),1m(nor_bank0_uboot),1m(nor_bank0_uboot_env),1m(nor_bank0_fman_uconde),40m(nor_bank0_fit),1m(nor_bank4_rcw),1m(nor_bank4_uboot),1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode),40m(nor_bank4_fit);7e800000.flash:1m(nand_uboot),1m(nand_uboot_env),20m(nand_fit);spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(file_system)
=> env default bootargs
=> printenv bootargs
bootargs=console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 ${mtdparts}


The macro  CONFIG_BOOTARGS  only be extern as an char-string, and it will be spliced into default_environment array . 

 const uchar default_environment[] = {
#ifdef  CONFIG_BOOTARGS
          "bootargs="     CONFIG_BOOTARGS                 "\0"
 #endif
 
The variable we use to have $consoledev, $othbootargs  was used in the following cases:

858  #define CONFIG_BOOTCOMMAND \
859         "setenv bootargs root=/dev/ram rw "             \
860         "console=$consoledev,$baudrate $othbootargs;"   \
861         "setenv ramdiskaddr 0x02000000;"                \
862         "setenv fdtaddr 0x00c00000;"                    \
863         "setenv loadaddr 0x1000000;"                    \
864         "bootm $loadaddr $ramdiskaddr $fdtaddr"

Because the "setenv"  will be executed  , So the variable could be extended.

What do you suggest?

Best Regards
Wenbin Song


> -----Original Message-----
> From: York Sun [mailto:york.sun@nxp.com]
> Sent: Wednesday, April 06, 2016 12:39 PM
> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu
> <mingkai.hu@nxp.com>; u-boot@lists.denx.de
> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie
> <shaohui.xie@nxp.com>; Zhiqiang Hou <zhiqiang.hou@nxp.com>
> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
> 
> On 04/05/2016 09:20 PM, Wenbin Song wrote:
> > Hi: York
> >
> > Do you mean that I should use $mtdpart to instead of
> "MTDPARTS_DEFAULT" ?
> >
> > As follows:
> >        #define CONFIG_BOOTARGS                 "console=ttyS0,115200
> root=/dev/ram0 " \
> > 	                                         "earlycon=uart8250,mmio,0x21c0500 " \
> > 	                                       "$mtdparts"
> >
> > If so, the variable $mtdparts can't  be extend ,like that:
> >
> > root@ls1043aqds:~# cat /proc/cmdline
> > console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500
> > ${mtdparts}
> >
> 
> What do you see "print bootargs" under U-Boot?
> I thought the variable can be extended when U-Boot runs the command. Like
> we used to have $consoledev, $othbootargs, etc.
> 
> York
York Sun April 6, 2016, 5:17 p.m. UTC | #7
On 04/06/2016 12:11 AM, Wenbin Song wrote:
> Hi: York
> 
> I set bootargs  as the following steps:
> 
> => env default mtdparts
> => printenv mtdparts
> mtdparts=mtdparts=60000000.nor:1m(nor_bank0_rcw),1m(nor_bank0_uboot),1m(nor_bank0_uboot_env),1m(nor_bank0_fman_uconde),40m(nor_bank0_fit),1m(nor_bank4_rcw),1m(nor_bank4_uboot),1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode),40m(nor_bank4_fit);7e800000.flash:1m(nand_uboot),1m(nand_uboot_env),20m(nand_fit);spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(file_system)
> => env default bootargs
> => printenv bootargs
> bootargs=console=ttyS0,115200 root=/dev/ram0 earlycon=uart8250,mmio,0x21c0500 ${mtdparts}
> 
> 
> The macro  CONFIG_BOOTARGS  only be extern as an char-string, and it will be spliced into default_environment array . 
> 
>  const uchar default_environment[] = {
> #ifdef  CONFIG_BOOTARGS
>           "bootargs="     CONFIG_BOOTARGS                 "\0"
>  #endif
>  
> The variable we use to have $consoledev, $othbootargs  was used in the following cases:
> 
> 858  #define CONFIG_BOOTCOMMAND \
> 859         "setenv bootargs root=/dev/ram rw "             \
> 860         "console=$consoledev,$baudrate $othbootargs;"   \
> 861         "setenv ramdiskaddr 0x02000000;"                \
> 862         "setenv fdtaddr 0x00c00000;"                    \
> 863         "setenv loadaddr 0x1000000;"                    \
> 864         "bootm $loadaddr $ramdiskaddr $fdtaddr"
> 
> Because the "setenv"  will be executed  , So the variable could be extended.

I see what you mean. I am trying to reduce the environmental variables.
Do you need the variable "mtdparts"?
Would it be a better idea to set bootargs using the bootcmd?

While you are on it, I suggest you take a look at other variables.
"console=ttyAMA0,38400n8" is wrong here.

We don't have to copy kernel image from NOR flash to DDR if the ramdisk load
address is set properly in its file. So you can remove the copying from bootcmd.

York
Wenbin song April 7, 2016, 5:46 a.m. UTC | #8
Hi: York

Please see my inline comments.

Best Regards
Wenbin Song

> -----Original Message-----
> From: York Sun [mailto:york.sun@nxp.com]
> Sent: Thursday, April 07, 2016 1:18 AM
> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu
> <mingkai.hu@nxp.com>; u-boot@lists.denx.de
> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie
> <shaohui.xie@nxp.com>; Zhiqiang Hou <zhiqiang.hou@nxp.com>
> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
> 
> On 04/06/2016 12:11 AM, Wenbin Song wrote:
> > Hi: York
> >
> > I set bootargs  as the following steps:
> >
> > => env default mtdparts
> > => printenv mtdparts
> >
> mtdparts=mtdparts=60000000.nor:1m(nor_bank0_rcw),1m(nor_bank0_uboot)
> ,1
> >
> m(nor_bank0_uboot_env),1m(nor_bank0_fman_uconde),40m(nor_bank0_fit
> ),1m
> >
> (nor_bank4_rcw),1m(nor_bank4_uboot),1m(nor_bank4_uboot_env),1m(nor_
> ban
> >
> k4_fman_ucode),40m(nor_bank4_fit);7e800000.flash:1m(nand_uboot),1m(na
> n
> > d_uboot_env),20m(nand_fit);spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(file
> > _system)
> > => env default bootargs
> > => printenv bootargs
> > bootargs=console=ttyS0,115200 root=/dev/ram0
> > earlycon=uart8250,mmio,0x21c0500 ${mtdparts}
> >
> >
> > The macro  CONFIG_BOOTARGS  only be extern as an char-string, and it will
> be spliced into default_environment array .
> >
> >  const uchar default_environment[] = { #ifdef  CONFIG_BOOTARGS
> >           "bootargs="     CONFIG_BOOTARGS                 "\0"
> >  #endif
> >
> > The variable we use to have $consoledev, $othbootargs  was used in the
> following cases:
> >
> > 858  #define CONFIG_BOOTCOMMAND \
> > 859         "setenv bootargs root=/dev/ram rw "             \
> > 860         "console=$consoledev,$baudrate $othbootargs;"   \
> > 861         "setenv ramdiskaddr 0x02000000;"                \
> > 862         "setenv fdtaddr 0x00c00000;"                    \
> > 863         "setenv loadaddr 0x1000000;"                    \
> > 864         "bootm $loadaddr $ramdiskaddr $fdtaddr"
> >
> > Because the "setenv"  will be executed  , So the variable could be extended.
> 
> I see what you mean. I am trying to reduce the environmental variables.
> Do you need the variable "mtdparts"?

[wenbin] 

I export this variable in order to make easier  to modify the bootargs under uboot command-line.

For example:
=>setenv bootargs  "console=ttyS0,115200  root=/dev/ram0  $mtdparts"
=>setenv bootargs  "console=ttyLP0,115200  root=/dev/ram0  $mtdparts"

Use the $mtdparts to instead of a long string.


> Would it be a better idea to set bootargs using the bootcmd?
[wenbin]

 yes, It is a good idea.
 But we need all kinds of  ways to boot kernel  with this  "bootargs".  The bootcmd only can specify one boot-way.
IOW,  only the way specified by this "bootcmd"  can  execute " setenv  bootargs".
So I want to supply the default bootargs  by the CONFIG_BOOTARGS .


> 
> While you are on it, I suggest you take a look at other variables.
> "console=ttyAMA0,38400n8" is wrong here.
> 
> We don't have to copy kernel image from NOR flash to DDR if the ramdisk load
> address is set properly in its file. So you can remove the copying from bootcmd.
> 
[wenbin]

Ok, thanks for your advices,  I will modify them on the later patch. 

> York
York Sun July 19, 2016, 10:02 p.m. UTC | #9
On 04/06/2016 10:46 PM, Wenbin Song wrote:
> Hi: York
>
> Please see my inline comments.
>
> Best Regards
> Wenbin Song
>
>> -----Original Message-----
>> From: York Sun [mailto:york.sun@nxp.com]
>> Sent: Thursday, April 07, 2016 1:18 AM
>> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu
>> <mingkai.hu@nxp.com>; u-boot@lists.denx.de
>> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie
>> <shaohui.xie@nxp.com>; Zhiqiang Hou <zhiqiang.hou@nxp.com>
>> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
>>
>> On 04/06/2016 12:11 AM, Wenbin Song wrote:
>>> Hi: York
>>>
>>> I set bootargs  as the following steps:
>>>
>>> => env default mtdparts
>>> => printenv mtdparts
>>>
>> mtdparts=mtdparts=60000000.nor:1m(nor_bank0_rcw),1m(nor_bank0_uboot)
>> ,1
>>>
>> m(nor_bank0_uboot_env),1m(nor_bank0_fman_uconde),40m(nor_bank0_fit
>> ),1m
>>>
>> (nor_bank4_rcw),1m(nor_bank4_uboot),1m(nor_bank4_uboot_env),1m(nor_
>> ban
>>>
>> k4_fman_ucode),40m(nor_bank4_fit);7e800000.flash:1m(nand_uboot),1m(na
>> n
>>> d_uboot_env),20m(nand_fit);spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(file
>>> _system)
>>> => env default bootargs
>>> => printenv bootargs
>>> bootargs=console=ttyS0,115200 root=/dev/ram0
>>> earlycon=uart8250,mmio,0x21c0500 ${mtdparts}
>>>
>>>
>>> The macro  CONFIG_BOOTARGS  only be extern as an char-string, and it will
>> be spliced into default_environment array .
>>>
>>>  const uchar default_environment[] = { #ifdef  CONFIG_BOOTARGS
>>>           "bootargs="     CONFIG_BOOTARGS                 "\0"
>>>  #endif
>>>
>>> The variable we use to have $consoledev, $othbootargs  was used in the
>> following cases:
>>>
>>> 858  #define CONFIG_BOOTCOMMAND \
>>> 859         "setenv bootargs root=/dev/ram rw "             \
>>> 860         "console=$consoledev,$baudrate $othbootargs;"   \
>>> 861         "setenv ramdiskaddr 0x02000000;"                \
>>> 862         "setenv fdtaddr 0x00c00000;"                    \
>>> 863         "setenv loadaddr 0x1000000;"                    \
>>> 864         "bootm $loadaddr $ramdiskaddr $fdtaddr"
>>>
>>> Because the "setenv"  will be executed  , So the variable could be extended.
>>
>> I see what you mean. I am trying to reduce the environmental variables.
>> Do you need the variable "mtdparts"?
>
> [wenbin]
>
> I export this variable in order to make easier  to modify the bootargs under uboot command-line.
>
> For example:
> =>setenv bootargs  "console=ttyS0,115200  root=/dev/ram0  $mtdparts"
> =>setenv bootargs  "console=ttyLP0,115200  root=/dev/ram0  $mtdparts"
>
> Use the $mtdparts to instead of a long string.
>
>
>> Would it be a better idea to set bootargs using the bootcmd?
> [wenbin]
>
>  yes, It is a good idea.
>  But we need all kinds of  ways to boot kernel  with this  "bootargs".  The bootcmd only can specify one boot-way.
> IOW,  only the way specified by this "bootcmd"  can  execute " setenv  bootargs".
> So I want to supply the default bootargs  by the CONFIG_BOOTARGS .
>
>
>>
>> While you are on it, I suggest you take a look at other variables.
>> "console=ttyAMA0,38400n8" is wrong here.
>>
>> We don't have to copy kernel image from NOR flash to DDR if the ramdisk load
>> address is set properly in its file. So you can remove the copying from bootcmd.
>>
> [wenbin]
>
> Ok, thanks for your advices,  I will modify them on the later patch.
>

Wenbin,

Do you have an update?

York
Wenbin song July 20, 2016, 3:02 a.m. UTC | #10
Hi: York

I'm sorry to have misunderstood you mean.
I think it is a good idea that modify/remove the wrong/useless variables  in a new patch.
And I will make it later.
Do you have any suggestion?

Best Regards
Wenbin Song

> -----Original Message-----
> From: york sun
> Sent: Wednesday, July 20, 2016 6:02 AM
> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu <mingkai.hu@nxp.com>;
> u-boot@lists.denx.de
> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie <shaohui.xie@nxp.com>;
> Zhiqiang Hou <zhiqiang.hou@nxp.com>
> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
> 
> On 04/06/2016 10:46 PM, Wenbin Song wrote:
> > Hi: York
> >
> > Please see my inline comments.
> >
> > Best Regards
> > Wenbin Song
> >
> >> -----Original Message-----
> >> From: York Sun [mailto:york.sun@nxp.com]
> >> Sent: Thursday, April 07, 2016 1:18 AM
> >> To: Wenbin Song <wenbin.song@nxp.com>; Mingkai Hu
> >> <mingkai.hu@nxp.com>; u-boot@lists.denx.de
> >> Cc: Qianyu Gong <qianyu.gong@nxp.com>; Shaohui Xie
> >> <shaohui.xie@nxp.com>; Zhiqiang Hou <zhiqiang.hou@nxp.com>
> >> Subject: Re: [PATCH] armv8/ls1043a: Add MTD partition scheme
> >>
> >> On 04/06/2016 12:11 AM, Wenbin Song wrote:
> >>> Hi: York
> >>>
> >>> I set bootargs  as the following steps:
> >>>
> >>> => env default mtdparts
> >>> => printenv mtdparts
> >>>
> >> mtdparts=mtdparts=60000000.nor:1m(nor_bank0_rcw),1m(nor_bank0_uboot)
> >> ,1
> >>>
> >> m(nor_bank0_uboot_env),1m(nor_bank0_fman_uconde),40m(nor_bank0_fit
> >> ),1m
> >>>
> >> (nor_bank4_rcw),1m(nor_bank4_uboot),1m(nor_bank4_uboot_env),1m(nor_
> >> ban
> >>>
> >> k4_fman_ucode),40m(nor_bank4_fit);7e800000.flash:1m(nand_uboot),1m(na
> >> n
> >>> d_uboot_env),20m(nand_fit);spi0.0:1m(uboot),5m(kernel),1m(dtb),9m(fi
> >>> le
> >>> _system)
> >>> => env default bootargs
> >>> => printenv bootargs
> >>> bootargs=console=ttyS0,115200 root=/dev/ram0
> >>> earlycon=uart8250,mmio,0x21c0500 ${mtdparts}
> >>>
> >>>
> >>> The macro  CONFIG_BOOTARGS  only be extern as an char-string, and it
> >>> will
> >> be spliced into default_environment array .
> >>>
> >>>  const uchar default_environment[] = { #ifdef  CONFIG_BOOTARGS
> >>>           "bootargs="     CONFIG_BOOTARGS                 "\0"
> >>>  #endif
> >>>
> >>> The variable we use to have $consoledev, $othbootargs  was used in
> >>> the
> >> following cases:
> >>>
> >>> 858  #define CONFIG_BOOTCOMMAND \
> >>> 859         "setenv bootargs root=/dev/ram rw "             \
> >>> 860         "console=$consoledev,$baudrate $othbootargs;"   \
> >>> 861         "setenv ramdiskaddr 0x02000000;"                \
> >>> 862         "setenv fdtaddr 0x00c00000;"                    \
> >>> 863         "setenv loadaddr 0x1000000;"                    \
> >>> 864         "bootm $loadaddr $ramdiskaddr $fdtaddr"
> >>>
> >>> Because the "setenv"  will be executed  , So the variable could be extended.
> >>
> >> I see what you mean. I am trying to reduce the environmental variables.
> >> Do you need the variable "mtdparts"?
> >
> > [wenbin]
> >
> > I export this variable in order to make easier  to modify the bootargs under
> uboot command-line.
> >
> > For example:
> > =>setenv bootargs  "console=ttyS0,115200  root=/dev/ram0  $mtdparts"
> > =>setenv bootargs  "console=ttyLP0,115200  root=/dev/ram0  $mtdparts"
> >
> > Use the $mtdparts to instead of a long string.
> >
> >
> >> Would it be a better idea to set bootargs using the bootcmd?
> > [wenbin]
> >
> >  yes, It is a good idea.
> >  But we need all kinds of  ways to boot kernel  with this  "bootargs".  The
> bootcmd only can specify one boot-way.
> > IOW,  only the way specified by this "bootcmd"  can  execute " setenv  bootargs".
> > So I want to supply the default bootargs  by the CONFIG_BOOTARGS .
> >
> >
> >>
> >> While you are on it, I suggest you take a look at other variables.
> >> "console=ttyAMA0,38400n8" is wrong here.
> >>
> >> We don't have to copy kernel image from NOR flash to DDR if the
> >> ramdisk load address is set properly in its file. So you can remove the copying
> from bootcmd.
> >>
> > [wenbin]
> >
> > Ok, thanks for your advices,  I will modify them on the later patch.
> >
> 
> Wenbin,
> 
> Do you have an update?
> 
> York
York Sun July 20, 2016, 9:27 p.m. UTC | #11
On 07/19/2016 08:02 PM, Wenbin Song wrote:
> Hi: York
>
> I'm sorry to have misunderstood you mean.
> I think it is a good idea that modify/remove the wrong/useless variables  in a new patch.
> And I will make it later.
> Do you have any suggestion?

Yes, please make a cleanup patch first, then your change of MTD partition.

York
diff mbox

Patch

diff --git a/include/configs/ls1043a_common.h b/include/configs/ls1043a_common.h
index fd243b1..6964873 100644
--- a/include/configs/ls1043a_common.h
+++ b/include/configs/ls1043a_common.h
@@ -236,6 +236,21 @@ 
 #define CONFIG_HWCONFIG
 #define HWCONFIG_BUFFER_SIZE		128
 
+#if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
+#define MTDPARTS_DEFAULT "mtdparts=spi0.0:1m(uboot)," \
+			"5m(kernel),1m(dtb),9m(file_system)"
+#else
+#define MTDPARTS_DEFAULT "mtdparts=60000000.nor:1m(nor_bank0_rcw)," \
+			"1m(nor_bank0_uboot),1m(nor_bank0_uboot_env)," \
+			"1m(nor_bank0_fman_uconde),40m(nor_bank0_fit)," \
+			"1m(nor_bank4_rcw),1m(nor_bank4_uboot)," \
+			"1m(nor_bank4_uboot_env),1m(nor_bank4_fman_ucode)," \
+			"40m(nor_bank4_fit);7e800000.flash:" \
+			"1m(nand_uboot),1m(nand_uboot_env)," \
+			"20m(nand_fit);spi0.0:1m(uboot)," \
+			"5m(kernel),1m(dtb),9m(file_system)"
+#endif
+
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS		\
 	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
@@ -248,10 +263,13 @@ 
 	"kernel_start=0x61100000\0"		\
 	"kernel_load=0xa0000000\0"		\
 	"kernel_size=0x2800000\0"		\
-	"console=ttyAMA0,38400n8\0"
+	"console=ttyAMA0,38400n8\0"		\
+	"mtdparts=" MTDPARTS_DEFAULT "\0"
 
 #define CONFIG_BOOTARGS			"console=ttyS0,115200 root=/dev/ram0 " \
-					"earlycon=uart8250,mmio,0x21c0500"
+					"earlycon=uart8250,mmio,0x21c0500 " \
+					MTDPARTS_DEFAULT
+
 #define CONFIG_BOOTCOMMAND		"cp.b $kernel_start $kernel_load "     \
 					"$kernel_size && bootm $kernel_load"
 #define CONFIG_BOOTDELAY		10