arm: socfpga: fix SPL booting from fpga OnChip RAM
Subsystems (3)
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
This patch prevents disabling the FPGA bridges when SPL or U-Boot is executed from FPGA onchip RAM.
---
There are other patches required to make boot from FPGA work correctly:
- CONFIG_SPL_TEXT_BASE needs to be set to 0xC0000000 ideally this is done by moving SPL_TEXT_BASE to Kconfig:
https://patchwork.ozlabs.org/patch/976918/
- spl_ram.c needs this patch by Michal Simek:
https://patchwork.ozlabs.org/patch/978694/
- For U-Boot to be run from FPGA onchip RAM, either CONFIG_SYS_EXTRA_ENV_RELOC needs to be used or this patch is required to relocate gd->env_addr:
https://patchwork.ozlabs.org/patch/975702/
--- arch/arm/mach-socfpga/include/mach/base_addr_ac5.h | 1 + arch/arm/mach-socfpga/misc_gen5.c | 8 ++++++++ arch/arm/mach-socfpga/spl_gen5.c | 4 ++++ 3 files changed, 13 insertions(+)
arch/arm/mach-socfpga/include/mach/base_addr_ac5.h +1 -0
@@ -6,6 +6,7 @@#ifndef _SOCFPGA_BASE_ADDRS_H_#define _SOCFPGA_BASE_ADDRS_H_ +#define SOCFPGA_FPGA_SLAVES_ADDRESS 0xc0000000#define SOCFPGA_STM_ADDRESS 0xfc000000#define SOCFPGA_DAP_ADDRESS 0xff000000#define SOCFPGA_EMAC0_ADDRESS 0xff700000
arch/arm/mach-socfpga/misc_gen5.c +8 -0
@@ -187,7 +187,15 @@ void socfpga_sdram_remap_zero(void)setbits_le32 (&scu_regs->sacr,0xfff );/* Configure the L2 controller to make SDRAM start at 0 */ +#if (defined(CONFIG_SPL_BUILD ) && \ + (CONFIG_SPL_TEXT_BASE ==SOCFPGA_FPGA_SLAVES_ADDRESS )) || \ + ((CONFIG_SYS_TEXT_BASE >=SOCFPGA_FPGA_SLAVES_ADDRESS ) && \ + (CONFIG_SYS_TEXT_BASE <SOCFPGA_STM_ADDRESS )) +/* remap.mpuzero, keep fpga bridge enabled */ +writel (0x9 , &nic301_regs->remap); +#else writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ +#endif writel (0x1 , &pl310->pl310_addr_filter_start); }
arch/arm/mach-socfpga/spl_gen5.c +4 -0
@@ -92,8 +92,10 @@ void board_init_f(ulong dummy)/* Put everything into reset but L4WD0. */ socfpga_per_reset_all (); +#if CONFIG_SPL_TEXT_BASE !=SOCFPGA_FPGA_SLAVES_ADDRESS /* Put FPGA bridges into reset too. */ socfpga_bridges_reset (1 ); +#endif socfpga_per_reset (SOCFPGA_RESET (SDR ),0 );socfpga_per_reset (SOCFPGA_RESET (UART0 ),0 );
@@ -163,5 +165,7 @@ void board_init_f(ulong dummy)hang (); } +#if CONFIG_SPL_TEXT_BASE !=SOCFPGA_FPGA_SLAVES_ADDRESS socfpga_bridges_reset (1 ); +#endif }
Signature · 1 line
2.17.1
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 7 lines · Simon Goldschmidt
This patch prevents disabling the FPGA bridges when SPL or U-Boot is executed from FPGA onchip RAM.
Signed-off-by Simon Goldschmidt <[email protected]>---
Quoted 11 lines
There are other patches required to make boot from FPGA work correctly:
-CONFIG_SPL_TEXT_BASEneeds to be set to0xC0000000ideally this is done by movingSPL_TEXT_BASEtoKconfig:
https://patchwork.ozlabs.org/patch/976918/
-spl_ram.cneeds this patch by Michal Simek:
https://patchwork.ozlabs.org/patch/978694/
- For U-Boot to be run from FPGA onchip RAM, eitherCONFIG_SYS_EXTRA_ENV_RELOCneeds to be used or this patch is required to relocategd->env_addr:
https://patchwork.ozlabs.org/patch/975702/
For the record, I'm currently reviewing the last two parts here. The first one will come soon (I do Kconfig migrations separate so I can see a lack of size change).
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/20181006/db5b6331/attachment.sig>
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 20 lines · Tom Rini
Quoted 11 lines · Simon Goldschmidt
This patch prevents disabling the FPGA bridges when SPL or U-Boot is executed from FPGA onchip RAM.
Signed-off-by Simon Goldschmidt <[email protected]>---
There are other patches required to make boot from FPGA work correctly:
-CONFIG_SPL_TEXT_BASEneeds to be set to0xC0000000ideally this is done by movingSPL_TEXT_BASEtoKconfig:Quoted 7 lines
https://patchwork.ozlabs.org/patch/976918/ - spl_ram.c needs this patch by Michal Simek: https://patchwork.ozlabs.org/patch/978694/ - For U-Boot to be run from FPGA onchip RAM, either CONFIG_SYS_EXTRA_ENV_RELOC needs to be used or this patch is required to relocate gd->env_addr: https://patchwork.ozlabs.org/patch/975702/
Quoted 3 lines
For the record, I'm currently reviewing the last two parts here. The first one will come soon (I do
Kconfigmigrations separate so I can see a lack of size change).
OK, after Tom merged the last to parts, I can confirm I can successfully boot from FPGA by adapting CONFIG_SYS_TEXT_BASE via config and hacking CONFIG_SPL_TEXT_BASE to 0xC0000000 (as moving this to Kconfig is still missing).
Thanks,
Simon
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 26 lines · Simon Goldschmidt
Quoted 20 lines · Tom Rini
Quoted 7 lines · Simon Goldschmidt
This patch prevents disabling the FPGA bridges when SPL or U-Boot is executed from FPGA onchip RAM.
Signed-off-by Simon Goldschmidt <[email protected]>---
Quoted 11 lines
There are other patches required to make boot from FPGA work correctly:
-CONFIG_SPL_TEXT_BASEneeds to be set to0xC0000000ideally this is done by movingSPL_TEXT_BASEtoKconfig:
https://patchwork.ozlabs.org/patch/976918/
-spl_ram.cneeds this patch by Michal Simek:
https://patchwork.ozlabs.org/patch/978694/
- For U-Boot to be run from FPGA onchip RAM, eitherCONFIG_SYS_EXTRA_ENV_RELOCneeds to be used or this patch is required to relocategd->env_addr:
https://patchwork.ozlabs.org/patch/975702/Quoted 3 lines
For the record, I'm currently reviewing the last two parts here. The first one will come soon (I do
Kconfigmigrations separate so I can see a lack of size change).
Quoted 4 lines
OK, after Tom merged the last to parts, I can confirm I can successfully boot from FPGA by adapting
CONFIG_SYS_TEXT_BASEvia config and hackingCONFIG_SPL_TEXT_BASEto0xC0000000(as moving this toKconfigis still missing).
So is this patch still needed ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Marek Vasut <[email protected]> schrieb am Mo., 8. Okt. 2018, 02:20:
Quoted 27 lines · Simon Goldschmidt
Quoted 26 lines · Tom Rini
Quoted 23 lines · Simon Goldschmidt
Quoted 12 lines
This patch prevents disabling the FPGA bridges when SPL or U-Boot is executed from FPGA onchip RAM.
Signed-off-by Simon Goldschmidt <[email protected]>---
There are other patches required to make boot from FPGA work correctly:
-CONFIG_SPL_TEXT_BASEneeds to be set to0xC0000000ideally this is done by movingSPL_TEXT_BASEtoKconfig:Quoted 7 lines
https://patchwork.ozlabs.org/patch/976918/ - spl_ram.c needs this patch by Michal Simek: https://patchwork.ozlabs.org/patch/978694/ - For U-Boot to be run from FPGA onchip RAM, either CONFIG_SYS_EXTRA_ENV_RELOC needs to be used or this patch is required to relocate gd->env_addr: https://patchwork.ozlabs.org/patch/975702/For the record, I'm currently reviewing the last two parts here. The first one will come soon (I do
Kconfigmigrations separate so I can see a lack of size change).
Quoted 7 lines
Quoted 4 lines
OK, after Tom merged the last to parts, I can confirm I can successfully boot from FPGA by adapting
CONFIG_SYS_TEXT_BASEvia config and hackingCONFIG_SPL_TEXT_BASEto0xC0000000(as moving this toKconfigis still missing).So is this patch still needed ?
Yes, sorry for being unclear there.
Simon
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 44 lines · Simon Goldschmidt
Marek Vasut <marex at denx.de <mailto:[email protected]>> schrieb am Mo., 8. Okt. 2018, 02:20:
On 10/07/2018 01:08 PM, Simon Goldschmidt wrote: > On 06.10.2018 22:38, Tom Rini wrote: >> On Sat, Oct 06, 2018 at 10:33:42PM +0200, Simon Goldschmidt wrote: >> >>> This patch prevents disabling the FPGA bridges when >>> SPL or U-Boot is executed from FPGA onchip RAM. >>> >>> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>> >>> --- >>> >>> >>> There are other patches required to make boot from >>> FPGA work correctly: >>> - CONFIG_SPL_TEXT_BASE needs to be set to 0xC0000000 >>> ideally this is done by moving SPL_TEXT_BASE to Kconfig: >>> https://patchwork.ozlabs.org/patch/976918/ >>> - spl_ram.c needs this patch by Michal Simek: >>> https://patchwork.ozlabs.org/patch/978694/ >>> - For U-Boot to be run from FPGA onchip RAM, either >>> CONFIG_SYS_EXTRA_ENV_RELOC needs to be used or this patch >>> is required to relocate gd->env_addr: >>> https://patchwork.ozlabs.org/patch/975702/ >> For the record, I'm currently reviewing the last two parts here. The >> first one will come soon (I do Kconfig migrations separate so I can see >> a lack of size change). > > > OK, after Tom merged the last to parts, I can confirm I can successfully > boot from FPGA by adapting CONFIG_SYS_TEXT_BASE via config and hacking > CONFIG_SPL_TEXT_BASE to 0xC0000000 (as moving this to Kconfig is still > missing). So is this patch still needed ?
Quoted 1 line
Yes, sorry for being unclear there.
Can we do what this patch does with less ifdeffery ? Maybe with simple if (address > FOO && < bar) remap() ?
Signature · 2 lines
Best regards, Marek Vasut
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 43 lines · Marek Vasut
Quoted 41 lines · Simon Goldschmidt
Marek Vasut <marex at denx.de <mailto:[email protected]>> schrieb am Mo., 8. Okt. 2018, 02:20:
On 10/07/2018 01:08 PM, Simon Goldschmidt wrote: > On 06.10.2018 22:38, Tom Rini wrote: >> On Sat, Oct 06, 2018 at 10:33:42PM +0200, Simon Goldschmidt wrote: >> >>> This patch prevents disabling the FPGA bridges when >>> SPL or U-Boot is executed from FPGA onchip RAM. >>> >>> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>> >>> --- >>> >>> >>> There are other patches required to make boot from >>> FPGA work correctly: >>> - CONFIG_SPL_TEXT_BASE needs to be set to 0xC0000000 >>> ideally this is done by moving SPL_TEXT_BASE to Kconfig: >>> https://patchwork.ozlabs.org/patch/976918/ >>> - spl_ram.c needs this patch by Michal Simek: >>> https://patchwork.ozlabs.org/patch/978694/ >>> - For U-Boot to be run from FPGA onchip RAM, either >>> CONFIG_SYS_EXTRA_ENV_RELOC needs to be used or this patch >>> is required to relocate gd->env_addr: >>> https://patchwork.ozlabs.org/patch/975702/ >> For the record, I'm currently reviewing the last two parts here. The >> first one will come soon (I do Kconfig migrations separate so I can see >> a lack of size change). > > > OK, after Tom merged the last to parts, I can confirm I can successfully > boot from FPGA by adapting CONFIG_SYS_TEXT_BASE via config and hacking > CONFIG_SPL_TEXT_BASE to 0xC0000000 (as moving this to Kconfig is still > missing).
Quoted 7 lines
Quoted 4 lines
So is this patch still needed ?
Yes, sorry for being unclear there.
Can we do what this patch does with less ifdeffery ? Maybe with simple if (address > FOO && < bar)
remap()?
Hmm, I can try, but the change in misc_gen5.c depends on whether we build SPL or U-Boot, I'm not sure how to do that without ifdef...
Does 'if (CONFIG_IS_ENABLED(SPL_BUILD))' work? Does it look nice? It's not used anywhere else like that.
Simon
PATCH 1/1 arm: socfpga: fix SPL booting from fpga OnChip RAM
Quoted 49 lines · Simon Goldschmidt
Quoted 48 lines · Marek Vasut
Quoted 45 lines · Simon Goldschmidt
Marek Vasut <marex at denx.de <mailto:[email protected]>> schrieb am Mo., 8. Okt. 2018, 02:20:
On 10/07/2018 01:08 PM, Simon Goldschmidt wrote: > On 06.10.2018 22:38, Tom Rini wrote: >> On Sat, Oct 06, 2018 at 10:33:42PM +0200, Simon Goldschmidt wrote: >> >>> This patch prevents disabling the FPGA bridges when >>> SPL or U-Boot is executed from FPGA onchip RAM. >>> >>> Signed-off-by: Simon Goldschmidt <[email protected] <mailto:[email protected]>> >>> --- >>> >>> >>> There are other patches required to make boot from >>> FPGA work correctly: >>> - CONFIG_SPL_TEXT_BASE needs to be set to 0xC0000000 >>> ideally this is done by moving SPL_TEXT_BASE to Kconfig: >>> https://patchwork.ozlabs.org/patch/976918/ >>> - spl_ram.c needs this patch by Michal Simek: >>> https://patchwork.ozlabs.org/patch/978694/ >>> - For U-Boot to be run from FPGA onchip RAM, either >>> CONFIG_SYS_EXTRA_ENV_RELOC needs to be used or this patch >>> is required to relocate gd->env_addr: >>> https://patchwork.ozlabs.org/patch/975702/ >> For the record, I'm currently reviewing the last two parts here. The >> first one will come soon (I do Kconfig migrations separate so I can see >> a lack of size change). > > > OK, after Tom merged the last to parts, I can confirm I can successfully > boot from FPGA by adapting CONFIG_SYS_TEXT_BASE via config and hacking > CONFIG_SPL_TEXT_BASE to 0xC0000000 (as moving this to Kconfig is still > missing). So is this patch still needed ?Yes, sorry for being unclear there.
Quoted 8 lines
Quoted 2 lines
Can we do what this patch does with less ifdeffery ? Maybe with simple if (address > FOO && < bar)
remap()?Hmm, I can try, but the change in
misc_gen5.cdepends on whether we build SPL or U-Boot, I'm not sure how to do that without ifdef...Does 'if (
CONFIG_IS_ENABLED(SPL_BUILD))' work? Does it look nice? It's not used anywhere else like that.
That's fine, I had those address range checks in mind.
Signature · 2 lines
Best regards, Marek Vasut