diff mbox series

[U-Boot,v3] board/lx2160ardb: Add distro boot support

Message ID 1548307216-5423-1-git-send-email-priyanka.jain@nxp.com
State Accepted
Delegated to: Prabhakar Kushwaha
Headers show
Series [U-Boot,v3] board/lx2160ardb: Add distro boot support | expand

Commit Message

Priyanka Jain Jan. 24, 2019, 5:22 a.m. UTC
Add u-boot enviroments to support distro boot which scan
boot.scr from external storage devices
(e.g. SD/USB/SCSI disk) and execute autoboot script

Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
---
Depends on https://patchwork.ozlabs.org/patch/990094/
Changes for v3:
 Add USB as boot target device

Changes for v2:
 xspi_bootcmd, sd_bootcmd env variables are
 dependent on board. So, move the definition
 from lx2160a_common.h file to lx2160ardb.h file

 configs/lx2160ardb_tfa_defconfig |  3 +-
 includefigs/lx2160a_common.h | 85 +++++++++++++++++++++++++++++++++++-----
 include/configs/lx2160ardb.h     | 29 +++++++-------
 3 files changed, 91 insertions(+), 26 deletions

Comments

Ashish Kumar Jan. 24, 2019, 5:33 a.m. UTC | #1
> -----Original Message-----
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Priyanka Jain
> Sent: Thursday, January 24, 2019 10:52 AM
> To: u-boot@lists.denx.de; York Sun <york.sun@nxp.com>
> Cc: Priyanka Jain <priyanka.jain@nxp.com>
> Subject: [U-Boot] [PATCH][v3] board/lx2160ardb: Add distro boot support
> 
> Add u-boot enviroments to support distro boot which scan boot.scr from
> external storage devices (e.g. SD/USB/SCSI disk) and execute autoboot script
> 
> Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
> ---
> Depends on
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch
> work.ozlabs.org%2Fpatch%2F990094%2F&amp;data=02%7C01%7CAshish.Ku
> mar%40nxp.com%7Ca8f46378f4674e15200208d681bbf3a8%7C686ea1d3bc2
> b4c6fa92cd99c5c301635%7C0%7C0%7C636839041601258920&amp;sdata=g
> Sg%2FH8h7cSD8dDO533bs6%2B9kRlHAsTub3HrVq6fzrbY%3D&amp;reserved=
> 0
> Changes for v3:
>  Add USB as boot target device
> 
> Changes for v2:
>  xspi_bootcmd, sd_bootcmd env variables are  dependent on board. So, move
> the definition  from lx2160a_common.h file to lx2160ardb.h file
> 
>  configs/lx2160ardb_tfa_defconfig |  3 +-  includefigs/lx2160a_common.h | 85
> +++++++++++++++++++++++++++++++++++-----
>  include/configs/lx2160ardb.h     | 29 +++++++-------
>  3 files changed, 91 insertions(+), 26 deletions diff --git
> a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
> index 67ba96b..8fb4950 100644
> --- a
> +++ b/configs/lx2160ardb_tfa_defconfig
> @@ -6,7 +6,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
>  CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
>  CONFIG_NR_DRAM_BANKS=3
>  CONFIG_DM=y
> -CONFIG_FIT=y
>  CONFIG_FIT_VERBOSE=y
>  CONFIG_OF_BOARD_SETUP=y
>  CONFIG_OF_STDOUT_VIA_ALIAS=y
> @@ -14,7 +13,7 @@ CONFIG_TFABOOT=y
>  CONFIG_BOOTDELAY=10
>  CONFIG_USE_BOOTARGS=y
>  CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0
> earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000
> default_hugepagesz=1024m hugepagesz=1024m hugepages=2
> pci=pcie_bus_perf"
> -# CONFIG_CMD_IMLS is not set
> +# CONFIG_USE_BOOTCOMMAND is not set
>  CONFIG_CMD_GREPENV=y
>  CONFIG_CMD_EEPROM=y
>  CONFIG_CMD_GPT=y
> diff --git a/include/configs/lx2160a_common.h
> b/include/configs/lx2160a_common.h
> index 41931e5..0e0e72d 100644
> --- a/include/configs/lx2160a_common.h
> +++ b/include/configs/lx2160a_common.h
> @@ -193,16 +193,6 @@ unsigned long get_board_ddr_clk(void);
>  #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size
> */
> 
>  /* Initial environment variables */
> -#define XSPI_NOR_BOOTCOMMAND	"fsl_mc apply dpl 0x20d00000;" \
> -				"sf probe 0:0;" \
> -				"sf read 0xa0000000 0x1000000 0x3000000;"
> \
> -				"bootm 0xa0000000"
> -
> -#define SD_BOOTCOMMAND		"mmc read 0xa0000000 0x6800
> 0xA0;" \
> -				"fsl_mc apply dpl 0xa0000000;" \
> -				"mmc read 0xb0000000 0x8000 0x1d000;" \
> -				"bootm 0xb0000000"
> -
>  #define XSPI_MC_INIT_CMD			\
>  	"fsl_mc start mc 0x20a00000 0x20e00000\0"
> 
> @@ -211,4 +201,79 @@ unsigned long get_board_ddr_clk(void);
>  	"mmc read 0x80100000 0x7000 0x800;"	\
>  	"fsl_mc start mc 0x80000000 0x80100000\0"
> 
> +#define EXTRA_ENV_SETTINGS			\
> +	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
> +	"ramdisk_addr=0x800000\0"		\
> +	"ramdisk_size=0x2000000\0"		\
> +	"fdt_high=0xa0000000\0"			\
> +	"initrd_high=0xffffffffffffffff\0"	\
> +	"fdt_addr=0x64f00000\0"			\
> +	"kernel_start=0x1000000\0"		\
> +	"kernelheader_start=0x800000\0"		\
> +	"scriptaddr=0x80000000\0"		\
> +	"scripthdraddr=0x80080000\0"		\
> +	"fdtheader_addr_r=0x80100000\0"		\
> +	"kernelheader_addr_r=0x80200000\0"	\
> +	"kernel_addr_r=0x81000000\0"		\
> +	"kernelheader_size=0x40000\0"		\
> +	"fdt_addr_r=0x90000000\0"		\
> +	"load_addr=0xa0000000\0"		\
> +	"kernel_size=0x2800000\0"		\
> +	"kernel_addr_sd=0x8000\0"		\
> +	"kernel_size_sd=0x1d000\0"              \
> +	"console=ttyAMA0,38400n8\0"		\
> +	BOOTENV					\
> +	"mcmemsize=0x70000000\0"		\
> +	XSPI_MC_INIT_CMD				\
> +	"boot_scripts=lx2160ardb_boot.scr\0"	\
> +	"boot_script_hdr=hdr_lx2160ardb_bs.out\0"	\
> +	"scan_dev_for_boot_part="		\
> +		"part list ${devtype} ${devnum} devplist; "	\
> +		"env exists devplist || setenv devplist 1; "	\
> +		"for distro_bootpart in ${devplist}; do "	\
> +			"if fstype ${devtype} "			\
> +				"${devnum}:${distro_bootpart} "	\
> +				"bootfstype; then "		\
> +				"run scan_dev_for_boot; "	\
> +			"fi; "					\
> +		"done\0"					\
> +	"scan_dev_for_boot="					\
> +		"echo Scanning ${devtype} "			\
> +			"${devnum}:${distro_bootpart}...; "	\
> +		"for prefix in ${boot_prefixes}; do "		\
> +			"run scan_dev_for_scripts; "		\
> +		"done;\0"					\
> +	"boot_a_script="					\
> +		"load ${devtype} ${devnum}:${distro_bootpart} "	\
> +			"${scriptaddr} ${prefix}${script}; "	\
> +		"env exists secureboot && load ${devtype} "	\
> +			"${devnum}:${distro_bootpart} "		\
> +			"${scripthdraddr} ${prefix}${boot_script_hdr} "	\
> +			"&& esbc_validate ${scripthdraddr};"	\
> +		"source ${scriptaddr}\0"
> +
> +#define XSPI_NOR_BOOTCOMMAND
> 	\
> +			"env exists mcinitcmd && env exists secureboot "\
> +			"&& esbc_validate 0x20780000; "
> 	\
> +			"env exists mcinitcmd && "			\
> +			"fsl_mc lazyapply dpl 0x20d00000; "		\
> +			"run distro_bootcmd;run xspi_bootcmd; "
> 	\
> +			"env exists secureboot && esbc_halt;"
> +
> +#define SD_BOOTCOMMAND						\
> +		"env exists mcinitcmd && mmcinfo; "		\
> +		"mmc read 0x80001000 0x6800 0x800; "		\
> +		"env exists mcinitcmd && env exists secureboot "	\
> +		" && mmc read 0x80780000 0x3C00 0x10 "		\
> +		"&& esbc_validate 0x80780000;env exists mcinitcmd "	\
> +		"&& fsl_mc lazyapply dpl 0x80001000;"		\
> +		"run distro_bootcmd;run sd_bootcmd;"		\
> +		"env exists secureboot && esbc_halt;"
> +
> +#define BOOT_TARGET_DEVICES(func) \
> +	func(USB, usb, 0) \
> +	func(MMC, mmc, 0) \
> +	func(SCSI, scsi, 0)
Dhcp can also be added here.

Regards
Ashish 
> +#include <config_distro_bootcmd.h>
> +
>  #endif /* __LX2_COMMON_H */
> diff --git a/include/configs/lx2160ardb.h b/include/configs/lx2160ardb.h index
> 67d214d..8c91fea 100644
> --- a/include/configs/lx2160ardb.h
> +++ b/include/configs/lx2160ardb.h
> @@ -81,21 +81,22 @@
> 
>  /* Initial environment variables */
>  #define CONFIG_EXTRA_ENV_SETTINGS		\
> -	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
> -	"scriptaddr=0x80800000\0"		\
> -	"kernel_addr_r=0x81000000\0"		\
> -	"pxefile_addr_r=0x81000000\0"		\
> -	"fdt_addr_r=0x88000000\0"		\
> -	"ramdisk_addr_r=0x89000000\0"		\
> -	"loadaddr=0x80100000\0"			\
> -	"kernel_addr=0x100000\0"		\
> -	"ramdisk_addr=0x800000\0"		\
> -	"ramdisk_size=0x2000000\0"		\
> -	"fdt_high=0xa0000000\0"			\
> -	"initrd_high=0xffffffffffffffff\0"	\
> -	"kernel_start=0x21000000\0"		\
> +	EXTRA_ENV_SETTINGS			\
>  	"lx2160ardb_vdd_mv=800\0"		\
> -	"mcmemsize=0x40000000\0"
> +	"BOARD=lx2160ardb\0"			\
> +	"xspi_bootcmd=echo Trying load from flexspi..;"		\
> +		"sf probe 0:0 && sf read $load_addr "		\
> +		"$kernel_start $kernel_size ; env exists secureboot &&"	\
> +		"sf read $kernelheader_addr_r $kernelheader_start "	\
> +		"$kernelheader_size && esbc_validate
> ${kernelheader_addr_r}; "\
> +		" bootm $load_addr#$BOARD\0"			\
> +	"sd_bootcmd=echo Trying load from sd card..;"		\
> +		"mmcinfo; mmc read $load_addr "			\
> +		"$kernel_addr_sd $kernel_size_sd ;"		\
> +		"env exists secureboot && mmc read $kernelheader_addr_r "\
> +		"$kernelhdr_addr_sd $kernelhdr_size_sd "	\
> +		" && esbc_validate ${kernelheader_addr_r};"	\
> +		"bootm $load_addr#$BOARD\0"
> 
>  #include <asm/fsl_secure_boot.h>
> 
> --
> 2.7.4
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.de
> nx.de%2Flistinfo%2Fu-
> boot&amp;data=02%7C01%7CAshish.Kumar%40nxp.com%7Ca8f46378f4674e
> 15200208d681bbf3a8%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%
> 7C636839041601258920&amp;sdata=B2KWMSyxQFkzBpZM5FWzAUQvDeQl5
> 9%2F6oAk5vTWHhL4%3D&amp;reserved=0
Priyanka Jain Feb. 12, 2019, 8:44 a.m. UTC | #2
>-----Original Message-----
>From: Ashish Kumar
>Sent: Thursday, January 24, 2019 11:04 AM
>To: Priyanka Jain <priyanka.jain@nxp.com>; u-boot@lists.denx.de; York Sun
><york.sun@nxp.com>
>Subject: RE: [U-Boot] [PATCH][v3] board/lx2160ardb: Add distro boot support
>
>
>
>> -----Original Message-----
>> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Priyanka Jain
>> Sent: Thursday, January 24, 2019 10:52 AM
>> To: u-boot@lists.denx.de; York Sun <york.sun@nxp.com>
>> Cc: Priyanka Jain <priyanka.jain@nxp.com>
>> Subject: [U-Boot] [PATCH][v3] board/lx2160ardb: Add distro boot
>> support
>>
>> Add u-boot enviroments to support distro boot which scan boot.scr from
>> external storage devices (e.g. SD/USB/SCSI disk) and execute autoboot
>> script
>>
>> Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
>> ---
>> Depends on
>>
>https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpat
>> ch
>work.ozlabs.org%2Fpatch%2F990094%2F&amp;data=02%7C01%7CAshish.Ku
>>
>mar%40nxp.com%7Ca8f46378f4674e15200208d681bbf3a8%7C686ea1d3bc2
>>
>b4c6fa92cd99c5c301635%7C0%7C0%7C636839041601258920&amp;sdata=g
>>
>Sg%2FH8h7cSD8dDO533bs6%2B9kRlHAsTub3HrVq6fzrbY%3D&amp;reserved=
>> 0
>> Changes for v3:
>>  Add USB as boot target device
>>
>> Changes for v2:
>>  xspi_bootcmd, sd_bootcmd env variables are  dependent on board. So,
>> move the definition  from lx2160a_common.h file to lx2160ardb.h file
>>
>>  configs/lx2160ardb_tfa_defconfig |  3 +-
>> includefigs/lx2160a_common.h | 85
>> +++++++++++++++++++++++++++++++++++-----
>>  include/configs/lx2160ardb.h     | 29 +++++++-------
>>  3 files changed, 91 insertions(+), 26 deletions diff --git
>> a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
>> index 67ba96b..8fb4950 100644
>> --- a
>> +++ b/configs/lx2160ardb_tfa_defconfig
>> @@ -6,7 +6,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
>>  CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
>>  CONFIG_NR_DRAM_BANKS=3
>>  CONFIG_DM=y
>> -CONFIG_FIT=y
>>  CONFIG_FIT_VERBOSE=y
>>  CONFIG_OF_BOARD_SETUP=y
>>  CONFIG_OF_STDOUT_VIA_ALIAS=y
>> @@ -14,7 +13,7 @@ CONFIG_TFABOOT=y
>>  CONFIG_BOOTDELAY=10
>>  CONFIG_USE_BOOTARGS=y
>>  CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0
>> earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000
>> default_hugepagesz=1024m hugepagesz=1024m hugepages=2
>> pci=pcie_bus_perf"
>> -# CONFIG_CMD_IMLS is not set
>> +# CONFIG_USE_BOOTCOMMAND is not set
>>  CONFIG_CMD_GREPENV=y
>>  CONFIG_CMD_EEPROM=y
>>  CONFIG_CMD_GPT=y
>> diff --git a/include/configs/lx2160a_common.h
>> b/include/configs/lx2160a_common.h
>> index 41931e5..0e0e72d 100644
>> --- a/include/configs/lx2160a_common.h
>> +++ b/include/configs/lx2160a_common.h
>> @@ -193,16 +193,6 @@ unsigned long get_board_ddr_clk(void);
>>  #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip
>size
>> */
>>
>>  /* Initial environment variables */
>> -#define XSPI_NOR_BOOTCOMMAND	"fsl_mc apply dpl
>0x20d00000;" \
>> -				"sf probe 0:0;" \
>> -				"sf read 0xa0000000 0x1000000 0x3000000;"
>> \
>> -				"bootm 0xa0000000"
>> -
>> -#define SD_BOOTCOMMAND		"mmc read 0xa0000000
>0x6800
>> 0xA0;" \
>> -				"fsl_mc apply dpl 0xa0000000;" \
>> -				"mmc read 0xb0000000 0x8000 0x1d000;" \
>> -				"bootm 0xb0000000"
>> -
>>  #define XSPI_MC_INIT_CMD			\
>>  	"fsl_mc start mc 0x20a00000 0x20e00000\0"
>>
>> @@ -211,4 +201,79 @@ unsigned long get_board_ddr_clk(void);
>>  	"mmc read 0x80100000 0x7000 0x800;"	\
>>  	"fsl_mc start mc 0x80000000 0x80100000\0"
>>
>> +#define EXTRA_ENV_SETTINGS			\
>> +	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
>> +	"ramdisk_addr=0x800000\0"		\
>> +	"ramdisk_size=0x2000000\0"		\
>> +	"fdt_high=0xa0000000\0"			\
>> +	"initrd_high=0xffffffffffffffff\0"	\
>> +	"fdt_addr=0x64f00000\0"			\
>> +	"kernel_start=0x1000000\0"		\
>> +	"kernelheader_start=0x800000\0"		\
>> +	"scriptaddr=0x80000000\0"		\
>> +	"scripthdraddr=0x80080000\0"		\
>> +	"fdtheader_addr_r=0x80100000\0"		\
>> +	"kernelheader_addr_r=0x80200000\0"	\
>> +	"kernel_addr_r=0x81000000\0"		\
>> +	"kernelheader_size=0x40000\0"		\
>> +	"fdt_addr_r=0x90000000\0"		\
>> +	"load_addr=0xa0000000\0"		\
>> +	"kernel_size=0x2800000\0"		\
>> +	"kernel_addr_sd=0x8000\0"		\
>> +	"kernel_size_sd=0x1d000\0"              \
>> +	"console=ttyAMA0,38400n8\0"		\
>> +	BOOTENV					\
>> +	"mcmemsize=0x70000000\0"		\
>> +	XSPI_MC_INIT_CMD				\
>> +	"boot_scripts=lx2160ardb_boot.scr\0"	\
>> +	"boot_script_hdr=hdr_lx2160ardb_bs.out\0"	\
>> +	"scan_dev_for_boot_part="		\
>> +		"part list ${devtype} ${devnum} devplist; "	\
>> +		"env exists devplist || setenv devplist 1; "	\
>> +		"for distro_bootpart in ${devplist}; do "	\
>> +			"if fstype ${devtype} "			\
>> +				"${devnum}:${distro_bootpart} "	\
>> +				"bootfstype; then "		\
>> +				"run scan_dev_for_boot; "	\
>> +			"fi; "					\
>> +		"done\0"					\
>> +	"scan_dev_for_boot="					\
>> +		"echo Scanning ${devtype} "			\
>> +			"${devnum}:${distro_bootpart}...; "	\
>> +		"for prefix in ${boot_prefixes}; do "		\
>> +			"run scan_dev_for_scripts; "		\
>> +		"done;\0"					\
>> +	"boot_a_script="					\
>> +		"load ${devtype} ${devnum}:${distro_bootpart} "	\
>> +			"${scriptaddr} ${prefix}${script}; "	\
>> +		"env exists secureboot && load ${devtype} "	\
>> +			"${devnum}:${distro_bootpart} "		\
>> +			"${scripthdraddr} ${prefix}${boot_script_hdr} "	\
>> +			"&& esbc_validate ${scripthdraddr};"	\
>> +		"source ${scriptaddr}\0"
>> +
>> +#define XSPI_NOR_BOOTCOMMAND
>> 	\
>> +			"env exists mcinitcmd && env exists secureboot "\
>> +			"&& esbc_validate 0x20780000; "
>> 	\
>> +			"env exists mcinitcmd && "			\
>> +			"fsl_mc lazyapply dpl 0x20d00000; "		\
>> +			"run distro_bootcmd;run xspi_bootcmd; "
>> 	\
>> +			"env exists secureboot && esbc_halt;"
>> +
>> +#define SD_BOOTCOMMAND
>	\
>> +		"env exists mcinitcmd && mmcinfo; "		\
>> +		"mmc read 0x80001000 0x6800 0x800; "		\
>> +		"env exists mcinitcmd && env exists secureboot "	\
>> +		" && mmc read 0x80780000 0x3C00 0x10 "		\
>> +		"&& esbc_validate 0x80780000;env exists mcinitcmd "	\
>> +		"&& fsl_mc lazyapply dpl 0x80001000;"		\
>> +		"run distro_bootcmd;run sd_bootcmd;"		\
>> +		"env exists secureboot && esbc_halt;"
>> +
>> +#define BOOT_TARGET_DEVICES(func) \
>> +	func(USB, usb, 0) \
>> +	func(MMC, mmc, 0) \
>> +	func(SCSI, scsi, 0)
>Dhcp can also be added here.
>
>Regards
>Ashish


Dhcp not tested yet. 
To add dhcp support, additional patch can be submitted later-on after proper testing
Priyanka

<snip>

>>
>> --
>> 2.7.4
>>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot@lists.denx.de
>> https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flis
>> ts.de
>> nx.de%2Flistinfo%2Fu-
>>
>boot&amp;data=02%7C01%7CAshish.Kumar%40nxp.com%7Ca8f46378f4674e
>>
>15200208d681bbf3a8%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%
>>
>7C636839041601258920&amp;sdata=B2KWMSyxQFkzBpZM5FWzAUQvDeQl5
>> 9%2F6oAk5vTWHhL4%3D&amp;reserved=0
Prabhakar Kushwaha Feb. 20, 2019, 7:46 a.m. UTC | #3
> -----Original Message-----
> From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Ashish Kumar
> Sent: Thursday, January 24, 2019 11:04 AM
> To: Priyanka Jain <priyanka.jain@nxp.com>; u-boot@lists.denx.de; York Sun
> <york.sun@nxp.com>
> Subject: Re: [U-Boot] [PATCH][v3] board/lx2160ardb: Add distro boot
> support
> 
> 
> 
> > -----Original Message-----
> > From: U-Boot <u-boot-bounces@lists.denx.de> On Behalf Of Priyanka Jain
> > Sent: Thursday, January 24, 2019 10:52 AM
> > To: u-boot@lists.denx.de; York Sun <york.sun@nxp.com>
> > Cc: Priyanka Jain <priyanka.jain@nxp.com>
> > Subject: [U-Boot] [PATCH][v3] board/lx2160ardb: Add distro boot
> > support
> >
> > Add u-boot enviroments to support distro boot which scan boot.scr from
> > external storage devices (e.g. SD/USB/SCSI disk) and execute autoboot
> > script
> >
> > Signed-off-by: Priyanka Jain <priyanka.jain@nxp.com>
> > ---

This patch been applied to fsl-qoriq master, awaiting upstream.

--pk
diff mbox series

Patch

diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig
index 67ba96b..8fb4950 100644
--- a
+++ b/configs/lx2160ardb_tfa_defconfig
@@ -6,7 +6,6 @@  CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y
 CONFIG_DEFAULT_DEVICE_TREE="fsl-lx2160a-rdb"
 CONFIG_NR_DRAM_BANKS=3
 CONFIG_DM=y
-CONFIG_FIT=y
 CONFIG_FIT_VERBOSE=y
 CONFIG_OF_BOARD_SETUP=y
 CONFIG_OF_STDOUT_VIA_ALIAS=y
@@ -14,7 +13,7 @@  CONFIG_TFABOOT=y
 CONFIG_BOOTDELAY=10
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyAMA0,115200 root=/dev/ram0 earlycon=pl011,mmio32,0x21c0000 ramdisk_size=0x2000000 default_hugepagesz=1024m hugepagesz=1024m hugepages=2 pci=pcie_bus_perf"
-# CONFIG_CMD_IMLS is not set
+# CONFIG_USE_BOOTCOMMAND is not set
 CONFIG_CMD_GREPENV=y
 CONFIG_CMD_EEPROM=y
 CONFIG_CMD_GPT=y
diff --git a/include/configs/lx2160a_common.h b/include/configs/lx2160a_common.h
index 41931e5..0e0e72d 100644
--- a/include/configs/lx2160a_common.h
+++ b/include/configs/lx2160a_common.h
@@ -193,16 +193,6 @@  unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_BOOTM_LEN   (64 << 20)      /* Increase max gunzip size */
 
 /* Initial environment variables */
-#define XSPI_NOR_BOOTCOMMAND	"fsl_mc apply dpl 0x20d00000;" \
-				"sf probe 0:0;" \
-				"sf read 0xa0000000 0x1000000 0x3000000;" \
-				"bootm 0xa0000000"
-
-#define SD_BOOTCOMMAND		"mmc read 0xa0000000 0x6800 0xA0;" \
-				"fsl_mc apply dpl 0xa0000000;" \
-				"mmc read 0xb0000000 0x8000 0x1d000;" \
-				"bootm 0xb0000000"
-
 #define XSPI_MC_INIT_CMD			\
 	"fsl_mc start mc 0x20a00000 0x20e00000\0"
 
@@ -211,4 +201,79 @@  unsigned long get_board_ddr_clk(void);
 	"mmc read 0x80100000 0x7000 0x800;"	\
 	"fsl_mc start mc 0x80000000 0x80100000\0"
 
+#define EXTRA_ENV_SETTINGS			\
+	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
+	"ramdisk_addr=0x800000\0"		\
+	"ramdisk_size=0x2000000\0"		\
+	"fdt_high=0xa0000000\0"			\
+	"initrd_high=0xffffffffffffffff\0"	\
+	"fdt_addr=0x64f00000\0"			\
+	"kernel_start=0x1000000\0"		\
+	"kernelheader_start=0x800000\0"		\
+	"scriptaddr=0x80000000\0"		\
+	"scripthdraddr=0x80080000\0"		\
+	"fdtheader_addr_r=0x80100000\0"		\
+	"kernelheader_addr_r=0x80200000\0"	\
+	"kernel_addr_r=0x81000000\0"		\
+	"kernelheader_size=0x40000\0"		\
+	"fdt_addr_r=0x90000000\0"		\
+	"load_addr=0xa0000000\0"		\
+	"kernel_size=0x2800000\0"		\
+	"kernel_addr_sd=0x8000\0"		\
+	"kernel_size_sd=0x1d000\0"              \
+	"console=ttyAMA0,38400n8\0"		\
+	BOOTENV					\
+	"mcmemsize=0x70000000\0"		\
+	XSPI_MC_INIT_CMD				\
+	"boot_scripts=lx2160ardb_boot.scr\0"	\
+	"boot_script_hdr=hdr_lx2160ardb_bs.out\0"	\
+	"scan_dev_for_boot_part="		\
+		"part list ${devtype} ${devnum} devplist; "	\
+		"env exists devplist || setenv devplist 1; "	\
+		"for distro_bootpart in ${devplist}; do "	\
+			"if fstype ${devtype} "			\
+				"${devnum}:${distro_bootpart} "	\
+				"bootfstype; then "		\
+				"run scan_dev_for_boot; "	\
+			"fi; "					\
+		"done\0"					\
+	"scan_dev_for_boot="					\
+		"echo Scanning ${devtype} "			\
+			"${devnum}:${distro_bootpart}...; "	\
+		"for prefix in ${boot_prefixes}; do "		\
+			"run scan_dev_for_scripts; "		\
+		"done;\0"					\
+	"boot_a_script="					\
+		"load ${devtype} ${devnum}:${distro_bootpart} "	\
+			"${scriptaddr} ${prefix}${script}; "	\
+		"env exists secureboot && load ${devtype} "	\
+			"${devnum}:${distro_bootpart} "		\
+			"${scripthdraddr} ${prefix}${boot_script_hdr} "	\
+			"&& esbc_validate ${scripthdraddr};"	\
+		"source ${scriptaddr}\0"
+
+#define XSPI_NOR_BOOTCOMMAND						\
+			"env exists mcinitcmd && env exists secureboot "\
+			"&& esbc_validate 0x20780000; "			\
+			"env exists mcinitcmd && "			\
+			"fsl_mc lazyapply dpl 0x20d00000; "		\
+			"run distro_bootcmd;run xspi_bootcmd; "		\
+			"env exists secureboot && esbc_halt;"
+
+#define SD_BOOTCOMMAND						\
+		"env exists mcinitcmd && mmcinfo; "		\
+		"mmc read 0x80001000 0x6800 0x800; "		\
+		"env exists mcinitcmd && env exists secureboot "	\
+		" && mmc read 0x80780000 0x3C00 0x10 "		\
+		"&& esbc_validate 0x80780000;env exists mcinitcmd "	\
+		"&& fsl_mc lazyapply dpl 0x80001000;"		\
+		"run distro_bootcmd;run sd_bootcmd;"		\
+		"env exists secureboot && esbc_halt;"
+
+#define BOOT_TARGET_DEVICES(func) \
+	func(USB, usb, 0) \
+	func(MMC, mmc, 0) \
+	func(SCSI, scsi, 0)
+#include <config_distro_bootcmd.h>
+
 #endif /* __LX2_COMMON_H */
diff --git a/include/configs/lx2160ardb.h b/include/configs/lx2160ardb.h
index 67d214d..8c91fea 100644
--- a/include/configs/lx2160ardb.h
+++ b/include/configs/lx2160ardb.h
@@ -81,21 +81,22 @@ 
 
 /* Initial environment variables */
 #define CONFIG_EXTRA_ENV_SETTINGS		\
-	"hwconfig=fsl_ddr:bank_intlv=auto\0"	\
-	"scriptaddr=0x80800000\0"		\
-	"kernel_addr_r=0x81000000\0"		\
-	"pxefile_addr_r=0x81000000\0"		\
-	"fdt_addr_r=0x88000000\0"		\
-	"ramdisk_addr_r=0x89000000\0"		\
-	"loadaddr=0x80100000\0"			\
-	"kernel_addr=0x100000\0"		\
-	"ramdisk_addr=0x800000\0"		\
-	"ramdisk_size=0x2000000\0"		\
-	"fdt_high=0xa0000000\0"			\
-	"initrd_high=0xffffffffffffffff\0"	\
-	"kernel_start=0x21000000\0"		\
+	EXTRA_ENV_SETTINGS			\
 	"lx2160ardb_vdd_mv=800\0"		\
-	"mcmemsize=0x40000000\0"
+	"BOARD=lx2160ardb\0"			\
+	"xspi_bootcmd=echo Trying load from flexspi..;"		\
+		"sf probe 0:0 && sf read $load_addr "		\
+		"$kernel_start $kernel_size ; env exists secureboot &&"	\
+		"sf read $kernelheader_addr_r $kernelheader_start "	\
+		"$kernelheader_size && esbc_validate ${kernelheader_addr_r}; "\
+		" bootm $load_addr#$BOARD\0"			\
+	"sd_bootcmd=echo Trying load from sd card..;"		\
+		"mmcinfo; mmc read $load_addr "			\
+		"$kernel_addr_sd $kernel_size_sd ;"		\
+		"env exists secureboot && mmc read $kernelheader_addr_r "\
+		"$kernelhdr_addr_sd $kernelhdr_size_sd "	\
+		" && esbc_validate ${kernelheader_addr_r};"	\
+		"bootm $load_addr#$BOARD\0"
 
 #include <asm/fsl_secure_boot.h>