Get socfpga gen5 SPL working again.
Subsystems (3)
v4 cover Get socfpga gen5 SPL working again.
Socfpga gen5 SPL has been broken since moving to DM serial with v2018.07. Also, U-Boot console output has been broken since then. This series fixes this and makes some related small improvements.
Changes in v4:
- dropped already merged patches 1, 3 and 4
- enable the env relocatation for all socfpga, not for gen5 only
- rename socfpga_init_bus_mapping() to socfpga_sdram_remap_zero() and move socfpga_bridges_reset(1) out of that function
Changes in v3:
- moved uart0's "u-boot,dm-pre-reloc;" from socfpga.dtsi to board specific dts files since this can change per board
- added patches 5-7 to boot SPL and U-Boot from fpga OnChip RAM
- dropped Patch 5/6 "serial: ns16550: fix debug uart putc called before init" (this needs a more generic fix)
Changes in v2:
- Improved comment on patch 1
- Removing gd->malloc_base assignment at the end of board_init_f() moved to an extra patch
- don't change printf() to debug() in reset_manager_gen5.c socfpga_bridges_reset() (instead make debug uart handle this)
- make ns16550 debug uart handle putc being called before init
- removed the assignment of gd->malloc_limit from board_init()
Simon Goldschmidt (5):
arm: socfpga: fix device trees to work with DM serial
arm: socfpga: fix U-Boot running from fpga OnChip RAM
arm: socfpga: gen5: combine some init code for SPL and U-Boot
arm: socfpga: fix SPL booting from fpga OnChip RAM
malloc_simple: calloc: don't call memset if malloc failed
arch/arm/dts/socfpga_arria5_socdk.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 5 +++ .../arm/dts/socfpga_cyclone5_de0_nano_soc.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_de1_soc.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_is1.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_socdk.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_sockit.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_socrates.dts | 5 +++ arch/arm/dts/socfpga_cyclone5_sr1500.dts | 2 + arch/arm/dts/socfpga_cyclone5_vining_fpga.dts | 5 +++ arch/arm/mach-socfpga/Kconfig | 12 ++++++ arch/arm/mach-socfpga/include/mach/misc.h | 4 ++ arch/arm/mach-socfpga/misc_gen5.c | 38 ++++++++++++------- arch/arm/mach-socfpga/spl_gen5.c | 34 +++-------------- common/malloc_simple.c | 3 +- include/configs/socfpga_common.h | 11 ++++++ 17 files changed, 111 insertions(+), 43 deletions(-)
Signature · 1 line
2.17.1
PATCH v4 1/5 arm: socfpga: fix device trees to work with DM serial
Device trees need to have the serial console device available before relocation and require a stdout-path in chosen at least for SPL to have a console.
---
Changes in v4: None
Changes in v3:
- moved uart0's "u-boot,dm-pre-reloc;" from socfpga.dtsi to board specific dts files since this can change per board
Changes in v2: None
arch/arm/dts/socfpga_arria5_socdk.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_de10_nano.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_de1_soc.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_is1.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_socdk.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_sockit.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_socrates.dts | 5 +++++ arch/arm/dts/socfpga_cyclone5_sr1500.dts | 2 ++ arch/arm/dts/socfpga_cyclone5_vining_fpga.dts | 5 +++++ 11 files changed, 52 insertions(+)
arch/arm/dts/socfpga_arria5_socdk.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; memory {
@@ -99,3 +100,7 @@ cdns,tslch-ns = <4>; }; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_dbm_soc1.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -56,3 +57,7 @@ disable-over-current; status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_de0_nano_soc.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -75,3 +76,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_de10_nano.dts +5 -0
@@ -13,6 +13,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -65,3 +66,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_de1_soc.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -63,3 +64,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_is1.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; memory {
@@ -102,3 +103,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_socdk.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; memory {
@@ -113,3 +114,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_sockit.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -93,3 +94,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_socrates.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -84,3 +85,7 @@ disable-over-current; status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
arch/arm/dts/socfpga_cyclone5_sr1500.dts +2 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -67,6 +68,7 @@ &uart0 { status = "okay"; + u-boot,dm-pre-reloc; }; &usb1 {
arch/arm/dts/socfpga_cyclone5_vining_fpga.dts +5 -0
@@ -11,6 +11,7 @@ chosen { bootargs = "console=ttyS0,115200"; + stdout-path = "serial0:115200n8"; }; aliases {
@@ -108,3 +109,7 @@ &usb1 { status = "okay"; }; + +&uart0 { + u-boot,dm-pre-reloc; +};
Signature · 1 line
2.17.1
PATCH v4 2/5 arm: socfpga: fix U-Boot running from fpga OnChip RAM
In reply to Simon Goldschmidtgd->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.
---
Changes in v4: enable this fix for all socfpga, not for gen5 only Changes in v3: this patch is new in v3
Changes in v2: None
include/configs/socfpga_common.h | 6 ++++++ 1 file changed, 6 insertions(+)
include/configs/socfpga_common.h +6 -0
@@ -284,6 +284,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START#endif +/* 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 */ +/* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 1 line
2.17.1
PATCH v4 2/5 arm: socfpga: fix U-Boot running from fpga OnChip RAM
Quoted 21 lines · Simon Goldschmidt
gd->env_addrpoints to pre-relocation address even after relocation. This leads to an abort inenv_callback_initwhen loading the environment.Fix this by enabling
CONFIG_SYS_EXTRA_ENV_RELOC.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: enable this fix for all socfpga, not for gen5 only Changes in v3: this patch is new in v3
Changes in v2: Noneinclude/configs/socfpga_common.h | 6 ++++++ 1 file changed, 6 insertions(+)include/configs/socfpga_common.h +0
-0
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 287
Quoted 4 lines
include/configs/socfpga_common.h +1
-0@@ -284,6 +284,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START#endif +/* When U-Boot is started from FPGA, prevent gd->env_addr to point into
Multi-line comment should have this format
/*
* foo
* bar
*/
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 291
Quoted 4 lines
include/configs/socfpga_common.h +4
-0+* FPGA OnChip RAM after relocation +*/ +#define CONFIG_SYS_EXTRA_ENV_RELOC +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE/* start of monitor */
What you don't explain in the commit message is this last line. Why is this needed ?
Quoted 4 lines
include/configs/socfpga_common.h +0
-0/* Extra Environment */ #ifndef CONFIG_SPL_BUILD
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 2/5 arm: socfpga: fix U-Boot running from fpga OnChip RAM
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 26 lines · Simon Goldschmidt
Quoted 9 lines
gd->env_addrpoints to pre-relocation address even after relocation. This leads to an abort inenv_callback_initwhen loading the environment.Fix this by enabling
CONFIG_SYS_EXTRA_ENV_RELOC.Signed-off-by Simon Goldschmidt <[email protected]>---
Review
Quoted 8 lines
Changes in v4: enable this fix for all socfpga, not for gen5 only Changes in v3: this patch is new in v3
Changes in v2: Noneinclude/configs/socfpga_common.h | 6 ++++++ 1 file changed, 6 insertions(+)(quoted diff) +0
-0
b/include/configs/socfpga_common.hQuoted 7 lines
index
8ebf6b85fe..d1148b838b100644include/configs/socfpga_common.h +0
-0@@ -284,6 +284,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START#endif
Quoted 8 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 287
Quoted 1 line
include/configs/socfpga_common.h +1
-0+/* When U-Boot is started from FPGA, prevent gd->env_addr to point into Multi-line comment should have this format
/*
* foo
* bar
*/
Right, of course. I wonder why patman didn't warm me about that...
Quoted 9 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void);
Quoted 4 lines
include/configs/socfpga_common.h +4
-0+* FPGA OnChip RAM after relocation +*/ +#define CONFIG_SYS_EXTRA_ENV_RELOC +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE/* start of monitor */
What you don't explain in the commit message is this last line. Why is this needed ?
The code enabled by CONFIG_SYS_EXTRA_ENV_RELOC used this to calculate the relocation offset. I do think that's a bit strange, but I wouldn't change it with this patchset, or should I?
Simon
Quoted 10 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 295
Quoted 4 lines
include/configs/socfpga_common.h +0
-0/* Extra Environment */ #ifndef CONFIG_SPL_BUILD --
Best regards,
Marek Vasut
PATCH v4 2/5 arm: socfpga: fix U-Boot running from fpga OnChip RAM
Quoted 51 lines · Simon Goldschmidt
Marek Vasut <marex at denx.de <mailto:[email protected]>> schrieb am Mo., 13. Aug. 2018, 22:36:
On 08/13/2018 09:34 PM, 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. > > Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>> > --- > > Changes in v4: enable this fix for all socfpga, not for gen5 only > Changes in v3: this patch is new in v3 > Changes in v2: None > > include/configs/socfpga_common.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h > index 8ebf6b85fe..d1148b838b 100644 > --- a/include/configs/socfpga_common.h > +++ b/include/configs/socfpga_common.h > @@ -284,6 +284,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void); > #define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START > #endif > > +/* When U-Boot is started from FPGA, prevent gd->env_addr to point into Multi-line comment should have this format /* * foo * bar */Right, of course. I wonder why patman didn't warm me about that...
Review
Quoted 4 lines
+ * FPGA OnChip RAM after relocation
+ */(quoted diff) +2
-0+#define CONFIG_SYS_EXTRA_ENV_RELOC +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /*start of monitor */
Quoted 7 lines
What you don't explain in the commit message is this last line. Why is this needed ?
The code enabled by CONFIG_SYS_EXTRA_ENV_RELOC used this to calculate the relocation offset. I do think that's a bit strange, but I wouldn't change it with this patchset, or should I?
You should document _why_ this is needed. Not "because the code enabled by foo needed this", but why that code enabled this and why setting it to SYS_TEXT_BASE is correct.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 2/5 arm: socfpga: fix U-Boot running from fpga OnChip RAM
Quoted 57 lines · Marek Vasut
Quoted 55 lines · Simon Goldschmidt
Marek Vasut <marex at denx.de <mailto:[email protected]>> schrieb am Mo., 13. Aug. 2018, 22:36:
On 08/13/2018 09:34 PM, 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. > > Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>> > --- > > Changes in v4: enable this fix for all socfpga, not for gen5 only > Changes in v3: this patch is new in v3 > Changes in v2: None > > include/configs/socfpga_common.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h > index 8ebf6b85fe..d1148b838b 100644 > --- a/include/configs/socfpga_common.h > +++ b/include/configs/socfpga_common.h > @@ -284,6 +284,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void); > #define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START > #endif > > +/* When U-Boot is started from FPGA, prevent gd->env_addr to point into Multi-line comment should have this format /* * foo * bar */Right, of course. I wonder why patman didn't warm me about that...
Review
Quoted 4 lines
+ * FPGA OnChip RAM after relocation
+ */(quoted diff) +2
-0+#define CONFIG_SYS_EXTRA_ENV_RELOC +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /*start of monitor */
What you don't explain in the commit message is this last line. Why is this needed ?
Quoted 7 lines
Quoted 3 lines
The code enabled by
CONFIG_SYS_EXTRA_ENV_RELOCused this to calculate the relocation offset. I do think that's a bit strange, but I wouldn't change it with this patchset, or should I?You should document _why_ this is needed. Not "because the code enabled by foo needed this", but why that code enabled this and why setting it to
SYS_TEXT_BASEis correct.
Yes, I wouldn't have sent a patch like that. I rather wanted to phrase that I don't know why this is needed for env relocation, as fdt relocation just uses gd->reloc_off. That might work for env relocation, too, but changing that seems out of scope for this patchset.
Simon
PATCH v4 2/5 arm: socfpga: fix U-Boot running from fpga OnChip RAM
Quoted 66 lines · Simon Goldschmidt
Quoted 57 lines · Marek Vasut
Quoted 55 lines · Simon Goldschmidt
Marek Vasut <marex at denx.de <mailto:[email protected]>> schrieb am Mo., 13. Aug. 2018, 22:36:
On 08/13/2018 09:34 PM, 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. > > Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>> > --- > > Changes in v4: enable this fix for all socfpga, not for gen5 only > Changes in v3: this patch is new in v3 > Changes in v2: None > > include/configs/socfpga_common.h | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/include/configs/socfpga_common.h b/include/configs/socfpga_common.h > index 8ebf6b85fe..d1148b838b 100644 > --- a/include/configs/socfpga_common.h > +++ b/include/configs/socfpga_common.h > @@ -284,6 +284,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void); > #define CONFIG_SPL_STACK CONFIG_SYS_SPL_MALLOC_START > #endif > > +/* When U-Boot is started from FPGA, prevent gd->env_addr to point into Multi-line comment should have this format /* * foo * bar */Right, of course. I wonder why patman didn't warm me about that...
Review
Quoted 4 lines
+ * FPGA OnChip RAM after relocation
+ */(quoted diff) +2
-0+#define CONFIG_SYS_EXTRA_ENV_RELOC +#define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE /*start of monitor */
What you don't explain in the commit message is this last line. Why is this needed ?
Quoted 7 lines
Quoted 3 lines
The code enabled by
CONFIG_SYS_EXTRA_ENV_RELOCused this to calculate the relocation offset. I do think that's a bit strange, but I wouldn't change it with this patchset, or should I?You should document _why_ this is needed. Not "because the code enabled by foo needed this", but why that code enabled this and why setting it to
SYS_TEXT_BASEis correct.
Quoted 5 lines
Yes, I wouldn't have sent a patch like that. I rather wanted to phrase that I don't know why this is needed for env relocation, as fdt relocation just uses
gd->reloc_off. That might work for env relocation, too, but changing that seems out of scope for this patchset.
Maybe the comment in board_r.c explains why?
143 #ifdef CONFIG_SYS_EXTRA_ENV_RELOC
144 /*
145 * Some systems need to relocate the env_addr pointer early
because the
146 * location it points to will get invalidated beforeenv_relocate is
147 * called. One example is on systems that might use a L2 or
L3 cache
148 * in SRAM mode and initialize that cache from SRAM mode
back to being
149 * a cache in cpu_init_r.
150 */
151 gd->env_addr += gd->relocaddr - CONFIG_SYS_MONITOR_BASE;
152 #endif
But then the env shouldn't point to pre-reloc address after relocation according to the comment ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 3/5 arm: socfpga: gen5: combine some init code for SPL and U-Boot
In reply to Simon GoldschmidtSome of the code for low level system initialization in SPL's board_init_f() and U-Boot's arch_early_init_r() is the same, so let's combine it into a single function called from both.
---
Changes in v4:
- rename socfpga_init_bus_mapping() to socfpga_sdram_remap_zero() and move socfpga_bridges_reset(1) out of that function
Changes in v3: this patch is new in v3
Changes in v2: None
arch/arm/mach-socfpga/include/mach/misc.h | 4 ++++ arch/arm/mach-socfpga/misc_gen5.c | 29 +++++++++++++---------- arch/arm/mach-socfpga/spl_gen5.c | 28 +--------------------- 3 files changed, 22 insertions(+), 39 deletions(-)
arch/arm/mach-socfpga/include/mach/misc.h +4 -0
@@ -27,6 +27,10 @@ unsigned int shared_uart_com_port(const void *blob);unsigned int uart_com_port (const void *blob);#endif +#ifdef CONFIG_TARGET_SOCFPGA_GEN5 +void socfpga_sdram_remap_zero (void ); +#endif +void do_bridge_reset (int enable);#endif /* _MISC_H_ */
arch/arm/mach-socfpga/misc_gen5.c +17 -12
@@ -175,6 +175,22 @@ static void socfpga_nic301_slave_ns(void)writel (0x1 , &nic301_regs->sdrdata); } +void socfpga_sdram_remap_zero (void ) +{ +socfpga_nic301_slave_ns (); + +/* +* Private components security: +* U-Boot : configure private timer, global timer and cpu component +* access as non secure for kernel stage (as required by Linux) +*/ +setbits_le32 (&scu_regs->sacr,0xfff ); + +/* Configure the L2 controller to make SDRAM start at 0 */ +writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +writel (0x1 , &pl310->pl310_addr_filter_start); +} +static u32 iswgrp_handoff[8 ];int arch_early_init_r (void )
@@ -195,18 +211,7 @@ int arch_early_init_r(void)socfpga_bridges_reset (1 ); -socfpga_nic301_slave_ns (); - -/* -* Private components security: -* U-Boot : configure private timer, global timer and cpu component -* access as non secure for kernel stage (as required by Linux) -*/ -setbits_le32 (&scu_regs->sacr,0xfff ); - -/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ -writel (0x1 , &pl310->pl310_addr_filter_start); +socfpga_sdram_remap_zero ();/* Add device descriptor to FPGA device table */ socfpga_fpga_add ();
arch/arm/mach-socfpga/spl_gen5.c +1 -27
@@ -5,7 +5,6 @@#include <common.h> #include <asm/io.h> -#include <asm/pl310.h> #include <asm/u-boot.h> #include <asm/utils.h> #include <image.h>
@@ -17,8 +16,6 @@#include <asm/arch/misc.h> #include <asm/arch/scan_manager.h> #include <asm/arch/sdram.h> -#include <asm/arch/scu.h> -#include <asm/arch/nic301.h> #include <asm/sections.h> #include <debug_uart.h> #include <fdtdec.h>
@@ -26,12 +23,6 @@DECLARE_GLOBAL_DATA_PTR ; -static struct pl310_regs *const pl310 = - (struct pl310_regs *)CONFIG_SYS_PL310_BASE ; -static struct scu_registers *scu_regs = - (struct scu_registers *)SOCFPGA_MPUSCU_ADDRESS ; -static struct nic301_registers *nic301_regs = - (struct nic301_registers *)SOCFPGA_L3REGS_ADDRESS ;static const struct socfpga_system_manager *sysmgr_regs = (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS ;
@@ -72,16 +63,6 @@ u32 spl_boot_mode(const u32 boot_device) }#endif -static void socfpga_nic301_slave_ns (void ) -{ -writel (0x1 , &nic301_regs->lwhps2fpgaregs); -writel (0x1 , &nic301_regs->hps2fpgaregs); -writel (0x1 , &nic301_regs->acp); -writel (0x1 , &nic301_regs->rom); -writel (0x1 , &nic301_regs->ocram); -writel (0x1 , &nic301_regs->sdrdata); -} -void board_init_f (ulong dummy) {const struct cm_config *cm_default_cfg =cm_get_default_config ();
@@ -103,14 +84,7 @@ void board_init_f(ulong dummy)memset (__bss_start,0 , __bss_end - __bss_start); -socfpga_nic301_slave_ns (); - -/* Configure ARM MPU SNSAC register. */ -setbits_le32 (&scu_regs->sacr,0xfff ); - -/* Remap SDRAM to 0x0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ -writel (0x1 , &pl310->pl310_addr_filter_start); +socfpga_sdram_remap_zero ();debug ("Freezing all I/O banks\n" );/* freeze all IO banks */
Signature · 1 line
2.17.1
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
In reply to Simon GoldschmidtTo boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.
---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: None
arch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)
arch/arm/mach-socfpga/Kconfig +12 -0
@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endif
arch/arm/mach-socfpga/misc_gen5.c +9 -2
@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }
@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();
arch/arm/mach-socfpga/spl_gen5.c +4 -2
@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );
@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }
include/configs/socfpga_common.h +5 -0
@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )
Signature · 1 line
2.17.1
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 100 lines · Simon Goldschmidt
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +0
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top)
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 10 lines
include/configs/socfpga_common.h +5
-0*/ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )
What about converting the SPL_TEXT_BASE to Kconfig , cfr my comment on the previous version of the patch ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 116 lines · Simon Goldschmidt
Quoted 16 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: NoneReview
Quoted 7 lines
arch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)(quoted diff) +0
-0b/arch/arm/mach-socfpga/Kconfig
Quoted 5 lines
index
5c1df2cf1f..a909395aac100644arch/arm/mach-socfpga/Kconfig +0
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGAarch/arm/mach-socfpga/Kconfig config SYS_CONFIG_NAME · line 142
Quoted 10 lines
arch/arm/mach-socfpga/Kconfig +8
-0endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code torun
arch/arm/mach-socfpga/Kconfig config SYS_CONFIG_NAME · line 143
Quoted 1 line
arch/arm/mach-socfpga/Kconfig +1
-0+ from FPGA OnChip memory instead of SRAM and ensures FPGA OnChipRAM
Review
Quoted 4 lines
arch/arm/mach-socfpga/Kconfig +3
-0+ stays accessible while SPL runs. + +endif(quoted diff) +0
-0
b/arch/arm/mach-socfpga/misc_gen5.cReview
Quoted 29 lines
index
429c3d6cd5..c82c3584dc100644arch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();(quoted diff) +0
-0
b/arch/arm/mach-socfpga/spl_gen5.cReview
Quoted 22 lines
index
be318cc0d9..0c7f6a8c84100644arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }(quoted diff) +0
-0
b/include/configs/socfpga_common.hQuoted 15 lines
index
d1148b838b..99c5e39086100644include/configs/socfpga_common.h +5
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE
Quoted 5 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 1 line
include/configs/socfpga_common.h +0
-0#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?
D'oh! That slipped through. Sorry for reminding.
Simon
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 119 lines · Simon Goldschmidt
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 115 lines · Simon Goldschmidt
Quoted 100 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +0
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 10 lines
include/configs/socfpga_common.h +5
-0*/ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?
Revisiting that request again, it seems like I would touch tons of files in include/configs (and maybe tons of defconfigs). Is this really the right series to do so?
Or did you think of a config option scoped to mach-socfpga only?
Simon
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 117 lines · Simon Goldschmidt
Quoted 115 lines · Simon Goldschmidt
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 111 lines · Simon Goldschmidt
Quoted 109 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +5
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZE
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 1 line
include/configs/socfpga_common.h +0
-0#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?Revisiting that request again, it seems like I would touch tons of files in
include/configs(and maybe tons of defconfigs). Is this really the right series to do so?
If you run moveconfig.py on it, does it seems like much work is left after moveconfig did it's job ? I'd like to prevent the ifdeffery.
Quoted 1 line
Or did you think of a config option scoped to mach-socfpga only?
I'd like to see a generic one, since this is generic config option. Try adding the Kconfig entry, then run moveconfig and see if there's much to be done. Maybe it'll be easier than it looks at first.
Quoted 2 lines
Simon
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 128 lines · Marek Vasut
Quoted 117 lines · Simon Goldschmidt
Quoted 115 lines · Simon Goldschmidt
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 111 lines · Simon Goldschmidt
Quoted 109 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +5
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZEQuoted 8 lines
Quoted 4 lines
Quoted 4 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 1 line
include/configs/socfpga_common.h +0
-0#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?Revisiting that request again, it seems like I would touch tons of files in
include/configs(and maybe tons of defconfigs). Is this really the right series to do so?
Quoted 8 lines
If you run
moveconfig.pyon it, does it seems like much work is left after moveconfig did it's job ? I'd like to prevent the ifdeffery.Quoted 1 line
Or did you think of a config option scoped to mach-socfpga only?
I'd like to see a generic one, since this is generic config option. Try adding the
Kconfigentry, then run moveconfig and see if there's much to be done. Maybe it'll be easier than it looks at first.
I didn't want to say it's not easy. I wanted to say it produces a really big patch, as almost every board is affected. Which does not seem to fit into this series...
But I do have some problems: defconfigs for nds32 and sandbox are failing. I got sh and riscv working by editing ~/.buildman. Is this expected?
Simon
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 134 lines · Simon Goldschmidt
Quoted 133 lines · Marek Vasut
Quoted 117 lines · Simon Goldschmidt
Quoted 115 lines · Simon Goldschmidt
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 111 lines · Simon Goldschmidt
Quoted 109 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +5
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZEQuoted 8 lines
Quoted 4 lines
Quoted 4 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 1 line
include/configs/socfpga_common.h +0
-0#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?Revisiting that request again, it seems like I would touch tons of files in
include/configs(and maybe tons of defconfigs). Is this really the right series to do so?If you run
moveconfig.pyon it, does it seems like much work is left after moveconfig did it's job ? I'd like to prevent the ifdeffery.Quoted 1 line
Or did you think of a config option scoped to mach-socfpga only?
Quoted 7 lines
Quoted 3 lines
I'd like to see a generic one, since this is generic config option. Try adding the
Kconfigentry, then run moveconfig and see if there's much to be done. Maybe it'll be easier than it looks at first.I didn't want to say it's not easy. I wanted to say it produces a really big patch, as almost every board is affected. Which does not seem to fit into this series...
I agree the patch will be huge. And it'd be a nice cleanup. Would you mind postponing this booting from FPGA patch series for after the release ? I'd like to get the fixes for the standard booting paths into the release, but the next into the next one.
Quoted 3 lines
But I do have some problems: defconfigs for nds32 and sandbox are failing. I got sh and riscv working by editing ~/.buildman. Is this expected?
Possibly. Try running it through travis-ci to see what broke. No need to build everything locally.
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 140 lines · Marek Vasut
Quoted 138 lines · Simon Goldschmidt
Quoted 136 lines · Marek Vasut
Quoted 117 lines · Simon Goldschmidt
Quoted 115 lines · Simon Goldschmidt
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 111 lines · Simon Goldschmidt
Quoted 109 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +5
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZEQuoted 8 lines
Quoted 4 lines
Quoted 4 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 1 line
include/configs/socfpga_common.h +0
-0#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?Revisiting that request again, it seems like I would touch tons of files in
include/configs(and maybe tons of defconfigs). Is this really the right series to do so?If you run
moveconfig.pyon it, does it seems like much work is left after moveconfig did it's job ? I'd like to prevent the ifdeffery.Quoted 1 line
Or did you think of a config option scoped to mach-socfpga only?
I'd like to see a generic one, since this is generic config option. Try adding the
Kconfigentry, then run moveconfig and see if there's much to be done. Maybe it'll be easier than it looks at first.
Quoted 8 lines
Quoted 3 lines
I didn't want to say it's not easy. I wanted to say it produces a really big patch, as almost every board is affected. Which does not seem to fit into this series...
I agree the patch will be huge. And it'd be a nice cleanup. Would you mind postponing this booting from FPGA patch series for after the release ? I'd like to get the fixes for the standard booting paths into the release, but the next into the next one.
Yes, let's leave SPL-from-FPGA for the next release then. But can we still merge the gd->ev_addr relocation patch for U-Boot? I'll send a V5 with fixed comments.
Simon
Quoted 11 lines
Quoted 4 lines
But I do have some problems: defconfigs for nds32 and sandbox are failing. I got sh and riscv working by editing ~/.buildman. Is this expected?
Possibly. Try running it through travis-ci to see what broke. No need to build everything locally.
--
Best regards,
Marek Vasut
PATCH v4 4/5 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 145 lines · Simon Goldschmidt
Quoted 144 lines · Marek Vasut
Quoted 141 lines · Simon Goldschmidt
Quoted 128 lines · Marek Vasut
Quoted 117 lines · Simon Goldschmidt
Quoted 115 lines · Simon Goldschmidt
Marek Vasut <[email protected]> schrieb am Mo., 13. Aug. 2018, 22:36:
Quoted 111 lines · Simon Goldschmidt
Quoted 109 lines
To boot from fpga OnChip RAM, some changes are required in SPL to ensure the code is linked to the correct address (in contrast to QSPI and MMC boot, FPGA boot executes SPL in place instead of copying it to SRAM) and that fpga OnChip RAM stays accessible while SPL runs (don't disable fpga bridges).
This adds a new config option (
CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA) for socfpga gen5 boards.Signed-off-by Simon Goldschmidt <[email protected]>---
Changes in v4: Adapted to changed previous patch
Changes in v3: this patch is new in v3
Changes in v2: Nonearch/arm/mach-socfpga/Kconfig | 12 ++++++++++++ arch/arm/mach-socfpga/misc_gen5.c | 11 +++++++++-- arch/arm/mach-socfpga/spl_gen5.c | 6 ++++-- include/configs/socfpga_common.h | 5 +++++ 4 files changed, 30 insertions(+), 4 deletions(-)arch/arm/mach-socfpga/Kconfig +12
-0@@ -132,3 +132,15 @@ config SYS_CONFIG_NAME default "socfpga_vining_fpga" if TARGET_SOCFPGA_SAMTEC_VINING_FPGA endif + +if TARGET_SOCFPGA_GEN5 + +config SPL_SOCFPGA_BOOT_FROM_FPGA + bool "Allow booting SPL from FPGA OnChip RAM" + default n + help + Boot from FPGA: this changes the linker address for SPL code to run + from FPGA OnChip memory instead of SRAM and ensures FPGA OnChip RAM + stays accessible while SPL runs. + +endifarch/arm/mach-socfpga/misc_gen5.c +9
-2@@ -187,7 +187,13 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +if (CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) { +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); + }else { +/* remap.mpuzero */ +writel (0x1 , &nic301_regs->remap); + }writel (0x1 , &pl310->pl310_addr_filter_start); }@@ -209,7 +215,8 @@ int arch_early_init_r(void)for (i =0 ; i <8 ; i++)/* Cache initial SW setting regs */ iswgrp_handoff[i] =readl (&sysmgr_regs->iswgrp_handoff[i]); -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_sdram_remap_zero ();arch/arm/mach-socfpga/spl_gen5.c +4
-2@@ -93,7 +93,8 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all ();/* Put FPGA bridges into reset too. */ -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 );socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );@@ -163,5 +164,6 @@ void board_init_f(ulong dummy)hang (); } -socfpga_bridges_reset (1 ); +if (!CONFIG_IS_ENABLED (SOCFPGA_BOOT_FROM_FPGA )) +socfpga_bridges_reset (1 ); }include/configs/socfpga_common.h +5
-0@@ -239,7 +239,12 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* 0xFFEz_zzzz ...... Malloc area (grows up to top) * 0xFFE3_FFFF ...... End of SRAM (top) */ +#if CONFIG_SPL_SOCFPGA_BOOT_FROM_FPGA +/* SPL executed from FPGA */ +#define CONFIG_SPL_TEXT_BASE 0xC0000000 +#else #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR +#endif #define CONFIG_SPL_MAX_SIZE CONFIG_SYS_INIT_RAM_SIZEQuoted 8 lines
Quoted 4 lines
Quoted 4 lines
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 250
Quoted 1 line
include/configs/socfpga_common.h +0
-0#if defined(CONFIG_TARGET_SOCFPGA_ARRIA10 )What about converting the
SPL_TEXT_BASEtoKconfig, cfr my comment on the previous version of the patch ?Revisiting that request again, it seems like I would touch tons of files in
include/configs(and maybe tons of defconfigs). Is this really the right series to do so?Quoted 8 lines
If you run
moveconfig.pyon it, does it seems like much work is left after moveconfig did it's job ? I'd like to prevent the ifdeffery.Quoted 1 line
Or did you think of a config option scoped to mach-socfpga only?
I'd like to see a generic one, since this is generic config option. Try adding the
Kconfigentry, then run moveconfig and see if there's much to be done. Maybe it'll be easier than it looks at first.I didn't want to say it's not easy. I wanted to say it produces a really big patch, as almost every board is affected. Which does not seem to fit into this series...
Quoted 8 lines
Quoted 4 lines
I agree the patch will be huge. And it'd be a nice cleanup. Would you mind postponing this booting from FPGA patch series for after the release ? I'd like to get the fixes for the standard booting paths into the release, but the next into the next one.
Yes, let's leave SPL-from-FPGA for the next release then. But can we still merge the
gd->ev_addrrelocation patch for U-Boot? I'll send a V5 with fixed comments.
Yes, thanks
Signature · 2 lines
Best regards, Marek Vasut
PATCH v4 5/5 malloc_simple: calloc: don't call memset if malloc failed
In reply to Simon Goldschmidtmalloc_simple() can return 0 if out of memory. Don't call memset from calloc() in this case but rely on the caller checking the return value.
---
Changes in v4: None
Changes in v3: None
Changes in v2: None
common/malloc_simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/malloc_simple.c +2 -1
@@ -57,7 +57,8 @@ void *calloc(size_t nmemb, size_t elem_size)void *ptr; ptr =malloc (size); -memset (ptr,'\0' , size); +if (ptr) +memset (ptr,'\0' , size);return ptr; }
Signature · 1 line
2.17.1
PATCH v4 5/5 malloc_simple: calloc: don't call memset if malloc failed
Quoted 6 lines · Simon Goldschmidt
malloc_simple()can return 0 if out of memory. Don't call memset fromcalloc()in this case but rely on the caller checking the return value.Signed-off-by Simon Goldschmidt <[email protected]>Reviewed-by Marek Vasut <[email protected]>
Separate this from the patchset, this has nothing to do with socfpga .
Quoted 24 lines
---
Changes in v4: None
Changes in v3: None
Changes in v2: Nonecommon/malloc_simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)common/malloc_simple.c +2
-1@@ -57,7 +57,8 @@ void *calloc(size_t nmemb, size_t elem_size)void *ptr; ptr =malloc (size); -memset (ptr,'\0' , size); +if (ptr) +memset (ptr,'\0' , size);return ptr; }
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 malloc_simple: calloc: don't call memset if malloc failed
malloc_simple() can return 0 if out of memory. Don't call memset from calloc() in this case but rely on the caller checking the return value.
---
Changes in v1:
- extracted this patch from series "Get socfpga gen5 SPL working again" as it is not socfpga specific
common/malloc_simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
common/malloc_simple.c +2 -1
@@ -57,7 +57,8 @@ void *calloc(size_t nmemb, size_t elem_size)void *ptr; ptr =malloc (size); -memset (ptr,'\0' , size); +if (ptr) +memset (ptr,'\0' , size);return ptr; }
Signature · 1 line
2.17.1
PATCH 1/1 malloc_simple: calloc: don't call memset if malloc failed
Quoted 6 lines · Simon Goldschmidt
malloc_simple()can return 0 if out of memory. Don't call memset fromcalloc()in this case but rely on the caller checking the return value.Signed-off-by Simon Goldschmidt <[email protected]>Reviewed-by Marek Vasut <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: not available URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180824/7794b59a/attachment.sig>