Add SPL support for SoCFPGA
Subsystems (3)
v2 cover Add SPL support for SoCFPGA
From: Dinh Nguyen <[email protected]>
Hello,
This is v2 of the patchset that adds all the SPL code that is necessary to support the SoCFPGA platform. For v2, here are the changes:
- SDRAM - further clean and addressing all comments. Simplified to only support DDR3, FULLRATE, and Hard PHY.
- SDRAM - Moved to drivers/ddr/altera
- Move extra code that maps SDRAM to 0x0 in board_init_f
I have pushed a branch to git://git.rocketboards.org/u-boot-socfpga-next.gitsocfpga_for_next_spl_v2 for testing and reviewing.
Rebased to 2015.04-rc2.
Thanks,
Dinh Nguyen (20):
arm: socfpga: spl: Add main sdram code
arm: socfpga: spl: Add SRAM section
arm: socfpga: spl: put SPL in sram
arm: socfpga: add functions to bring sdram, timer, and uart out of
reset
arm: socfpga: spl: enable sdram, timer and uart
arm: socfpga: spl: Add call to timer_init
arm: socfpga: spl: allow bootrom to enable IOs after warm reset
arm: socfpga: spl: add sdram init and calibration
arm: socfpga: spl: printout sdram size
arm: socfpga: spl: Use common lowlevel_init
arm: socfpga: spl: Add s_init
arm: socfpga: spl: add the stack in OCRAM
arm: socfpga: spl: add CONFIG_SPL_STACK to socfpga_common.h
arm: socfpga: add sdram stack to SPL
arm: socfpga: spl: adjust SPL_MALLOC_SIZE to 256
arm: socfpga: spl: add a malloc section in sram
arm: socfpga: spl: Add SDRAM check
arm: socfpga: spl: add board_init_f to SPL
arm: socfpga: spl: update pll_config for dev kit
arm: socfpga: remove the need to map sdram in arch_early_init
Makefile | 1 + arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/socfpga/Makefile | 4 +- arch/arm/cpu/armv7/socfpga/lowlevel_init.S | 4 - arch/arm/cpu/armv7/socfpga/misc.c | 3 - arch/arm/cpu/armv7/socfpga/reset_manager.c | 24 + arch/arm/cpu/armv7/socfpga/s_init.c | 37 + arch/arm/cpu/armv7/socfpga/spl.c | 47 + arch/arm/cpu/armv7/socfpga/system_manager.c | 9 + arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 29 +- arch/arm/include/asm/arch-socfpga/reset_manager.h | 6 + arch/arm/include/asm/arch-socfpga/sdram.h | 434 +++ arch/arm/include/asm/arch-socfpga/sdram_config.h | 100 + arch/arm/include/asm/arch-socfpga/system_manager.h | 1 + board/altera/socfpga/pll_config.h | 8 +- drivers/ddr/altera/Makefile | 12 + drivers/ddr/altera/sdram.c | 1307 +++++++ drivers/ddr/altera/sequencer.c | 3972 ++++++++++++++++++++ drivers/ddr/altera/sequencer.h | 359 ++ drivers/ddr/altera/sequencer_auto.h | 216 ++ drivers/ddr/altera/sequencer_auto_ac_init.c | 85 + drivers/ddr/altera/sequencer_auto_inst_init.c | 270 ++ drivers/ddr/altera/sequencer_defines.h | 121 + include/configs/socfpga_common.h | 11 +- include/configs/socfpga_cyclone5.h | 1 + scripts/Makefile.spl | 1 + 26 files changed, 7046 insertions(+), 18 deletions(-) create mode 100644 arch/arm/cpu/armv7/socfpga/s_init.c create mode 100644 arch/arm/include/asm/arch-socfpga/sdram.h create mode 100644 arch/arm/include/asm/arch-socfpga/sdram_config.h create mode 100644 drivers/ddr/altera/Makefile create mode 100644 drivers/ddr/altera/sdram.c create mode 100644 drivers/ddr/altera/sequencer.c create mode 100644 drivers/ddr/altera/sequencer.h create mode 100644 drivers/ddr/altera/sequencer_auto.h create mode 100644 drivers/ddr/altera/sequencer_auto_ac_init.c create mode 100644 drivers/ddr/altera/sequencer_auto_inst_init.c create mode 100644 drivers/ddr/altera/sequencer_defines.h
Signature · 1 line
2.2.1
PATCH v2 1/20 arm: socfpga: spl: Add main sdram code
From: Dinh Nguyen <[email protected]>
This adds the code to configure the SDRAM controller that is found in the SoCFGPA Cyclone5 and Arria5 platforms.
---
v2: moved to drivers/ddr/altera/
only supports DDR3 at FULLRATE
--- Makefile | 1 + arch/arm/include/asm/arch-socfpga/sdram.h | 434 +++ arch/arm/include/asm/arch-socfpga/sdram_config.h | 100 + drivers/ddr/altera/Makefile | 12 + drivers/ddr/altera/sdram.c | 1307 +++++++ drivers/ddr/altera/sequencer.c | 3972 ++++++++++++++++++++++ drivers/ddr/altera/sequencer.h | 359 ++ drivers/ddr/altera/sequencer_auto.h | 216 ++ drivers/ddr/altera/sequencer_auto_ac_init.c | 85 + drivers/ddr/altera/sequencer_auto_inst_init.c | 270 ++ drivers/ddr/altera/sequencer_defines.h | 121 + include/configs/socfpga_cyclone5.h | 1 + scripts/Makefile.spl | 1 + 13 files changed, 6879 insertions(+) create mode 100644 arch/arm/include/asm/arch-socfpga/sdram.h create mode 100644 arch/arm/include/asm/arch-socfpga/sdram_config.h create mode 100644 drivers/ddr/altera/Makefile create mode 100644 drivers/ddr/altera/sdram.c create mode 100644 drivers/ddr/altera/sequencer.c create mode 100644 drivers/ddr/altera/sequencer.h create mode 100644 drivers/ddr/altera/sequencer_auto.h create mode 100644 drivers/ddr/altera/sequencer_auto_ac_init.c create mode 100644 drivers/ddr/altera/sequencer_auto_inst_init.c create mode 100644 drivers/ddr/altera/sequencer_defines.h
Makefile +1 -0
@@ -636,6 +636,7 @@ libs-y += drivers/power/ \ libs-y += drivers/spi/ libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/ libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/ +libs-$(CONFIG_ALTERA_SDRAM) += drivers/ddr/altera/ libs-y += drivers/serial/ libs-y += drivers/usb/eth/ libs-y += drivers/usb/gadget/
arch/arm/include/asm/arch-socfpga/sdram.h new file +434 -0
434 lines not on this page · raw message
arch/arm/include/asm/arch-socfpga/sdram_config.h new file +100 -0
100 lines not on this page · raw message
drivers/ddr/altera/Makefile new file +12 -0
@@ -0,0 +1,12 @@ +# +# (C) Copyright 2000-2003 +# Wolfgang Denk, DENX Software Engineering, wd at denx.de. +# +# (C) Copyright 2010, Thomas Chou <[email protected]> +# Copyright (C) 2014 Altera Corporation <www.altera.com> +# +# SPDX-License-Identifier: GPL-2.0+ +# + +obj-$(CONFIG_ALTERA_SDRAM) += sdram.o sequencer.o sequencer_auto_ac_init.o \ + sequencer_auto_inst_init.o
drivers/ddr/altera/sdram.c new file +1307 -0
1,307 lines not on this page · raw message
drivers/ddr/altera/sequencer.c new file +3972 -0
1,140 lines not on this page · raw message
drivers/ddr/altera/sequencer.h new file +359 -0
359 lines not on this page · raw message
drivers/ddr/altera/sequencer_auto.h new file +216 -0
216 lines not on this page · raw message
drivers/ddr/altera/sequencer_auto_ac_init.c new file +85 -0
85 lines not on this page · raw message
drivers/ddr/altera/sequencer_auto_inst_init.c new file +270 -0
270 lines not on this page · raw message
drivers/ddr/altera/sequencer_defines.h new file +121 -0
121 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.2.1
Part of the diff is not shown here. View the raw message.
PATCH v2 1/20 arm: socfpga: spl: Add main sdram code
Quoted 6 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
This adds the code to configure the SDRAM controller that is found in the SoCFGPA Cyclone5 and Arria5 platforms.
Signed-off-by Dinh Nguyen <[email protected]>
Hi!
[...]
Quoted 12 lines
(quoted diff) +0
-0
b/arch/arm/include/asm/arch-socfpga/sdram.hnew file mode 100644 index 0000000..83e45d2arch/arm/include/asm/arch-socfpga/sdram.h new file +6
-0@@ -0,0 +1,434 @@ +/* +* Copyright (C) 2014 Altera Corporation <www.altera.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ +#ifndef _SDRAM_H_
arch/arm/include/asm/arch-socfpga/sdram.h line 16
Quoted 10 lines
arch/arm/include/asm/arch-socfpga/sdram.h new file +10
-0+#define _SDRAM_H_ + +#ifndef __ASSEMBLY__ + +/* function declaration */ +unsigned long sdram_calculate_size (void ); +unsigned sdram_mmr_init_full (unsigned int sdr_phy_reg); +int sdram_calibration_full (void ); + +extern int sdram_calibration (void );
Is the "extern" keyword really needed here ?
Quoted 2 lines
arch/arm/include/asm/arch-socfpga/sdram.h new file +1
-0+/* Group: sdr.phygrp.sccgrp */ +#define
SDR_PHYGRP_SCCGRP_ADDRESS0x0
Can you define these registers using the struct-based access please ?
Quoted 4 lines
+/* Group: sdr.phygrp.phymgrgrp
*/ +#defineSDR_PHYGRP_PHYMGRGRP_ADDRESS0x1000
+/* Group: sdr.phygrp.rwmgrgrp
*/ +#defineSDR_PHYGRP_RWMGRGRP_ADDRESS0x2000
[...]
Quoted 8 lines
(quoted diff) +0
-0
b/arch/arm/include/asm/arch-socfpga/sdram_config.hnew file mode 100644 index 0000000..5c3ba86arch/arm/include/asm/arch-socfpga/sdram_config.h new file +2
-0@@ -0,0 +1,100 @@ +/* +* Copyright Altera Corporation (C) 2012-2014. All rights reserved
arch/arm/include/asm/arch-socfpga/sdram_config.h line 12
Quoted 10 lines
arch/arm/include/asm/arch-socfpga/sdram_config.h new file +10
-0+* +* SPDX-License-Identifier: BSD-3-Clause +*/ + +#ifndef __SDRAM_CONFIG_H +#define __SDRAM_CONFIG_H + +#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_MEMTYPE (2) +#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_MEMBL (8) +#define CONFIG_HPS_SDR_CTRLCFG_CTRLCFG_ADDRORDER (0)
You can drop those brackets around numeric values, there's no point in them.
[...]
About the rest of the code ... what is your feeling when you look at the code? What do you think of the code quality ? Do you think it's good or do you think there are obvious places where it can be improved ?
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
--- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 2 ++ include/configs/socfpga_common.h | 1 + 2 files changed, 3 insertions(+)
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +2 -0
@@ -5,6 +5,8 @@ */ MEMORY { .sdram : ORIGIN = (0), LENGTH = (0xffffffff) } +MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,\ + LENGTH = CONFIG_SPL_MAX_SIZE } OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") OUTPUT_ARCH(arm)
include/configs/socfpga_common.h +1 -0
@@ -294,6 +294,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_INIT_SP_ADDR#define CONFIG_SYS_SPL_MALLOC_SIZE (5 * 1024) +#define CONFIG_SPL_MAX_SIZE (64 * 1024)#define CHUNKSZ_CRC32 (1 * 1024)/* FIXME: ewww */ #define CONFIG_CRC32_VERIFY
Signature · 1 line
2.2.1
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
Quoted 5 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
Signed-off-by Dinh Nguyen <[email protected]>
Hi!
Can we not use the generic SPL stuff ( ./arch/arm/cpu/u-boot-spl.lds ) here instead please ?
Best regards,
Marek Vasut
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
Quoted 12 lines · Marek Vasut
Quoted 5 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
Signed-off-by Dinh Nguyen <[email protected]>Hi!
Can we not use the generic SPL stuff (
./arch/arm/cpu/u-boot-spl.lds) here instead please ?
I looked at this, but I didn't see way to overlay in an SRAM section. Do you have an example of how to do this?
Thanks,
Dinh
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
Quoted 2 lines · Dinh Nguyen
Quoted 1 line · Marek Vasut
On Monday, March 02, 2015 at 05:27:50 PM, dinguyen at opensource.altera.com
Quoted 6 lines · wrote:
Quoted 6 lines
Quoted 5 lines
From: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
Signed-off-by Dinh Nguyen <[email protected]>
Quoted 7 lines
Quoted 4 lines
Hi!
Can we not use the generic SPL stuff (
./arch/arm/cpu/u-boot-spl.lds) here instead please ?I looked at this, but I didn't see way to overlay in an SRAM section. Do you have an example of how to do this?
Hi!
Is it really needed at all in the first place ? Why ?
Best regards,
Marek Vasut
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
Quoted 15 lines · Marek Vasut
Quoted 2 lines · Dinh Nguyen
Quoted 1 line · Marek Vasut
On Monday, March 02, 2015 at 05:27:50 PM, dinguyen at opensource.altera.com
Quoted 11 lines · wrote:
Quoted 10 lines
Quoted 5 lines
From: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
Signed-off-by Dinh Nguyen <[email protected]>Hi!
Can we not use the generic SPL stuff (
./arch/arm/cpu/u-boot-spl.lds) here instead please ?
Quoted 7 lines
Quoted 2 lines
I looked at this, but I didn't see way to overlay in an SRAM section. Do you have an example of how to do this?
Hi!
Is it really needed at all in the first place ? Why ?
Isn't this need to specify the SPL to be located in the sram section? I see other platforms doing the same thing, ie. zynq, sunxi.
Dinh
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
Quoted 21 lines · Dinh Nguyen
Quoted 20 lines · Marek Vasut
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · Marek Vasut
On Monday, March 02, 2015 at 05:27:50 PM,
dinguyen at opensource.altera.comQuoted 13 lines · wrote:
Quoted 10 lines
Quoted 5 lines
From: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
Signed-off-by Dinh Nguyen <[email protected]>Hi!
Can we not use the generic SPL stuff (
./arch/arm/cpu/u-boot-spl.lds) here instead please ?I looked at this, but I didn't see way to overlay in an SRAM section. Do you have an example of how to do this?
Quoted 6 lines
Quoted 3 lines
Hi!
Is it really needed at all in the first place ? Why ?
Isn't this need to specify the SPL to be located in the sram section? I see other platforms doing the same thing, ie. zynq, sunxi.
CONFIG_SPL_TEXT_BASE is what specifies the address to which the SPL is linked. This is the address where the BootROM should place the SPL and jump to it's first instruction.
I don't think you explicitly need to hack linker scripts to add this section.
btw. Tom Rini has a different email address (@konsulko) now.
btw2. is there any way I can help you with hacking on the SPL please ?
Best regards,
Marek Vasut
PATCH v2 2/20 arm: socfpga: spl: Add SRAM section
Quoted 26 lines · Marek Vasut
Quoted 25 lines · Dinh Nguyen
Quoted 23 lines · Marek Vasut
Quoted 3 lines · Dinh Nguyen
Quoted 2 lines · Marek Vasut
On Monday, March 02, 2015 at 05:27:50 PM,
dinguyen at opensource.altera.comQuoted 6 lines · wrote:
Quoted 6 lines
Quoted 5 lines
From: Dinh Nguyen <[email protected]>
Add a section of SRAM to the SPL linker file.
Signed-off-by Dinh Nguyen <[email protected]>Quoted 7 lines
Quoted 4 lines
Hi!
Can we not use the generic SPL stuff (
./arch/arm/cpu/u-boot-spl.lds) here instead please ?I looked at this, but I didn't see way to overlay in an SRAM section. Do you have an example of how to do this?
Hi!
Is it really needed at all in the first place ? Why ?
Quoted 8 lines
Quoted 2 lines
Isn't this need to specify the SPL to be located in the sram section? I see other platforms doing the same thing, ie. zynq, sunxi.
CONFIG_SPL_TEXT_BASEis what specifies the address to which the SPL is linked. This is the address where the BootROM should place the SPL and jump to it's first instruction.I don't think you explicitly need to hack linker scripts to add this section.
Ah yes, I think I can make use of it now.
Quoted 2 lines
btw. Tom Rini has a different email address (@konsulko) now.
Right...saw it right after I sent out this series.
Quoted 3 lines
btw2. is there any way I can help you with hacking on the SPL please ?
Let me post a v3 within this week, and I would appreciate any help. Does posting the series to git repo help you to help me?
Dinh
PATCH v2 3/20 arm: socfpga: spl: put SPL in sram
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Update SPL linker file to use SRAM.
--- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +4 -4
@@ -21,13 +21,13 @@ SECTIONS *(.vectors) arch/arm/cpu/armv7/start.o (.text*) *(.text*) - } >.sdram + } >.sram . = ALIGN(4); - .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } >.sdram + .rodata : { *(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*))) } >.sram . = ALIGN(4); - .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sdram + .data : { *(SORT_BY_ALIGNMENT(.data*)) } >.sram . = ALIGN(4); __image_copy_end = .;
@@ -43,5 +43,5 @@ SECTIONS *(.bss*) . = ALIGN(4); __bss_end = .; - } >.sdram + } >.sram }
Signature · 1 line
2.2.1
PATCH v2 3/20 arm: socfpga: spl: put SPL in sram
Quoted 6 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Update SPL linker file to use SRAM.
Signed-off-by Dinh Nguyen <[email protected]>Acked-by Pavel Machek <[email protected]>
Hi!
Same comment applies as for 02/20 ( can't we use generic ./arch/arm/cpu/u-boot-spl.lds ?) Also, you can probably just combine this patch with 02/20 .
Best regards,
Marek Vasut
PATCH v2 4/20 arm: socfpga: add functions to bring sdram, timer, and uart out of reset
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
These functions will be needed for use by the SPL for enabling the console and sdram initialization.
--- arch/arm/cpu/armv7/socfpga/reset_manager.c | 24 +++++++++++++++++++++++ arch/arm/include/asm/arch-socfpga/reset_manager.h | 6 ++++++ 2 files changed, 30 insertions(+)
arch/arm/cpu/armv7/socfpga/reset_manager.c +24 -0
@@ -113,3 +113,27 @@ void socfpga_spim_enable(void)clrbits_le32 (reset, (1 <<RSTMGR_PERMODRST_SPIM0_LSB ) | (1 <<RSTMGR_PERMODRST_SPIM1_LSB )); } + +/* Bring UART0 out of reset. */ +void socfpga_uart0_enable (void ) +{ +const void *reset = &reset_manager_base->per_mod_reset; + +clrbits_le32 (reset,1 <<RSTMGR_PERMODRST_UART0_LSB ); +} + +/* Bring SDRAM controller out of reset. */ +void socfpga_sdram_enable (void ) +{ +const void *reset = &reset_manager_base->per_mod_reset; + +clrbits_le32 (reset,1 <<RSTMGR_PERMODRST_SDR_LSB ); +} + +/* Bring OSC1 timer out of reset. */ +void socfpga_osc1timer_enable (void ) +{ +const void *reset = &reset_manager_base->per_mod_reset; + +clrbits_le32 (reset,1 <<RSTMGR_PERMODRST_OSC1TIMER0_LSB ); +}
arch/arm/include/asm/arch-socfpga/reset_manager.h +6 -0
@@ -15,6 +15,9 @@ void socfpga_bridges_reset(int enable);void socfpga_emac_reset (int enable);void socfpga_watchdog_reset (void );void socfpga_spim_enable (void ); +void socfpga_uart0_enable (void ); +void socfpga_sdram_enable (void ); +void socfpga_osc1timer_enable (void );struct socfpga_reset_manager {u32 status;
@@ -36,7 +39,10 @@ struct socfpga_reset_manager {#define RSTMGR_PERMODRST_EMAC0_LSB 0#define RSTMGR_PERMODRST_EMAC1_LSB 1#define RSTMGR_PERMODRST_L4WD0_LSB 6 +#define RSTMGR_PERMODRST_OSC1TIMER0_LSB 8 +#define RSTMGR_PERMODRST_UART0_LSB 16#define RSTMGR_PERMODRST_SPIM0_LSB 18#define RSTMGR_PERMODRST_SPIM1_LSB 19 +#define RSTMGR_PERMODRST_SDR_LSB 29#endif /* _RESET_MANAGER_H_ */
Signature · 1 line
2.2.1
PATCH v2 5/20 arm: socfpga: spl: enable sdram, timer and uart
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Add the calls in the spl_board_init to enable SDRAM, timer, and UART.
--- arch/arm/cpu/armv7/socfpga/spl.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +4 -0
@@ -145,6 +145,10 @@ void spl_board_init(void)/* freeze all IO banks */ sys_mgr_frzctrl_freeze_req (); +socfpga_sdram_enable (); +socfpga_uart0_enable (); +socfpga_osc1timer_enable (); +debug ("Reconfigure Clock Manager\n" );/* reconfigure the PLLs */ cm_basic_init (&cm_default_cfg);
Signature · 1 line
2.2.1
PATCH v2 6/20 arm: socfpga: spl: Add call to timer_init
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
--- arch/arm/cpu/armv7/socfpga/spl.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +2 -0
@@ -149,6 +149,8 @@ void spl_board_init(void)socfpga_uart0_enable ();socfpga_osc1timer_enable (); +timer_init (); +debug ("Reconfigure Clock Manager\n" );/* reconfigure the PLLs */ cm_basic_init (&cm_default_cfg);
Signature · 1 line
2.2.1
PATCH v2 6/20 arm: socfpga: spl: Add call to timer_init
Quoted 3 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>
Hi!
The common SPL framework , common/spl/spl.c , does such timer_init() call as well. Can we use the common SPL framework instead (preferred) ?
Also, please add descriptive commit messages to your patches.
Best regards,
Marek Vasut
PATCH v2 7/20 arm: socfpga: spl: allow bootrom to enable IOs after warm reset
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
--- arch/arm/cpu/armv7/socfpga/spl.c | 3 +++ arch/arm/cpu/armv7/socfpga/system_manager.c | 9 +++++++++ arch/arm/include/asm/arch-socfpga/system_manager.h | 1 + 3 files changed, 13 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +3 -0
@@ -155,6 +155,9 @@ void spl_board_init(void)/* reconfigure the PLLs */ cm_basic_init (&cm_default_cfg); +/* Enable bootrom to configure IOs. */ +sysmgr_enable_warmrstcfgio (); +/* configure the IOCSR / IO buffer settings */ if (scan_mgr_configure_iocsr ())hang ();
arch/arm/cpu/armv7/socfpga/system_manager.c +9 -0
@@ -66,3 +66,12 @@ void sysmgr_pinmux_init(void)populate_sysmgr_fpgaintf_module (); } + +/* +* This bit allows the bootrom to configure the IOs after a warm reset. +*/ +void sysmgr_enable_warmrstcfgio (void ) +{ +setbits_le32 (&sysmgr_regs->romcodegrp_ctrl, +SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGIO ); +}
arch/arm/include/asm/arch-socfpga/system_manager.h +1 -0
@@ -10,6 +10,7 @@#ifndef __ASSEMBLY__void sysmgr_pinmux_init (void ); +void sysmgr_enable_warmrstcfgio (void );/* declaration for handoff table type */ extern unsigned long sys_mgr_init_table[CONFIG_HPS_PINMUX_NUM ];
Signature · 1 line
2.2.1
PATCH v2 8/20 arm: socfpga: spl: add sdram init and calibration
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Add a call to checkboard along with sdram intilialization and calibration.
---
v2: Add a fail message
--- arch/arm/cpu/armv7/socfpga/spl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +12 -0
@@ -16,6 +16,7 @@#include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> #include <asm/arch/scan_manager.h> +#include <asm/arch/sdram.h> DECLARE_GLOBAL_DATA_PTR ;
@@ -175,4 +176,15 @@ void spl_board_init(void)/* enable console uart printing */ preloader_console_init (); + +if (sdram_mmr_init_full (0xffffffff ) !=0 ) { +puts ("SDRAM init failed\n" ); +hang (); + } +puts ("SDRAM: Calibrating PHY\n" ); +/* SDRAM calibration */ +if (sdram_calibration_full () ==0 ) { +puts ("SDRAM calibration failed!\n" ); +hang (); + } }
Signature · 1 line
2.2.1
PATCH v2 8/20 arm: socfpga: spl: add sdram init and calibration
Quoted 24 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Add a call to checkboard along with sdram intilialization and calibration.
Signed-off-by Dinh Nguyen <[email protected]>---
v2: Add a fail message--- arch/arm/cpu/armv7/socfpga/spl.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/spl.cindex 9ef2983..71021f0 100644arch/arm/cpu/armv7/socfpga/spl.c +1
-0@@ -16,6 +16,7 @@#include <asm/arch/freeze_controller.h> #include <asm/arch/clock_manager.h> #include <asm/arch/scan_manager.h> +#include <asm/arch/sdram.h> DECLARE_GLOBAL_DATA_PTR ;
arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 184
Quoted 9 lines
arch/arm/cpu/armv7/socfpga/spl.c +6
-0@@ -175,4 +176,15 @@ void spl_board_init(void)/* enable console uart printing */ preloader_console_init (); + +if (sdram_mmr_init_full (0xffffffff ) !=0 ) { +puts ("SDRAM init failed\n" ); +hang (); + } +puts ("SDRAM: Calibrating PHY\n" );
Hi!
you might want to add newlines around the puts() above, to make the code visually separated. Also, the puts() above should probably be turned into debug(), since the user is most likely not interested to see such message upon each boot ... what do you think please ?
arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 190
Quoted 6 lines
arch/arm/cpu/armv7/socfpga/spl.c +5
-0+/* SDRAM calibration */ +if (sdram_calibration_full () ==0 ) { +puts ("SDRAM calibration failed!\n" ); +hang (); + } }
Best regards,
Marek Vasut
PATCH v2 9/20 arm: socfpga: spl: printout sdram size
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
---
v2: Add a debug print
--- arch/arm/cpu/armv7/socfpga/spl.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +4 -0
@@ -55,6 +55,7 @@ u32 spl_boot_device(void)*/ void spl_board_init (void ) { +unsigned long sdram_size;#ifndef CONFIG_SOCFPGA_VIRTUAL_TARGET cm_config_t cm_default_cfg = { /* main group */
@@ -187,4 +188,7 @@ void spl_board_init(void)puts ("SDRAM calibration failed!\n" );hang (); } + + sdram_size =sdram_calculate_size (); +debug ("SDRAM: %ld MiB\n" , (sdram_size >>20 )); }
Signature · 1 line
2.2.1
PATCH v2 9/20 arm: socfpga: spl: printout sdram size
Quoted 22 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>---
v2: Add a debug print--- arch/arm/cpu/armv7/socfpga/spl.c | 4 ++++ 1 file changed, 4 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/spl.cindex 71021f0..ea4a1fb 100644arch/arm/cpu/armv7/socfpga/spl.c +1
-0@@ -55,6 +55,7 @@ u32 spl_boot_device(void)*/ void spl_board_init (void ) { +unsigned long sdram_size;#ifndef CONFIG_SOCFPGA_VIRTUAL_TARGET cm_config_t cm_default_cfg = { /* main group */
arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 193
Quoted 6 lines
arch/arm/cpu/armv7/socfpga/spl.c +3
-0@@ -187,4 +188,7 @@ void spl_board_init(void)puts ("SDRAM calibration failed!\n" );hang (); } + + sdram_size =sdram_calculate_size (); +debug ("SDRAM: %ld MiB\n" , (sdram_size >>20 ));
You don't need the inner brackets, they're redundant.
Otherwise:
Best regards,
Marek Vasut
PATCH v2 10/20 arm: socfpga: spl: Use common lowlevel_init
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
For SoCFGPA, use the common ARMv7 lowlevel_init.
--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/socfpga/lowlevel_init.S | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-)
arch/arm/cpu/armv7/Makefile +1 -1
@@ -12,7 +12,7 @@ obj-y += cache_v7.o obj-y += cpu.o obj-y += syslib.o -ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI),) +ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CONFIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI)$(CONFIG_SOCFPGA),) ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y) obj-y += lowlevel_init.o endif
arch/arm/cpu/armv7/socfpga/lowlevel_init.S +0 -4
@@ -7,10 +7,6 @@ #include <config.h> #include <version.h> -/* Set up the platform, once the cpu has been initialized */ -.globl lowlevel_init -lowlevel_init: - /* Remap */ #ifdef CONFIG_SPL_BUILD /*
Signature · 1 line
2.2.1
PATCH v2 10/20 arm: socfpga: spl: Use common lowlevel_init
Quoted 32 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
For SoCFGPA, use the common ARMv7
lowlevel_init.Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/cpu/armv7/Makefile | 2 +- arch/arm/cpu/armv7/socfpga/lowlevel_init.S | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-)arch/arm/cpu/armv7/Makefile +0
-1@@ -12,7 +12,7 @@ obj-y += cache_v7.o obj-y += cpu.o obj-y += syslib.o -ifneq($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CON FIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI), ) +ifneq ($(CONFIG_AM43XX)$(CONFIG_AM33XX)$(CONFIG_OMAP44XX)$(CONFIG_OMAP54XX)$(CON FIG_TEGRA)$(CONFIG_MX6)$(CONFIG_TI81XX)$(CONFIG_AT91FAMILY)$(CONFIG_SUNXI)$ (
CONFIG_SOCFPGA),) ifneq ($(CONFIG_SKIP_LOWLEVEL_INIT),y)
obj-y += lowlevel_init.o
endif(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/lowlevel_init.Sindex afed773..723508c 100644
arch/arm/cpu/armv7/socfpga/lowlevel_init.S line 13
Quoted 7 lines
arch/arm/cpu/armv7/socfpga/lowlevel_init.S +0
-4@@ -7,10 +7,6 @@ #include <config.h> #include <version.h> -/* Set up the platform, once the cpu has been initialized */ -.globl lowlevel_init -lowlevel_init: -
Hi!
you should zap the entire file, no? The rest of the content of the file is the implementation of the function lowlevel_init, which by removing the label turned into an unreachable code. Right ?
arch/arm/cpu/armv7/socfpga/lowlevel_init.S line 12
Quoted 3 lines
arch/arm/cpu/armv7/socfpga/lowlevel_init.S +0
-0/* Remap */ #ifdef CONFIG_SPL_BUILD /*
Best regards,
Marek Vasut
PATCH v2 11/20 arm: socfpga: spl: Add s_init
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Clear OCRAM's ECC.
---
v2: remove redundant code that is already in arch_early_init_r
--- arch/arm/cpu/armv7/socfpga/Makefile | 4 ++-- arch/arm/cpu/armv7/socfpga/s_init.c | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 2 deletions(-) create mode 100644 arch/arm/cpu/armv7/socfpga/s_init.c
arch/arm/cpu/armv7/socfpga/Makefile +2 -2
@@ -8,6 +8,6 @@ # obj-y := lowlevel_init.o -obj-y += misc.o timer.o reset_manager.o system_manager.o clock_manager.o \ - fpga_manager.o +obj-y += s_init.o misc.o timer.o reset_manager.o system_manager.o \ + clock_manager.o fpga_manager.o obj-$(CONFIG_SPL_BUILD) += spl.o freeze_controller.o scan_manager.o
arch/arm/cpu/armv7/socfpga/s_init.c new file +37 -0
@@ -0,0 +1,37 @@ +/* +* Copyright (C) 2014 Altera Corporation <www.altera.com> +* +* SPDX-License-Identifier: GPL-2.0+ +*/ + +#include <common.h> +#include <spl.h> +#include <watchdog.h> +#include <asm/io.h> +#include <asm/spl.h> +#include <asm/arch/system_manager.h> + +DECLARE_GLOBAL_DATA_PTR ; + +/* +* First C function to initialize the critical hardware early +*/ +void s_init (void ) +{ +#ifdef CONFIG_SPL_BUILD +struct socfpga_system_manager *sysmgr_regs = + (struct socfpga_system_manager *)SOCFPGA_SYSMGR_ADDRESS ; +unsigned long reg; +/* +* First C code to run. Clear fake OCRAM ECC first as SBE +* and DBE might triggered during power on +*/ + reg =readl (&sysmgr_regs->eccgrp_ocram); +if (reg &SYSMGR_ECC_OCRAM_SERR ) +writel (SYSMGR_ECC_OCRAM_SERR |SYSMGR_ECC_OCRAM_EN , + &sysmgr_regs->eccgrp_ocram); +if (reg &SYSMGR_ECC_OCRAM_DERR ) +writel (SYSMGR_ECC_OCRAM_DERR |SYSMGR_ECC_OCRAM_EN , + &sysmgr_regs->eccgrp_ocram); +#endif /* CONFIG_SPL_BUILD */ +}
Signature · 1 line
2.2.1
PATCH v2 12/20 arm: socfpga: spl: add the stack in OCRAM
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Allocate a stack in the OCRAM for the SPL to use.
--- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 7 +++++++ include/configs/socfpga_common.h | 1 + 2 files changed, 8 insertions(+)
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +7 -0
@@ -44,4 +44,11 @@ SECTIONS . = ALIGN(4); __bss_end = .; } >.sram + + .stack : + { + . = . + CONFIG_SPL_STACK_SIZE; + . = ALIGN(8); + __stack_start = .; + } >.sram }
include/configs/socfpga_common.h +1 -0
@@ -295,6 +295,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_INIT_SP_ADDR#define CONFIG_SYS_SPL_MALLOC_SIZE (5 * 1024)#define CONFIG_SPL_MAX_SIZE (64 * 1024) +#define CONFIG_SPL_STACK_SIZE 0x1000#define CHUNKSZ_CRC32 (1 * 1024)/* FIXME: ewww */ #define CONFIG_CRC32_VERIFY
Signature · 1 line
2.2.1
PATCH v2 12/20 arm: socfpga: spl: add the stack in OCRAM
Quoted 5 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Allocate a stack in the OCRAM for the SPL to use.
Signed-off-by Dinh Nguyen <[email protected]>
Hi!
Setting CONFIG_SPL_STACK to point to SRAM end will do exactly the same thing. You might need to use generic u-boot-spl.lds for that though.
Best regards,
Marek Vasut
PATCH v2 13/20 arm: socfpga: spl: add CONFIG_SPL_STACK to socfpga_common.h
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
--- include/configs/socfpga_common.h | 5 +++++ 1 file changed, 5 insertions(+)
include/configs/socfpga_common.h +5 -0
@@ -308,6 +308,11 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_WATCHDOG_SUPPORT #define CONFIG_SPL_SERIAL_SUPPORT +/* +* Stack setup +*/ +#define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR +#ifdef CONFIG_SPL_BUILD #undef CONFIG_PARTITIONS#endif
Signature · 1 line
2.2.1
PATCH v2 13/20 arm: socfpga: spl: add CONFIG_SPL_STACK to socfpga_common.h
Quoted 3 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>
This patch would invalidate the previous 12/20 , no ?
Best regards,
Marek Vasut
PATCH v2 14/20 arm: socfpga: add sdram stack to SPL
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Add a stack in the SDRAM to be able to use SPL_FAT_LOAD in later stages of the SPL.
--- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 7 +++++++ include/configs/socfpga_common.h | 1 + 2 files changed, 8 insertions(+)
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +7 -0
@@ -51,4 +51,11 @@ SECTIONS . = ALIGN(8); __stack_start = .; } >.sram + + .sdram_stack : + { + __sdram_stack_end = .; + . = . + CONFIG_SPL_SDRAM_STACK_SIZE; + __sdram_stack_start = .; + } >.sdram }
include/configs/socfpga_common.h +1 -0
@@ -312,6 +312,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);* Stack setup */ #define CONFIG_SPL_STACK CONFIG_SYS_INIT_SP_ADDR +#define CONFIG_SPL_SDRAM_STACK_SIZE (128 * 1024)#ifdef CONFIG_SPL_BUILD #undef CONFIG_PARTITIONS
Signature · 1 line
2.2.1
PATCH v2 14/20 arm: socfpga: add sdram stack to SPL
Quoted 6 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Add a stack in the SDRAM to be able to use
SPL_FAT_LOADin later stages of the SPL.Signed-off-by Dinh Nguyen <[email protected]>
Were you able to find out whether this is really needed for FATLOAD in SPL please ? Is the FATload is demanding ?
Best regards,
Marek Vasut
PATCH v2 15/20 arm: socfpga: spl: adjust SPL_MALLOC_SIZE to 256
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
--- include/configs/socfpga_common.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/configs/socfpga_common.h +1 -1
@@ -293,7 +293,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SPL_RAM_DEVICE #define CONFIG_SPL_TEXT_BASE CONFIG_SYS_INIT_RAM_ADDR#define CONFIG_SYS_SPL_MALLOC_START CONFIG_SYS_INIT_SP_ADDR -#define CONFIG_SYS_SPL_MALLOC_SIZE (5 * 1024) +#define CONFIG_SYS_SPL_MALLOC_SIZE 256#define CONFIG_SPL_MAX_SIZE (64 * 1024)#define CONFIG_SPL_STACK_SIZE 0x1000
Signature · 1 line
2.2.1
PATCH v2 15/20 arm: socfpga: spl: adjust SPL_MALLOC_SIZE to 256
Quoted 3 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>
Why did you do this change please ?
Best regards,
Marek Vasut
PATCH v2 15/20 arm: socfpga: spl: adjust SPL_MALLOC_SIZE to 256
Hi Marek,
Quoted 7 lines · Marek Vasut
Quoted 3 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>Why did you do this change please ?
Sorry that it's taken me a while to get back to you on this, but this is why I had to adjust the SPL_MALLOC_SIZE to 256:
#define CONFIG_SYS_INIT_RAM_SIZE (0x10000 - 0x100)
#define CONFIG_SYS_INIT_SP_ADDR \
(CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE - \
GENERATED_GBL_DATA_SIZE)Because of the above define I only have 0x100 left for SPL_MALLOC_SIZE.
I think I should rework this patch to be like this:
include/configs/socfpga_common.h +1 -1
@@ -41,7 +41,7 @@#define CONFIG_SYS_MEMTEST_END PHYS_SDRAM_1_SIZE#define CONFIG_SYS_INIT_RAM_ADDR 0xFFFF0000 -#define CONFIG_SYS_INIT_RAM_SIZE (0x10000 - 0x100) +#define CONFIG_SYS_INIT_RAM_SIZE (0x10000 -
CONFIG_SYS_SPL_MALLOC_SIZE)
Dinh
PATCH v2 15/20 arm: socfpga: spl: adjust SPL_MALLOC_SIZE to 256
Quoted 1 line · Dinh Nguyen
Hi Marek,
Hi Dinh,
Quoted 2 lines · Marek Vasut
Quoted 1 line
On Monday, March 02, 2015 at 05:28:03 PM, dinguyen at opensource.altera.com
Quoted 8 lines · wrote:
Quoted 5 lines
Quoted 3 lines
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>Why did you do this change please ?
Sorry that it's taken me a while to get back to you on this, but this is why I had to adjust the
SPL_MALLOC_SIZEto 256:
No worries, I'm also quite busy myself :)
Quoted 12 lines
#define
CONFIG_SYS_INIT_RAM_SIZE(0x10000-0x100)#define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_INIT_RAM_ADDR + CONFIG_SYS_INIT_RAM_SIZE - \ GENERATED_GBL_DATA_SIZE)Because of the above define I only have
0x100left forSPL_MALLOC_SIZE.I think I should rework this patch to be like this:
include/configs/socfpga_common.h line 45
Quoted 6 lines
include/configs/socfpga_common.h +1
-1@@ -41,7 +41,7 @@#define CONFIG_SYS_MEMTEST_END PHYS_SDRAM_1_SIZE#define CONFIG_SYS_INIT_RAM_ADDR 0xFFFF0000 -#define CONFIG_SYS_INIT_RAM_SIZE (0x10000 - 0x100) +#define CONFIG_SYS_INIT_RAM_SIZE (0x10000 - CONFIG_SYS_SPL_MALLOC_SIZE)
Certainly, that makes more sense ;-) You can also take for example include/configs/novena.h for a reference. It contains the defines which should be enabled for SPL with working mallocator, while it still runs from OCRAM.
Best regards,
Marek Vasut
PATCH v2 16/20 arm: socfpga: spl: add a malloc section in sram
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
--- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 7 +++++++ include/configs/socfpga_common.h | 1 + 2 files changed, 8 insertions(+)
arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +7 -0
@@ -45,6 +45,13 @@ SECTIONS __bss_end = .; } >.sram + .malloc : + { + . = . + CONFIG_SPL_MALLOC_SIZE; + . = ALIGN(8); + __malloc_start = .; + } >.sram + .stack : { . = . + CONFIG_SPL_STACK_SIZE;
include/configs/socfpga_common.h +1 -0
@@ -296,6 +296,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_SPL_MALLOC_SIZE 256#define CONFIG_SPL_MAX_SIZE (64 * 1024)#define CONFIG_SPL_STACK_SIZE 0x1000 +#define CONFIG_SPL_MALLOC_SIZE (5 * 1024)#define CHUNKSZ_CRC32 (1 * 1024)/* FIXME: ewww */ #define CONFIG_CRC32_VERIFY
Signature · 1 line
2.2.1
PATCH v2 16/20 arm: socfpga: spl: add a malloc section in sram
Quoted 31 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/cpu/armv7/socfpga/u-boot-spl.lds | 7 +++++++ include/configs/socfpga_common.h | 1 + 2 files changed, 8 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/u-boot-spl.ldsindex 739f3f1..f87e951 100644arch/arm/cpu/armv7/socfpga/u-boot-spl.lds +7
-0@@ -45,6 +45,13 @@ SECTIONS __bss_end = .; } >.sram + .malloc : + { + . = . + CONFIG_SPL_MALLOC_SIZE; + . = ALIGN(8); + __malloc_start = .; + } >.sram + .stack : { . = . + CONFIG_SPL_STACK_SIZE;(quoted diff) +0
-0
b/include/configs/socfpga_common.hindex 31c8961..5d1343a 100644
include/configs/socfpga_common.h unsigned int cm_get_qspi_controller_clk_hz(void); · line 299
Quoted 4 lines
include/configs/socfpga_common.h +1
-0@@ -296,6 +296,7 @@ unsigned int cm_get_qspi_controller_clk_hz(void);#define CONFIG_SYS_SPL_MALLOC_SIZE 256#define CONFIG_SPL_MAX_SIZE (64 * 1024)#define CONFIG_SPL_STACK_SIZE 0x1000 +#define CONFIG_SPL_MALLOC_SIZE (5 * 1024)
So this macro, CONFIG_SPL_MALLOC_SIZE, now contains the value which used to be in macro CONFIG_SYS_SPL_MALLOC_SIZE before patch 15/20 . In patch 15/20 , the macro CONFIG_SYS_SPL_MALLOC_SIZE was changed to be 256 .
Things are starting to be really chaotic here and it's not really clear why these macros are really needed. Can we please clear this situation up ?
Best regards,
Marek Vasut
PATCH v2 17/20 arm: socfpga: spl: Add SDRAM check
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
--- arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +8 -0
@@ -191,4 +191,12 @@ void spl_board_init(void) sdram_size =sdram_calculate_size ();debug ("SDRAM: %ld MiB\n" , (sdram_size >>20 )); + +/* Sanity check ensure correct SDRAM size specified */ +puts ("SDRAM: Ensuring specified SDRAM size is correct ..." ); +if (get_ram_size (0 , sdram_size) != sdram_size) { +puts ("failed\n" ); +hang (); + } +puts ("passed\n" ); }
Signature · 1 line
2.2.1
PATCH v2 17/20 arm: socfpga: spl: Add SDRAM check
Quoted 12 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++ 1 file changed, 8 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/spl.cindex ea4a1fb..31ac789 100644
arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 198
Quoted 8 lines
arch/arm/cpu/armv7/socfpga/spl.c +5
-0@@ -191,4 +191,12 @@ void spl_board_init(void) sdram_size =sdram_calculate_size ();debug ("SDRAM: %ld MiB\n" , (sdram_size >>20 )); + +/* Sanity check ensure correct SDRAM size specified */ +puts ("SDRAM: Ensuring specified SDRAM size is correct ..." ); +if (get_ram_size (0 , sdram_size) != sdram_size) { +puts ("failed\n" );
Hi!
Maybe just report a failure, the positive state is not interesting to the user and just polutes the console with messages which noone cares about (unless this would be a debug build maybe).
What do you think please ?
arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 202
Quoted 4 lines
arch/arm/cpu/armv7/socfpga/spl.c +3
-0+hang (); + } +puts ("passed\n" ); }
Best regards,
Marek Vasut
PATCH v2 17/20 arm: socfpga: spl: Add SDRAM check
Quoted 24 lines · Marek Vasut
Quoted 12 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>--- arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++ 1 file changed, 8 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/spl.cindex ea4a1fb..31ac789 100644arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 198
Quoted 8 lines
arch/arm/cpu/armv7/socfpga/spl.c +5
-0@@ -191,4 +191,12 @@ void spl_board_init(void) sdram_size =sdram_calculate_size ();debug ("SDRAM: %ld MiB\n" , (sdram_size >>20 )); + +/* Sanity check ensure correct SDRAM size specified */ +puts ("SDRAM: Ensuring specified SDRAM size is correct ..." ); +if (get_ram_size (0 , sdram_size) != sdram_size) { +puts ("failed\n" );Hi!
Quoted 6 lines
Maybe just report a failure, the positive state is not interesting to the user and just polutes the console with messages which noone cares about (unless this would be a debug build maybe).
What do you think please ?
Yeah, I think that's fine.
Dinh
PATCH v2 17/20 arm: socfpga: spl: Add SDRAM check
Quoted 2 lines · Dinh Nguyen
Quoted 1 line · Marek Vasut
On Monday, March 02, 2015 at 05:28:05 PM, dinguyen at opensource.altera.com
Quoted 25 lines · wrote:
Quoted 25 lines
Quoted 13 lines
From: Dinh Nguyen <[email protected]>
Signed-off-by Dinh Nguyen <[email protected]>---
arch/arm/cpu/armv7/socfpga/spl.c | 8 ++++++++ 1 file changed, 8 insertions(+)(quoted diff) +0
-0
b/arch/arm/cpu/armv7/socfpga/spl.cindex ea4a1fb..31ac789 100644arch/arm/cpu/armv7/socfpga/spl.c void spl_board_init(void) · line 199
Quoted 9 lines
arch/arm/cpu/armv7/socfpga/spl.c +5
-0@@ -191,4 +191,12 @@ void spl_board_init(void) sdram_size =sdram_calculate_size ();debug ("SDRAM: %ld MiB\n" , (sdram_size >>20 )); + +/* Sanity check ensure correct SDRAM size specified */ +puts ("SDRAM: Ensuring specified SDRAM size is correct ..." ); +if (get_ram_size (0 , sdram_size) != sdram_size) { +puts ("failed\n" );Hi!
Quoted 7 lines
Quoted 5 lines
Maybe just report a failure, the positive state is not interesting to the user and just polutes the console with messages which noone cares about (unless this would be a debug build maybe).
What do you think please ?
Yeah, I think that's fine.
Cool, thanks!
Best regards,
Marek Vasut
PATCH v2 18/20 arm: socfpga: spl: add board_init_f to SPL
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Remap SDRAM to 0x0 in board_init_f().
--- arch/arm/cpu/armv7/socfpga/spl.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
arch/arm/cpu/armv7/socfpga/spl.c +14 -0
@@ -6,6 +6,7 @@#include <common.h> #include <asm/io.h> +#include <asm/pl310.h> #include <asm/u-boot.h> #include <asm/utils.h> #include <version.h>
@@ -20,6 +21,9 @@DECLARE_GLOBAL_DATA_PTR ; +static struct pl310_regs *const pl310 = + (struct pl310_regs *)CONFIG_SYS_PL310_BASE ; +#define MAIN_VCO_BASE ( \ (CONFIG_HPS_MAINPLLGRP_VCO_DENOM << \ CLKMGR_MAINPLLGRP_VCO_DENOM_OFFSET) | \
@@ -45,6 +49,16 @@ DECLARE_GLOBAL_DATA_PTR; CLKMGR_SDRPLLGRP_VCO_NUMER_OFFSET) \ ) +void board_init_f (ulong dummy) +{ +memset (__bss_start,0 , __bss_end - __bss_start); + gd = &gdata; + +writel (0x1 , &pl310->pl310_addr_filter_start); + +board_init_r (NULL ,0 ); +} +u32 spl_boot_device (void ) {return BOOT_DEVICE_RAM ;
Signature · 1 line
2.2.1
PATCH v2 18/20 arm: socfpga: spl: add board_init_f to SPL
Quoted 5 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Remap SDRAM to
0x0inboard_init_f().Signed-off-by Dinh Nguyen <[email protected]>
Best regards,
Marek Vasut
PATCH v2 19/20 arm: socfpga: spl: update pll_config for dev kit
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
This sets the CPU clocks to 925MHz and DDR to 400MHz.
--- board/altera/socfpga/pll_config.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
board/altera/socfpga/pll_config.h +4 -4
@@ -12,13 +12,13 @@/* PLL configuration data */ /* Main PLL */ #define CONFIG_HPS_MAINPLLGRP_VCO_DENOM (0) -#define CONFIG_HPS_MAINPLLGRP_VCO_NUMER (63) +#define CONFIG_HPS_MAINPLLGRP_VCO_NUMER (73)#define CONFIG_HPS_MAINPLLGRP_MPUCLK_CNT (0)#define CONFIG_HPS_MAINPLLGRP_MAINCLK_CNT (0)#define CONFIG_HPS_MAINPLLGRP_DBGATCLK_CNT (0) -#define CONFIG_HPS_MAINPLLGRP_MAINQSPICLK_CNT (3) -#define CONFIG_HPS_MAINPLLGRP_MAINNANDSDMMCCLK_CNT (3) -#define CONFIG_HPS_MAINPLLGRP_CFGS2FUSER0CLK_CNT (12) +#define CONFIG_HPS_MAINPLLGRP_MAINQSPICLK_CNT (4) +#define CONFIG_HPS_MAINPLLGRP_MAINNANDSDMMCCLK_CNT (0) +#define CONFIG_HPS_MAINPLLGRP_CFGS2FUSER0CLK_CNT (14)#define CONFIG_HPS_MAINPLLGRP_MAINDIV_L3MPCLK (1)#define CONFIG_HPS_MAINPLLGRP_MAINDIV_L3SPCLK (1)#define CONFIG_HPS_MAINPLLGRP_MAINDIV_L4MPCLK (1)
Signature · 1 line
2.2.1
PATCH v2 19/20 arm: socfpga: spl: update pll_config for dev kit
Quoted 5 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
This sets the CPU clocks to 925MHz and DDR to 400MHz.
Signed-off-by Dinh Nguyen <[email protected]>
Best regards,
Marek Vasut
PATCH v2 20/20 arm: socfpga: remove the need to map sdram in arch_early_init
In reply to dinguyen at opensource.altera.comFrom: Dinh Nguyen <[email protected]>
Since we are already mapping sdram 0x0 in board_init_f, we can remove it here.
--- arch/arm/cpu/armv7/socfpga/misc.c | 3 --- 1 file changed, 3 deletions(-)
arch/arm/cpu/armv7/socfpga/misc.c +0 -3
@@ -205,9 +205,6 @@ int arch_early_init_r(void)/* Configure the L2 controller to make SDRAM start at 0 */ #ifdef CONFIG_SOCFPGA_VIRTUAL_TARGET writel (0x2 , &nic301_regs->remap); -#else -writel (0x1 , &nic301_regs->remap);/* remap.mpuzero */ -writel (0x1 , &pl310->pl310_addr_filter_start);#endif /* Add device descriptor to FPGA device table */
Signature · 1 line
2.2.1
PATCH v2 20/20 arm: socfpga: remove the need to map sdram in arch_early_init
Quoted 6 lines · dinguyen at opensource.altera.com
From: Dinh Nguyen <[email protected]>
Since we are already mapping sdram
0x0inboard_init_f, we can remove it here.Signed-off-by Dinh Nguyen <[email protected]>
Best regards,
Marek Vasut