diff mbox series

[U-Boot,v3,5/8] arm: socfpga: fix U-Boot running from fpga OnChip RAM

Message ID 20180813073351.29293-6-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. 13, 2018, 7:33 a.m. UTC
gd->env_addr points to pre-relocation address even after
relocation. This leads to an abort in env_callback_init
when loading the environment.

Fix this by enabling CONFIG_SYS_EXTRA_ENV_RELOC.

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

Changes in v3: this patch is new in v3
Changes in v2: None

 include/configs/socfpga_common.h | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Marek Vasut Aug. 13, 2018, 1:23 p.m. UTC | #1
On 08/13/2018 09:33 AM, Simon Goldschmidt wrote:
> gd->env_addr points to pre-relocation address even after
> relocation. This leads to an abort in env_callback_init
> when loading the environment.
> 
> Fix this by enabling CONFIG_SYS_EXTRA_ENV_RELOC.

Doesn't this apply to gen10 too ?

> Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> ---
> 
> Changes in v3: this patch is new in v3
> Changes in v2: None
> 
>  include/configs/socfpga_common.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
> index 8ebf6b85fe..2fb207c86a 100644
> --- a/include/configs/socfpga_common.h
> +++ b/include/configs/socfpga_common.h
> @@ -284,6 +284,14 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>  #define CONFIG_SPL_STACK		CONFIG_SYS_SPL_MALLOC_START
>  #endif
>  
> +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> +/* When U-Boot is started from FPGA, prevent gd->env_addr to point into
> + * FPGA OnChip RAM after relocation
> + */
> +#define CONFIG_SYS_EXTRA_ENV_RELOC
> +#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */
> +#endif
> +
>  /* Extra Environment */
>  #ifndef CONFIG_SPL_BUILD
>  
>
Simon Goldschmidt Aug. 13, 2018, 1:33 p.m. UTC | #2
Marek Vasut <marex@denx.de> schrieb am Mo., 13. Aug. 2018, 15:29:

> On 08/13/2018 09:33 AM, Simon Goldschmidt wrote:
> > gd->env_addr points to pre-relocation address even after
> > relocation. This leads to an abort in env_callback_init
> > when loading the environment.
> >
> > Fix this by enabling CONFIG_SYS_EXTRA_ENV_RELOC.
>
> Doesn't this apply to gen10 too ?
>

Ehrm, I really don't know. As I don't know gen10, I didn't want to break it.

I could try to check the sources, but without knowing the architecture
details and having a board to test, I might break things...


> > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com>
> > ---
> >
> > Changes in v3: this patch is new in v3
> > Changes in v2: None
> >
> >  include/configs/socfpga_common.h | 8 ++++++++
> >  1 file changed, 8 insertions(+)
> >
> > diff --git a/include/configs/socfpga_common.h
> b/include/configs/socfpga_common.h
> > index 8ebf6b85fe..2fb207c86a 100644
> > --- a/include/configs/socfpga_common.h
> > +++ b/include/configs/socfpga_common.h
> > @@ -284,6 +284,14 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
> >  #define CONFIG_SPL_STACK             CONFIG_SYS_SPL_MALLOC_START
> >  #endif
> >
> > +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
> > +/* When U-Boot is started from FPGA, prevent gd->env_addr to point into
> > + * FPGA OnChip RAM after relocation
> > + */
> > +#define CONFIG_SYS_EXTRA_ENV_RELOC
> > +#define CONFIG_SYS_MONITOR_BASE      CONFIG_SYS_TEXT_BASE    /* start
> of monitor */
> > +#endif
> > +
> >  /* Extra Environment */
> >  #ifndef CONFIG_SPL_BUILD
> >
> >
>
>
> --
> Best regards,
> Marek Vasut
>
Marek Vasut Aug. 13, 2018, 1:49 p.m. UTC | #3
On 08/13/2018 03:33 PM, Simon Goldschmidt wrote:
> 
> 
> Marek Vasut <marex@denx.de <mailto:marex@denx.de>> schrieb am Mo., 13.
> Aug. 2018, 15:29:
> 
>     On 08/13/2018 09:33 AM, Simon Goldschmidt wrote:
>     > gd->env_addr points to pre-relocation address even after
>     > relocation. This leads to an abort in env_callback_init
>     > when loading the environment.
>     >
>     > Fix this by enabling CONFIG_SYS_EXTRA_ENV_RELOC.
> 
>     Doesn't this apply to gen10 too ?
> 
> 
> Ehrm, I really don't know. As I don't know gen10, I didn't want to break it.
> 
> I could try to check the sources, but without knowing the architecture
> details and having a board to test, I might break things...

I'll probably be able to intercept that breakage, so just send a V4 with
that ifdef removed.

>     > Signed-off-by: Simon Goldschmidt <simon.k.r.goldschmidt@gmail.com
>     <mailto:simon.k.r.goldschmidt@gmail.com>>
>     > ---
>     >
>     > Changes in v3: this patch is new in v3
>     > Changes in v2: None
>     >
>     >  include/configs/socfpga_common.h | 8 ++++++++
>     >  1 file changed, 8 insertions(+)
>     >
>     > diff --git a/include/configs/socfpga_common.h
>     b/include/configs/socfpga_common.h
>     > index 8ebf6b85fe..2fb207c86a 100644
>     > --- a/include/configs/socfpga_common.h
>     > +++ b/include/configs/socfpga_common.h
>     > @@ -284,6 +284,14 @@ unsigned int cm_get_qspi_controller_clk_hz(void);
>     >  #define CONFIG_SPL_STACK             CONFIG_SYS_SPL_MALLOC_START
>     >  #endif
>     > 
>     > +#ifdef CONFIG_TARGET_SOCFPGA_GEN5
>     > +/* When U-Boot is started from FPGA, prevent gd->env_addr to
>     point into
>     > + * FPGA OnChip RAM after relocation
>     > + */
>     > +#define CONFIG_SYS_EXTRA_ENV_RELOC
>     > +#define CONFIG_SYS_MONITOR_BASE      CONFIG_SYS_TEXT_BASE    /*
>     start of monitor */
>     > +#endif
>     > +
>     >  /* Extra Environment */
>     >  #ifndef CONFIG_SPL_BUILD
>     > 
>     >
> 
> 
>     -- 
>     Best regards,
>     Marek Vasut
>
diff mbox series

Patch

diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h
index 8ebf6b85fe..2fb207c86a 100644
--- a/include/configs/socfpga_common.h
+++ b/include/configs/socfpga_common.h
@@ -284,6 +284,14 @@  unsigned int cm_get_qspi_controller_clk_hz(void);
 #define CONFIG_SPL_STACK		CONFIG_SYS_SPL_MALLOC_START
 #endif
 
+#ifdef CONFIG_TARGET_SOCFPGA_GEN5
+/* When U-Boot is started from FPGA, prevent gd->env_addr to point into
+ * FPGA OnChip RAM after relocation
+ */
+#define CONFIG_SYS_EXTRA_ENV_RELOC
+#define CONFIG_SYS_MONITOR_BASE	CONFIG_SYS_TEXT_BASE	/* start of monitor */
+#endif
+
 /* Extra Environment */
 #ifndef CONFIG_SPL_BUILD