arm: socfpga: arria10: Setting image magic value to romcode initswstate reg
PATCH 1/3 arm: socfpga: arria10: Setting image magic value to romcode initswstate reg
From: Tien Fong Chee <[email protected]>
The romcode_initswstate register need to be set with FSBL_IMAGE_IS_VALID value if the current FSBL image is found valid, otherwise BootROM will look for next subsequent valid FSBL image when warm reset is triggered.
--- .../mach-socfpga/include/mach/system_manager_arria10.h | 3 ++- arch/arm/mach-socfpga/spl_a10.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/system_manager_arria10.h +2 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2016-2017 Intel Corporation <www.intel.com> +* Copyright (C) 2016-2021 Intel Corporation <www.intel.com> */ #ifndef _SYSTEM_MANAGER_ARRIA10_H_
@@ -31,6 +31,7 @@#define SYSMGR_A10_NOC_IDLEACK 0xd0#define SYSMGR_A10_NOC_IDLESTATUS 0xd4#define SYSMGR_A10_FPGA2SOC_CTRL 0xd8 +#define SYSMGR_A10_ROMCODE_INITSWSTATE 0x20C#define SYSMGR_SDMMC SYSMGR_A10_SDMMC
arch/arm/mach-socfpga/spl_a10.c +9 -1
@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright (C) 2012-2019 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2021 Altera Corporation <www.altera.com> */ #include <common.h>
@@ -32,6 +32,7 @@#include <memalign.h> #define FPGA_BUFSIZ 16 * 1024 +#define FSBL_IMAGE_IS_VALID 0x49535756DECLARE_GLOBAL_DATA_PTR ;
@@ -169,3 +170,10 @@ void board_init_f(ulong dummy)config_dedicated_pins (gd->fdt_blob);WATCHDOG_RESET (); } + +/* board specific function prior loading SSBL / U-Boot proper */ +void spl_board_prepare_for_boot (void ) +{ +writel (FSBL_IMAGE_IS_VALID ,socfpga_get_sysmgr_addr () + +SYSMGR_A10_ROMCODE_INITSWSTATE ); +}
Signature · 1 line
2.25.1
PATCH 2/3 arm: socfpga: arria10: Reset MPFE NoC after program periph / combined RBF
From: Tien Fong Chee <[email protected]>
This patch triggers warm reset to recover the MPFE NoC from corruption due to high frequency transient clock output from HPS EMIF IOPLL at VCO startup after peripheral RBF is programmed.
--- arch/arm/mach-socfpga/include/mach/misc.h | 5 +- .../include/mach/reset_manager_arria10.h | 6 +- .../include/mach/system_manager_arria10.h | 4 + arch/arm/mach-socfpga/misc_arria10.c | 90 ++++++++++++++++- arch/arm/mach-socfpga/spl_a10.c | 96 ++++++++++++++++++- 5 files changed, 195 insertions(+), 6 deletions(-)
arch/arm/mach-socfpga/include/mach/misc.h +4 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2016-2017 Intel Corporation +* Copyright (C) 2016-2021 Intel Corporation */ #ifndef _SOCFPGA_MISC_H_
@@ -45,7 +45,10 @@ int is_fpga_config_ready(void);#endif void do_bridge_reset (int enable,unsigned int mask); +bool is_regular_boot_valid (void ); +void set_regular_boot (unsigned int status);void socfpga_pl310_clear (void );void socfpga_get_managers_addr (void ); +int qspi_flash_software_reset (void );#endif /* _SOCFPGA_MISC_H_ */
arch/arm/mach-socfpga/include/mach/reset_manager_arria10.h +5 -1
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2016-2017 Intel Corporation +* Copyright (C) 2016-2021 Intel Corporation */ #ifndef _RESET_MANAGER_ARRIA10_H_
@@ -22,6 +22,7 @@ int socfpga_bridges_reset(void);#define RSTMGR_A10_PER1MODRST 0x28#define RSTMGR_A10_BRGMODRST 0x2c#define RSTMGR_A10_SYSMODRST 0x30 +#define RSTMGR_A10_SYSWARMMASK 0x50#define RSTMGR_CTRL RSTMGR_A10_CTRL
@@ -115,4 +116,7 @@ int socfpga_bridges_reset(void);#define ALT_RSTMGR_HDSKEN_FPGAHSEN_SET_MSK BIT(2)#define ALT_RSTMGR_HDSKEN_ETRSTALLEN_SET_MSK BIT(3) +#define ALT_RSTMGR_FPGAMGRWARMMASK_S2F_SET_MSK BIT(3) +#define ALT_RSTMGR_SYSWARMMASK_S2F_SET_MSK BIT(4) +#endif /* _RESET_MANAGER_ARRIA10_H_ */
arch/arm/mach-socfpga/include/mach/system_manager_arria10.h +4 -0
@@ -31,7 +31,11 @@#define SYSMGR_A10_NOC_IDLEACK 0xd0#define SYSMGR_A10_NOC_IDLESTATUS 0xd4#define SYSMGR_A10_FPGA2SOC_CTRL 0xd8 +#define SYSMGR_A10_ROMCODE_CTRL 0x204#define SYSMGR_A10_ROMCODE_INITSWSTATE 0x20C +#define SYSMGR_A10_ROMCODE_QSPIRESETCOMMAND 0x208 +#define SYSMGR_A10_ISW_HANDOFF_BASE 0x230 +#define SYSMGR_A10_ISW_HANDOFF_7 0x1c#define SYSMGR_SDMMC SYSMGR_A10_SDMMC
arch/arm/mach-socfpga/misc_arria10.c +89 -1
116 lines not on this page · raw message
arch/arm/mach-socfpga/spl_a10.c +93 -3
125 lines not on this page · raw message
Signature · 1 line
2.25.1
RE: [PATCH 2/3] arm: socfpga: arria10: Reset MPFE NoC after program periph / combined RBF
Quoted 22 lines
-----Original Message-----
From: Kho, Sin Hui <[email protected]>
Sent: Sunday, 7 November, 2021 11:09 PM
To: [email protected]
Cc: Simon Goldschmidt <[email protected]>; Marek Vasut <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Westergreen, Dalon <[email protected]>; Cozart, Sue <[email protected]>; Kho, Sin Hui <[email protected]>
Subject: [PATCH 2/3] arm: socfpga: arria10: Reset MPFE NoC after program periph / combined RBFFrom: Tien Fong Chee <[email protected]>
This patch triggers warm reset to recover the MPFE NoC from corruption due to high frequency transient clock output from HPS EMIF IOPLL at VCO startup after peripheral RBF is programmed.
Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Sin Hui Kho <[email protected]>
Quoted 7 lines
--- arch/arm/mach-socfpga/include/mach/misc.h | 5 +- .../include/mach/reset_manager_arria10.h | 6 +- .../include/mach/system_manager_arria10.h | 4 + arch/arm/mach-socfpga/misc_arria10.c | 90 ++++++++++++++++- arch/arm/mach-socfpga/spl_a10.c | 96 ++++++++++++++++++- 5 files changed, 195 insertions(+), 6 deletions(-)
PATCH 3/3 arm: socfpga: arria10: Enable double peripheral RBF configuration
In reply to [email protected]From: Tien Fong Chee <[email protected]>
Double peripheral RBF configuration are needed on some devices or boards to stabilize the IO configuration system.
--- arch/arm/mach-socfpga/include/mach/misc.h | 2 ++ arch/arm/mach-socfpga/misc_arria10.c | 36 +++++++++++++++++++++++ arch/arm/mach-socfpga/spl_a10.c | 14 +++++++++ drivers/fpga/socfpga_arria10.c | 3 +- 4 files changed, 54 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/include/mach/misc.h +2 -0
@@ -45,7 +45,9 @@ int is_fpga_config_ready(void);#endif void do_bridge_reset (int enable,unsigned int mask); +void force_periph_program (unsigned int status);bool is_regular_boot_valid (void ); +bool is_periph_program_force (void );void set_regular_boot (unsigned int status);void socfpga_pl310_clear (void );void socfpga_get_managers_addr (void );
arch/arm/mach-socfpga/misc_arria10.c +36 -0
@@ -32,6 +32,7 @@#define PINMUX_UART1_TX_SHARED_IO_OFFSET_Q4_3 0x98#define REGULAR_BOOT_MAGIC 0xd15ea5e +#define PERIPH_RBF_PROG_FORCE 0x50455249#define QSPI_S25FL_SOFT_RESET_COMMAND 0x00f0ff82#define QSPI_N25_SOFT_RESET_COMMAND 0x00000001
@@ -131,6 +132,41 @@ void do_bridge_reset(int enable, unsigned int mask)socfpga_bridges_reset (); } +/* +* This function set/unset flag with number "0x50455249" to +* handoff register isw_handoff[7] - 0xffd0624c +* This flag is used to force periph RBF program regardless FPGA status +* and double periph RBF config are needed on some devices or boards to +* stabilize the IO config system. +*/ +void force_periph_program (unsigned int status) +{ +if (status) +writel (PERIPH_RBF_PROG_FORCE ,socfpga_get_sysmgr_addr () + +SYSMGR_A10_ISW_HANDOFF_BASE +SYSMGR_A10_ISW_HANDOFF_7 ); +else +writel (0 ,socfpga_get_sysmgr_addr () + +SYSMGR_A10_ISW_HANDOFF_BASE +SYSMGR_A10_ISW_HANDOFF_7 ); +} + +/* +* This function is used to check whether +* handoff register isw_handoff[7] contains +* flag for forcing the periph RBF program "0x50455249". +*/ +bool is_periph_program_force (void ) +{ +unsigned int status; + + status =readl (socfpga_get_sysmgr_addr () + +SYSMGR_A10_ISW_HANDOFF_BASE +SYSMGR_A10_ISW_HANDOFF_7 ); + +if (status ==PERIPH_RBF_PROG_FORCE ) +return true; +else +return false; +} +/* * This function set/unset magic number "0xd15ea5e" to * handoff register isw_handoff[7] - 0xffd0624c
arch/arm/mach-socfpga/spl_a10.c +14 -0
@@ -133,6 +133,20 @@ void spl_board_init(void) }else if (!is_fpgamgr_early_user_mode ()) {/* Program IOSSM(early IO release) or full FPGA */ fpgamgr_program (buf,FPGA_BUFSIZ ,0 ); + +/* Skipping double program for combined RBF */ +if (!is_fpgamgr_user_mode ()) { +/* +* Expect FPGA entered early user mode, so +* the flag is set to re-program IOSSM +*/ +force_periph_program (true); + +/* Re-program IOSSM to stabilize IO system */ +fpgamgr_program (buf,FPGA_BUFSIZ ,0 ); + +force_periph_program (false); + } }/* If the IOSSM/full FPGA is already loaded, start DDR */
drivers/fpga/socfpga_arria10.c +2 -1
@@ -604,7 +604,8 @@ static int first_loading_rbf_to_buffer(struct udevice *dev,if (strstr (uname,"fpga-periph" ) && (!is_fpgamgr_early_user_mode () || -is_fpgamgr_user_mode ())) { +is_fpgamgr_user_mode () || +is_periph_program_force ())) { fpga_node_name = uname;printf ("FPGA: Start to program " );printf ("peripheral/full bitstream ...\n" );
Signature · 1 line
2.25.1
RE: [PATCH 3/3] arm: socfpga: arria10: Enable double peripheral RBF configuration
Quoted 21 lines
-----Original Message-----
From: Kho, Sin Hui <[email protected]>
Sent: Sunday, 7 November, 2021 11:09 PM
To: [email protected]
Cc: Simon Goldschmidt <[email protected]>; Marek Vasut <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Westergreen, Dalon <[email protected]>; Cozart, Sue <[email protected]>; Kho, Sin Hui <[email protected]>
Subject: [PATCH 3/3] arm: socfpga: arria10: Enable double peripheral RBF configurationFrom: Tien Fong Chee <[email protected]>
Double peripheral RBF configuration are needed on some devices or boards to stabilize the IO configuration system.
Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Sin Hui Kho <[email protected]>
Quoted 8 lines
--- arch/arm/mach-socfpga/include/mach/misc.h | 2 ++ arch/arm/mach-socfpga/misc_arria10.c | 36 +++++++++++++++++++++++ arch/arm/mach-socfpga/spl_a10.c | 14 +++++++++ drivers/fpga/socfpga_arria10.c | 3 +- 4 files changed, 54 insertions(+), 1 deletion(-)
Quoted 78 lines
-----Original Message-----
From: Kho, Sin Hui <[email protected]>
Sent: Sunday, 7 November, 2021 11:09 PM
To: [email protected]
Cc: Simon Goldschmidt <[email protected]>; Marek Vasut <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Westergreen, Dalon <[email protected]>; Cozart, Sue <[email protected]>; Kho, Sin Hui <[email protected]>
Subject: [PATCH 1/3] arm: socfpga: arria10: Setting image magic value to romcode initswstate regFrom: Tien Fong Chee <[email protected]>
The
romcode_initswstateregister need to be set withFSBL_IMAGE_IS_VALIDvalue if the current FSBL image is found valid, otherwise BootROM will look for next subsequent valid FSBL image when warm reset is triggered.Signed-off-by Tien Fong Chee <[email protected]>Signed-off-by Sin Hui Kho <[email protected]>--- .../mach-socfpga/include/mach/system_manager_arria10.h | 3 ++- arch/arm/mach-socfpga/spl_a10.c | 10 +++++++++- 2 files changed, 11 insertions(+), 2 deletions(-)arch/arm/mach-socfpga/include/mach/system_manager_arria10.h +2
-1@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 */ /* -* Copyright (C) 2016-2017 Intel Corporation <www.intel.com> +* Copyright (C) 2016-2021 Intel Corporation <www.intel.com> */ #ifndef _SYSTEM_MANAGER_ARRIA10_H_@@ -31,6 +31,7 @@#define SYSMGR_A10_NOC_IDLEACK 0xd0#define SYSMGR_A10_NOC_IDLESTATUS 0xd4#define SYSMGR_A10_FPGA2SOC_CTRL 0xd8 +#define SYSMGR_A10_ROMCODE_INITSWSTATE 0x20C#define SYSMGR_SDMMC SYSMGR_A10_SDMMCarch/arm/mach- renamed from arch/arm/mach-socfpga/spl_a10.c +0
-0
socfpga/spl_a10.cindexecb656e4de..f6c4b5708d100644arch/arm/mach-socfpga/spl_a10.c +7
-2@@ -1,6 +1,6 @@// SPDX-License-Identifier: GPL-2.0+ /* -* Copyright (C) 2012-2019 Altera Corporation <www.altera.com> +* Copyright (C) 2012-2021 Altera Corporation <www.altera.com> */ #include <common.h> @@ -32,6 +32,7 @@#include <memalign.h> #define FPGA_BUFSIZ 16 * 1024 +#define FSBL_IMAGE_IS_VALID 0x49535756DECLARE_GLOBAL_DATA_PTR ;@@ -169,3 +170,10 @@ void board_init_f(ulong dummy)config_dedicated_pins (gd->fdt_blob);WATCHDOG_RESET (); } + +/* board specific function prior loading SSBL / U-Boot proper */ void +spl_board_prepare_for_boot (void ) { +writel (FSBL_IMAGE_IS_VALID ,socfpga_get_sysmgr_addr () + +SYSMGR_A10_ROMCODE_INITSWSTATE ); } --
Quoted 1 line
2.25.1