Restructure Stratix10 and Agilex handoff code
Subsystems (3)
cover Restructure Stratix10 and Agilex handoff code
This patchset is extracted from "Add Intel Diamond Mesa SoC support" series. We are in preparation to support new Intel N5X (Diamond Mesa) SOC64 device and we would like to clean up some code before enable N5X device.
This patchset restructure Stratix10 and Agilex handoff code to be generic and to be used by all SOC64 devices.
Remove wrap_pinmux_config_s10.c. Add wrap_handoff_soc64.c which contains the generic function to parse the handoff data.
Rename all handoff macro prefix from S10_* to SOC64* and change all corresponding file name from *_s10 to *_soc64. Last, change the code to use generic fundtion from wrap_handoff_soc64.c.
History:
--------
The first version of this patchset is extracted from "Add Intel Diamond Mesa SoC support" series.
https://patchwork.ozlabs.org/project/uboot/cover/20201110064439.9683-1-elly.siew.chin.lim at intel.com/
This patchset has dependency on:
--------
1. arm: socfpga: Move Stratix10 and Agilex SPL common code
https://patchwork.ozlabs.org/project/uboot/patch/20210315075916.26336-1-elly.siew.chin.lim at intel.com/
Siew Chin Lim (5):
arm: socfpga: Rename Stratix10 and Agilex handoff common macros
arm: socfpga: Changed wrap_pll_config_s10.c to wrap_pll_config_soc64.c
arm: socfpga: Changed system_manager_s10.c to system_manager_soc64.c
arm: socfpga: Rearrange sequence of macros in handoff_soc64.h
arm: socfpga: Restructure Stratix10 and Agilex handoff code
arch/arm/mach-socfpga/Makefile | 12 ++--
arch/arm/mach-socfpga/clock_manager_s10.c | 2 +-
arch/arm/mach-socfpga/include/mach/handoff_s10.h | 39 ------------
arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 62 ++++++++++++++++++
.../include/mach/system_manager_soc64.h | 4 --
...system_manager_s10.c => system_manager_soc64.c} | 53 ++++++++++------
arch/arm/mach-socfpga/wrap_handoff_soc64.c | 73 ++++++++++++++++++++++
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c | 56 -----------------
...ap_pll_config_s10.c => wrap_pll_config_soc64.c} | 16 ++---
include/configs/socfpga_soc64_common.h | 4 +-
10 files changed, 187 insertions(+), 134 deletions(-)
delete mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h
create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_soc64.h
rename arch/arm/mach-socfpga/{system_manager_s10.c => system_manager_soc64.c} (57%)
create mode 100644 arch/arm/mach-socfpga/wrap_handoff_soc64.c
delete mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
rename arch/arm/mach-socfpga/{wrap_pll_config_s10.c => wrap_pll_config_soc64.c} (74%)Signature · 1 line
2.13.0
PATCH 1/5 arm: socfpga: Rename Stratix10 and Agilex handoff common macros
Rename handoff_s10.h to handoff_soc64.h. Changed macros prefix from S10_HANDOFF to SOC64_HANDOFF.
--- arch/arm/mach-socfpga/clock_manager_s10.c | 2 +- arch/arm/mach-socfpga/include/mach/handoff_s10.h | 39 ---------------------- arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 39 ++++++++++++++++++++++ arch/arm/mach-socfpga/wrap_pinmux_config_s10.c | 18 +++++----- arch/arm/mach-socfpga/wrap_pll_config_s10.c | 16 ++++----- include/configs/socfpga_soc64_common.h | 4 +-- 6 files changed, 59 insertions(+), 59 deletions(-) delete mode 100644 arch/arm/mach-socfpga/include/mach/handoff_s10.h create mode 100644 arch/arm/mach-socfpga/include/mach/handoff_soc64.h
arch/arm/mach-socfpga/clock_manager_s10.c +1 -1
@@ -8,7 +8,7 @@#include <asm/global_data.h> #include <asm/io.h> #include <asm/arch/clock_manager.h> -#include <asm/arch/handoff_s10.h> +#include <asm/arch/handoff_soc64.h> #include <asm/arch/system_manager.h> DECLARE_GLOBAL_DATA_PTR ;
arch/arm/mach-socfpga/include/mach/handoff_s10.h deleted +0 -39
@@ -1,39 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0 -* -* Copyright (C) 2016-2018 Intel Corporation <www.intel.com> -* -*/ - -#ifndef _HANDOFF_S10_H_ -#define _HANDOFF_S10_H_ - -/* -* Offset for HW handoff from Quartus tools -*/ -#define S10_HANDOFF_BASE 0xFFE3F000 -#define S10_HANDOFF_MUX (S10_HANDOFF_BASE + 0x10) -#define S10_HANDOFF_IOCTL (S10_HANDOFF_BASE + 0x1A0) -#define S10_HANDOFF_FPGA (S10_HANDOFF_BASE + 0x330) -#define S10_HANODFF_DELAY (S10_HANDOFF_BASE + 0x3F0) -#define S10_HANDOFF_CLOCK (S10_HANDOFF_BASE + 0x580) -#define S10_HANDOFF_MISC (S10_HANDOFF_BASE + 0x610) -#define S10_HANDOFF_MAGIC_MUX 0x504D5558 -#define S10_HANDOFF_MAGIC_IOCTL 0x494F4354 -#define S10_HANDOFF_MAGIC_FPGA 0x46504741 -#define S10_HANDOFF_MAGIC_DELAY 0x444C4159 -#define S10_HANDOFF_MAGIC_CLOCK 0x434C4B53 -#define S10_HANDOFF_MAGIC_MISC 0x4D495343 -#define S10_HANDOFF_OFFSET_LENGTH 0x4 -#define S10_HANDOFF_OFFSET_DATA 0x10 - -#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 -#define HANDOFF_CLOCK_OSC (S10_HANDOFF_BASE + 0x608) -#define HANDOFF_CLOCK_FPGA (S10_HANDOFF_BASE + 0x60C) -#else -#define HANDOFF_CLOCK_OSC (S10_HANDOFF_BASE + 0x5fc) -#define HANDOFF_CLOCK_FPGA (S10_HANDOFF_BASE + 0x600) -#endif - -#define S10_HANDOFF_SIZE 4096 - -#endif /* _HANDOFF_S10_H_ */
arch/arm/mach-socfpga/include/mach/handoff_soc64.h new file +39 -0
@@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 +* +* Copyright (C) 2016-2018 Intel Corporation <www.intel.com> +* +*/ + +#ifndef _HANDOFF_SOC64_H_ +#define _HANDOFF_SOC64_H_ + +/* +* Offset for HW handoff from Quartus tools +*/ +#define SOC64_HANDOFF_BASE 0xFFE3F000 +#define SOC64_HANDOFF_MUX (SOC64_HANDOFF_BASE + 0x10) +#define SOC64_HANDOFF_IOCTL (SOC64_HANDOFF_BASE + 0x1A0) +#define SOC64_HANDOFF_FPGA (SOC64_HANDOFF_BASE + 0x330) +#define SOC64_HANDOFF_DELAY (SOC64_HANDOFF_BASE + 0x3F0) +#define SOC64_HANDOFF_CLOCK (SOC64_HANDOFF_BASE + 0x580) +#define SOC64_HANDOFF_MISC (SOC64_HANDOFF_BASE + 0x610) +#define SOC64_HANDOFF_MAGIC_MUX 0x504D5558 +#define SOC64_HANDOFF_MAGIC_IOCTL 0x494F4354 +#define SOC64_HANDOFF_MAGIC_FPGA 0x46504741 +#define SOC64_HANDOFF_MAGIC_DELAY 0x444C4159 +#define SOC64_HANDOFF_MAGIC_CLOCK 0x434C4B53 +#define SOC64_HANDOFF_MAGIC_MISC 0x4D495343 +#define SOC64_HANDOFF_OFFSET_LENGTH 0x4 +#define SOC64_HANDOFF_OFFSET_DATA 0x10 + +#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 +#define SOC64_HANDOFF_CLOCK_OSC (SOC64_HANDOFF_BASE + 0x608) +#define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x60C) +#else +#define SOC64_HANDOFF_CLOCK_OSC (SOC64_HANDOFF_BASE + 0x5fc) +#define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x600) +#endif + +#define SOC64_HANDOFF_SIZE 4096 + +#endif /* _HANDOFF_SOC64_H_ */
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c +9 -9
@@ -7,23 +7,23 @@#include <common.h> #include <errno.h> #include <asm/io.h> -#include <asm/arch/handoff_s10.h> +#include <asm/arch/handoff_soc64.h> static void sysmgr_pinmux_handoff_read (void *handoff_address,const u32 **table,unsigned int *table_len) {unsigned int handoff_entry = (swab32 (readl (handoff_address + -S10_HANDOFF_OFFSET_LENGTH )) - -S10_HANDOFF_OFFSET_DATA ) / +SOC64_HANDOFF_OFFSET_LENGTH )) - +SOC64_HANDOFF_OFFSET_DATA ) /sizeof (unsigned int );unsigned int handoff_chunk[handoff_entry], temp, i; -if (swab32 (readl (S10_HANDOFF_MUX )) ==S10_HANDOFF_MAGIC_MUX ) { +if (swab32 (readl (SOC64_HANDOFF_MUX )) ==SOC64_HANDOFF_MAGIC_MUX ) {/* using handoff from Quartus tools if exists */ for (i =0 ; i < handoff_entry; i++) { temp =readl (handoff_address + -S10_HANDOFF_OFFSET_DATA + (i *4 )); +SOC64_HANDOFF_OFFSET_DATA + (i *4 )); handoff_chunk[i] =swab32 (temp); } *table = handoff_chunk;
@@ -33,24 +33,24 @@ static void sysmgr_pinmux_handoff_read(void *handoff_address,void sysmgr_pinmux_table_sel (const u32 **table,unsigned int *table_len) { -sysmgr_pinmux_handoff_read ((void *)S10_HANDOFF_MUX , table, +sysmgr_pinmux_handoff_read ((void *)SOC64_HANDOFF_MUX , table, table_len); }void sysmgr_pinmux_table_ctrl (const u32 **table,unsigned int *table_len) { -sysmgr_pinmux_handoff_read ((void *)S10_HANDOFF_IOCTL , table, +sysmgr_pinmux_handoff_read ((void *)SOC64_HANDOFF_IOCTL , table, table_len); }void sysmgr_pinmux_table_fpga (const u32 **table,unsigned int *table_len) { -sysmgr_pinmux_handoff_read ((void *)S10_HANDOFF_FPGA , table, +sysmgr_pinmux_handoff_read ((void *)SOC64_HANDOFF_FPGA , table, table_len); }void sysmgr_pinmux_table_delay (const u32 **table,unsigned int *table_len) { -sysmgr_pinmux_handoff_read ((void *)S10_HANODFF_DELAY , table, +sysmgr_pinmux_handoff_read ((void *)SOC64_HANDOFF_DELAY , table, table_len); }
arch/arm/mach-socfpga/wrap_pll_config_s10.c +8 -8
@@ -7,24 +7,24 @@#include <common.h> #include <asm/arch/clock_manager.h> #include <asm/io.h> -#include <asm/arch/handoff_s10.h> +#include <asm/arch/handoff_soc64.h> #include <asm/arch/system_manager.h> const struct cm_config *const cm_get_default_config (void ) {#ifdef CONFIG_SPL_BUILD struct cm_config *cm_handoff_cfg = (struct cm_config *) - (S10_HANDOFF_CLOCK +S10_HANDOFF_OFFSET_DATA ); + (SOC64_HANDOFF_CLOCK +SOC64_HANDOFF_OFFSET_DATA );u32 *conversion = (u32 *)cm_handoff_cfg;u32 i; -u32 handoff_clk =readl (S10_HANDOFF_CLOCK ); +u32 handoff_clk =readl (SOC64_HANDOFF_CLOCK ); -if (swab32 (handoff_clk) ==S10_HANDOFF_MAGIC_CLOCK ) { -writel (swab32 (handoff_clk),S10_HANDOFF_CLOCK ); +if (swab32 (handoff_clk) ==SOC64_HANDOFF_MAGIC_CLOCK ) { +writel (swab32 (handoff_clk),SOC64_HANDOFF_CLOCK );for (i =0 ; i < (sizeof (*cm_handoff_cfg) /sizeof (u32)); i++) conversion[i] =swab32 (conversion[i]);return cm_handoff_cfg; - }else if (handoff_clk ==S10_HANDOFF_MAGIC_CLOCK ) { + }else if (handoff_clk ==SOC64_HANDOFF_MAGIC_CLOCK ) {return cm_handoff_cfg; }#endif
@@ -35,7 +35,7 @@ const unsigned int cm_get_osc_clk_hz(void) {#ifdef CONFIG_SPL_BUILD -u32 clock =readl (HANDOFF_CLOCK_OSC ); +u32 clock =readl (SOC64_HANDOFF_CLOCK_OSC );writel (clock,socfpga_get_sysmgr_addr () +SYSMGR_SOC64_BOOT_SCRATCH_COLD1 );
@@ -52,7 +52,7 @@ const unsigned int cm_get_intosc_clk_hz(void)const unsigned int cm_get_fpga_clk_hz (void ) {#ifdef CONFIG_SPL_BUILD -u32 clock =readl (HANDOFF_CLOCK_FPGA ); +u32 clock =readl (SOC64_HANDOFF_CLOCK_FPGA );writel (clock,socfpga_get_sysmgr_addr () +SYSMGR_SOC64_BOOT_SCRATCH_COLD2 );
include/configs/socfpga_soc64_common.h +2 -2
@@ -8,7 +8,7 @@#define __CONFIG_SOCFPGA_SOC64_COMMON_H__#include <asm/arch/base_addr_s10.h> -#include <asm/arch/handoff_s10.h> +#include <asm/arch/handoff_soc64.h> #include <linux/stringify.h> /*
@@ -43,7 +43,7 @@#ifdef CONFIG_SPL_BUILD #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_INIT_RAM_ADDR \ + CONFIG_SYS_INIT_RAM_SIZE \ - - S10_HANDOFF_SIZE) + - SOC64_HANDOFF_SIZE)#else #define CONFIG_SYS_INIT_SP_ADDR (CONFIG_SYS_TEXT_BASE \ + 0x100000)
Signature · 1 line
2.13.0
Tan
PATCH 1/5 arm: socfpga: Rename Stratix10 and Agilex handoff common macros
Quoted 16 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 15, 2021 5:43 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v1 1/5] arm: socfpga: Rename Stratix10 and Agilex handoff common macros
Quoted 5 lines
Rename
handoff_s10.htohandoff_soc64.h. Changed macros prefix fromS10_HANDOFFtoSOC64_HANDOFF.Signed-off-by Siew Chin Lim <[email protected]>---
PATCH 2/5 arm: socfpga: Changed wrap_pll_config_s10.c to wrap_pll_config_soc64.c
In reply to Siew Chin LimRename to common file name to used by all SOC64 devices.
---
arch/arm/mach-socfpga/Makefile | 4 ++--
.../mach-socfpga/{wrap_pll_config_s10.c => wrap_pll_config_soc64.c} | 0
2 files changed, 2 insertions(+), 2 deletions(-)
rename arch/arm/mach-socfpga/{wrap_pll_config_s10.c => wrap_pll_config_soc64.c} (100%)arch/arm/mach-socfpga/Makefile +2 -2
@@ -38,7 +38,7 @@ obj-y += reset_manager_s10.o obj-y += system_manager_s10.o obj-y += timer_s10.o obj-y += wrap_pinmux_config_s10.o -obj-y += wrap_pll_config_s10.o +obj-y += wrap_pll_config_soc64.o endif ifdef CONFIG_TARGET_SOCFPGA_AGILEX
@@ -53,7 +53,7 @@ obj-y += system_manager_s10.o obj-y += timer_s10.o obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH) += vab.o obj-y += wrap_pinmux_config_s10.o -obj-y += wrap_pll_config_s10.o +obj-y += wrap_pll_config_soc64.o endif ifdef CONFIG_SPL_BUILD
arch/arm/mach-socfpga/wrap_pll_config_soc64.c renamed from arch/arm/mach-socfpga/wrap_pll_config_s10.c +0 -0
Signature · 1 line
2.13.0
Tan
PATCH 2/5 arm: socfpga: Changed wrap_pll_config_s10.c to wrap_pll_config_soc64.c
Quoted 16 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 15, 2021 5:43 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v1 2/5] arm: socfpga: Changedwrap_pll_config_s10.ctowrap_pll_config_soc64.c
Quoted 4 lines
Rename to common file name to used by all SOC64 devices.
Signed-off-by Siew Chin Lim <[email protected]>---
PATCH 3/5 arm: socfpga: Changed system_manager_s10.c to system_manager_soc64.c
In reply to Siew Chin LimRename to common file name to used by all SOC64 devices. No functionality change.
---
arch/arm/mach-socfpga/Makefile | 4 ++--
.../arm/mach-socfpga/{system_manager_s10.c => system_manager_soc64.c} | 0
2 files changed, 2 insertions(+), 2 deletions(-)
rename arch/arm/mach-socfpga/{system_manager_s10.c => system_manager_soc64.c} (100%)arch/arm/mach-socfpga/Makefile +2 -2
@@ -35,7 +35,7 @@ obj-y += mailbox_s10.o obj-y += misc_s10.o obj-y += mmu-arm64_s10.o obj-y += reset_manager_s10.o -obj-y += system_manager_s10.o +obj-y += system_manager_soc64.o obj-y += timer_s10.o obj-y += wrap_pinmux_config_s10.o obj-y += wrap_pll_config_soc64.o
@@ -49,7 +49,7 @@ obj-y += misc_s10.o obj-y += mmu-arm64_s10.o obj-y += reset_manager_s10.o obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH) += secure_vab.o -obj-y += system_manager_s10.o +obj-y += system_manager_soc64.o obj-y += timer_s10.o obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH) += vab.o obj-y += wrap_pinmux_config_s10.o
arch/arm/mach-socfpga/system_manager_soc64.c renamed from arch/arm/mach-socfpga/system_manager_s10.c +0 -0
Signature · 1 line
2.13.0
Tan
PATCH 3/5 arm: socfpga: Changed system_manager_s10.c to system_manager_soc64.c
Quoted 16 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 15, 2021 5:43 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v1 3/5] arm: socfpga: Changedsystem_manager_s10.ctosystem_manager_soc64.c
Quoted 5 lines
Rename to common file name to used by all SOC64 devices. No functionality change.
Signed-off-by Siew Chin Lim <[email protected]>---
PATCH 4/5 arm: socfpga: Rearrange sequence of macros in handoff_soc64.h
In reply to Siew Chin LimRearrange sequence of macros in handoff_soc64.h without any functionality change. In preparation for Stratix10 and Agilex handoff function restructuring.
--- arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +12 -10
@@ -1,6 +1,6 @@/* SPDX-License-Identifier: GPL-2.0 * -* Copyright (C) 2016-2018 Intel Corporation <www.intel.com> +* Copyright (C) 2016-2020 Intel Corporation <www.intel.com> * */
@@ -10,21 +10,25 @@/* * Offset for HW handoff from Quartus tools */ -#define SOC64_HANDOFF_BASE 0xFFE3F000 -#define SOC64_HANDOFF_MUX (SOC64_HANDOFF_BASE + 0x10) -#define SOC64_HANDOFF_IOCTL (SOC64_HANDOFF_BASE + 0x1A0) -#define SOC64_HANDOFF_FPGA (SOC64_HANDOFF_BASE + 0x330) -#define SOC64_HANDOFF_DELAY (SOC64_HANDOFF_BASE + 0x3F0) -#define SOC64_HANDOFF_CLOCK (SOC64_HANDOFF_BASE + 0x580) -#define SOC64_HANDOFF_MISC (SOC64_HANDOFF_BASE + 0x610) +/* HPS handoff */ #define SOC64_HANDOFF_MAGIC_MUX 0x504D5558#define SOC64_HANDOFF_MAGIC_IOCTL 0x494F4354#define SOC64_HANDOFF_MAGIC_FPGA 0x46504741#define SOC64_HANDOFF_MAGIC_DELAY 0x444C4159#define SOC64_HANDOFF_MAGIC_CLOCK 0x434C4B53#define SOC64_HANDOFF_MAGIC_MISC 0x4D495343 +#define SOC64_HANDOFF_OFFSET_LENGTH 0x4#define SOC64_HANDOFF_OFFSET_DATA 0x10 +#define SOC64_HANDOFF_SIZE 4096 + +#define SOC64_HANDOFF_BASE 0xFFE3F000 +#define SOC64_HANDOFF_MISC (SOC64_HANDOFF_BASE + 0x610) +#define SOC64_HANDOFF_MUX (SOC64_HANDOFF_BASE + 0x10) +#define SOC64_HANDOFF_IOCTL (SOC64_HANDOFF_BASE + 0x1A0) +#define SOC64_HANDOFF_FPGA (SOC64_HANDOFF_BASE + 0x330) +#define SOC64_HANDOFF_DELAY (SOC64_HANDOFF_BASE + 0x3F0) +#define SOC64_HANDOFF_CLOCK (SOC64_HANDOFF_BASE + 0x580)#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 #define SOC64_HANDOFF_CLOCK_OSC (SOC64_HANDOFF_BASE + 0x608)
@@ -34,6 +38,4 @@#define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x600)#endif -#define SOC64_HANDOFF_SIZE 4096 -#endif /* _HANDOFF_SOC64_H_ */
Signature · 1 line
2.13.0
Tan
PATCH 4/5 arm: socfpga: Rearrange sequence of macros in handoff_soc64.h
Quoted 16 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 15, 2021 5:43 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v1 4/5] arm: socfpga: Rearrange sequence of macros inhandoff_soc64.h
Quoted 9 lines
Rearrange sequence of macros in
handoff_soc64.hwithout any functionality change. In preparation for Stratix10 and Agilex handoff function restructuring.Signed-off-by Siew Chin Lim <[email protected]>--- arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
PATCH 5/5 arm: socfpga: Restructure Stratix10 and Agilex handoff code
In reply to Siew Chin LimRestructure Stratix10 and Agilex handoff code to used by all SOC64 devices, in preparation to support handoff for Diamond Mesa.
Remove wrap_pinmux_config_s10.c. Add wrap_handoff_soc64.c which contains the generic function to parse the handoff data.
Update system_manager_soc64.c to use generic handoff function in wrap_handoff_soc64.c.
--- arch/arm/mach-socfpga/Makefile | 4 +- arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 21 +++++++ .../include/mach/system_manager_soc64.h | 4 -- arch/arm/mach-socfpga/system_manager_soc64.c | 53 ++++++++++------ arch/arm/mach-socfpga/wrap_handoff_soc64.c | 73 ++++++++++++++++++++++ arch/arm/mach-socfpga/wrap_pinmux_config_s10.c | 56 ----------------- 6 files changed, 131 insertions(+), 80 deletions(-) create mode 100644 arch/arm/mach-socfpga/wrap_handoff_soc64.c delete mode 100644 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c
arch/arm/mach-socfpga/Makefile +2 -2
@@ -37,7 +37,7 @@ obj-y += mmu-arm64_s10.o obj-y += reset_manager_s10.o obj-y += system_manager_soc64.o obj-y += timer_s10.o -obj-y += wrap_pinmux_config_s10.o +obj-y += wrap_handoff_soc64.o obj-y += wrap_pll_config_soc64.o endif
@@ -52,7 +52,7 @@ obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH) += secure_vab.o obj-y += system_manager_soc64.o obj-y += timer_s10.o obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH) += vab.o -obj-y += wrap_pinmux_config_s10.o +obj-y += wrap_handoff_soc64.o obj-y += wrap_pll_config_soc64.o endif
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +21 -0
@@ -11,6 +11,7 @@* Offset for HW handoff from Quartus tools */ /* HPS handoff */ +#define SOC64_HANDOFF_MAGIC_BOOT 0x424F4F54#define SOC64_HANDOFF_MAGIC_MUX 0x504D5558#define SOC64_HANDOFF_MAGIC_IOCTL 0x494F4354#define SOC64_HANDOFF_MAGIC_FPGA 0x46504741
@@ -38,4 +39,24 @@#define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x600)#endif +#define SOC64_HANDOFF_MUX_LEN 96 +#define SOC64_HANDOFF_IOCTL_LEN 96 +#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 +#define SOC64_HANDOFF_FPGA_LEN 42 +#else +#define SOC64_HANDOFF_FPGA_LEN 40 +#endif +#define SOC64_HANDOFF_DELAY_LEN 96 + +#ifndef __ASSEMBLY__ +#include <asm/types.h> +enum endianness { + little_endian, + big_endian +}; + +int socfpga_get_handoff_size (void *handoff_address,enum endianness endian); +int socfpga_handoff_read (void *handoff_address,void *table,u32 table_len, +enum endianness big_endian); +#endif #endif /* _HANDOFF_SOC64_H_ */
arch/arm/mach-socfpga/include/mach/system_manager_soc64.h +0 -4
@@ -10,10 +10,6 @@void sysmgr_pinmux_init (void );void populate_sysmgr_fpgaintf_module (void );void populate_sysmgr_pinmux (void ); -void sysmgr_pinmux_table_sel (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_ctrl (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_fpga (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_delay (const u32 **table,unsigned int *table_len);#define SYSMGR_SOC64_WDDBG 0x08#define SYSMGR_SOC64_DMA 0x20
arch/arm/mach-socfpga/system_manager_soc64.c +35 -18
83 lines not on this page · raw message
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +73 -0
73 lines not on this page · raw message
arch/arm/mach-socfpga/wrap_pinmux_config_s10.c deleted +0 -56
56 lines not on this page · raw message
Signature · 1 line
2.13.0
Tan
PATCH 5/5 arm: socfpga: Restructure Stratix10 and Agilex handoff code
Quoted 48 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 15, 2021 5:43 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v1 5/5] arm: socfpga: Restructure Stratix10 and Agilex handoff codeRestructure Stratix10 and Agilex handoff code to used by all SOC64 devices, in preparation to support handoff for Diamond Mesa.
Remove
wrap_pinmux_config_s10.c. Addwrap_handoff_soc64.cwhich contains the generic function to parse the handoff data.Update
system_manager_soc64.cto use generic handoff function inwrap_handoff_soc64.c.Signed-off-by Siew Chin Lim <[email protected]>--- arch/arm/mach-socfpga/Makefile | 4 +- arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 21 +++++++ .../include/mach/system_manager_soc64.h | 4 -- arch/arm/mach-socfpga/system_manager_soc64.c | 53 ++++++++++-----(quoted diff) +1
-1- arch/arm/mach-socfpga/wrap_handoff_soc64.c | 73 ++++++++++++++++++++++arch/arm/mach-socfpga/include/mach/handoff_soc64.h +1
-0@@ -11,6 +11,7 @@* Offset for HW handoff from Quartus tools */ /* HPS handoff */ +#define SOC64_HANDOFF_MAGIC_BOOT 0x424F4F54#define SOC64_HANDOFF_MAGIC_MUX 0x504D5558#define SOC64_HANDOFF_MAGIC_IOCTL 0x494F4354#define SOC64_HANDOFF_MAGIC_FPGA 0x46504741
arch/arm/mach-socfpga/include/mach/handoff_soc64.h line 45
Quoted 7 lines
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +3
-0@@ -38,4 +39,24 @@#define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x600)#endif +#define SOC64_HANDOFF_MUX_LEN 96 +#define SOC64_HANDOFF_IOCTL_LEN 96 +#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
Can change to #if CONFIG_IS_ENABLED()
arch/arm/mach-socfpga/include/mach/handoff_soc64.h line 56
Quoted 12 lines
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +12
-0+#define SOC64_HANDOFF_FPGA_LEN 42 +#else +#define SOC64_HANDOFF_FPGA_LEN 40 +#endif +#define SOC64_HANDOFF_DELAY_LEN 96 + +#ifndef __ASSEMBLY__ +#include <asm/types.h> +enum endianness { + little_endian, + big_endian +};
Uses capital letter for enum macros.
Quoted 24 lines
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +3
-0+ +int socfpga_get_handoff_size (void *handoff_address,enum endianness +endian); int socfpga_handoff_read(void *handoff_address, void *table,u32
table_len,arch/arm/mach-socfpga/include/mach/handoff_soc64.h +2
-0+ enum endianness big_endian); +#endif #endif /* _HANDOFF_SOC64_H_ */ arch/arm/mach-socfpga/include/mach/system_manager_soc64.h +0
-3@@ -10,10 +10,6 @@void sysmgr_pinmux_init (void );void populate_sysmgr_fpgaintf_module (void );void populate_sysmgr_pinmux (void ); -void sysmgr_pinmux_table_sel (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_ctrl (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_fpga (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len);#define SYSMGR_SOC64_WDDBG 0x08#define SYSMGR_SOC64_DMA 0x20
[...]
Quoted 8 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +1
-0@@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0
arch/arm/mach-socfpga/wrap_handoff_soc64.c line 11
Quoted 10 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +10
-0+/* +* Copyright (C) 2020 Intel Corporation <www.intel.com> +* +*/ + +#include <common.h> +#include <asm/arch/handoff_soc64.h> +#include <asm/io.h> +#include <errno.h> +#include "log.h"
Sort this.
arch/arm/mach-socfpga/wrap_handoff_soc64.c line 29
Quoted 13 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +7
-0+ +int socfpga_get_handoff_size (void *handoff_address,enum endianness +endian) { +u32 handoff_size; + +if (endian == little_endian) { + handoff_size = (readl(handoff_address +
SOC64_HANDOFF_OFFSET_LENGTH) -arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +5
-0+ SOC64_HANDOFF_OFFSET_DATA) / +sizeof (u32); + }else if (endian == big_endian) { + handoff_size = swab32(readl(handoff_address + +
Can merge this, just need do additional swab32 if it is bit endian.
[.....]
Quoted 36 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +2
-0+ +int socfpga_handoff_read(void *handoff_address, void *table, u32
table_len,arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +6
-0+ enum endianness big_endian) +{ +u32 temp, i; +u32 *table_x32 = table; + + debug("%s: handoff addr = 0x%p ", __func__, (u32*)handoff_address);
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +3
-0+ +if (big_endian) { + if (swab32(readl(SOC64_HANDOFF_BASE)) ==
SOC64_HANDOFF_MAGIC_BOOT) {arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +21
-0+debug ("Handoff table address = 0x%p " , table_x32); +debug ("table length = 0x%x\n" , table_len); +debug ("%s: handoff data =\n{\n" , __func__); + +for (i =0 ; i < table_len; i++) { + temp =readl (handoff_address + +SOC64_HANDOFF_OFFSET_DATA + + (i *sizeof (u32))); + *table_x32 =swab32 (temp); + +if (!(i %2 )) +debug (" No.%d Addr 0x%08x: " , i, + *table_x32); +else +debug (" 0x%08x\n" , *table_x32); + + table_x32++; + } +debug ("\n}\n" ); + }else { + debug("%s: Cannot find
SOC64_HANDOFF_MAGIC_BOOT",__func__);
arch/arm/mach-socfpga/wrap_handoff_soc64.c line 70
Quoted 4 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +4
-0+debug ("at addr 0x%p\n" , (u32 *)handoff_address); +return -EPERM ; + } + }
How about if it is little endian, why don't need to fill up table_x32?
Regards
Ley Foon
Lim
PATCH 5/5 arm: socfpga: Restructure Stratix10 and Agilex handoff code
Hi Ley Foon,
Quoted 188 lines
-----Original Message-----
From: Tan, Ley Foon <[email protected]>
Sent: Tuesday, March 23, 2021 6:04 PM
To: Lim, Elly Siew Chin <[email protected]>; u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: RE: [v1 5/5] arm: socfpga: Restructure Stratix10 and Agilex handoff codeQuoted 23 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Monday, March 15, 2021 5:43 PM
To: u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>; Lim, Elly Siew Chin <[email protected]>
Subject: [v1 5/5] arm: socfpga: Restructure Stratix10 and Agilex handoff codeRestructure Stratix10 and Agilex handoff code to used by all SOC64 devices, in preparation to support handoff for Diamond Mesa.
Remove
wrap_pinmux_config_s10.c. Addwrap_handoff_soc64.cwhich contains the generic function to parse the handoff data.Update
system_manager_soc64.cto use generic handoff function inwrap_handoff_soc64.c.Quoted 6 lines
Signed-off-by Siew Chin Lim <[email protected]>--- arch/arm/mach-socfpga/Makefile | 4 +- arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 21 +++++++ .../include/mach/system_manager_soc64.h | 4 -- arch/arm/mach-socfpga/system_manager_soc64.c | 53 ++++++++++-----
Quoted 18 lines
(quoted diff) +1
-1- arch/arm/mach-socfpga/wrap_handoff_soc64.c | 73 ++++++++++++++++++++++arch/arm/mach-socfpga/include/mach/handoff_soc64.h +1
-0@@ -11,6 +11,7 @@* Offset for HW handoff from Quartus tools */ /* HPS handoff */ +#define SOC64_HANDOFF_MAGIC_BOOT 0x424F4F54#define SOC64_HANDOFF_MAGIC_MUX 0x504D5558#define SOC64_HANDOFF_MAGIC_IOCTL 0x494F4354#define SOC64_HANDOFF_MAGIC_FPGA 0x46504741arch/arm/mach-socfpga/include/mach/handoff_soc64.h line 45
Quoted 7 lines
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +3
-0@@ -38,4 +39,24 @@#define SOC64_HANDOFF_CLOCK_FPGA (SOC64_HANDOFF_BASE + 0x600)#endif +#define SOC64_HANDOFF_MUX_LEN 96 +#define SOC64_HANDOFF_IOCTL_LEN 96 +#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10 Can change to #if
CONFIG_IS_ENABLED()arch/arm/mach-socfpga/include/mach/handoff_soc64.h line 56
Quoted 12 lines
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +12
-0+#define SOC64_HANDOFF_FPGA_LEN 42 +#else +#define SOC64_HANDOFF_FPGA_LEN 40 +#endif +#define SOC64_HANDOFF_DELAY_LEN 96 + +#ifndef __ASSEMBLY__ +#include <asm/types.h> +enum endianness { + little_endian, + big_endian +};Uses capital letter for enum macros.
Review
Quoted 8 lines
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +3
-0+ +int socfpga_get_handoff_size (void *handoff_address,enum endianness +endian); int socfpga_handoff_read(void *handoff_address, void *table,u32
table_len,arch/arm/mach-socfpga/include/mach/handoff_soc64.h +2
-0+ enum endianness big_endian); +#endif #endif /* _HANDOFF_SOC64_H_ */ (quoted diff) +0
-0
socfpga/include/mach/system_manager_soc64.hQuoted 16 lines
b/arch/arm/mach-socfpga/include/mach/system_manager_soc64.hindex4949cae97a..1eb8e7a904100644arch/arm/mach-socfpga/include/mach/system_manager_soc64.h +0
-1@@ -10,10 +10,6 @@void sysmgr_pinmux_init (void );void populate_sysmgr_fpgaintf_module (void );void populate_sysmgr_pinmux (void ); -void sysmgr_pinmux_table_sel (const u32 **table,unsigned int *table_len); -void sysmgr_pinmux_table_ctrl(const u32 **table,unsigned int
*table_len); -voidsysmgr_pinmux_table_fpga(const u32 **table, unsigned int *table_len); -voidsysmgr_pinmux_table_delay(const u32 **table, unsigned int *table_len);#define
SYSMGR_SOC64_WDDBG0x08
#defineSYSMGR_SOC64_DMA0x20[...]
Quoted 8 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +1
-0@@ -0,0 +1,73 @@ +// SPDX-License-Identifier: GPL-2.0 arch/arm/mach-socfpga/wrap_handoff_soc64.c line 11
Quoted 10 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +10
-0+/* +* Copyright (C) 2020 Intel Corporation <www.intel.com> +* +*/ + +#include <common.h> +#include <asm/arch/handoff_soc64.h> +#include <asm/io.h> +#include <errno.h> +#include "log.h" Sort this.
arch/arm/mach-socfpga/wrap_handoff_soc64.c line 29
Quoted 13 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +7
-0+ +int socfpga_get_handoff_size (void *handoff_address,enum endianness +endian) { +u32 handoff_size; + +if (endian == little_endian) { + handoff_size = (readl(handoff_address +
SOC64_HANDOFF_OFFSET_LENGTH) -arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +5
-0+ SOC64_HANDOFF_OFFSET_DATA) / +sizeof (u32); + }else if (endian == big_endian) { + handoff_size = swab32(readl(handoff_address + +Can merge this, just need do additional swab32 if it is bit endian.
[.....]
Quoted 33 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +2
-0+ +int socfpga_handoff_read(void *handoff_address, void *table, u32
table_len,arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +6
-0+ enum endianness big_endian) +{ +u32 temp, i; +u32 *table_x32 = table; + + debug("%s: handoff addr = 0x%p ", __func__, (u32*)handoff_address);
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +3
-0+ +if (big_endian) { + if (swab32(readl(SOC64_HANDOFF_BASE)) ==
SOC64_HANDOFF_MAGIC_BOOT) {arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +19
-0+debug ("Handoff table address = 0x%p " , table_x32); +debug ("table length = 0x%x\n" , table_len); +debug ("%s: handoff data =\n{\n" , __func__); + +for (i =0 ; i < table_len; i++) { + temp =readl (handoff_address + +SOC64_HANDOFF_OFFSET_DATA + + (i *sizeof (u32))); + *table_x32 =swab32 (temp); + +if (!(i %2 )) +debug (" No.%d Addr 0x%08x: " , i, + *table_x32); +else +debug (" 0x%08x\n" , *table_x32); + + table_x32++; + } +debug ("\n}\n" );
Quoted 9 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c line 70
Quoted 7 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +2
-0+ }else { + debug("%s: Cannot find
SOC64_HANDOFF_MAGIC_BOOT",__func__);arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +4
-0+debug ("at addr 0x%p\n" , (u32 *)handoff_address); +return -EPERM ; + } + }How about if it is little endian, why don't need to fill up
table_x32?
The little endian only needed in new Intel SOC N5X (Diamond Mesa) , we will upstream this part together with N5X patches later.
And, I will update the code per comment above in next review. Thanks.
Quoted 4 lines
Regards
Ley Foon
Tan
PATCH 5/5 arm: socfpga: Restructure Stratix10 and Agilex handoff code
Quoted 59 lines
-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Wednesday, March 24, 2021 11:02 AM
To: Tan, Ley Foon <[email protected]>; u-boot at lists.denx.de
Cc: Marek Vasut <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: RE: [v1 5/5] arm: socfpga: Restructure Stratix10 and Agilex handoff codeHi Ley Foon,
Quoted 33 lines
Quoted 33 lines
(quoted diff) +2
-0+ +int socfpga_handoff_read(void *handoff_address, void *table, u32
table_len,arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +6
-0+ enum endianness big_endian) +{ +u32 temp, i; +u32 *table_x32 = table; + + debug("%s: handoff addr = 0x%p ", __func__, (u32*)handoff_address);
arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +3
-0+ +if (big_endian) { + if (swab32(readl(SOC64_HANDOFF_BASE)) ==
SOC64_HANDOFF_MAGIC_BOOT) {arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +19
-0+debug ("Handoff table address = 0x%p " , table_x32); +debug ("table length = 0x%x\n" , table_len); +debug ("%s: handoff data =\n{\n" , __func__); + +for (i =0 ; i < table_len; i++) { + temp =readl (handoff_address + +SOC64_HANDOFF_OFFSET_DATA + + (i *sizeof (u32))); + *table_x32 =swab32 (temp); + +if (!(i %2 )) +debug (" No.%d Addr 0x%08x: " , i, + *table_x32); +else +debug (" 0x%08x\n" , *table_x32); + + table_x32++; + } +debug ("\n}\n" );Quoted 9 lines
arch/arm/mach-socfpga/wrap_handoff_soc64.c line 70
Quoted 7 lines
(quoted diff) +2
-0+ } else { + debug("%s: Cannot find
SOC64_HANDOFF_MAGIC_BOOT",__func__);arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +4
-0+debug ("at addr 0x%p\n" , (u32 *)handoff_address); +return -EPERM ; + } + }How about if it is little endian, why don't need to fill up
table_x32?
Quoted 2 lines
The little endian only needed in new Intel SOC N5X (Diamond Mesa) , we will upstream this part together with N5X patches later.
Then can return error if doesn't support little endian as now.