Skip to contentSkip to conversation

Restructure Stratix10 and Agilex handoff code

PATCH New Siew Chin Lim 2 participants 7 messages Mar 24, 2021 – Mar 26, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 cover Restructure Stratix10 and Agilex handoff code

This is the 2cd version of patchset to restructure Stratix10 and Agilex handoff code to be generic and to be used by all SOC64 devices.

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.

Patch status:
Have changes: Patch 5
Other patches unchanged.

Detail changelog can find in commit message.

v1->v2:
--------
Patch 5:
- Change "#ifdef" to "#if IS_ENABLED()"
- Change to use captial letter for enum macros (LITTLE_ENDIAN, BIG_ENDIAN)
- Soft include files by alphabetical order in system_manager_soc64.c and wrap_handoff_soc64.c
- Simplify and clean up socfpga_get_handoff_size function

History:
--------

[v1]: https://patchwork.ozlabs.org/project/uboot/cover/20210315094329.30282-1-elly.siew.chin.lim at intel.com/

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} | 55 +++++++++++-------
 arch/arm/mach-socfpga/wrap_handoff_soc64.c         | 66 ++++++++++++++++++++++
 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, 181 insertions(+), 135 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
#1 lore raw

PATCH v2 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
index 642dcbb0ac..e060e5754e 100644
@@ -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
deleted file mode 100644
index 3e9b606ce2..0000000000
@@ -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
new file mode 100644
index 0000000000..804715b13d
@@ -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
index 0b497ec30c..d10fb5e454 100644
@@ -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
index 049c5711a8..6a0d6b5ead 100644
@@ -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
index 1cfa190047..5afdb10454 100644
@@ -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
#2 lore raw

PATCH v2 2/5 arm: socfpga: Changed wrap_pll_config_s10.c to wrap_pll_config_soc64.c

In reply to Siew Chin Lim

Rename 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
index e4c2da93d5..eca6fd173f 100644
@@ -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
similarity index 100%
rename from arch/arm/mach-socfpga/wrap_pll_config_s10.c
rename to arch/arm/mach-socfpga/wrap_pll_config_soc64.c
Signature · 1 line
2.13.0
#3 lore raw

PATCH v2 3/5 arm: socfpga: Changed system_manager_s10.c to system_manager_soc64.c

In reply to Siew Chin Lim

Rename 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
index eca6fd173f..f9dd166ab3 100644
@@ -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
similarity index 100%
rename from arch/arm/mach-socfpga/system_manager_s10.c
rename to arch/arm/mach-socfpga/system_manager_soc64.c
Signature · 1 line
2.13.0
#4 lore raw

PATCH v2 4/5 arm: socfpga: Rearrange sequence of macros in handoff_soc64.h

In reply to Siew Chin Lim

Rearrange 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
index 804715b13d..2561255712 100644
@@ -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
#5 lore raw

PATCH v2 5/5 arm: socfpga: Restructure Stratix10 and Agilex handoff code

In reply to Siew Chin Lim

Restructure 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.

---
v2
- Change "#ifdef" to "#if IS_ENABLED()"
- Change to use captial letter for enum macros (LITTLE_ENDIAN, BIG_ENDIAN)
- Soft include files by alphabetical order in system_manager_soc64.c and wrap_handoff_soc64.c
- Simplify and clean up socfpga_get_handoff_size function

---
 arch/arm/mach-socfpga/Makefile                     |  4 +-
 arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 23 +++++++-
 .../include/mach/system_manager_soc64.h            |  4 --
 arch/arm/mach-socfpga/system_manager_soc64.c       | 55 +++++++++++-------
 arch/arm/mach-socfpga/wrap_handoff_soc64.c         | 66 ++++++++++++++++++++++
 arch/arm/mach-socfpga/wrap_pinmux_config_s10.c     | 56 ------------------
 6 files changed, 126 insertions(+), 82 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
index f9dd166ab3..5779c55621 100644
@@ -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 +22 -1
index 2561255712..3750216a9a 100644
@@ -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
@@ -30,7 +31,7 @@
 #define SOC64_HANDOFF_DELAY		(SOC64_HANDOFF_BASE + 0x3F0)
 #define SOC64_HANDOFF_CLOCK		(SOC64_HANDOFF_BASE + 0x580)
 
-#ifdef CONFIG_TARGET_SOCFPGA_STRATIX10
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_STRATIX10)
 #define SOC64_HANDOFF_CLOCK_OSC	(SOC64_HANDOFF_BASE + 0x608)
 #define SOC64_HANDOFF_CLOCK_FPGA	(SOC64_HANDOFF_BASE + 0x60C)
 #else
@@ -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
+#if IS_ENABLED(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 = 0,
+	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
index 4949cae97a..1eb8e7a904 100644
@@ -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 +36 -19

85 lines not on this page · raw message

arch/arm/mach-socfpga/wrap_handoff_soc64.c new file +66 -0

66 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
#6 lore raw

PATCH v2 5/5 arm: socfpga: Restructure Stratix10 and Agilex handoff code

Quoted 33 lines

-----Original Message-----
From: Lim, Elly Siew Chin <[email protected]>
Sent: Wednesday, March 24, 2021 1:12 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: [v2 5/5] arm: socfpga: Restructure Stratix10 and Agilex handoff code

Restructure 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.

---
v2
- Change "#ifdef" to "#if IS_ENABLED()"
- Change to use captial letter for enum macros (LITTLE_ENDIAN, BIG_ENDIAN)
- Soft include files by alphabetical order in system_manager_soc64.c and wrap_handoff_soc64.c
- Simplify and clean up socfpga_get_handoff_size function

Quoted 8 lines
---
 arch/arm/mach-socfpga/Makefile                     |  4 +-
 arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 23 +++++++-
 .../include/mach/system_manager_soc64.h            |  4 --
 arch/arm/mach-socfpga/system_manager_soc64.c       | 55 +++++++++++----
---
 arch/arm/mach-socfpga/wrap_handoff_soc64.c         | 66

++++++++++++++++++++++