diff mbox series

[U-Boot,1/5] arm: socfpga: fix SPL on gen5 after moving to DM serial

Message ID 20180805193500.3693-2-simon.k.r.goldschmidt@gmail.com
State Superseded
Delegated to: Marek Vasut
Headers show
Series Get socfpga gen5 SPL working again. | expand

Commit Message

Simon Goldschmidt Aug. 5, 2018, 7:34 p.m. UTC
There were some NULL pointers dereferenced because DM was used
too early without correct initialization.

This fixes commit 73172753f4f3 ("ARM: socfpga: Convert to DM serial")

Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
---

 arch/arm/mach-socfpga/spl_gen5.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Marek Vasut Aug. 6, 2018, 12:40 p.m. UTC | #1
On 08/05/2018 09:34 PM, Simon Goldschmidt wrote:
> There were some NULL pointers dereferenced because DM was used
> too early without correct initialization.

This needs better explanation, really.

> This fixes commit 73172753f4f3 ("ARM: socfpga: Convert to DM serial")
> 
> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
>  arch/arm/mach-socfpga/spl_gen5.c | 10 +++++++---
>  1 file changed, 7 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/mach-socfpga/spl_gen5.c b/arch/arm/mach-socfpga/spl_gen5.c
> index d6fe7d35af..0d5526656d 100644
> --- a/arch/arm/mach-socfpga/spl_gen5.c
> +++ b/arch/arm/mach-socfpga/spl_gen5.c
> @@ -86,6 +86,7 @@ void board_init_f(ulong dummy)
>  	const struct cm_config *cm_default_cfg = cm_get_default_config();
>  	unsigned long sdram_size;
>  	unsigned long reg;
> +	int ret;
>  
>  	/*
>  	 * First C code to run. Clear fake OCRAM ECC first as SBE
> @@ -152,6 +153,12 @@ void board_init_f(ulong dummy)
>  	/* unfreeze / thaw all IO banks */
>  	sys_mgr_frzctrl_thaw_req();
>  
> +	ret = spl_early_init();
> +	if (ret) {
> +		debug("spl_early_init() failed: %d\n", ret);
> +		hang();
> +	}
> +
>  	/* enable console uart printing */
>  	preloader_console_init();
>  
> @@ -177,7 +184,4 @@ void board_init_f(ulong dummy)
>  	}
>  
>  	socfpga_bridges_reset(1);
> -
> -	/* Configure simple malloc base pointer into RAM. */
> -	gd->malloc_base = CONFIG_SYS_TEXT_BASE + (1024 * 1024);
>  }
>
Simon Goldschmidt Aug. 6, 2018, 1:40 p.m. UTC | #2
Marek Vasut <marex@denx.de> schrieb am Mo., 6. Aug. 2018, 15:18:

> On 08/05/2018 09:34 PM, Simon Goldschmidt wrote:
> > There were some NULL pointers dereferenced because DM was used
> > too early without correct initialization.
>
> This needs better explanation, really.
>

Ok.

> This fixes commit 73172753f4f3 ("ARM: socfpga: Convert to DM serial")
> >
> > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > ---
> >
> >  arch/arm/mach-socfpga/spl_gen5.c | 10 +++++++---
> >  1 file changed, 7 insertions(+), 3 deletions(-)
> >
> > diff --git a/arch/arm/mach-socfpga/spl_gen5.c
> b/arch/arm/mach-socfpga/spl_gen5.c
> > index d6fe7d35af..0d5526656d 100644
> > --- a/arch/arm/mach-socfpga/spl_gen5.c
> > +++ b/arch/arm/mach-socfpga/spl_gen5.c
> > @@ -86,6 +86,7 @@ void board_init_f(ulong dummy)
> >       const struct cm_config *cm_default_cfg = cm_get_default_config();
> >       unsigned long sdram_size;
> >       unsigned long reg;
> > +     int ret;
> >
> >       /*
> >        * First C code to run. Clear fake OCRAM ECC first as SBE
> > @@ -152,6 +153,12 @@ void board_init_f(ulong dummy)
> >       /* unfreeze / thaw all IO banks */
> >       sys_mgr_frzctrl_thaw_req();
> >
> > +     ret = spl_early_init();
> > +     if (ret) {
> > +             debug("spl_early_init() failed: %d\n", ret);
> > +             hang();
> > +     }
> > +
> >       /* enable console uart printing */
> >       preloader_console_init();
> >
> > @@ -177,7 +184,4 @@ void board_init_f(ulong dummy)
> >       }
> >
> >       socfpga_bridges_reset(1);
> > -
> > -     /* Configure simple malloc base pointer into RAM. */
> > -     gd->malloc_base = CONFIG_SYS_TEXT_BASE + (1024 * 1024);
> >  }
> >
>
>
> --
> Best regards,
> Marek Vasut
>
diff mbox series

Patch

diff --git a/arch/arm/mach-socfpga/spl_gen5.c b/arch/arm/mach-socfpga/spl_gen5.c
index d6fe7d35af..0d5526656d 100644
--- a/arch/arm/mach-socfpga/spl_gen5.c
+++ b/arch/arm/mach-socfpga/spl_gen5.c
@@ -86,6 +86,7 @@  void board_init_f(ulong dummy)
 	const struct cm_config *cm_default_cfg = cm_get_default_config();
 	unsigned long sdram_size;
 	unsigned long reg;
+	int ret;
 
 	/*
 	 * First C code to run. Clear fake OCRAM ECC first as SBE
@@ -152,6 +153,12 @@  void board_init_f(ulong dummy)
 	/* unfreeze / thaw all IO banks */
 	sys_mgr_frzctrl_thaw_req();
 
+	ret = spl_early_init();
+	if (ret) {
+		debug("spl_early_init() failed: %d\n", ret);
+		hang();
+	}
+
 	/* enable console uart printing */
 	preloader_console_init();
 
@@ -177,7 +184,4 @@  void board_init_f(ulong dummy)
 	}
 
 	socfpga_bridges_reset(1);
-
-	/* Configure simple malloc base pointer into RAM. */
-	gd->malloc_base = CONFIG_SYS_TEXT_BASE + (1024 * 1024);
 }