diff mbox series

[U-Boot,2/3] armv8: ls1088a: SPL size reduction

Message ID 1503990107-28658-2-git-send-email-sumit.garg@nxp.com
State Superseded
Delegated to: York Sun
Headers show
Series [U-Boot,1/3] armv8: fsl-layerscape: SPL size reduction | expand

Commit Message

Sumit Garg Aug. 29, 2017, 7:01 a.m. UTC
Using changes in this patch we were able to reduce approx 8k
size of u-boot-spl.bin image. Following is breif description of
changes to reduce SPL size:
1. Changes in board/freescale/ls1088a/Makefile to remove
   compilation of eth.c and cpld.c in case of SPL build.
2. Changes in board/freescale/ls1088a/ls1088a.c to keep
   board_early_init_f funcations in case of SPL build.
3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
   specific macros due to which static data was being compiled in
   case of SPL build.
4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
   not being enabled in case of SPL image but was compiled in to
   add redundant code.

Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
---

Dependent on ls1088 base SD boot target. Also dependent on ls1088
QPSI secure boot target.

 board/freescale/ls1088a/Makefile  |  4 +++-
 board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
 include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
 include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
 4 files changed, 51 insertions(+), 7 deletions(-)

Comments

York Sun Aug. 29, 2017, 3:55 p.m. UTC | #1
On 08/29/2017 12:02 AM, Sumit Garg wrote:
> Using changes in this patch we were able to reduce approx 8k
> size of u-boot-spl.bin image. Following is breif description of
> changes to reduce SPL size:
> 1. Changes in board/freescale/ls1088a/Makefile to remove
>     compilation of eth.c and cpld.c in case of SPL build.
> 2. Changes in board/freescale/ls1088a/ls1088a.c to keep
>     board_early_init_f funcations in case of SPL build.
> 3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
>     specific macros due to which static data was being compiled in
>     case of SPL build.
> 4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
>     not being enabled in case of SPL image but was compiled in to
>     add redundant code.
> 
> Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
> ---
> 
> Dependent on ls1088 base SD boot target. Also dependent on ls1088
> QPSI secure boot target.
> 
>   board/freescale/ls1088a/Makefile  |  4 +++-
>   board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
>   include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
>   include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
>   4 files changed, 51 insertions(+), 7 deletions(-)
> 
> diff --git a/board/freescale/ls1088a/Makefile b/board/freescale/ls1088a/Makefile
> index bdcce9e..0e15031 100644
> --- a/board/freescale/ls1088a/Makefile
> +++ b/board/freescale/ls1088a/Makefile
> @@ -5,6 +5,8 @@
>   #
>   
>   obj-y += ls1088a.o
> +obj-y += ddr.o
> +ifndef CONFIG_SPL_BUILD
>   obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
>   obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o
> -obj-y += ddr.o
> +endif
> diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
> index 1860f9c..1c28ab4 100644
> --- a/board/freescale/ls1088a/ls1088a.c
> +++ b/board/freescale/ls1088a/ls1088a.c
> @@ -24,6 +24,13 @@
>   
>   DECLARE_GLOBAL_DATA_PTR;
>   
> +int board_early_init_f(void)
> +{
> +	fsl_lsch3_early_init_f();
> +	return 0;
> +}
> +
> +#if !defined(CONFIG_SPL_BUILD)
>   unsigned long long get_qixis_addr(void)
>   {
>   	unsigned long long addr;
> @@ -324,12 +331,6 @@ int board_init(void)
>   	return 0;
>   }
>   
> -int board_early_init_f(void)
> -{
> -	fsl_lsch3_early_init_f();
> -	return 0;
> -}
> -
>   void detail_board_ddr_info(void)
>   {
>   	puts("\nDDR    ");
> @@ -404,3 +405,4 @@ int ft_board_setup(void *blob, bd_t *bd)
>   	return 0;
>   }
>   #endif
> +#endif /* defined(CONFIG_SPL_BUILD) */
> diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h
> index 63b69f8..fb4c852 100644
> --- a/include/configs/ls1088a_common.h
> +++ b/include/configs/ls1088a_common.h
> @@ -7,6 +7,20 @@
>   #ifndef __LS1088_COMMON_H
>   #define __LS1088_COMMON_H
>   
> +/* SPL build */
> +#ifdef CONFIG_SPL_BUILD
> +#define SPL_NO_BOARDINFO
> +#define SPL_NO_QIXIS
> +#define SPL_NO_PCI
> +#define SPL_NO_ENV
> +#define SPL_NO_RTC
> +#define SPL_NO_USB
> +#define SPL_NO_SATA
> +#define SPL_NO_QSPI
> +#define SPL_NO_IFC
> +#define CONFIG_SYS_DCACHE_OFF

How much space can you save with data cache off? I prefer to leave the 
cache on. Cache is used if PPA is loaded in SPL stage for boost booting 
speed.

York
Sumit Garg Aug. 29, 2017, 5:36 p.m. UTC | #2
> -----Original Message-----
> From: York Sun
> Sent: Tuesday, August 29, 2017 9:25 PM
> To: Sumit Garg <sumit.garg@nxp.com>; u-boot@lists.denx.de
> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; Ruchika Gupta
> <ruchika.gupta@nxp.com>
> Subject: Re: [u-boot-release] [PATCH 2/3] armv8: ls1088a: SPL size reduction
> 
> On 08/29/2017 12:02 AM, Sumit Garg wrote:
> > Using changes in this patch we were able to reduce approx 8k size of
> > u-boot-spl.bin image. Following is breif description of changes to
> > reduce SPL size:
> > 1. Changes in board/freescale/ls1088a/Makefile to remove
> >     compilation of eth.c and cpld.c in case of SPL build.
> > 2. Changes in board/freescale/ls1088a/ls1088a.c to keep
> >     board_early_init_f funcations in case of SPL build.
> > 3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
> >     specific macros due to which static data was being compiled in
> >     case of SPL build.
> > 4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
> >     not being enabled in case of SPL image but was compiled in to
> >     add redundant code.
> >
> > Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
> > ---
> >
> > Dependent on ls1088 base SD boot target. Also dependent on ls1088 QPSI
> > secure boot target.
> >
> >   board/freescale/ls1088a/Makefile  |  4 +++-
> >   board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
> >   include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
> >   include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
> >   4 files changed, 51 insertions(+), 7 deletions(-)
> >
> > diff --git a/board/freescale/ls1088a/Makefile
> > b/board/freescale/ls1088a/Makefile
> > index bdcce9e..0e15031 100644
> > --- a/board/freescale/ls1088a/Makefile
> > +++ b/board/freescale/ls1088a/Makefile
> > @@ -5,6 +5,8 @@
> >   #
> >
> >   obj-y += ls1088a.o
> > +obj-y += ddr.o
> > +ifndef CONFIG_SPL_BUILD
> >   obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
> >   obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o -obj-y += ddr.o
> > +endif
> > diff --git a/board/freescale/ls1088a/ls1088a.c
> > b/board/freescale/ls1088a/ls1088a.c
> > index 1860f9c..1c28ab4 100644
> > --- a/board/freescale/ls1088a/ls1088a.c
> > +++ b/board/freescale/ls1088a/ls1088a.c
> > @@ -24,6 +24,13 @@
> >
> >   DECLARE_GLOBAL_DATA_PTR;
> >
> > +int board_early_init_f(void)
> > +{
> > +	fsl_lsch3_early_init_f();
> > +	return 0;
> > +}
> > +
> > +#if !defined(CONFIG_SPL_BUILD)
> >   unsigned long long get_qixis_addr(void)
> >   {
> >   	unsigned long long addr;
> > @@ -324,12 +331,6 @@ int board_init(void)
> >   	return 0;
> >   }
> >
> > -int board_early_init_f(void)
> > -{
> > -	fsl_lsch3_early_init_f();
> > -	return 0;
> > -}
> > -
> >   void detail_board_ddr_info(void)
> >   {
> >   	puts("\nDDR    ");
> > @@ -404,3 +405,4 @@ int ft_board_setup(void *blob, bd_t *bd)
> >   	return 0;
> >   }
> >   #endif
> > +#endif /* defined(CONFIG_SPL_BUILD) */
> > diff --git a/include/configs/ls1088a_common.h
> > b/include/configs/ls1088a_common.h
> > index 63b69f8..fb4c852 100644
> > --- a/include/configs/ls1088a_common.h
> > +++ b/include/configs/ls1088a_common.h
> > @@ -7,6 +7,20 @@
> >   #ifndef __LS1088_COMMON_H
> >   #define __LS1088_COMMON_H
> >
> > +/* SPL build */
> > +#ifdef CONFIG_SPL_BUILD
> > +#define SPL_NO_BOARDINFO
> > +#define SPL_NO_QIXIS
> > +#define SPL_NO_PCI
> > +#define SPL_NO_ENV
> > +#define SPL_NO_RTC
> > +#define SPL_NO_USB
> > +#define SPL_NO_SATA
> > +#define SPL_NO_QSPI
> > +#define SPL_NO_IFC
> > +#define CONFIG_SYS_DCACHE_OFF
> 
> How much space can you save with data cache off? I prefer to leave the cache
> on. Cache is used if PPA is loaded in SPL stage for boost booting speed.
> 
> York
 
As we discussed earlier too, dcache was not enabled in SPL for our layerscape platforms. I have just
removed redundant dcache specific code from SPL. I do save 2KB memory by removing redundant
dcache specific code.

Also we do need more space (approx.. 6KB) on OCRAM for header. As currently we are only supporting
single key in header (Max Size: 4KB) for validation. But actual use-case requires SRK table (8 keys) in
header (Size: 10KB).

Total Available OCRAM for SPL image and header:	88KB

Current SPL image size with GCC 5.4.1 tool-chain:	84KB
Current SPL header size with GCC 5.4.1 tool-chain:	4KB

Required SPL header size with GCC 5.4.1 tool-chain:	10KB

So we need to reduce SPL image size by 6KB more.

Sumit
York Sun Aug. 29, 2017, 5:49 p.m. UTC | #3
On 08/29/2017 10:36 AM, Sumit Garg wrote:
>> -----Original Message-----
>> From: York Sun
>> Sent: Tuesday, August 29, 2017 9:25 PM
>> To: Sumit Garg <sumit.garg@nxp.com>; u-boot@lists.denx.de
>> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; Ruchika Gupta
>> <ruchika.gupta@nxp.com>
>> Subject: Re: [u-boot-release] [PATCH 2/3] armv8: ls1088a: SPL size reduction
>>
>> On 08/29/2017 12:02 AM, Sumit Garg wrote:
>>> Using changes in this patch we were able to reduce approx 8k size of
>>> u-boot-spl.bin image. Following is breif description of changes to
>>> reduce SPL size:
>>> 1. Changes in board/freescale/ls1088a/Makefile to remove
>>>      compilation of eth.c and cpld.c in case of SPL build.
>>> 2. Changes in board/freescale/ls1088a/ls1088a.c to keep
>>>      board_early_init_f funcations in case of SPL build.
>>> 3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
>>>      specific macros due to which static data was being compiled in
>>>      case of SPL build.
>>> 4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
>>>      not being enabled in case of SPL image but was compiled in to
>>>      add redundant code.
>>>
>>> Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
>>> ---
>>>
>>> Dependent on ls1088 base SD boot target. Also dependent on ls1088 QPSI
>>> secure boot target.
>>>
>>>    board/freescale/ls1088a/Makefile  |  4 +++-
>>>    board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
>>>    include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
>>>    include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
>>>    4 files changed, 51 insertions(+), 7 deletions(-)
>>>
>>> diff --git a/board/freescale/ls1088a/Makefile
>>> b/board/freescale/ls1088a/Makefile
>>> index bdcce9e..0e15031 100644
>>> --- a/board/freescale/ls1088a/Makefile
>>> +++ b/board/freescale/ls1088a/Makefile
>>> @@ -5,6 +5,8 @@
>>>    #
>>>
>>>    obj-y += ls1088a.o
>>> +obj-y += ddr.o
>>> +ifndef CONFIG_SPL_BUILD
>>>    obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
>>>    obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o -obj-y += ddr.o
>>> +endif
>>> diff --git a/board/freescale/ls1088a/ls1088a.c
>>> b/board/freescale/ls1088a/ls1088a.c
>>> index 1860f9c..1c28ab4 100644
>>> --- a/board/freescale/ls1088a/ls1088a.c
>>> +++ b/board/freescale/ls1088a/ls1088a.c
>>> @@ -24,6 +24,13 @@
>>>
>>>    DECLARE_GLOBAL_DATA_PTR;
>>>
>>> +int board_early_init_f(void)
>>> +{
>>> +	fsl_lsch3_early_init_f();
>>> +	return 0;
>>> +}
>>> +
>>> +#if !defined(CONFIG_SPL_BUILD)
>>>    unsigned long long get_qixis_addr(void)
>>>    {
>>>    	unsigned long long addr;
>>> @@ -324,12 +331,6 @@ int board_init(void)
>>>    	return 0;
>>>    }
>>>
>>> -int board_early_init_f(void)
>>> -{
>>> -	fsl_lsch3_early_init_f();
>>> -	return 0;
>>> -}
>>> -
>>>    void detail_board_ddr_info(void)
>>>    {
>>>    	puts("\nDDR    ");
>>> @@ -404,3 +405,4 @@ int ft_board_setup(void *blob, bd_t *bd)
>>>    	return 0;
>>>    }
>>>    #endif
>>> +#endif /* defined(CONFIG_SPL_BUILD) */
>>> diff --git a/include/configs/ls1088a_common.h
>>> b/include/configs/ls1088a_common.h
>>> index 63b69f8..fb4c852 100644
>>> --- a/include/configs/ls1088a_common.h
>>> +++ b/include/configs/ls1088a_common.h
>>> @@ -7,6 +7,20 @@
>>>    #ifndef __LS1088_COMMON_H
>>>    #define __LS1088_COMMON_H
>>>
>>> +/* SPL build */
>>> +#ifdef CONFIG_SPL_BUILD
>>> +#define SPL_NO_BOARDINFO
>>> +#define SPL_NO_QIXIS
>>> +#define SPL_NO_PCI
>>> +#define SPL_NO_ENV
>>> +#define SPL_NO_RTC
>>> +#define SPL_NO_USB
>>> +#define SPL_NO_SATA
>>> +#define SPL_NO_QSPI
>>> +#define SPL_NO_IFC
>>> +#define CONFIG_SYS_DCACHE_OFF
>>
>> How much space can you save with data cache off? I prefer to leave the cache
>> on. Cache is used if PPA is loaded in SPL stage for boost booting speed.
>>
>> York
>   
> As we discussed earlier too, dcache was not enabled in SPL for our layerscape platforms. 

That was a mistake when SPL targets were added. It should be enabled.
As I said, if you load PPA in SPL, cache will be enabled for EL2. You 
didn't do it because booting performance is not a concern. If you enable 
falcon boot, this is required.

> 
> Also we do need more space (approx.. 6KB) on OCRAM for header. As currently we are only supporting
> single key in header (Max Size: 4KB) for validation. But actual use-case requires SRK table (8 keys) in
> header (Size: 10KB).
> 
> Total Available OCRAM for SPL image and header:	88KB
> 
> Current SPL image size with GCC 5.4.1 tool-chain:	84KB
> Current SPL header size with GCC 5.4.1 tool-chain:	4KB
> 
> Required SPL header size with GCC 5.4.1 tool-chain:	10KB
> 
> So we need to reduce SPL image size by 6KB more.
> 

I understand the difficulty to fit secure boot into OCRAM. Please try 
GCC 6. It has better optimization.

York
Sumit Garg Aug. 30, 2017, 8:53 a.m. UTC | #4
< snip >

> >> On 08/29/2017 12:02 AM, Sumit Garg wrote:
> >>> Using changes in this patch we were able to reduce approx 8k size of
> >>> u-boot-spl.bin image. Following is breif description of changes to
> >>> reduce SPL size:
> >>> 1. Changes in board/freescale/ls1088a/Makefile to remove
> >>>      compilation of eth.c and cpld.c in case of SPL build.
> >>> 2. Changes in board/freescale/ls1088a/ls1088a.c to keep
> >>>      board_early_init_f funcations in case of SPL build.
> >>> 3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
> >>>      specific macros due to which static data was being compiled in
> >>>      case of SPL build.
> >>> 4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
> >>>      not being enabled in case of SPL image but was compiled in to
> >>>      add redundant code.
> >>>
> >>> Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
> >>> ---
> >>>
> >>> Dependent on ls1088 base SD boot target. Also dependent on ls1088
> >>> QPSI secure boot target.
> >>>
> >>>    board/freescale/ls1088a/Makefile  |  4 +++-
> >>>    board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
> >>>    include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
> >>>    include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
> >>>    4 files changed, 51 insertions(+), 7 deletions(-)
> >>>
> >>> diff --git a/board/freescale/ls1088a/Makefile
> >>> b/board/freescale/ls1088a/Makefile
> >>> index bdcce9e..0e15031 100644
> >>> --- a/board/freescale/ls1088a/Makefile
> >>> +++ b/board/freescale/ls1088a/Makefile
> >>> @@ -5,6 +5,8 @@
> >>>    #
> >>>
> >>>    obj-y += ls1088a.o
> >>> +obj-y += ddr.o
> >>> +ifndef CONFIG_SPL_BUILD
> >>>    obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
> >>>    obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o -obj-y +=
> >>> ddr.o
> >>> +endif
> >>> diff --git a/board/freescale/ls1088a/ls1088a.c
> >>> b/board/freescale/ls1088a/ls1088a.c
> >>> index 1860f9c..1c28ab4 100644
> >>> --- a/board/freescale/ls1088a/ls1088a.c
> >>> +++ b/board/freescale/ls1088a/ls1088a.c
> >>> @@ -24,6 +24,13 @@
> >>>
> >>>    DECLARE_GLOBAL_DATA_PTR;
> >>>
> >>> +int board_early_init_f(void)
> >>> +{
> >>> +	fsl_lsch3_early_init_f();
> >>> +	return 0;
> >>> +}
> >>> +
> >>> +#if !defined(CONFIG_SPL_BUILD)
> >>>    unsigned long long get_qixis_addr(void)
> >>>    {
> >>>    	unsigned long long addr;
> >>> @@ -324,12 +331,6 @@ int board_init(void)
> >>>    	return 0;
> >>>    }
> >>>
> >>> -int board_early_init_f(void)
> >>> -{
> >>> -	fsl_lsch3_early_init_f();
> >>> -	return 0;
> >>> -}
> >>> -
> >>>    void detail_board_ddr_info(void)
> >>>    {
> >>>    	puts("\nDDR    ");
> >>> @@ -404,3 +405,4 @@ int ft_board_setup(void *blob, bd_t *bd)
> >>>    	return 0;
> >>>    }
> >>>    #endif
> >>> +#endif /* defined(CONFIG_SPL_BUILD) */
> >>> diff --git a/include/configs/ls1088a_common.h
> >>> b/include/configs/ls1088a_common.h
> >>> index 63b69f8..fb4c852 100644
> >>> --- a/include/configs/ls1088a_common.h
> >>> +++ b/include/configs/ls1088a_common.h
> >>> @@ -7,6 +7,20 @@
> >>>    #ifndef __LS1088_COMMON_H
> >>>    #define __LS1088_COMMON_H
> >>>
> >>> +/* SPL build */
> >>> +#ifdef CONFIG_SPL_BUILD
> >>> +#define SPL_NO_BOARDINFO
> >>> +#define SPL_NO_QIXIS
> >>> +#define SPL_NO_PCI
> >>> +#define SPL_NO_ENV
> >>> +#define SPL_NO_RTC
> >>> +#define SPL_NO_USB
> >>> +#define SPL_NO_SATA
> >>> +#define SPL_NO_QSPI
> >>> +#define SPL_NO_IFC
> >>> +#define CONFIG_SYS_DCACHE_OFF
> >>
> >> How much space can you save with data cache off? I prefer to leave
> >> the cache on. Cache is used if PPA is loaded in SPL stage for boost booting
> speed.
> >>
> >> York
> >
> > As we discussed earlier too, dcache was not enabled in SPL for our layerscape
> platforms.
> 
> That was a mistake when SPL targets were added. It should be enabled.
> As I said, if you load PPA in SPL, cache will be enabled for EL2. You didn't do it
> because booting performance is not a concern. If you enable falcon boot, this is
> required.
 
Ok. BTW, do you think latest PPA which claims whole of OCRAM could work with SPL.
I saw crashes in SPL on ls1043ardb with latest PPA enabled in SPL upstream u-boot.

As per my understanding, shouldn't we enable cache as part of main u-boot image
running in EL2? Also in case of SD, it uses DMA to copy main u-boot image or kernel
in case of falcon boot to DDR. I am not sure how much booting performance gain
can we get by enabling dcache in SPL.

> 
> >
> > Also we do need more space (approx.. 6KB) on OCRAM for header. As
> > currently we are only supporting single key in header (Max Size: 4KB)
> > for validation. But actual use-case requires SRK table (8 keys) in header (Size:
> 10KB).
> >
> > Total Available OCRAM for SPL image and header:	88KB
> >
> > Current SPL image size with GCC 5.4.1 tool-chain:	84KB
> > Current SPL header size with GCC 5.4.1 tool-chain:	4KB
> >
> > Required SPL header size with GCC 5.4.1 tool-chain:	10KB
> >
> > So we need to reduce SPL image size by 6KB more.
> >
> 
> I understand the difficulty to fit secure boot into OCRAM. Please try GCC 6. It
> has better optimization.
> 
> York
 
Sure I will use GCC 6 for upstream. But for LSDK, we have to stick with GCCC 5.4.1
for now.

Sumit
York Sun Jan. 5, 2018, 3:56 p.m. UTC | #5
On 08/30/2017 01:53 AM, Sumit Garg wrote:
> < snip >
> 
>>>> On 08/29/2017 12:02 AM, Sumit Garg wrote:
>>>>> Using changes in this patch we were able to reduce approx 8k size of
>>>>> u-boot-spl.bin image. Following is breif description of changes to
>>>>> reduce SPL size:
>>>>> 1. Changes in board/freescale/ls1088a/Makefile to remove
>>>>>      compilation of eth.c and cpld.c in case of SPL build.
>>>>> 2. Changes in board/freescale/ls1088a/ls1088a.c to keep
>>>>>      board_early_init_f funcations in case of SPL build.
>>>>> 3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
>>>>>      specific macros due to which static data was being compiled in
>>>>>      case of SPL build.
>>>>> 4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
>>>>>      not being enabled in case of SPL image but was compiled in to
>>>>>      add redundant code.
>>>>>
>>>>> Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
>>>>> ---
>>>>>
>>>>> Dependent on ls1088 base SD boot target. Also dependent on ls1088
>>>>> QPSI secure boot target.
>>>>>
>>>>>    board/freescale/ls1088a/Makefile  |  4 +++-
>>>>>    board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
>>>>>    include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
>>>>>    include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
>>>>>    4 files changed, 51 insertions(+), 7 deletions(-)
>>>>>
>>>>> diff --git a/board/freescale/ls1088a/Makefile
>>>>> b/board/freescale/ls1088a/Makefile
>>>>> index bdcce9e..0e15031 100644
>>>>> --- a/board/freescale/ls1088a/Makefile
>>>>> +++ b/board/freescale/ls1088a/Makefile
>>>>> @@ -5,6 +5,8 @@
>>>>>    #
>>>>>
>>>>>    obj-y += ls1088a.o
>>>>> +obj-y += ddr.o
>>>>> +ifndef CONFIG_SPL_BUILD
>>>>>    obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
>>>>>    obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o -obj-y +=
>>>>> ddr.o
>>>>> +endif
>>>>> diff --git a/board/freescale/ls1088a/ls1088a.c
>>>>> b/board/freescale/ls1088a/ls1088a.c
>>>>> index 1860f9c..1c28ab4 100644
>>>>> --- a/board/freescale/ls1088a/ls1088a.c
>>>>> +++ b/board/freescale/ls1088a/ls1088a.c
>>>>> @@ -24,6 +24,13 @@
>>>>>
>>>>>    DECLARE_GLOBAL_DATA_PTR;
>>>>>
>>>>> +int board_early_init_f(void)
>>>>> +{
>>>>> +	fsl_lsch3_early_init_f();
>>>>> +	return 0;
>>>>> +}
>>>>> +
>>>>> +#if !defined(CONFIG_SPL_BUILD)
>>>>>    unsigned long long get_qixis_addr(void)
>>>>>    {
>>>>>    	unsigned long long addr;
>>>>> @@ -324,12 +331,6 @@ int board_init(void)
>>>>>    	return 0;
>>>>>    }
>>>>>
>>>>> -int board_early_init_f(void)
>>>>> -{
>>>>> -	fsl_lsch3_early_init_f();
>>>>> -	return 0;
>>>>> -}
>>>>> -
>>>>>    void detail_board_ddr_info(void)
>>>>>    {
>>>>>    	puts("\nDDR    ");
>>>>> @@ -404,3 +405,4 @@ int ft_board_setup(void *blob, bd_t *bd)
>>>>>    	return 0;
>>>>>    }
>>>>>    #endif
>>>>> +#endif /* defined(CONFIG_SPL_BUILD) */
>>>>> diff --git a/include/configs/ls1088a_common.h
>>>>> b/include/configs/ls1088a_common.h
>>>>> index 63b69f8..fb4c852 100644
>>>>> --- a/include/configs/ls1088a_common.h
>>>>> +++ b/include/configs/ls1088a_common.h
>>>>> @@ -7,6 +7,20 @@
>>>>>    #ifndef __LS1088_COMMON_H
>>>>>    #define __LS1088_COMMON_H
>>>>>
>>>>> +/* SPL build */
>>>>> +#ifdef CONFIG_SPL_BUILD
>>>>> +#define SPL_NO_BOARDINFO
>>>>> +#define SPL_NO_QIXIS
>>>>> +#define SPL_NO_PCI
>>>>> +#define SPL_NO_ENV
>>>>> +#define SPL_NO_RTC
>>>>> +#define SPL_NO_USB
>>>>> +#define SPL_NO_SATA
>>>>> +#define SPL_NO_QSPI
>>>>> +#define SPL_NO_IFC
>>>>> +#define CONFIG_SYS_DCACHE_OFF
>>>>
>>>> How much space can you save with data cache off? I prefer to leave
>>>> the cache on. Cache is used if PPA is loaded in SPL stage for boost booting
>> speed.
>>>>
>>>> York
>>>
>>> As we discussed earlier too, dcache was not enabled in SPL for our layerscape
>> platforms.
>>
>> That was a mistake when SPL targets were added. It should be enabled.
>> As I said, if you load PPA in SPL, cache will be enabled for EL2. You didn't do it
>> because booting performance is not a concern. If you enable falcon boot, this is
>> required.
>  
> Ok. BTW, do you think latest PPA which claims whole of OCRAM could work with SPL.
> I saw crashes in SPL on ls1043ardb with latest PPA enabled in SPL upstream u-boot.

Sumit,

PPA has been fixed to not claim OCRAM. Please rework your patch.

York
Sumit Garg Jan. 5, 2018, 4:07 p.m. UTC | #6
> -----Original Message-----
> From: York Sun
> Sent: Friday, January 05, 2018 9:26 PM
> To: Sumit Garg <sumit.garg@nxp.com>; u-boot@lists.denx.de
> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; Ruchika Gupta
> <ruchika.gupta@nxp.com>
> Subject: Re: [u-boot-release] [PATCH 2/3] armv8: ls1088a: SPL size reduction
> 
> On 08/30/2017 01:53 AM, Sumit Garg wrote:
> > < snip >
> >
> >>>> On 08/29/2017 12:02 AM, Sumit Garg wrote:
> >>>>> Using changes in this patch we were able to reduce approx 8k size
> >>>>> of u-boot-spl.bin image. Following is breif description of changes
> >>>>> to reduce SPL size:
> >>>>> 1. Changes in board/freescale/ls1088a/Makefile to remove
> >>>>>      compilation of eth.c and cpld.c in case of SPL build.
> >>>>> 2. Changes in board/freescale/ls1088a/ls1088a.c to keep
> >>>>>      board_early_init_f funcations in case of SPL build.
> >>>>> 3. Changes in ls1088a_common.h & ls1088ardb.h to remove driver
> >>>>>      specific macros due to which static data was being compiled in
> >>>>>      case of SPL build.
> >>>>> 4. Enable CONFIG_SYS_DCACHE_OFF in case of SPL build as DCACHE is
> >>>>>      not being enabled in case of SPL image but was compiled in to
> >>>>>      add redundant code.
> >>>>>
> >>>>> Signed-off-by: Sumit Garg <sumit.garg@nxp.com>
> >>>>> ---
> >>>>>
> >>>>> Dependent on ls1088 base SD boot target. Also dependent on ls1088
> >>>>> QPSI secure boot target.
> >>>>>
> >>>>>    board/freescale/ls1088a/Makefile  |  4 +++-
> >>>>>    board/freescale/ls1088a/ls1088a.c | 14 ++++++++------
> >>>>>    include/configs/ls1088a_common.h  | 20 ++++++++++++++++++++
> >>>>>    include/configs/ls1088ardb.h      | 20 ++++++++++++++++++++
> >>>>>    4 files changed, 51 insertions(+), 7 deletions(-)
> >>>>>
> >>>>> diff --git a/board/freescale/ls1088a/Makefile
> >>>>> b/board/freescale/ls1088a/Makefile
> >>>>> index bdcce9e..0e15031 100644
> >>>>> --- a/board/freescale/ls1088a/Makefile
> >>>>> +++ b/board/freescale/ls1088a/Makefile
> >>>>> @@ -5,6 +5,8 @@
> >>>>>    #
> >>>>>
> >>>>>    obj-y += ls1088a.o
> >>>>> +obj-y += ddr.o
> >>>>> +ifndef CONFIG_SPL_BUILD
> >>>>>    obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
> >>>>>    obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o -obj-y +=
> >>>>> ddr.o
> >>>>> +endif
> >>>>> diff --git a/board/freescale/ls1088a/ls1088a.c
> >>>>> b/board/freescale/ls1088a/ls1088a.c
> >>>>> index 1860f9c..1c28ab4 100644
> >>>>> --- a/board/freescale/ls1088a/ls1088a.c
> >>>>> +++ b/board/freescale/ls1088a/ls1088a.c
> >>>>> @@ -24,6 +24,13 @@
> >>>>>
> >>>>>    DECLARE_GLOBAL_DATA_PTR;
> >>>>>
> >>>>> +int board_early_init_f(void)
> >>>>> +{
> >>>>> +	fsl_lsch3_early_init_f();
> >>>>> +	return 0;
> >>>>> +}
> >>>>> +
> >>>>> +#if !defined(CONFIG_SPL_BUILD)
> >>>>>    unsigned long long get_qixis_addr(void)
> >>>>>    {
> >>>>>    	unsigned long long addr;
> >>>>> @@ -324,12 +331,6 @@ int board_init(void)
> >>>>>    	return 0;
> >>>>>    }
> >>>>>
> >>>>> -int board_early_init_f(void)
> >>>>> -{
> >>>>> -	fsl_lsch3_early_init_f();
> >>>>> -	return 0;
> >>>>> -}
> >>>>> -
> >>>>>    void detail_board_ddr_info(void)
> >>>>>    {
> >>>>>    	puts("\nDDR    ");
> >>>>> @@ -404,3 +405,4 @@ int ft_board_setup(void *blob, bd_t *bd)
> >>>>>    	return 0;
> >>>>>    }
> >>>>>    #endif
> >>>>> +#endif /* defined(CONFIG_SPL_BUILD) */
> >>>>> diff --git a/include/configs/ls1088a_common.h
> >>>>> b/include/configs/ls1088a_common.h
> >>>>> index 63b69f8..fb4c852 100644
> >>>>> --- a/include/configs/ls1088a_common.h
> >>>>> +++ b/include/configs/ls1088a_common.h
> >>>>> @@ -7,6 +7,20 @@
> >>>>>    #ifndef __LS1088_COMMON_H
> >>>>>    #define __LS1088_COMMON_H
> >>>>>
> >>>>> +/* SPL build */
> >>>>> +#ifdef CONFIG_SPL_BUILD
> >>>>> +#define SPL_NO_BOARDINFO
> >>>>> +#define SPL_NO_QIXIS
> >>>>> +#define SPL_NO_PCI
> >>>>> +#define SPL_NO_ENV
> >>>>> +#define SPL_NO_RTC
> >>>>> +#define SPL_NO_USB
> >>>>> +#define SPL_NO_SATA
> >>>>> +#define SPL_NO_QSPI
> >>>>> +#define SPL_NO_IFC
> >>>>> +#define CONFIG_SYS_DCACHE_OFF
> >>>>
> >>>> How much space can you save with data cache off? I prefer to leave
> >>>> the cache on. Cache is used if PPA is loaded in SPL stage for boost
> >>>> booting
> >> speed.
> >>>>
> >>>> York
> >>>
> >>> As we discussed earlier too, dcache was not enabled in SPL for our
> >>> layerscape
> >> platforms.
> >>
> >> That was a mistake when SPL targets were added. It should be enabled.
> >> As I said, if you load PPA in SPL, cache will be enabled for EL2. You
> >> didn't do it because booting performance is not a concern. If you
> >> enable falcon boot, this is required.
> >
> > Ok. BTW, do you think latest PPA which claims whole of OCRAM could work
> with SPL.
> > I saw crashes in SPL on ls1043ardb with latest PPA enabled in SPL upstream u-
> boot.
> 
> Sumit,
> 
> PPA has been fixed to not claim OCRAM. Please rework your patch.
> 
> York
 
York,

I have just sent reworked patches without removing dcache cache code. It's been working
only with toolchain above GCC 6 that reduces SPL size.

https://patchwork.ozlabs.org/patch/856095/
https://patchwork.ozlabs.org/patch/856097/
https://patchwork.ozlabs.org/patch/856096/

Sumit
York Sun Jan. 5, 2018, 4:09 p.m. UTC | #7
On 01/05/2018 08:07 AM, Sumit Garg wrote:

<snip>

>>
>> Sumit,
>>
>> PPA has been fixed to not claim OCRAM. Please rework your patch.
>>
>> York
>  
> York,
> 
> I have just sent reworked patches without removing dcache cache code. It's been working
> only with toolchain above GCC 6 that reduces SPL size.

Thanks.
What do you mean "working only with toolchain above GCC 6"? Do you mean
the size would be too large using older toolchain?

York
Sumit Garg Jan. 5, 2018, 4:22 p.m. UTC | #8
> -----Original Message-----
> From: York Sun
> Sent: Friday, January 05, 2018 9:40 PM
> To: Sumit Garg <sumit.garg@nxp.com>; u-boot@lists.denx.de
> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; Ruchika Gupta
> <ruchika.gupta@nxp.com>
> Subject: Re: [u-boot-release] [PATCH 2/3] armv8: ls1088a: SPL size reduction
> 
> On 01/05/2018 08:07 AM, Sumit Garg wrote:
> 
> <snip>
> 
> >>
> >> Sumit,
> >>
> >> PPA has been fixed to not claim OCRAM. Please rework your patch.
> >>
> >> York
> >
> > York,
> >
> > I have just sent reworked patches without removing dcache cache code.
> > It's been working only with toolchain above GCC 6 that reduces SPL size.
> 
> Thanks.
> What do you mean "working only with toolchain above GCC 6"? Do you mean
> the size would be too large using older toolchain?
> 
> York

Yes for LSDK, tool-chain being used is GCC 5.4.1. Following is analysis with LSDK too-chain:

SPL size for Secure boot image without dcache code:	83K
Available max OCRAM memory size for SPL image:	84K
SPL size for Secure boot image with dcache code:	85K

So for LSDK we have remove dcache code for Secure boot to work with current SPL size reduction.

-Sumit
York Sun Jan. 5, 2018, 4:24 p.m. UTC | #9
On 01/05/2018 08:22 AM, Sumit Garg wrote:
>> -----Original Message-----
>> From: York Sun
>> Sent: Friday, January 05, 2018 9:40 PM
>> To: Sumit Garg <sumit.garg@nxp.com>; u-boot@lists.denx.de
>> Cc: Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>; Ruchika Gupta
>> <ruchika.gupta@nxp.com>
>> Subject: Re: [u-boot-release] [PATCH 2/3] armv8: ls1088a: SPL size reduction
>>
>> On 01/05/2018 08:07 AM, Sumit Garg wrote:
>>
>> <snip>
>>
>>>>
>>>> Sumit,
>>>>
>>>> PPA has been fixed to not claim OCRAM. Please rework your patch.
>>>>
>>>> York
>>>
>>> York,
>>>
>>> I have just sent reworked patches without removing dcache cache code.
>>> It's been working only with toolchain above GCC 6 that reduces SPL size.
>>
>> Thanks.
>> What do you mean "working only with toolchain above GCC 6"? Do you mean
>> the size would be too large using older toolchain?
>>
>> York
> 
> Yes for LSDK, tool-chain being used is GCC 5.4.1. Following is analysis with LSDK too-chain:
> 
> SPL size for Secure boot image without dcache code:	83K
> Available max OCRAM memory size for SPL image:	84K
> SPL size for Secure boot image with dcache code:	85K
> 
> So for LSDK we have remove dcache code for Secure boot to work with current SPL size reduction.

If you are out of space for LSDK, go ahead to remove the dcache code.
For upstream U-Boot, I want to keep those code for falcon boot. We are
going with GCC 6 anyway.

York
diff mbox series

Patch

diff --git a/board/freescale/ls1088a/Makefile b/board/freescale/ls1088a/Makefile
index bdcce9e..0e15031 100644
--- a/board/freescale/ls1088a/Makefile
+++ b/board/freescale/ls1088a/Makefile
@@ -5,6 +5,8 @@ 
 #
 
 obj-y += ls1088a.o
+obj-y += ddr.o
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_TARGET_LS1088ARDB) += eth_ls1088ardb.o
 obj-$(CONFIG_TARGET_LS1088AQDS) += eth_ls1088aqds.o
-obj-y += ddr.o
+endif
diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index 1860f9c..1c28ab4 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -24,6 +24,13 @@ 
 
 DECLARE_GLOBAL_DATA_PTR;
 
+int board_early_init_f(void)
+{
+	fsl_lsch3_early_init_f();
+	return 0;
+}
+
+#if !defined(CONFIG_SPL_BUILD)
 unsigned long long get_qixis_addr(void)
 {
 	unsigned long long addr;
@@ -324,12 +331,6 @@  int board_init(void)
 	return 0;
 }
 
-int board_early_init_f(void)
-{
-	fsl_lsch3_early_init_f();
-	return 0;
-}
-
 void detail_board_ddr_info(void)
 {
 	puts("\nDDR    ");
@@ -404,3 +405,4 @@  int ft_board_setup(void *blob, bd_t *bd)
 	return 0;
 }
 #endif
+#endif /* defined(CONFIG_SPL_BUILD) */
diff --git a/include/configs/ls1088a_common.h b/include/configs/ls1088a_common.h
index 63b69f8..fb4c852 100644
--- a/include/configs/ls1088a_common.h
+++ b/include/configs/ls1088a_common.h
@@ -7,6 +7,20 @@ 
 #ifndef __LS1088_COMMON_H
 #define __LS1088_COMMON_H
 
+/* SPL build */
+#ifdef CONFIG_SPL_BUILD
+#define SPL_NO_BOARDINFO
+#define SPL_NO_QIXIS
+#define SPL_NO_PCI
+#define SPL_NO_ENV
+#define SPL_NO_RTC
+#define SPL_NO_USB
+#define SPL_NO_SATA
+#define SPL_NO_QSPI
+#define SPL_NO_IFC
+#define CONFIG_SYS_DCACHE_OFF
+#undef CONFIG_DISPLAY_CPUINFO
+#endif
 
 #define CONFIG_REMAKE_ELF
 #define CONFIG_FSL_LAYERSCAPE
@@ -70,8 +84,10 @@ 
 #define CONFIG_BAUDRATE			115200
 #define CONFIG_SYS_BAUDRATE_TABLE	{ 9600, 19200, 38400, 57600, 115200 }
 
+#ifndef SPL_NO_IFC
 /* IFC */
 #define CONFIG_FSL_IFC
+#endif
 
 /*
  * During booting, IFC is mapped at the region of 0x30000000.
@@ -154,6 +170,7 @@  unsigned long long get_qixis_addr(void);
 
 /* #define CONFIG_DISPLAY_CPUINFO */
 
+#ifndef SPL_NO_ENV
 /* Allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
 
@@ -192,6 +209,7 @@  unsigned long long get_qixis_addr(void);
 				" cp.b $kernel_start $kernel_load" \
 				" $kernel_size && bootm $kernel_load"
 #endif
+#endif
 
 /* Monitor Command Prompt */
 #define CONFIG_SYS_CBSIZE		512	/* Console I/O Buffer Size */
@@ -200,7 +218,9 @@  unsigned long long get_qixis_addr(void);
 #define CONFIG_SYS_PROMPT_HUSH_PS2	"> "
 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE /* Boot args buffer */
 #define CONFIG_SYS_LONGHELP
+#ifndef SPL_NO_ENV
 #define CONFIG_CMDLINE_EDITING		1
+#endif
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_MAXARGS		64	/* max command args */
 
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index 1d2dd4f..913252d 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -9,7 +9,9 @@ 
 
 #include "ls1088a_common.h"
 
+#ifndef SPL_NO_BOARDINFO
 #define CONFIG_DISPLAY_BOARDINFO_LATE
+#endif
 
 #if defined(CONFIG_QSPI_BOOT)
 #define CONFIG_ENV_IS_IN_SPI_FLASH
@@ -29,7 +31,9 @@ 
 #endif
 
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
+#ifndef CONFIG_SPL_BUILD
 #define CONFIG_QIXIS_I2C_ACCESS
+#endif
 #define SYS_NO_FLASH
 #undef CONFIG_CMD_IMLS
 #endif
@@ -97,7 +101,11 @@ 
 #define CONFIG_SYS_FLASH_BANKS_LIST	{ CONFIG_SYS_FLASH_BASE }
 #endif
 #endif
+
+#ifndef SPL_NO_IFC
 #define CONFIG_NAND_FSL_IFC
+#endif
+
 #define CONFIG_SYS_NAND_MAX_ECCPOS	256
 #define CONFIG_SYS_NAND_MAX_OOBFREE	2
 
@@ -139,7 +147,10 @@ 
 
 #define CONFIG_SYS_NAND_BLOCK_SIZE	(128 * 1024)
 
+#ifndef SPL_NO_QIXIS
 #define CONFIG_FSL_QIXIS
+#endif
+
 #define CONFIG_SYS_I2C_FPGA_ADDR	0x66
 #define QIXIS_LBMAP_SWITCH		2
 #define QIXIS_QMAP_MASK			0xe0
@@ -223,6 +234,8 @@ 
 #define I2C_RETIMER_ADDR		0x18
 #define I2C_MUX_CH_DEFAULT		0x8
 #define I2C_MUX_CH5			0xD
+
+#ifndef SPL_NO_RTC
 /*
 * RTC configuration
 */
@@ -230,6 +243,7 @@ 
 #define CONFIG_RTC_PCF8563 1
 #define CONFIG_SYS_I2C_RTC_ADDR         0x51  /* Channel 3*/
 #define CONFIG_CMD_DATE
+#endif
 
 /* EEPROM */
 #define CONFIG_ID_EEPROM
@@ -240,6 +254,7 @@ 
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS	3
 #define CONFIG_SYS_EEPROM_PAGE_WRITE_DELAY_MS	5
 
+#ifndef SPL_NO_QSPI
 /* QSPI device */
 #if defined(CONFIG_QSPI_BOOT) || defined(CONFIG_SD_BOOT_QSPI)
 #define CONFIG_FSL_QSPI
@@ -247,6 +262,7 @@ 
 #define FSL_QSPI_FLASH_SIZE		(1 << 26)
 #define FSL_QSPI_FLASH_NUM		2
 #endif
+#endif
 
 #define CONFIG_CMD_MEMINFO
 #define CONFIG_CMD_MEMTEST
@@ -260,6 +276,7 @@ 
 #endif
 #define CONFIG_FSL_MEMAC
 
+#ifndef SPL_NO_ENV
 /* Initial environment variables */
 #ifdef CONFIG_SECURE_BOOT
 #undef CONFIG_EXTRA_ENV_SETTINGS
@@ -342,6 +359,7 @@ 
 #define CONFIG_ETHPRIME		"DPMAC1@xgmii"
 #define CONFIG_PHY_GIGE
 #endif
+#endif
 
 /*  MMC  */
 #ifdef CONFIG_MMC
@@ -349,6 +367,7 @@ 
 #define CONFIG_SYS_FSL_MMC_HAS_CAPBLT_VS33
 #endif
 
+#ifndef SPL_NO_ENV
 #undef CONFIG_CMDLINE_EDITING
 #include <config_distro_defaults.h>
 
@@ -358,6 +377,7 @@ 
 	func(SCSI, scsi, 0) \
 	func(DHCP, dhcp, na)
 #include <config_distro_bootcmd.h>
+#endif
 
 #include <asm/fsl_secure_boot.h>