diff mbox series

[v1,1/3] arm: xea: Modify board code to generate single binary u-boot

Message ID 20211222124904.2475-1-lukma@denx.de
State Changes Requested
Delegated to: Tom Rini
Headers show
Series [v1,1/3] arm: xea: Modify board code to generate single binary u-boot | expand

Commit Message

Lukasz Majewski Dec. 22, 2021, 12:49 p.m. UTC
This change provides the possibility to build XEA (imx287 based) board
U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).

The generated u-boot.sb can be used in the factory environment to for
example perform initial setup or HW testing.

It can be used with 'uuu' utility
(SDPS: boot -f /srv/tftp/xea/u-boot.sb)

The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which
is utilized when CONFIG_SPL_FRAMEWORK is disabled.

However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is used,
which requires the lowlevel_init() function.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 board/liebherr/xea/spl_xea.c | 8 ++++++++
 board/liebherr/xea/xea.c     | 3 ++-
 2 files changed, 10 insertions(+), 1 deletion(-)

Comments

Tom Rini Dec. 22, 2021, 4:46 p.m. UTC | #1
On Wed, Dec 22, 2021 at 01:49:02PM +0100, Lukasz Majewski wrote:

> This change provides the possibility to build XEA (imx287 based) board
> U-Boot as a single binary (without support for CONFIG_SPL_FRAMEWORK).
> 
> The generated u-boot.sb can be used in the factory environment to for
> example perform initial setup or HW testing.
> 
> It can be used with 'uuu' utility
> (SDPS: boot -f /srv/tftp/xea/u-boot.sb)
> 
> The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S, which
> is utilized when CONFIG_SPL_FRAMEWORK is disabled.
> 
> However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is used,
> which requires the lowlevel_init() function.
> 
> Signed-off-by: Lukasz Majewski <lukma@denx.de>
> ---
> 
>  board/liebherr/xea/spl_xea.c | 8 ++++++++
>  board/liebherr/xea/xea.c     | 3 ++-
>  2 files changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/board/liebherr/xea/spl_xea.c b/board/liebherr/xea/spl_xea.c
> index 192f68fca5f..5ee561b8b78 100644
> --- a/board/liebherr/xea/spl_xea.c
> +++ b/board/liebherr/xea/spl_xea.c
> @@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
>  	0x00000000, 0xffffffff
>  };
>  
> +/* #ifndef CONFIG_SPL_FRAMEWORK */
> +#if !CONFIG_IS_ENABLED(FRAMEWORK)
> +void board_init_ll(const u32 arg, const uint32_t *resptr)
> +{
> +	mxs_common_spl_init(arg, resptr, iomux_setup, ARRAY_SIZE(iomux_setup));
> +}
> +#else
>  void lowlevel_init(void)
>  {
>  	struct mxs_pinctrl_regs *pinctrl_regs =
> @@ -301,3 +308,4 @@ void lowlevel_init(void)
>  
>  	mxs_common_spl_init(0, NULL, iomux_setup, ARRAY_SIZE(iomux_setup));
>  }
> +#endif
> diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
> index cd11b0ada77..685e2e26a18 100644
> --- a/board/liebherr/xea/xea.c
> +++ b/board/liebherr/xea/xea.c
> @@ -58,7 +58,8 @@ static void init_clocks(void)
>  	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
>  }
>  
> -#ifdef CONFIG_SPL_BUILD
> +/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
> +#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
>  void board_init_f(ulong arg)
>  {
>  	init_clocks();

I know checkpatch.pl has a warning, but maybe the text needs to be
tweaked there slightly?  Using CONFIG_IS_ENABLED here is less readable /
clear than CONFIG_SPL_BUILD (which is special) and CONFIG_SPL_FRAMEWORK
(there's no CONFIG_FRAMEWORK and this board isn't going to use TPL).
Lukasz Majewski Dec. 23, 2021, 8:42 a.m. UTC | #2
Hi Tom,

> On Wed, Dec 22, 2021 at 01:49:02PM +0100, Lukasz Majewski wrote:
> 
> > This change provides the possibility to build XEA (imx287 based)
> > board U-Boot as a single binary (without support for
> > CONFIG_SPL_FRAMEWORK).
> > 
> > The generated u-boot.sb can be used in the factory environment to
> > for example perform initial setup or HW testing.
> > 
> > It can be used with 'uuu' utility
> > (SDPS: boot -f /srv/tftp/xea/u-boot.sb)
> > 
> > The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S,
> > which is utilized when CONFIG_SPL_FRAMEWORK is disabled.
> > 
> > However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is
> > used, which requires the lowlevel_init() function.
> > 
> > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > ---
> > 
> >  board/liebherr/xea/spl_xea.c | 8 ++++++++
> >  board/liebherr/xea/xea.c     | 3 ++-
> >  2 files changed, 10 insertions(+), 1 deletion(-)
> > 
> > diff --git a/board/liebherr/xea/spl_xea.c
> > b/board/liebherr/xea/spl_xea.c index 192f68fca5f..5ee561b8b78 100644
> > --- a/board/liebherr/xea/spl_xea.c
> > +++ b/board/liebherr/xea/spl_xea.c
> > @@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
> >  	0x00000000, 0xffffffff
> >  };
> >  
> > +/* #ifndef CONFIG_SPL_FRAMEWORK */
> > +#if !CONFIG_IS_ENABLED(FRAMEWORK)
> > +void board_init_ll(const u32 arg, const uint32_t *resptr)
> > +{
> > +	mxs_common_spl_init(arg, resptr, iomux_setup,
> > ARRAY_SIZE(iomux_setup)); +}
> > +#else
> >  void lowlevel_init(void)
> >  {
> >  	struct mxs_pinctrl_regs *pinctrl_regs =
> > @@ -301,3 +308,4 @@ void lowlevel_init(void)
> >  
> >  	mxs_common_spl_init(0, NULL, iomux_setup,
> > ARRAY_SIZE(iomux_setup)); }
> > +#endif
> > diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
> > index cd11b0ada77..685e2e26a18 100644
> > --- a/board/liebherr/xea/xea.c
> > +++ b/board/liebherr/xea/xea.c
> > @@ -58,7 +58,8 @@ static void init_clocks(void)
> >  	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
> >  }
> >  
> > -#ifdef CONFIG_SPL_BUILD
> > +/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
> > +#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
> >  void board_init_f(ulong arg)
> >  {
> >  	init_clocks();  
> 
> I know checkpatch.pl has a warning, but maybe the text needs to be
> tweaked there slightly?  

Yes, exactly - this was done to silence the checkpatch.pl error.

> Using CONFIG_IS_ENABLED here is less
> readable / clear than CONFIG_SPL_BUILD (which is special) and
> CONFIG_SPL_FRAMEWORK (there's no CONFIG_FRAMEWORK and this board
> isn't going to use TPL).
> 

If you prefer I can just add the preprocessor code from the above
comment.



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
Tom Rini Dec. 23, 2021, 12:53 p.m. UTC | #3
On Thu, Dec 23, 2021 at 09:42:13AM +0100, Lukasz Majewski wrote:
> Hi Tom,
> 
> > On Wed, Dec 22, 2021 at 01:49:02PM +0100, Lukasz Majewski wrote:
> > 
> > > This change provides the possibility to build XEA (imx287 based)
> > > board U-Boot as a single binary (without support for
> > > CONFIG_SPL_FRAMEWORK).
> > > 
> > > The generated u-boot.sb can be used in the factory environment to
> > > for example perform initial setup or HW testing.
> > > 
> > > It can be used with 'uuu' utility
> > > (SDPS: boot -f /srv/tftp/xea/u-boot.sb)
> > > 
> > > The board_init_ll() is used in arch/arm/cpu/arm926ejs/mxs/start.S,
> > > which is utilized when CONFIG_SPL_FRAMEWORK is disabled.
> > > 
> > > However, when it is enabled the arch/arm/cpu/arm926ejs/start.S is
> > > used, which requires the lowlevel_init() function.
> > > 
> > > Signed-off-by: Lukasz Majewski <lukma@denx.de>
> > > ---
> > > 
> > >  board/liebherr/xea/spl_xea.c | 8 ++++++++
> > >  board/liebherr/xea/xea.c     | 3 ++-
> > >  2 files changed, 10 insertions(+), 1 deletion(-)
> > > 
> > > diff --git a/board/liebherr/xea/spl_xea.c
> > > b/board/liebherr/xea/spl_xea.c index 192f68fca5f..5ee561b8b78 100644
> > > --- a/board/liebherr/xea/spl_xea.c
> > > +++ b/board/liebherr/xea/spl_xea.c
> > > @@ -290,6 +290,13 @@ u32 mxs_dram_vals[] = {
> > >  	0x00000000, 0xffffffff
> > >  };
> > >  
> > > +/* #ifndef CONFIG_SPL_FRAMEWORK */
> > > +#if !CONFIG_IS_ENABLED(FRAMEWORK)
> > > +void board_init_ll(const u32 arg, const uint32_t *resptr)
> > > +{
> > > +	mxs_common_spl_init(arg, resptr, iomux_setup,
> > > ARRAY_SIZE(iomux_setup)); +}
> > > +#else
> > >  void lowlevel_init(void)
> > >  {
> > >  	struct mxs_pinctrl_regs *pinctrl_regs =
> > > @@ -301,3 +308,4 @@ void lowlevel_init(void)
> > >  
> > >  	mxs_common_spl_init(0, NULL, iomux_setup,
> > > ARRAY_SIZE(iomux_setup)); }
> > > +#endif
> > > diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
> > > index cd11b0ada77..685e2e26a18 100644
> > > --- a/board/liebherr/xea/xea.c
> > > +++ b/board/liebherr/xea/xea.c
> > > @@ -58,7 +58,8 @@ static void init_clocks(void)
> > >  	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
> > >  }
> > >  
> > > -#ifdef CONFIG_SPL_BUILD
> > > +/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
> > > +#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
> > >  void board_init_f(ulong arg)
> > >  {
> > >  	init_clocks();  
> > 
> > I know checkpatch.pl has a warning, but maybe the text needs to be
> > tweaked there slightly?  
> 
> Yes, exactly - this was done to silence the checkpatch.pl error.
> 
> > Using CONFIG_IS_ENABLED here is less
> > readable / clear than CONFIG_SPL_BUILD (which is special) and
> > CONFIG_SPL_FRAMEWORK (there's no CONFIG_FRAMEWORK and this board
> > isn't going to use TPL).
> > 
> 
> If you prefer I can just add the preprocessor code from the above
> comment.

It's a warning not an error, please just use #ifdef here instead,
thanks.
diff mbox series

Patch

diff --git a/board/liebherr/xea/spl_xea.c b/board/liebherr/xea/spl_xea.c
index 192f68fca5f..5ee561b8b78 100644
--- a/board/liebherr/xea/spl_xea.c
+++ b/board/liebherr/xea/spl_xea.c
@@ -290,6 +290,13 @@  u32 mxs_dram_vals[] = {
 	0x00000000, 0xffffffff
 };
 
+/* #ifndef CONFIG_SPL_FRAMEWORK */
+#if !CONFIG_IS_ENABLED(FRAMEWORK)
+void board_init_ll(const u32 arg, const uint32_t *resptr)
+{
+	mxs_common_spl_init(arg, resptr, iomux_setup, ARRAY_SIZE(iomux_setup));
+}
+#else
 void lowlevel_init(void)
 {
 	struct mxs_pinctrl_regs *pinctrl_regs =
@@ -301,3 +308,4 @@  void lowlevel_init(void)
 
 	mxs_common_spl_init(0, NULL, iomux_setup, ARRAY_SIZE(iomux_setup));
 }
+#endif
diff --git a/board/liebherr/xea/xea.c b/board/liebherr/xea/xea.c
index cd11b0ada77..685e2e26a18 100644
--- a/board/liebherr/xea/xea.c
+++ b/board/liebherr/xea/xea.c
@@ -58,7 +58,8 @@  static void init_clocks(void)
 	mxs_set_sspclk(MXC_SSPCLK3, 96000, 0);
 }
 
-#ifdef CONFIG_SPL_BUILD
+/* #if CONFIG_SPL_BUILD && CONFIG_SPL_FRAMEWORK */
+#if CONFIG_IS_ENABLED(BUILD) && CONFIG_IS_ENABLED(FRAMEWORK)
 void board_init_f(ulong arg)
 {
 	init_clocks();