Skip to contentSkip to conversation

SoCFPGA: Add Boot Support for Agilex 5 in U-Boot

PATCH In review [email protected] 3 participants 55 messages Sep 20, 2024 – Sep 27, 2024

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

cover SoCFPGA: Add Boot Support for Agilex 5 in U-Boot

From: Tien Fong Chee <[email protected]>

This patch set introduces boot support for the Altera SoCFPGA Agilex 5 platform in U-Boot. The changes include:
1. Board-specific configurations and setup required to enable Agilex 5 operation in U-Boot.
2. Integration of cache coherency unit (CCU) initialization routine, including CCU conguration in DT.
3. Clock, firewall (configured in DT), SMMU, low level initialization specific to Agilex 5.
4. Integration of memory initialization routine, including DDR setup.

This patch set has been tested on Agilex 5 devkit with QSPI boot (UBI/UBIFS) and RAM boot (TFTP & ARM DS debugger).

Alif Zakuan Yuslaimi (1):
configs: socfpga: soc64: agilex5: Enable QSPI boot with UBI / UBIFS

Tien Fong Chee (18):
arm: socfpga: agilex5: Add new system manager base addresses
arm: socfpga: Add support for agilex5 clock manager
linker: Add SPL linker script for SoC64 devices
arm: socfpga: agilex5: Add low level initialization
arm: socfpga: Add handoff data support for SoCFPGA Agilex5 device
arm: dts: agilex5: Add HPS cache coherency unit configuration settings
arm: dts: agilex5: Add firewall configure settings
arm: dts: agilex5: Enable XGMAC
sysreset: Add reset support to SoCFPGA Agilex5 device
arm: socfpga: agilex5: Enable cache flush for system memory cache in
CCU
arm: socfpga: agilex5: Add SMMU initialization
arm: socfpga: agilex5: Update CPU info
arm: socfpga: Export board ID as U-Boot environment variable
configs: agilex5: Add configuration for malloc pool
arm: socfpga: smc: Add memory coherency support to mailbox command
arm: socfpga: agilex5: Add SPL for Agilex5 SoCFPGA
configs: socfpga: soc64: agilex5: Enable XGMAC
arm: socfpga: soc64: Add support for board_boot_order()

Tingting Meng (1):
ddr: altera: Add DDR driver for Agilex5 series

 MAINTAINERS                                   |   2 +
 arch/arm/Kconfig                              |   1 +
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi      | 660 ++++++++++++++++++
 arch/arm/dts/socfpga_agilex5.dtsi             |   7 +
 .../arm/dts/socfpga_agilex5_socdk-u-boot.dtsi |  33 +
 arch/arm/mach-socfpga/Makefile                |   6 +
 arch/arm/mach-socfpga/ccu_ncore3.c            |  64 ++
 arch/arm/mach-socfpga/include/mach/firewall.h |  23 +-
 .../mach-socfpga/include/mach/handoff_soc64.h |   4 +-
 arch/arm/mach-socfpga/include/mach/misc.h     |   1 +
 .../include/mach/reset_manager_soc64.h        |  12 +-
 .../include/mach/system_manager_soc64.h       | 129 ++--
 arch/arm/mach-socfpga/lowlevel_init_agilex5.S |  57 ++
 arch/arm/mach-socfpga/misc.c                  |  24 +-
 arch/arm/mach-socfpga/misc_soc64.c            |  12 +-
 arch/arm/mach-socfpga/smc_api.c               |  13 +-
 arch/arm/mach-socfpga/spl_agilex5.c           |  84 +++
 arch/arm/mach-socfpga/spl_soc64.c             | 120 +++-
 arch/arm/mach-socfpga/u-boot-spl-soc64.lds    |  80 +++
 arch/arm/mach-socfpga/wrap_handoff_soc64.c    |  10 +-
 configs/socfpga_agilex5_defconfig             |   6 +
 drivers/ddr/altera/Makefile                   |   1 +
 drivers/ddr/altera/iossm_mailbox.c            | 613 ++++++++++++++++
 drivers/ddr/altera/iossm_mailbox.h            | 186 +++++
 drivers/ddr/altera/sdram_agilex5.c            | 377 ++++++++++
 drivers/ddr/altera/sdram_soc64.c              |  78 ++-
 drivers/ddr/altera/sdram_soc64.h              |  32 +-
 drivers/sysreset/Kconfig                      |   7 +
 drivers/sysreset/Makefile                     |   1 +
 drivers/sysreset/sysreset_socfpga_agilex5.c   |  47 ++
 include/configs/socfpga_soc64_common.h        |   5 +
 31 files changed, 2605 insertions(+), 90 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/ccu_ncore3.c
 create mode 100644 arch/arm/mach-socfpga/lowlevel_init_agilex5.S
 create mode 100644 arch/arm/mach-socfpga/spl_agilex5.c
 create mode 100644 arch/arm/mach-socfpga/u-boot-spl-soc64.lds
 create mode 100644 drivers/ddr/altera/iossm_mailbox.c
 create mode 100644 drivers/ddr/altera/iossm_mailbox.h
 create mode 100644 drivers/ddr/altera/sdram_agilex5.c
 create mode 100644 drivers/sysreset/sysreset_socfpga_agilex5.c
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/20 arm: socfpga: agilex5: Add new system manager base addresses

From: Tien Fong Chee <[email protected]>

Initial creation of new system manager base addresses for Agilex5.

---
 .../include/mach/system_manager_soc64.h       | 129 +++++++++++-------
 1 file changed, 83 insertions(+), 46 deletions(-)
arch/arm/mach-socfpga/include/mach/system_manager_soc64.h +83 -46
index a8009664fee..b1ef4a70641 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Copyright (C) 2019-2021 Intel Corporation <www.intel.com>
+ * Copyright (C) 2019-2024 Intel Corporation <www.intel.com>
  */
 
 #ifndef _SYSTEM_MANAGER_SOC64_H_
@@ -11,22 +11,43 @@ void sysmgr_pinmux_init(void);
 void populate_sysmgr_fpgaintf_module(void);
 void populate_sysmgr_pinmux(void);
 
-#define SYSMGR_SOC64_WDDBG			0x08
-#define SYSMGR_SOC64_DMA			0x20
-#define SYSMGR_SOC64_DMA_PERIPH			0x24
-#define SYSMGR_SOC64_SDMMC			0x28
-#define SYSMGR_SOC64_SDMMC_L3MASTER		0x2c
-#define SYSMGR_SOC64_EMAC_GLOBAL		0x40
-#define SYSMGR_SOC64_EMAC0			0x44
-#define SYSMGR_SOC64_EMAC1			0x48
-#define SYSMGR_SOC64_EMAC2			0x4c
-#define SYSMGR_SOC64_EMAC0_ACE			0x50
-#define SYSMGR_SOC64_EMAC1_ACE			0x54
-#define SYSMGR_SOC64_EMAC2_ACE			0x58
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
+#define SYSMGR_SOC64_SILICONID_1		0x00
+#define SYSMGR_SOC64_SILICONID_2		0x04
+#define SYSMGR_SOC64_MPU_STATUS			0x10
+#define SYSMGR_SOC64_COMBOPHY_DFISEL		0xfc
+#define SYSMGR_SOC64_COMBOPHY_DFISEL_SDMMC	0x1
+#define SYSMGR_SOC64_NANDGRP_L3MASTER		0x34
+#define SYSMGR_SOC64_USB0_L3MASTER		0x38
+#define SYSMGR_SOC64_USB1_L3MASTER		0x3c
+#define SYSMGR_SOC64_DMAC0_L3_MASTER		0x74
+#define SYSMGR_SOC64_ETR_L3_MASTER		0x78
+#define SYSMGR_SOC64_DMAC1_L3_MASTER		0x7C
+#define SYSMGR_SOC64_SEC_CTRL_SLT		0x80
+#define SYSMGR_SOC64_OSC_TRIM			0x84
+#define SYSMGR_SOC64_DMAC0_CTRL_STATUS_REG	0x88
+#define SYSMGR_SOC64_DMAC1_CTRL_STATUS_REG	0x8C
+#define SYSMGR_SOC64_ECC_INTMASK_VALUE		0x90
+#define SYSMGR_SOC64_ECC_INTMASK_SET		0x94
+#define SYSMGR_SOC64_ECC_INTMASK_CLR		0x98
+#define SYSMGR_SOC64_ECC_INTMASK_SERR		0x9C
+#define SYSMGR_SOC64_ECC_INTMASK_DERR		0xA0
+#define SYSMGR_SOC64_MPFE_CONFIG		0x228
+#define SYSMGR_SOC64_BOOT_SCRATCH_POR0		0x258
+#define SYSMGR_SOC64_BOOT_SCRATCH_POR1		0x25C
+#define SYSMGR_SCRATCH_REG_0_QSPI_REFCLK_MASK		GENMASK(31, 0)
+#define ALT_SYSMGR_SCRATCH_REG_3_DDR_RESET_TYPE_MASK	GENMASK(31, 29)
+#define ALT_SYSMGR_SCRATCH_REG_3_DDR_RESET_TYPE_SHIFT	29
+#define ALT_SYSMGR_SCRATCH_REG_3_DDR_PORT_INFO_MASK	BIT(27)
+#define ALT_SYSMGR_SCRATCH_REG_3_DDR_EMIF_INFO_MASK	BIT(28)
+#define ALT_SYSMGR_SCRATCH_REG_3_DDR_PORT_EMIF_INFO_MASK	GENMASK(28, 27)
+#define ALT_SYSMGR_SCRATCH_REG_3_DDR_DBE_MASK	BIT(1)
+#define ALT_SYSMGR_SCRATCH_REG_3_OCRAM_DBE_MASK	BIT(0)
+#define ALT_SYSMGR_SCRATCH_REG_POR_0_DDR_PROGRESS_MASK	BIT(0)
+#define ALT_SYSMGR_SCRATCH_REG_POR_1_REVA_WORKAROUND_USER_MODE_MASK	BIT(0)
+#define ALT_SYSMGR_SCRATCH_REG_POR_1_REVA_WORKAROUND_MASK	BIT(1)
+#else
 #define SYSMGR_SOC64_NAND_AXUSER		0x5c
-#define SYSMGR_SOC64_FPGAINTF_EN1		0x68
-#define SYSMGR_SOC64_FPGAINTF_EN2		0x6c
-#define SYSMGR_SOC64_FPGAINTF_EN3		0x70
 #define SYSMGR_SOC64_DMA_L3MASTER		0x74
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
 #define SYSMGR_SOC64_DDR_MODE			0xb8
@@ -34,39 +55,56 @@ void populate_sysmgr_pinmux(void);
 #define SYSMGR_SOC64_HMC_CLK			0xb4
 #define SYSMGR_SOC64_IO_PA_CTRL			0xb8
 #endif
-#define SYSMGR_SOC64_NOC_TIMEOUT		0xc0
-#define SYSMGR_SOC64_NOC_IDLEREQ_SET		0xc4
-#define SYSMGR_SOC64_NOC_IDLEREQ_CLR		0xc8
-#define SYSMGR_SOC64_NOC_IDLEREQ_VAL		0xcc
-#define SYSMGR_SOC64_NOC_IDLEACK		0xd0
-#define SYSMGR_SOC64_NOC_IDLESTATUS		0xd4
-#define SYSMGR_SOC64_FPGA2SOC_CTRL		0xd8
-#define SYSMGR_SOC64_FPGA_CONFIG		0xdc
 #define SYSMGR_SOC64_IOCSRCLK_GATE		0xe0
 #define SYSMGR_SOC64_GPO			0xe4
 #define SYSMGR_SOC64_GPI			0xe8
 #define SYSMGR_SOC64_MPU			0xf0
-/*
- * Bits[31:28] reserved for N5X DDR retention, bits[27:0] reserved for SOC 64-bit
- * storing qspi ref clock (kHz)
- */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD0		0x200
-/* store osc1 clock freq */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD1		0x204
-/* store fpga clock freq */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD2		0x208
-/* reserved for customer use */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD3		0x20c
-/* store PSCI_CPU_ON value */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD4		0x210
-/* store PSCI_CPU_ON value */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD5		0x214
-/* store VBAR_EL3 value */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD6		0x218
-/* store VBAR_EL3 value */
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD7		0x21c
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD8		0x220
-#define SYSMGR_SOC64_BOOT_SCRATCH_COLD9		0x224
+#define SYSMGR_SCRATCH_REG_0_QSPI_REFCLK_MASK	GENMASK(27, 0)
+#endif /*CONFIG_TARGET_SOCFPGA_AGILEX5*/
+
+#define SYSMGR_SOC64_DMA			0x20
+#define SYSMGR_SOC64_DMA_PERIPH			0x24
+#define SYSMGR_SOC64_WDDBG			0x08
+#define SYSMGR_SOC64_SDMMC			0x28
+#define SYSMGR_SOC64_SDMMC_L3MASTER		0x2C
+#define SYSMGR_SOC64_FPGAINTF_EN1		0x68
+#define SYSMGR_SOC64_FPGAINTF_EN2		0x6C
+#define SYSMGR_SOC64_FPGAINTF_EN3		0x70
+#define SYSMGR_SOC64_NOC_TIMEOUT		0xC0
+#define SYSMGR_SOC64_NOC_IDLEREQ_SET		0xC4
+#define SYSMGR_SOC64_NOC_IDLEREQ_CLR		0xC8
+#define SYSMGR_SOC64_NOC_IDLEREQ_VAL		0xCC
+#define SYSMGR_SOC64_NOC_IDLEACK		0xd0
+#define SYSMGR_SOC64_NOC_IDLESTATUS		0xD4
+#define SYSMGR_SOC64_FPGA2SOC_CTRL		0xD8
+#define SYSMGR_SOC64_FPGA_CONFIG		0xDC
+
+#define SYSMGR_SOC64_TSN_GLOBAL			0x40
+#define SYSMGR_SOC64_TSN_0			0x44
+#define SYSMGR_SOC64_TSN_1			0x48
+#define SYSMGR_SOC64_TSN_2			0x4C
+#define SYSMGR_SOC64_TSN_0_ACE			0x50
+#define SYSMGR_SOC64_TSN_1_ACE			0x54
+#define SYSMGR_SOC64_TSN_2_ACE			0x58
+#define SYSMGR_SOC64_EMAC_GLOBAL	SYSMGR_SOC64_TSN_GLOBAL
+#define SYSMGR_SOC64_EMAC0		SYSMGR_SOC64_TSN_0
+#define SYSMGR_SOC64_EMAC1		SYSMGR_SOC64_TSN_1
+#define SYSMGR_SOC64_EMAC2		SYSMGR_SOC64_TSN_2
+#define SYSMGR_SOC64_EMAC0_ACE		SYSMGR_SOC64_TSN_0_ACE
+#define SYSMGR_SOC64_EMAC1_ACE		SYSMGR_SOC64_TSN_1_ACE
+#define SYSMGR_SOC64_EMAC2_ACE		SYSMGR_SOC64_TSN_2_ACE
+
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD0	0x200
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD1	0x204
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD2	0x208
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD3	0x20C
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD4	0x210
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD5	0x214
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD6	0x218
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD7	0x21C
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD8	0x220
+#define SYSMGR_SOC64_BOOT_SCRATCH_COLD9	0x224
+
 #define SYSMGR_SOC64_PINSEL0			0x1000
 #define SYSMGR_SOC64_IOCTRL0			0x1130
 #define SYSMGR_SOC64_EMAC0_USEFPGA		0x1300
@@ -97,7 +135,6 @@ void populate_sysmgr_pinmux(void);
  * Bits[31:28] reserved for DM DDR retention, bits[27:0] reserved for SOC 64-bit
  * storing qspi ref clock (kHz)
  */
-#define SYSMGR_SCRATCH_REG_0_QSPI_REFCLK_MASK		GENMASK(27, 0)
 #define ALT_SYSMGR_SCRATCH_REG_0_DDR_RETENTION_MASK	BIT(31)
 #define ALT_SYSMGR_SCRATCH_REG_0_DDR_SHA_MASK		BIT(30)
 #define ALT_SYSMGR_SCRATCH_REG_0_DDR_RESET_TYPE_MASK	(BIT(29) | BIT(28))
Signature · 1 line
2.25.1
#2 lore raw

Re: [PATCH v1 01/20] arm: socfpga: agilex5: Add new system manager base addresses

Quoted 3 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Initial creation of new system manager base addresses for Agilex5.

How much of this can be converted to DT probing ?

#3 lore raw

RE: [PATCH v1 01/20] arm: socfpga: agilex5: Add new system manager base addresses

Hi,

Quoted 11 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:47 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 01/20] arm: socfpga: agilex5: Add new system manager base addresses

Quoted 5 lines
Quoted 3 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Initial creation of new system manager base addresses for Agilex5.

How much of this can be converted to DT probing ?

Yes, we have dedicated resource is working to convert this to DT in conjunction with syscon support to provide System-wide configuration.

I can pull in this for Agilex5 first if you want to see it here or separate submission on the changes since it impacts all devices, more tests are needed to cover all devices.

Let me know your preference.

Thanks.

Regards,
Tien Fong.

#4 lore raw

Re: [PATCH v1 01/20] arm: socfpga: agilex5: Add new system manager base addresses

On 9/24/24 6:45 AM, Chee, Tien Fong wrote:

Hi,

Quoted 10 lines
Quoted 2 lines
Quoted 1 line

Initial creation of new system manager base addresses for Agilex5.

How much of this can be converted to DT probing ?

Yes, we have dedicated resource is working to convert this to DT in conjunction with syscon support to provide System-wide configuration.

I can pull in this for Agilex5 first if you want to see it here or separate submission on the changes since it impacts all devices, more tests are needed to cover all devices.

Let me know your preference.

Either option is fine as long as this is moving toward DT probing, thanks .

#5 lore raw

PATCH 2/20 arm: socfpga: Add support for agilex5 clock manager

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Adding mechanism to retrieve base address for Agilex5 Clock Mananger.

---
 arch/arm/mach-socfpga/misc.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
arch/arm/mach-socfpga/misc.c +14 -10
index 495ba2a0d41..6cf2ee60038 100644
@@ -1,6 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- *  Copyright (C) 2012-2017 Altera Corporation <www.altera.com>
+ *  Copyright (C) 2012-2024 Altera Corporation <www.altera.com>
  */
 
 #include <config.h>
@@ -252,15 +252,19 @@ void socfpga_get_managers_addr(void)
 	if (ret)
 		hang();
 
-#ifdef CONFIG_TARGET_SOCFPGA_AGILEX
-	ret = socfpga_get_base_addr("intel,agilex-clkmgr",
-				    &socfpga_clkmgr_base);
-#elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
-	ret = socfpga_get_base_addr("intel,n5x-clkmgr",
-				    &socfpga_clkmgr_base);
-#else
-	ret = socfpga_get_base_addr("altr,clk-mgr", &socfpga_clkmgr_base);
-#endif
+	if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX))
+		ret = socfpga_get_base_addr("intel,agilex-clkmgr",
+					    &socfpga_clkmgr_base);
+	else if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X))
+		ret = socfpga_get_base_addr("intel,n5x-clkmgr",
+					    &socfpga_clkmgr_base);
+	else if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5))
+		ret = socfpga_get_base_addr("intel,agilex5-clkmgr",
+					    &socfpga_clkmgr_base);
+	else
+		ret = socfpga_get_base_addr("altr,clk-mgr",
+					    &socfpga_clkmgr_base);
+
 	if (ret)
 		hang();
 }
Signature · 1 line
2.25.1
#7 lore raw

RE: [PATCH v1 02/20] arm: socfpga: Add support for agilex5 clock manager

Hi,

Quoted 11 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:48 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 02/20] arm: socfpga: Add support for agilex5 clock manager

Quoted 7 lines
Quoted 5 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Adding mechanism to retrieve base address for Agilex5 Clock Mananger.

Can this be turned into clock driver and probe from DT ?

I will remove this patch, because I just noticed the clk driver for Agilex 5 is already in driver model (DT).

Regards,
Tien Fong.

#8 lore raw

PATCH 3/20 linker: Add SPL linker script for SoC64 devices

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Add a new .data section for preserving the original state of the .data section of SoC64 SPL. This new .data section is required to make SPL reentrant after warm reset.

---
 arch/arm/mach-socfpga/u-boot-spl-soc64.lds | 80 ++++++++++++++++++++++
 1 file changed, 80 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/u-boot-spl-soc64.lds
arch/arm/mach-socfpga/u-boot-spl-soc64.lds new file +80 -0
new file mode 100644
index 00000000000..91cf8dd3139
@@ -0,0 +1,80 @@
+/*
+ * (C) Copyright 2013
+ * David Feng <[email protected]>
+ *
+ * (C) Copyright 2002
+ * Gary Jennejohn, DENX Software Engineering, <[email protected]>
+ *
+ * (C) Copyright 2010
+ * Texas Instruments, <www.ti.com>
+ *	Aneesh V <[email protected]>
+ *
+ * Copyright (C) 2024 Intel Corporation <www.intel.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+MEMORY { .sram : ORIGIN = CONFIG_SPL_TEXT_BASE,
+		LENGTH = CONFIG_SPL_MAX_SIZE }
+MEMORY { .sdram : ORIGIN = CONFIG_SPL_BSS_START_ADDR,
+		LENGTH = CONFIG_SPL_BSS_MAX_SIZE }
+
+OUTPUT_FORMAT("elf64-littleaarch64", "elf64-littleaarch64", "elf64-littleaarch64")
+OUTPUT_ARCH(aarch64)
+ENTRY(_start)
+SECTIONS
+{
+	__image_copy_start = ADDR(.text);
+	.text : {
+		. = ALIGN(8);
+		CPUDIR/start.o (.text*)
+		*(.text*)
+	} >.sram
+
+	.rodata : {
+		. = ALIGN(8);
+		*(SORT_BY_ALIGNMENT(SORT_BY_NAME(.rodata*)))
+	} >.sram
+
+	.data : {
+		. = ALIGN(8);
+		/* Run time .data section starting at this location */
+		__data_start = .;
+		*(.data*)
+		/* Run time .data section ending at this location */
+		__data_end = .;
+	} >.sram
+
+	. = ALIGN(8);
+	/* Preserve original .data section starting at this location */
+	__preserve_data_start = .;
+	. = __preserve_data_start + (__data_end - __data_start);
+	/* Preserve original .data section ending at this location */
+	__preserve_data_end = .;
+
+	. = ALIGN(8);
+	__u_boot_list . : {
+		KEEP(*(SORT(__u_boot_list*)));
+	} >.sram
+
+	. = ALIGN(8);
+	__image_copy_end = .;
+
+	_end = .;
+
+	_image_binary_end = .;
+
+	.bss : {
+		__bss_start = .;
+		*(.bss*)
+		. = ALIGN(8);
+		__bss_end = .;
+	} >.sdram
+
+	/DISCARD/ : { *(.dynsym) }
+	/DISCARD/ : { *(.dynstr*) }
+	/DISCARD/ : { *(.dynamic*) }
+	/DISCARD/ : { *(.plt*) }
+	/DISCARD/ : { *(.interp*) }
+	/DISCARD/ : { *(.gnu*) }
+}
Signature · 1 line
2.25.1
#9 lore raw

Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

Quoted 5 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Add a new .data section for preserving the original state of the .data section of SoC64 SPL. This new .data section is required to make SPL reentrant after warm reset.

Where is the linker script copied from ? What is the original file name and path ?

#10 lore raw

RE: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

Hi,

Quoted 10 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:49 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

Quoted 8 lines
Quoted 5 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Add a new .data section for preserving the original state of the .data section of SoC64 SPL. This new .data section is required to make SPL reentrant after warm reset.

Where is the linker script copied from ? What is the original file name and path ?

I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .

Regards,
Tien Fong.

#11 lore raw

Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

On 9/24/24 7:48 AM, Chee, Tien Fong wrote:

Hi,

Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Add a new .data section for preserving the original state of the .data section of SoC64 SPL. This new .data section is required to make SPL reentrant after warm reset.

Where is the linker script copied from ? What is the original file name and path ?

I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .

Can arch/arm/cpu/armv8/u-boot-spl.lds be extended somehow instead , or are there too many differences ?

#12 lore raw

RE: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

Hi,

Quoted 17 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, September 25, 2024 2:36 AM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

On 9/24/24 7:48 AM, Chee, Tien Fong wrote:

Hi,

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Add a new .data section for preserving the original state of the .data section of SoC64 SPL. This new .data section is required to make SPL reentrant after warm reset.

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

Where is the linker script copied from ? What is the original file name and path ?

I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .

Can arch/arm/cpu/armv8/u-boot-spl.lds be extended somehow instead , or are there too many differences ?

We think can use arch/arm/cpu/armv8/u-boot-spl.lds, because we just noticed the CONFIG_SPL_RECOVER_DATA_SECTION was added into lds and this should be the same design with current patch.

Thanks.

Best regards,
Tien Fong

#13 lore raw

Re: [PATCH v1 03/20] linker: Add SPL linker script for SoC64 devices

On 9/25/24 8:06 AM, Chee, Tien Fong wrote:

Hi,

Quoted 11 lines
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines

Add a new .data section for preserving the original state of the .data section of SoC64 SPL. This new .data section is required to make SPL reentrant after warm reset.

Where is the linker script copied from ? What is the original file name and path ?

I think the script is copied from arch/arm/cpu/armv8/u-boot-spl.lds .

Can arch/arm/cpu/armv8/u-boot-spl.lds be extended somehow instead , or are there too many differences ?

We think can use arch/arm/cpu/armv8/u-boot-spl.lds, because we just noticed the CONFIG_SPL_RECOVER_DATA_SECTION was added into lds and this should be the same design with current patch.

Excellent !

#14 lore raw

PATCH 4/20 arm: socfpga: agilex5: Add low level initialization

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Create new low level initialization for Agile5 due to the new ARM core composition and warm reset behavior.

---
 arch/arm/mach-socfpga/Makefile                |  1 +
 .../include/mach/reset_manager_soc64.h        | 12 +++-
 arch/arm/mach-socfpga/lowlevel_init_agilex5.S | 57 +++++++++++++++++++
 3 files changed, 68 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/lowlevel_init_agilex5.S
arch/arm/mach-socfpga/Makefile +1 -0
index 67c6a8dfec5..53c91d1d2a5 100644
@@ -58,6 +58,7 @@ endif
 
 ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
 obj-y	+= clock_manager_agilex5.o
+obj-y	+= lowlevel_init_agilex5.o
 obj-y	+= mailbox_s10.o
 obj-y	+= misc_soc64.o
 obj-y	+= mmu-arm64_s10.o
arch/arm/mach-socfpga/include/mach/reset_manager_soc64.h +10 -2
index c8bb727aa2b..d373ec0dc70 100644
@@ -1,15 +1,17 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- *  Copyright (C) 2016-2019 Intel Corporation <www.intel.com>
+ *  Copyright (C) 2016-2024 Intel Corporation <www.intel.com>
  */
 
 #ifndef _RESET_MANAGER_SOC64_H_
 #define _RESET_MANAGER_SOC64_H_
 
+#ifndef __ASSEMBLY__
 void reset_deassert_peripherals_handoff(void);
 int cpu_has_been_warmreset(void);
 void print_reset_info(void);
 void socfpga_bridges_reset(int enable);
+#endif
 
 #define RSTMGR_SOC64_STATUS	0x00
 #define RSTMGR_SOC64_MPUMODRST	0x20
@@ -23,14 +25,20 @@ void socfpga_bridges_reset(int enable);
 #define RSTMGR_BRGMODRST_FPGA2SOC_MASK	0x00000004
 
 /* SDM, Watchdogs and MPU warm reset mask */
-#define RSTMGR_STAT_SDMWARMRST		BIT(1)
+#define RSTMGR_STAT_SDMWARMRST		0x2
 #define RSTMGR_STAT_MPU0RST_BITPOS	8
 #define RSTMGR_STAT_L4WD0RST_BITPOS	16
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
+#define RSTMGR_STAT_L4WD0RST_BIT	0x1F0000
+#define RSTMGR_L4WD_MPU_WARMRESET_MASK	(RSTMGR_STAT_SDMWARMRST | \
+		RSTMGR_STAT_L4WD0RST_BIT)
+#else
 #define RSTMGR_L4WD_MPU_WARMRESET_MASK	(RSTMGR_STAT_SDMWARMRST | \
 		GENMASK(RSTMGR_STAT_MPU0RST_BITPOS + 3, \
 			RSTMGR_STAT_MPU0RST_BITPOS) | \
 		GENMASK(RSTMGR_STAT_L4WD0RST_BITPOS + 3, \
 			RSTMGR_STAT_L4WD0RST_BITPOS))
+#endif
 
 /*
  * SocFPGA Stratix10 reset IDs, bank mapping is as follows:
arch/arm/mach-socfpga/lowlevel_init_agilex5.S new file +57 -0

57 lines not on this page · raw message

Signature · 1 line
2.25.1
#15 lore raw

Re: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Quoted 18 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Create new low level initialization for Agile5 due to the new ARM core composition and warm reset behavior.

---
  arch/arm/mach-socfpga/Makefile                |  1 +
  .../include/mach/reset_manager_soc64.h        | 12 +++-
  arch/arm/mach-socfpga/lowlevel_init_agilex5.S | 57 +++++++++++++++++++
  3 files changed, 68 insertions(+), 2 deletions(-)

create mode 100644 arch/arm/mach-socfpga/lowlevel_init_agilex5.S

arch/arm/mach-socfpga/Makefile +0 -0
index 67c6a8dfec5..53c91d1d2a5 100644

arch/arm/mach-socfpga/Makefile endif · line 64

Quoted 7 lines
arch/arm/mach-socfpga/Makefile +1 -0
@@ -58,6 +58,7 @@ endif
 
  ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
  obj-y	+= clock_manager_agilex5.o
+obj-y	+= lowlevel_init_agilex5.o
  obj-y	+= mailbox_s10.o
  obj-y	+= misc_soc64.o
  obj-y	+= mmu-arm64_s10.o

Can this be wired into existing early hook function, like s_init or so ?

#16 lore raw

RE: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Hi,

Quoted 33 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:49 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Quoted 10 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Create new low level initialization for Agile5 due to the new ARM core composition and warm reset behavior.

---
  arch/arm/mach-socfpga/Makefile                |  1 +
  .../include/mach/reset_manager_soc64.h        | 12 +++-
  arch/arm/mach-socfpga/lowlevel_init_agilex5.S | 57

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

Quoted 5 lines
  3 files changed, 68 insertions(+), 2 deletions(-)

create mode 100644 arch/arm/mach-socfpga/lowlevel_init_agilex5.S

(quoted diff) +0 -0

b/arch/arm/mach-socfpga/Makefile index 67c6a8dfec5..53c91d1d2a5

100644

Quoted 4 lines
arch/arm/mach-socfpga/Makefile +0 -0
@@ -58,6 +58,7 @@ endif
 
Quoted 7 lines

arch/arm/mach-socfpga/Makefile endif · line 64

Quoted 6 lines
arch/arm/mach-socfpga/Makefile +1 -0
  ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
  obj-y	+= clock_manager_agilex5.o
+obj-y	+= lowlevel_init_agilex5.o
  obj-y	+= mailbox_s10.o
  obj-y	+= misc_soc64.o
  obj-y	+= mmu-arm64_s10.o

Can this be wired into existing early hook function, like s_init or so ?

I cannot find the caller for s_init, wonder where is the s_init is called?
What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

Regards,
Tien Fong.

#17 lore raw

Re: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

On 9/24/24 5:14 AM, Chee, Tien Fong wrote:

Hi,

Quoted 15 lines
Quoted 7 lines
Quoted 2 lines
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/Makefile index 67c6a8dfec5..53c91d1d2a5

100644

Quoted 4 lines
arch/arm/mach-socfpga/Makefile +0 -0
@@ -58,6 +58,7 @@ endif
 
Quoted 7 lines

arch/arm/mach-socfpga/Makefile endif · line 64

Quoted 6 lines
arch/arm/mach-socfpga/Makefile +1 -0
   ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
   obj-y	+= clock_manager_agilex5.o
+obj-y	+= lowlevel_init_agilex5.o
   obj-y	+= mailbox_s10.o
   obj-y	+= misc_soc64.o
   obj-y	+= mmu-arm64_s10.o

Can this be wired into existing early hook function, like s_init or so ?

Quoted 1 line

I cannot find the caller for s_init, wonder where is the s_init is called?

arch/arm/cpu/armv7/lowlevel_init.S:.pushsection .text.s_init, "ax" arch/arm/cpu/armv7/lowlevel_init.S:WEAK(s_init) arch/arm/cpu/armv7/lowlevel_init.S:ENDPROC(s_init)
arch/arm/cpu/armv7/lowlevel_init.S: bl s_init

Maybe such a default lowlevel_init for armv8 could also have an s_init ?

Quoted 1 line

What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

I would like to avoid duplicating lowlevel_init functionality as much as possible , common lowlevel_init would be very welcome .

#18 lore raw

RE: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Hi,

Quoted 37 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, September 25, 2024 2:32 AM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

On 9/24/24 5:14 AM, Chee, Tien Fong wrote:

Hi,

Quoted 15 lines
Quoted 7 lines
Quoted 2 lines
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/Makefile index 67c6a8dfec5..53c91d1d2a5

100644

Quoted 4 lines
arch/arm/mach-socfpga/Makefile +0 -0
@@ -58,6 +58,7 @@ endif
 
Quoted 7 lines

arch/arm/mach-socfpga/Makefile endif · line 64

Quoted 6 lines
arch/arm/mach-socfpga/Makefile +1 -0
   ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
   obj-y	+= clock_manager_agilex5.o
+obj-y	+= lowlevel_init_agilex5.o
   obj-y	+= mailbox_s10.o
   obj-y	+= misc_soc64.o
   obj-y	+= mmu-arm64_s10.o

Can this be wired into existing early hook function, like s_init or so ?

Quoted 1 line

I cannot find the caller for s_init, wonder where is the s_init is called?

arch/arm/cpu/armv7/lowlevel_init.S:.pushsection .text.s_init, "ax" arch/arm/cpu/armv7/lowlevel_init.S:WEAK(s_init) arch/arm/cpu/armv7/lowlevel_init.S:ENDPROC(s_init)
arch/arm/cpu/armv7/lowlevel_init.S: bl s_init

Quoted 6 lines

Maybe such a default lowlevel_init for armv8 could also have an s_init ?

Quoted 2 lines

What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

I would like to avoid duplicating lowlevel_init functionality as much as possible , common lowlevel_init would be very welcome .

Sure, I can add the s_init to common lowlevel_init and moving the codes to s_init.

Thanks.

Regards,
Tien Fong

#19 lore raw

Re: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

On 9/25/24 7:40 AM, Chee, Tien Fong wrote:

Hi,

Quoted 5 lines
Quoted 5 lines

arch/arm/cpu/armv7/lowlevel_init.S:.pushsection .text.s_init, "ax" arch/arm/cpu/armv7/lowlevel_init.S:WEAK(s_init) arch/arm/cpu/armv7/lowlevel_init.S:ENDPROC(s_init)
arch/arm/cpu/armv7/lowlevel_init.S: bl s_init

Quoted 8 lines
Quoted 6 lines

Maybe such a default lowlevel_init for armv8 could also have an s_init ?

Quoted 2 lines

What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

I would like to avoid duplicating lowlevel_init functionality as much as possible , common lowlevel_init would be very welcome .

Sure, I can add the s_init to common lowlevel_init and moving the codes to s_init.

Thanks. Then the question is, how much of this stuff can be removed because it is part of generic lowlevel_init, I hope a lot.

#20 lore raw

RE: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Hi,

Quoted 9 lines
Quoted 9 lines
Quoted 9 lines

arch/arm/cpu/armv7/lowlevel_init.S:.pushsection .text.s_init, "ax" arch/arm/cpu/armv7/lowlevel_init.S:WEAK(s_init) arch/arm/cpu/armv7/lowlevel_init.S:ENDPROC(s_init)
arch/arm/cpu/armv7/lowlevel_init.S: bl s_init

Maybe such a default lowlevel_init for armv8 could also have an s_init ?

Quoted 2 lines

What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I would like to avoid duplicating lowlevel_init functionality as much as possible , common lowlevel_init would be very welcome .

Sure, I can add the s_init to common lowlevel_init and moving the codes to

s_init.
Thanks. Then the question is, how much of this stuff can be removed because it is part of generic lowlevel_init, I hope a lot.

I'm not sure I completely understand your question, but I can share what we're going to do. Declaring a weak s_init function at lowlevel_init.S

.pushsection .text.s_init, "ax"
WEAK(s_init)
bx lr
ENDPROC(s_init)
.popsection

Calling s_init before lowlevel_init returned to parent call
[...]
bl s_init
move lr, x29
ret

We will move the codes to s_init which is declared in our platform driver, arch/arm/mach-socfpga .

The codes is needed to backup the data section as earlier as possible to support warm reset / watchdog due to warm reset use case, where reloading SPL would be skipped after reset.

Thanks.

Regards,
Tien Fong

#21 lore raw

Re: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Quoted 1 line · Tien Fong

Hi,

Hi,

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 11 lines

arch/arm/cpu/armv7/lowlevel_init.S:.pushsection .text.s_init, "ax" arch/arm/cpu/armv7/lowlevel_init.S:WEAK(s_init) arch/arm/cpu/armv7/lowlevel_init.S:ENDPROC(s_init)
arch/arm/cpu/armv7/lowlevel_init.S: bl s_init

Maybe such a default lowlevel_init for armv8 could also have an s_init ?

Quoted 2 lines

What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

I would like to avoid duplicating lowlevel_init functionality as much as possible , common lowlevel_init would be very welcome .

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

Sure, I can add the s_init to common lowlevel_init and moving the codes to

s_init.
Thanks. Then the question is, how much of this stuff can be removed because it is part of generic lowlevel_init, I hope a lot.

I'm not sure I completely understand your question, but I can share what we're going to do.

I am wondering if some of the code here can be deduplicated by using the generic lowlevel_init.S , i.e. if some of the code in lowlevel_init.S is duplicate of the code in this custom lowlevel_init.S implementation.

Quoted 14 lines

Declaring a weak s_init function at lowlevel_init.S

.pushsection .text.s_init, "ax"
WEAK(s_init)
bx lr
ENDPROC(s_init)
.popsection

Calling s_init before lowlevel_init returned to parent call
[...]
bl s_init
move lr, x29
ret

Quoted 4 lines

We will move the codes to s_init which is declared in our platform driver, arch/arm/mach-socfpga .

The codes is needed to backup the data section as earlier as possible to support warm reset / watchdog due to warm reset use case, where reloading SPL would be skipped after reset.

If you need to run code very early and back up critical data, look at save_boot_params .

#22 lore raw

RE: [PATCH v1 04/20] arm: socfpga: agilex5: Add low level initialization

Hi,

Quoted 18 lines
Quoted 18 lines
Quoted 17 lines
Quoted 7 lines
Quoted 7 lines

arch/arm/cpu/armv7/lowlevel_init.S:.pushsection .text.s_init, "ax" arch/arm/cpu/armv7/lowlevel_init.S:WEAK(s_init) arch/arm/cpu/armv7/lowlevel_init.S:ENDPROC(s_init)
arch/arm/cpu/armv7/lowlevel_init.S: bl s_init

Maybe such a default lowlevel_init for armv8 could also have an s_init ?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

What's concern with lowlevel_init()? It's also wired into existing early hook function which's located inside start.S

I would like to avoid duplicating lowlevel_init functionality as much as possible , common lowlevel_init would be very welcome .

Sure, I can add the s_init to common lowlevel_init and moving the codes to

s_init.
Thanks. Then the question is, how much of this stuff can be removed because it is part of generic lowlevel_init, I hope a lot.

Quoted 6 lines
Quoted 1 line

I'm not sure I completely understand your question, but I can share what

we're going to do.

I am wondering if some of the code here can be deduplicated by using the generic lowlevel_init.S , i.e. if some of the code in lowlevel_init.S is duplicate of the code in this custom lowlevel_init.S implementation.

No duplicate codes in both common lowlevel_init.S and custom lowlevel_init.S.

Quoted 15 lines
Quoted 15 lines

Declaring a weak s_init function at lowlevel_init.S

.pushsection .text.s_init, "ax"
WEAK(s_init)
bx lr
ENDPROC(s_init)
.popsection

Calling s_init before lowlevel_init returned to parent call
[...]
bl s_init
move lr, x29
ret

Quoted 8 lines
Quoted 1 line

We will move the codes to s_init which is declared in our platform driver,

arch/arm/mach-socfpga .

Quoted 3 lines

The codes is needed to backup the data section as earlier as possible to support warm reset / watchdog due to warm reset use case, where

reloading SPL would be skipped after reset.
If you need to run code very early and back up critical data, look at save_boot_params .

Thanks for suggesting this, we will try this out.

Regards,
Tien Fong

#23 lore raw

PATCH 5/20 arm: socfpga: Add handoff data support for SoCFPGA Agilex5 device

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Agilex5 supports both HPS handoff data and DDR handoff data. Existing HPS handoff functions are restructured to support both existing devices and Agilex5 device.

---
 arch/arm/mach-socfpga/Makefile                     |  1 +
 arch/arm/mach-socfpga/include/mach/handoff_soc64.h |  4 ++--
 arch/arm/mach-socfpga/wrap_handoff_soc64.c         | 10 ++++++++--
 3 files changed, 11 insertions(+), 4 deletions(-)
arch/arm/mach-socfpga/Makefile +1 -0
index 53c91d1d2a5..e0ada69dd5a 100644
@@ -63,6 +63,7 @@ obj-y	+= mailbox_s10.o
 obj-y	+= misc_soc64.o
 obj-y	+= mmu-arm64_s10.o
 obj-y	+= reset_manager_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 +2 -2
index d839f288411..918d25a1b61 100644
@@ -17,9 +17,9 @@
 #define SOC64_HANDOFF_MAGIC_FPGA	0x46504741
 #define SOC64_HANDOFF_MAGIC_DELAY	0x444C4159
 #define SOC64_HANDOFF_MAGIC_CLOCK	0x434C4B53
+#define SOC64_HANDOFF_MAGIC_SDRAM	0x5344524d
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
 #define SOC64_HANDOFF_MAGIC_PERI	0x50455249
-#define SOC64_HANDOFF_MAGIC_SDRAM	0x5344524d
 #else
 #define SOC64_HANDOFF_MAGIC_MISC	0x4D495343
 #endif
@@ -68,7 +68,7 @@
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
 #define SOC64_HANDOFF_PERI		(SOC64_HANDOFF_BASE + 0x620)
 #define SOC64_HANDOFF_SDRAM		(SOC64_HANDOFF_BASE + 0x634)
-#define SOC64_HANDOFF_SDRAM_LEN		1
+#define SOC64_HANDOFF_SDRAM_LEN		5
 #endif
 
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_STRATIX10)
arch/arm/mach-socfpga/wrap_handoff_soc64.c +8 -2
index 92051d19b73..c8456c8dd6a 100644
@@ -1,15 +1,16 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) 2020-2021 Intel Corporation <www.intel.com>
+ * Copyright (C) 2020-2024 Intel Corporation <www.intel.com>
  *
  */
 
+#include <errno.h>
 #include <asm/arch/handoff_soc64.h>
 #include <asm/io.h>
-#include <errno.h>
 #include "log.h"
 
 #ifndef __ASSEMBLY__
+#include <asm/types.h>
 enum endianness {
 	LITTLE_ENDIAN = 0,
 	BIG_ENDIAN,
@@ -26,7 +27,12 @@ static enum endianness check_endianness(u32 handoff)
 	case SOC64_HANDOFF_MAGIC_FPGA:
 	case SOC64_HANDOFF_MAGIC_DELAY:
 	case SOC64_HANDOFF_MAGIC_CLOCK:
+	case SOC64_HANDOFF_MAGIC_SDRAM:
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
+	case SOC64_HANDOFF_MAGIC_PERI:
+#else
 	case SOC64_HANDOFF_MAGIC_MISC:
+#endif
 		return BIG_ENDIAN;
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
 	case SOC64_HANDOFF_DDR_UMCTL2_MAGIC:
Signature · 1 line
2.25.1
#24 lore raw

PATCH 6/20 arm: dts: agilex5: Add HPS cache coherency unit configuration settings

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

These configuration settings are required to enable cache maintenance and access between initiators and targets.

---
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi | 209 +++++++++++++++++++++++
 1 file changed, 209 insertions(+)
arch/arm/dts/socfpga_agilex5-u-boot.dtsi +209 -0
index a8167e5c14a..ec42fd01a9c 100644
@@ -13,6 +13,215 @@
 		#size-cells = <2>;
 		bootph-all;
 	};
+
+	soc {
+		bootph-all;
+
+		socfpga_ccu_config: socfpga-ccu-config {
+			compatible = "intel,socfpga-dtreg";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			bootph-all;
+
+			/* DSU */
+			i_ccu_caiu0@1c000000 {
+				reg = <0x1c000000 0x00001000>;
+				intel,offset-settings =
+					/* CAIUMIFSR */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* DII1_MPFEREGS */
+					<0x00000414 0x00018000 0xffffffff>,
+					<0x00000418 0x00000000 0x000000ff>,
+					<0x00000410 0xc0e00200 0xc1f03e1f>,
+					/* DII2_GICREGS */
+					<0x00000424 0x0001d000 0xffffffff>,
+					<0x00000428 0x00000000 0x000000ff>,
+					<0x00000420 0xc0800400 0xc1f03e1f>,
+					/* NCAIU0_LWSOC2FPGA */
+					<0x00000444 0x00020000 0xffffffff>,
+					<0x00000448 0x00000000 0x000000ff>,
+					<0x00000440 0xc1100006 0xc1f03e1f>,
+					/* NCAIU0_SOC2FPGA_1G */
+					<0x00000454 0x00040000 0xffffffff>,
+					<0x00000458 0x00000000 0x000000ff>,
+					<0x00000450 0xc1200006 0xc1f03e1f>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* NCAIU0_SOC2FPGA_16G */
+					<0x00000474 0x00400000 0xffffffff>,
+					<0x00000478 0x00000000 0x000000ff>,
+					<0x00000470 0xc1600006 0xc1f03e1f>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* NCAIU0_SOC2FPGA_256G */
+					<0x00000494 0x04000000 0xffffffff>,
+					<0x00000498 0x00000000 0x000000ff>,
+					<0x00000490 0xc1a00006 0xc1f03e1f>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* FPGA2SOC */
+			i_ccu_ncaiu0@1c001000 {
+				reg = <0x1c001000 0x00001000>;
+				intel,offset-settings =
+					/* NCAIU0MIFSR */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* PSS */
+					<0x00000404 0x00010000 0xffffffff>,
+					<0x00000408 0x00000000 0x000000ff>,
+					<0x00000400 0xC0F00000 0xc1f03e1f>,
+					/* DII1_MPFEREGS */
+					<0x00000414 0x00018000 0xffffffff>,
+					<0x00000418 0x00000000 0x000000ff>,
+					<0x00000410 0xc0e00200 0xc1f03e1f>,
+					/* NCAIU0_LWSOC2FPGA */
+					<0x00000444 0x00020000 0xffffffff>,
+					<0x00000448 0x00000000 0x000000ff>,
+					<0x00000440 0xc1100006 0xc1f03e1f>,
+					/* NCAIU0_SOC2FPGA_1G */
+					<0x00000454 0x00040000 0xffffffff>,
+					<0x00000458 0x00000000 0x000000ff>,
+					<0x00000450 0xc1200006 0xc1f03e1f>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* NCAIU0_SOC2FPGA_16G */
+					<0x00000474 0x00400000 0xffffffff>,
+					<0x00000478 0x00000000 0x000000ff>,
+					<0x00000470 0xc1600006 0xc1f03e1f>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* NCAIU0_SOC2FPGA_256G */
+					<0x00000494 0x04000000 0xffffffff>,
+					<0x00000498 0x00000000 0x000000ff>,
+					<0x00000490 0xc1a00006 0xc1f03e1f>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* GIC_M */
+			i_ccu_ncaiu1@1c002000 {
+				reg = <0x1c002000 0x00001000>;
+				intel,offset-settings =
+					/* NCAIU1MIFSR */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* SMMU */
+			i_ccu_ncaiu2@1c003000 {
+				reg = <0x1c003000 0x00001000>;
+				intel,offset-settings =
+					/* NCAIU2MIFSR */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* PSS NOC */
+			i_ccu_ncaiu3@1c004000 {
+				reg = <0x1c004000 0x00001000>;
+				intel,offset-settings =
+					/* NCAIU3MIFSR */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* DII1_MPFEREGS */
+					<0x00000414 0x00018000 0xffffffff>,
+					<0x00000418 0x00000000 0x000000ff>,
+					<0x00000410 0xc0e00200 0xc1f03e1f>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* DCE0 */
+			i_ccu_dce0@1c005000 {
+				reg = <0x1c005000 0x00001000>;
+				intel,offset-settings =
+					/* DCEUMIFSR0 */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* DCE1 */
+			i_ccu_dce1@1c006000 {
+				reg = <0x1c006000 0x00001000>;
+				intel,offset-settings =
+					/* DCEUMIFSR1 */
+					<0x000003c4 0x00000000 0x07070777>,
+					/* DMI_SDRAM_2G */
+					<0x00000464 0x00080000 0xffffffff>,
+					<0x00000468 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_30G */
+					<0x00000484 0x00800000 0xffffffff>,
+					<0x00000488 0x00000000 0x000000ff>,
+					/* DMI_SDRAM_480G */
+					<0x000004a4 0x08000000 0xffffffff>,
+					<0x000004a8 0x00000000 0x000000ff>;
+				bootph-all;
+			};
+
+			/* DMI0 */
+			i_ccu_dmi0@1c007000 {
+				reg = <0x1c007000 0x00001000>;
+				intel,offset-settings =
+					/* DMIUSMCTCR */
+					<0x00000300 0x00000001 0x00000003>,
+					<0x00000300 0x00000003 0x00000003>;
+				bootph-all;
+			};
+
+			/* DMI1 */
+			i_ccu_dmi0@1c008000 {
+				reg = <0x1c008000 0x00001000>;
+				intel,offset-settings =
+					/* DMIUSMCTCR */
+					<0x00000300 0x00000001 0x00000003>,
+					<0x00000300 0x00000003 0x00000003>;
+				bootph-all;
+			};
+		};
+	};
 };
 
 &clkmgr {
Signature · 1 line
2.25.1
#25 lore raw

PATCH 7/20 arm: dts: agilex5: Add firewall configure settings

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

These firewall configure settings are needed to disable firewall on respective hardware component so both secure and non-secure transactions are allowed.

---
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi | 166 +++++++++++++++++++++++
 1 file changed, 166 insertions(+)
arch/arm/dts/socfpga_agilex5-u-boot.dtsi +166 -0
index ec42fd01a9c..bf30b3b8858 100644
@@ -221,6 +221,172 @@
 				bootph-all;
 			};
 		};
+
+		socfpga_firewall_config: socfpga-firewall-config {
+			compatible = "intel,socfpga-dtreg";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			bootph-all;
+
+			/* L4 peripherals firewall */
+			noc_fw_l4_per@10d21000 {
+				reg = <0x10d21000 0x0000008c>;
+				intel,offset-settings =
+					/* NAND */
+					<0x00000000 0x01010001 0x01010001>,
+					/* USB0 */
+					<0x0000000c 0x01010001 0x01010001>,
+					/* USB1 */
+					<0x00000010 0x01010001 0x01010001>,
+					/* SPI_MAIN0 */
+					<0x0000001c 0x01010301 0x01010301>,
+					/* SPI_MAIN1 */
+					<0x00000020 0x01010301 0x01010301>,
+					/* SPI_SECONDARY0 */
+					<0x00000024 0x01010301 0x01010301>,
+					/* SPI_SECONDARY1 */
+					<0x00000028 0x01010301 0x01010301>,
+					/* EMAC0 */
+					<0x0000002c 0x01010001 0x01010001>,
+					/* EMAC1 */
+					<0x00000030 0x01010001 0x01010001>,
+					/* EMAC2 */
+					<0x00000034 0x01010001 0x01010001>,
+					/* SDMMC */
+					<0x00000040 0x01010001 0x01010001>,
+					/* GPIO0 */
+					<0x00000044 0x01010301 0x01010301>,
+					/* GPIO1 */
+					<0x00000048 0x01010301 0x01010301>,
+					/* I2C0 */
+					<0x00000050 0x01010301 0x01010301>,
+					/* I2C1 */
+					<0x00000054 0x01010301 0x01010301>,
+					/* I2C2 */
+					<0x00000058 0x01010301 0x01010301>,
+					/* I2C3 */
+					<0x0000005c 0x01010301 0x01010301>,
+					/* I2C4 */
+					<0x00000060 0x01010301 0x01010301>,
+					/* SP_TIMER0 */
+					<0x00000064 0x01010301 0x01010301>,
+					/* SP_TIMER1 */
+					<0x00000068 0x01010301 0x01010301>,
+					/* UART0 */
+					<0x0000006c 0x01010301 0x01010301>,
+					/* UART1 */
+					<0x00000070 0x01010301 0x01010301>,
+					/* I3C0 */
+					<0x00000074 0x01010301 0x01010301>,
+					/* I3C1 */
+					<0x00000078 0x01010301 0x01010301>,
+					/* DMA0 */
+					<0x0000007c 0x01010001 0x01010001>,
+					/* DMA1 */
+					<0x00000080 0x01010001 0x01010001>,
+					/* COMBO_PHY */
+					<0x00000084 0x01010001 0x01010001>,
+					/* NAND_SDMA */
+					<0x00000088 0x01010301 0x01010301>;
+				bootph-all;
+			};
+
+			/* L4 system firewall */
+			noc_fw_l4_sys@10d21100 {
+				reg = <0x10d21100 0x00000098>;
+				intel,offset-settings =
+					/* DMA_ECC */
+					<0x00000008 0x01010001 0x01010001>,
+					/* EMAC0RX_ECC */
+					<0x0000000c 0x01010001 0x01010001>,
+					/* EMAC0TX_ECC */
+					<0x00000010 0x01010001 0x01010001>,
+					/* EMAC1RX_ECC */
+					<0x00000014 0x01010001 0x01010001>,
+					/* EMAC1TX_ECC */
+					<0x00000018 0x01010001 0x01010001>,
+					/* EMAC2RX_ECC */
+					<0x0000001c 0x01010001 0x01010001>,
+					/* EMAC2TX_ECC */
+					<0x00000020 0x01010001 0x01010001>,
+					/* NAND_ECC */
+					<0x0000002c 0x01010001 0x01010001>,
+					/* NAND_READ_ECC */
+					<0x00000030 0x01010001 0x01010001>,
+					/* NAND_WRITE_ECC */
+					<0x00000034 0x01010001 0x01010001>,
+					/* OCRAM_ECC */
+					<0x00000038 0x01010001 0x01010001>,
+					/* SDMMC_ECC */
+					<0x00000040 0x01010001 0x01010001>,
+					/* USB0_ECC */
+					<0x00000044 0x01010001 0x01010001>,
+					/* USB1_CACHEECC */
+					<0x00000048 0x01010001 0x01010001>,
+					/* CLOCK_MANAGER */
+					<0x0000004c 0x01010001 0x01010001>,
+					/* IO_MANAGER */
+					<0x00000054 0x01010001 0x01010001>,
+					/* RESET_MANAGER */
+					<0x00000058 0x01010001 0x01010001>,
+					/* SYSTEM_MANAGER */
+					<0x0000005c 0x01010001 0x01010001>,
+					/* OSC0_TIMER */
+					<0x00000060 0x01010301 0x01010301>,
+					/* OSC1_TIMER0*/
+					<0x00000064 0x01010301 0x01010301>,
+					/* WATCHDOG0 */
+					<0x00000068 0x01010301 0x01010301>,
+					/* WATCHDOG1 */
+					<0x0000006c 0x01010301 0x01010301>,
+					/* WATCHDOG2 */
+					<0x00000070 0x01010301 0x01010301>,
+					/* WATCHDOG3 */
+					<0x00000074 0x01010301 0x01010301>,
+					/* DAP */
+					<0x00000078 0x03010001 0x03010001>,
+					/* WATCHDOG4 */
+					<0x0000007c 0x01010301 0x01010301>,
+					/* POWER_MANAGER */
+					<0x00000080 0x01010001 0x01010001>,
+					/* USB1_RXECC */
+					<0x00000084 0x01010001 0x01010001>,
+					/* USB1_TXECC */
+					<0x00000088 0x01010001 0x01010001>,
+					/* L4_NOC_PROBES */
+					<0x00000090 0x01010001 0x01010001>,
+					/* L4_NOC_QOS */
+					<0x00000094 0x01010001 0x01010001>;
+				bootph-all;
+			};
+
+			/* Light weight SoC2FPGA */
+			noc_fw_lwsoc2fpga@10d21300 {
+				reg = <0x10d21300 0x0000004>;
+				intel,offset-settings =
+					/* LWSOC2FPGA_CSR */
+					<0x00000000 0x0ffe0301 0x0ffe0301>;
+				bootph-all;
+			};
+
+			/* SoC2FPGA */
+			noc_fw_soc2fpga@10d21200 {
+				reg = <0x10d21200 0x0000004>;
+				intel,offset-settings =
+					/* SOC2FPGA_CSR */
+					<0x00000000 0x0ffe0301 0x0ffe0301>;
+				bootph-all;
+			};
+
+			/* TCU */
+			noc_fw_tcu@10d21400 {
+				reg = <0x10d21400 0x0000004>;
+				intel,offset-settings =
+					/* TCU_CSR */
+					<0x00000000 0x01010001 0x01010001>;
+				bootph-all;
+			};
+		};
 	};
 };
 
Signature · 1 line
2.25.1
#26 lore raw

PATCH 8/20 arm: dts: agilex5: Enable XGMAC

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Enable XGMAC for SoCFPGA Agilex5 devkit.

---
 .../arm/dts/socfpga_agilex5_socdk-u-boot.dtsi | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +33 -0
index 9eb21d65428..75ab05031bc 100644
@@ -122,3 +122,36 @@
 	bootph-all;
 };
 
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;
+
+	max-frame-size = <9000>;
+
+	mdio0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "snps,dwxgmac-mdio";
+		emac0_phy0: ethernet-phy@0 {
+			reg = <0>;
+		};
+	};
+};
+
+&gmac2 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac2_phy0>;
+
+	max-frame-size = <9000>;
+
+	mdio0 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "snps,dwxgmac-mdio";
+		emac2_phy0: ethernet-phy@0 {
+			reg = <0>;
+		};
+	};
+};
Signature · 1 line
2.25.1
#27 lore raw

Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 14 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Enable XGMAC for SoCFPGA Agilex5 devkit.

---
  .../arm/dts/socfpga_agilex5_socdk-u-boot.dtsi | 33 +++++++++++++++++++
  1 file changed, 33 insertions(+)
arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +0 -0
index 9eb21d65428..75ab05031bc 100644

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi line 128

Quoted 7 lines
arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +4 -0
@@ -122,3 +122,36 @@
  	bootph-all;
  };
 
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;

Shouldn't this be part of Linux DT already ?

#28 lore raw

RE: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Hi,

Quoted 30 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:51 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 7 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Enable XGMAC for SoCFPGA Agilex5 devkit.

---
  .../arm/dts/socfpga_agilex5_socdk-u-boot.dtsi | 33

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

Review

Quoted 3 lines
  1 file changed, 33 insertions(+)
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi

Quoted 7 lines

index 9eb21d65428..75ab05031bc 100644

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +0 -0
@@ -122,3 +122,36 @@
  	bootph-all;
  };
 
Quoted 5 lines

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi line 128

Quoted 4 lines
arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +4 -0
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;

Shouldn't this be part of Linux DT already ?

This enablement not yet in Linux DT, I believe our Linux team is still working on it.

Regards,
Tien Fong

#29 lore raw

Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 1 line · Tien Fong

Hi,

Hi,

Quoted 9 lines
Quoted 9 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi

Quoted 7 lines

index 9eb21d65428..75ab05031bc 100644

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +0 -0
@@ -122,3 +122,36 @@
   	bootph-all;
   };
 
Quoted 7 lines
Quoted 5 lines

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi line 128

Quoted 4 lines
arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +4 -0
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;

Shouldn't this be part of Linux DT already ?

This enablement not yet in Linux DT, I believe our Linux team is still working on it.

Is there at least a patch posted upstream ?

#30 lore raw

RE: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Hi,

Quoted 30 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, September 25, 2024 2:36 AM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 1 line · Tien Fong

Hi,

Hi,

Quoted 15 lines
Quoted 14 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi line 128

Quoted 11 lines

index 9eb21d65428..75ab05031bc 100644

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +4 -0
@@ -122,3 +122,36 @@
   	bootph-all;
   };
 
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;

Shouldn't this be part of Linux DT already ?

Quoted 3 lines
Quoted 1 line

This enablement not yet in Linux DT, I believe our Linux team is still working

on it.
Is there at least a patch posted upstream ?

Having two patches posted now in Linux mainline, but gmac device is still not yet added into these dt.
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/intel/socfpga_agilex5_socdk.dts

I think we can do a cleanup if the duplicated found in U-Boot later.

Thanks.

Regards,
Tien Fong

#31 lore raw

Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 33 lines · Tien Fong

Hi,

Quoted 31 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, September 25, 2024 2:36 AM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 1 line · Tien Fong

Hi,

Hi,

Quoted 16 lines
Quoted 9 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi

Quoted 7 lines

index 9eb21d65428..75ab05031bc 100644

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +0 -0
@@ -122,3 +122,36 @@
    	bootph-all;
    };
 
Quoted 5 lines

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi line 128

Quoted 4 lines
arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +4 -0
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;

Shouldn't this be part of Linux DT already ?

This enablement not yet in Linux DT, I believe our Linux team is still working

Quoted 8 lines
Quoted 2 lines

on it.
Is there at least a patch posted upstream ?

Having two patches posted now in Linux mainline, but gmac device is still not yet added into these dt.
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/intel/socfpga_agilex5.dtsi
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/intel/socfpga_agilex5_socdk.dts

I think we can do a cleanup if the duplicated found in U-Boot later.

At least reference the two patches (lore links) in the V2 of this patch.

#32 lore raw

RE: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Hi,

Quoted 49 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, September 25, 2024 8:51 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 32 lines · Tien Fong

Hi,

Quoted 30 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Wednesday, September 25, 2024 2:36 AM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 08/20] arm: dts: agilex5: Enable XGMAC

Quoted 1 line · Tien Fong

Hi,

Hi,

Quoted 15 lines
Quoted 14 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi line 128

Quoted 11 lines

index 9eb21d65428..75ab05031bc 100644

arch/arm/dts/socfpga_agilex5_socdk-u-boot.dtsi +4 -0
@@ -122,3 +122,36 @@
    	bootph-all;
    };
 
+&gmac0 {
+	status = "okay";
+	phy-mode = "rgmii";
+	phy-handle = <&emac0_phy0>;

Shouldn't this be part of Linux DT already ?

Quoted 6 lines
Quoted 4 lines
Quoted 2 lines

This enablement not yet in Linux DT, I believe our Linux team is still working

on it.
Is there at least a patch posted upstream ?

Having two patches posted now in Linux mainline, but gmac device is still

Quoted 8 lines

not yet added into these dt.

Quoted 6 lines

https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/inte
l/socfpga_agilex5.dtsi
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/inte
l/socfpga_agilex5_socdk.dts

I think we can do a cleanup if the duplicated found in U-Boot later.

At least reference the two patches (lore links) in the V2 of this patch.

Noted. Will do.

Thanks.

Regards,
Tien Fong

#33 lore raw

PATCH 9/20 sysreset: Add reset support to SoCFPGA Agilex5 device

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

The reset driver can support both cold reset and warm reset with SMCC to ATF.

---
 arch/arm/Kconfig                            |  1 +
 drivers/sysreset/Kconfig                    |  7 +++
 drivers/sysreset/Makefile                   |  1 +
 drivers/sysreset/sysreset_socfpga_agilex5.c | 47 +++++++++++++++++++++
 4 files changed, 56 insertions(+)
 create mode 100644 drivers/sysreset/sysreset_socfpga_agilex5.c
arch/arm/Kconfig +1 -0
index ba0359fed5a..8e9a39e7d23 100644
@@ -1123,6 +1123,7 @@ config ARCH_SOCFPGA
 	select SYSRESET_SOCFPGA if TARGET_SOCFPGA_GEN5 || TARGET_SOCFPGA_ARRIA10
 	select SYSRESET_SOCFPGA_SOC64 if !TARGET_SOCFPGA_AGILEX5 && \
 	  TARGET_SOCFPGA_SOC64
+	select SYSRESET_SOCFPGA_AGILEX5 if TARGET_SOCFPGA_AGILEX5
 	imply CMD_DM
 	imply CMD_MTDPARTS
 	imply CRC32_VERIFY
drivers/sysreset/Kconfig +7 -0
index 121194e4418..8dc1e7fec58 100644
@@ -156,6 +156,13 @@ config SYSRESET_SOCFPGA_SOC64
 	  This enables the system reset driver support for Intel SOCFPGA
 	  SoC64 SoCs.
 
+config SYSRESET_SOCFPGA_AGILEX5
+	bool "Enable support for Intel SOCFPGA AGILEX5 device"
+	depends on ARCH_SOCFPGA && TARGET_SOCFPGA_AGILEX5
+	help
+	  This enables the system reset driver support for Intel SOCFPGA
+	  AGILEX5 device.
+
 config SYSRESET_TEGRA
 	bool "Tegra PMC system reset driver"
 	depends on ARCH_TEGRA
drivers/sysreset/Makefile +1 -0
index a6a0584585c..c090db48af4 100644
@@ -19,6 +19,7 @@ obj-$(CONFIG_SYSRESET_PSCI) += sysreset_psci.o
 obj-$(CONFIG_SYSRESET_SBI) += sysreset_sbi.o
 obj-$(CONFIG_SYSRESET_SOCFPGA) += sysreset_socfpga.o
 obj-$(CONFIG_SYSRESET_SOCFPGA_SOC64) += sysreset_socfpga_soc64.o
+obj-$(CONFIG_SYSRESET_SOCFPGA_AGILEX5) += sysreset_socfpga_agilex5.o
 obj-$(CONFIG_SYSRESET_TEGRA) += sysreset_tegra.o
 obj-$(CONFIG_SYSRESET_TI_SCI) += sysreset-ti-sci.o
 obj-$(CONFIG_$(SPL_TPL_)SYSRESET_TPS65910) += sysreset_tps65910.o
drivers/sysreset/sysreset_socfpga_agilex5.c new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
2.25.1
#34 lore raw

Re: [PATCH v1 09/20] sysreset: Add reset support to SoCFPGA Agilex5 device

On 9/20/24 9:02 AM, [email protected] wrote:

[...]

drivers/sysreset/sysreset_socfpga_agilex5.c line 29

Quoted 9 lines
drivers/sysreset/sysreset_socfpga_agilex5.c new file +9 -0
+	if (reset && !strcmp(reset, "warm")) {
+		/* Ensure content in dcache is flushed to system memory */
+		flush_dcache_all();
+
+		/* request a warm reset */
+		puts("Do warm reset now...\n");
+
+		/* doing architecture system reset */
+		psci_system_reset2(0, 0);

Can this use SYSRESET_PSCI driver instead ?

#35 lore raw

RE: [PATCH v1 09/20] sysreset: Add reset support to SoCFPGA Agilex5 device

Hi,

Quoted 15 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:52 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 09/20] sysreset: Add reset support to SoCFPGA Agilex5 device

On 9/20/24 9:02 AM, [email protected] wrote:

[...]

Quoted 10 lines

drivers/sysreset/sysreset_socfpga_agilex5.c line 29

Quoted 9 lines
drivers/sysreset/sysreset_socfpga_agilex5.c new file +9 -0
+	if (reset && !strcmp(reset, "warm")) {
+		/* Ensure content in dcache is flushed to system memory */
+		flush_dcache_all();
+
+		/* request a warm reset */
+		puts("Do warm reset now...\n");
+
+		/* doing architecture system reset */
+		psci_system_reset2(0, 0);

Can this use SYSRESET_PSCI driver instead ?

This driver seems can be used after quick check, we will try out this.

Thanks.

Regards,
Tien Fong

#36 lore raw

PATCH 10/20 arm: socfpga: agilex5: Enable cache flush for system memory cache in CCU

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

set/way instructions "dc cisw" ehich is used by the "dcache flush" command only flushing CPU data caches from L1 -> L2 -> L3 to system memory cache in cache coherency unit, hence this patch enables data flush from system memory cache of CCU into DDR memory.

---
 arch/arm/mach-socfpga/Makefile     |  1 +
 arch/arm/mach-socfpga/ccu_ncore3.c | 64 ++++++++++++++++++++++++++++++
 2 files changed, 65 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/ccu_ncore3.c
arch/arm/mach-socfpga/Makefile +1 -0
index e0ada69dd5a..32b3e7a57e2 100644
@@ -65,6 +65,7 @@ obj-y	+= mmu-arm64_s10.o
 obj-y	+= reset_manager_s10.o
 obj-y	+= wrap_handoff_soc64.o
 obj-y	+= wrap_pll_config_soc64.o
+obj-y	+= ccu_ncore3.o
 endif
 
 ifdef CONFIG_TARGET_SOCFPGA_N5X
arch/arm/mach-socfpga/ccu_ncore3.c new file +64 -0

64 lines not on this page · raw message

Signature · 1 line
2.25.1
#37 lore raw

PATCH 11/20 arm: socfpga: agilex5: Add SMMU initialization

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Allow non-secure accesses only with SMMU peripherals. This would protect the content in DDR secure region from accidentally modified by SMMU peripherals.

---
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi | 34 ++++++++++++++++++++++++
 arch/arm/mach-socfpga/spl_soc64.c        | 17 +++++++++++-
 2 files changed, 50 insertions(+), 1 deletion(-)
arch/arm/dts/socfpga_agilex5-u-boot.dtsi +34 -0
index bf30b3b8858..9baf2cbc525 100644
@@ -387,6 +387,40 @@
 				bootph-all;
 			};
 		};
+
+		socfpga_smmu_secure_config: socfpga-smmu-secure-config {
+			compatible = "intel,socfpga-dtreg";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			bootph-all;
+
+			/* System manager */
+			i_sys_mgt_sysmgr_csr@10d12000 {
+				reg = <0x10d12000 0x00000500>;
+				intel,offset-settings =
+					/* dma_tbu_stream_ctrl_reg_0_dma0 */
+					<0x0000017c 0x00000000 0x0000003f>,
+					/* dma_tbu_stream_ctrl_reg_0_dma1 */
+					<0x00000180 0x00000000 0x0000003f>,
+					/* sdm_tbu_stream_ctrl_reg_1_sdm */
+					<0x00000184 0x00000000 0x0000003f>,
+					/* io_tbu_stream_ctrl_reg_2_usb2 */
+					<0x00000188 0x00000000 0x0000003f>,
+					/* io_tbu_stream_ctrl_reg_2_sdmmc */
+					<0x00000190 0x00000000 0x0000003f>,
+					/* io_tbu_stream_ctrl_reg_2_nand */
+					<0x00000194 0x00000000 0x0000003f>,
+					/* io_tbu_stream_ctrl_reg_2_etr */
+					<0x00000198 0x00000000 0x0000003f>,
+					/* tsn_tbu_stream_ctrl_reg_3_tsn0 */
+					<0x0000019c 0x00000000 0x0000003f>,
+					/* tsn_tbu_stream_ctrl_reg_3_tsn1 */
+					<0x000001a0 0x00000000 0x0000003f>,
+					/* tsn_tbu_stream_ctrl_reg_3_tsn2 */
+					<0x000001a4 0x00000000 0x0000003f>;
+				bootph-all;
+			};
+		};
 	};
 };
 
arch/arm/mach-socfpga/spl_soc64.c +16 -1
index 4fe67ea0811..3bfe4bb9dd3 100644
@@ -1,10 +1,12 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- *  Copyright (C) 2020 Intel Corporation. All rights reserved
+ *  Copyright (C) 2020-2024 Intel Corporation. All rights reserved
  *
  */
 
+#include <hang.h>
 #include <spl.h>
+#include <dm/uclass.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -22,3 +24,16 @@ u32 spl_boot_mode(const u32 boot_device)
 		return MMCSD_MODE_RAW;
 }
 #endif
+
+/* board specific function prior loading SSBL / U-Boot */
+void spl_perform_fixups(struct spl_image_info *spl_image)
+{
+	int ret;
+	struct udevice *dev;
+
+	ret = uclass_get_device_by_name(UCLASS_NOP, "socfpga-smmu-secure-config", &dev);
+	if (ret) {
+		printf("HPS SMMU secure settings init failed: %d\n", ret);
+		hang();
+	}
+}
Signature · 1 line
2.25.1
#38 lore raw

PATCH 12/20 arm: socfpga: agilex5: Update CPU info

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Update the print info per Agilex 5.

---
 arch/arm/mach-socfpga/misc_soc64.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/misc_soc64.c +6 -1
index a6cc78454da..95e1c07e39f 100644
@@ -45,7 +45,12 @@ static Altera_desc altera_fpga[] = {
 #if defined(CONFIG_DISPLAY_CPUINFO)
 int print_cpuinfo(void)
 {
-	puts("CPU:   Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-A53)\n");
+	if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)) {
+		puts("CPU: Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-A55/A76)");
+		puts("\n");
+	} else {
+		puts("CPU: Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-A53)\n");
+	}
 
 	return 0;
 }
Signature · 1 line
2.25.1
#39 lore raw

Re: [PATCH v1 12/20] arm: socfpga: agilex5: Update CPU info

Quoted 14 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Update the print info per Agilex 5.

---
  arch/arm/mach-socfpga/misc_soc64.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach-socfpga/misc_soc64.c +0 -0
index a6cc78454da..95e1c07e39f 100644

arch/arm/mach-socfpga/misc_soc64.c static Altera_desc altera_fpga[] = { · line 52

Quoted 9 lines
arch/arm/mach-socfpga/misc_soc64.c +5 -1
@@ -45,7 +45,12 @@ static Altera_desc altera_fpga[] = {
  #if defined(CONFIG_DISPLAY_CPUINFO)
  int print_cpuinfo(void)
  {
-	puts("CPU:   Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-A53)\n");
+	if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)) {
+		puts("CPU: Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-A55/A76)");
+		puts("\n");
+	} else {
+		

printf("CPU: Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-%s)\n",

       IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5) ? "A55/A76" : "A53");
#40 lore raw

RE: [PATCH v1 12/20] arm: socfpga: agilex5: Update CPU info

Hi,

Quoted 34 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:53 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 12/20] arm: socfpga: agilex5: Update CPU info

arch/arm/mach-

Quoted 10 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Update the print info per Agilex 5.

---
  arch/arm/mach-socfpga/misc_soc64.c | 7 ++++++-
  1 file changed, 6 insertions(+), 1 deletion(-)
arch/arm/mach- renamed from arch/arm/mach-socfpga/misc_soc64.c +0 -0

socfpga/misc_soc64.c

arch/arm/mach-socfpga/misc_soc64.c static Altera_desc altera_fpga[] = { · line 48

Quoted 8 lines

index a6cc78454da..95e1c07e39f 100644

arch/arm/mach-socfpga/misc_soc64.c +0 -1
@@ -45,7 +45,12 @@ static Altera_desc altera_fpga[] = {
  #if defined(CONFIG_DISPLAY_CPUINFO)
  int print_cpuinfo(void)
  {
-	puts("CPU:   Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-

A53)\n");

arch/arm/mach-socfpga/misc_soc64.c static Altera_desc altera_fpga[] = { · line 49

Quoted 2 lines
arch/arm/mach-socfpga/misc_soc64.c +2 -0
+	if (IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)) {
+		puts("CPU: Intel FPGA SoCFPGA Platform (ARMv8 64bit

Cortex-A55/A76)");

Quoted 6 lines

arch/arm/mach-socfpga/misc_soc64.c static Altera_desc altera_fpga[] = {

Quoted 3 lines
arch/arm/mach-socfpga/misc_soc64.c +3 -0
+		puts("\n");
+	} else {
+

printf("CPU: Intel FPGA SoCFPGA Platform (ARMv8 64bit Cortex-%s)\n",

        IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5) ? "A55/A76" : "A53");

We will fix it.

Thanks for the good comment.

Regards,
Tien Fong

#41 lore raw

PATCH 13/20 arm: socfpga: Export board ID as U-Boot environment variable

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Board ID is exported as environment variable for use to boot Linux with FIT configuration.

---
 arch/arm/mach-socfpga/include/mach/misc.h | 1 +
 arch/arm/mach-socfpga/misc_soc64.c        | 5 +++++
 2 files changed, 6 insertions(+)
arch/arm/mach-socfpga/include/mach/misc.h +1 -0
index 8460acb00d9..e62bea017b0 100644
@@ -52,5 +52,6 @@ void set_regular_boot(unsigned int status);
 void socfpga_pl310_clear(void);
 void socfpga_get_managers_addr(void);
 int qspi_flash_software_reset(void);
+u8 socfpga_get_board_id(void);
 
 #endif /* _SOCFPGA_MISC_H_ */
arch/arm/mach-socfpga/misc_soc64.c +5 -0
index 95e1c07e39f..e34c54518a3 100644
@@ -60,10 +60,15 @@ int print_cpuinfo(void)
 int arch_misc_init(void)
 {
 	char qspi_string[13];
+	char id[3];
 
 	sprintf(qspi_string, "<0x%08x>", cm_get_qspi_controller_clk_hz());
 	env_set("qspi_clock", qspi_string);
 
+	/* Export board_id as environment variable */
+	sprintf(id, "%u", socfpga_get_board_id());
+	env_set("board_id", id);
+
 	return 0;
 }
 #endif
Signature · 1 line
2.25.1
#42 lore raw

Re: [PATCH v1 13/20] arm: socfpga: Export board ID as U-Boot environment variable

Quoted 28 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Board ID is exported as environment variable for use to boot Linux with FIT configuration.

---
  arch/arm/mach-socfpga/include/mach/misc.h | 1 +
  arch/arm/mach-socfpga/misc_soc64.c        | 5 +++++
  2 files changed, 6 insertions(+)
arch/arm/mach-socfpga/include/mach/misc.h +1 -0
index 8460acb00d9..e62bea017b0 100644
@@ -52,5 +52,6 @@ void set_regular_boot(unsigned int status);
  void socfpga_pl310_clear(void);
  void socfpga_get_managers_addr(void);
  int qspi_flash_software_reset(void);
+u8 socfpga_get_board_id(void);
 
  #endif /* _SOCFPGA_MISC_H_ */
arch/arm/mach-socfpga/misc_soc64.c +0 -0
index 95e1c07e39f..e34c54518a3 100644
@@ -60,10 +60,15 @@ int print_cpuinfo(void)
  int arch_misc_init(void)

arch/arm/mach-socfpga/misc_soc64.c int print_cpuinfo(void) · line 70

Quoted 10 lines
arch/arm/mach-socfpga/misc_soc64.c +4 -0
  {
  	char qspi_string[13];
+	char id[3];
 
  	sprintf(qspi_string, "<0x%08x>", cm_get_qspi_controller_clk_hz());
  	env_set("qspi_clock", qspi_string);
 
+	/* Export board_id as environment variable */
+	sprintf(id, "%u", socfpga_get_board_id());
+	env_set("board_id", id);

env_set_ulong()

#43 lore raw

RE: [PATCH v1 13/20] arm: socfpga: Export board ID as U-Boot environment variable

Hi,

Quoted 46 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:54 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 13/20] arm: socfpga: Export board ID as U-Boot environment variable

Quoted 34 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

Board ID is exported as environment variable for use to boot Linux with FIT configuration.

---
  arch/arm/mach-socfpga/include/mach/misc.h | 1 +
  arch/arm/mach-socfpga/misc_soc64.c        | 5 +++++
  2 files changed, 6 insertions(+)
arch/arm/mach-socfpga/include/mach/misc.h +1 -0
index 8460acb00d9..e62bea017b0 100644
@@ -52,5 +52,6 @@ void set_regular_boot(unsigned int status);
  void socfpga_pl310_clear(void);
  void socfpga_get_managers_addr(void);
  int qspi_flash_software_reset(void);
+u8 socfpga_get_board_id(void);
 
  #endif /* _SOCFPGA_MISC_H_ */
arch/arm/mach-socfpga/misc_soc64.c +1 -0
index 95e1c07e39f..e34c54518a3 100644
@@ -60,10 +60,15 @@ int print_cpuinfo(void)
  int arch_misc_init(void)
  {
  	char qspi_string[13];
+	char id[3];
 
Quoted 7 lines

arch/arm/mach-socfpga/misc_soc64.c int print_cpuinfo(void) · line 70

Quoted 6 lines
arch/arm/mach-socfpga/misc_soc64.c +3 -0
  	sprintf(qspi_string, "<0x%08x>", cm_get_qspi_controller_clk_hz());
  	env_set("qspi_clock", qspi_string);
 
+	/* Export board_id as environment variable */
+	sprintf(id, "%u", socfpga_get_board_id());
+	env_set("board_id", id);

env_set_ulong()

OK, we will change it.

Regards,
Tien Fong

#44 lore raw

PATCH 14/20 configs: agilex5: Add configuration for malloc pool

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Adding configuration for SPL malloc pool.

---
 configs/socfpga_agilex5_defconfig | 4 ++++
 1 file changed, 4 insertions(+)
configs/socfpga_agilex5_defconfig +4 -0
index dc1cef3754e..81bbe967dcf 100644
@@ -29,6 +29,10 @@ CONFIG_BOOTDELAY=5
 CONFIG_USE_BOOTARGS=y
 CONFIG_BOOTARGS="console=ttyS0,115200 initrd=0x90000000 root=/dev/ram0 rw init=/sbin/init ramdisk_size=10000000 earlycon panic=-1 nosmp kvm-arm.mode=nvhe"
 CONFIG_SPL_MAX_SIZE=0x40000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_SPL_HAS_CUSTOM_MALLOC_START=y
+CONFIG_SPL_CUSTOM_SYS_MALLOC_ADDR=0xbfa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_CACHE=y
Signature · 1 line
2.25.1
#45 lore raw

PATCH 15/20 arm: socfpga: smc: Add memory coherency support to mailbox command

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

As cache is enabled in U-Boot and disabled in ATF(BL31). We need to perform cache flush of buffers that are shared between U-Boot and ATF using secure monitor calls.

---
 arch/arm/mach-socfpga/smc_api.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
arch/arm/mach-socfpga/smc_api.c +10 -3
index ebaa0b8fa17..dac888c399f 100644
@@ -1,9 +1,10 @@
 // SPDX-License-Identifier: GPL-2.0+
 /*
- * Copyright (C) 2020 Intel Corporation <www.intel.com>
+ * Copyright (C) 2020-2024 Intel Corporation <www.intel.com>
  *
  */
 
+#include <cpu_func.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
 #include <linux/errno.h>
@@ -40,10 +41,16 @@ int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32 *resp_buf_len,
 	args[2] = len;
 	args[3] = urgent;
 	args[4] = (u64)resp_buf;
-	if (resp_buf_len)
+
+	if (arg && len > 0)
+		flush_dcache_range((u64)arg, (u64)arg + len);
+
+	if (resp_buf && resp_buf_len && *resp_buf_len > 0) {
 		args[5] = *resp_buf_len;
-	else
+		flush_dcache_range((u64)resp_buf, (u64)resp_buf + *resp_buf_len);
+	} else {
 		args[5] = 0;
+	}
 
 	ret = invoke_smc(INTEL_SIP_SMC_MBOX_SEND_CMD, args, ARRAY_SIZE(args),
 			 resp, ARRAY_SIZE(resp));
Signature · 1 line
2.25.1
#46 lore raw

Re: [PATCH v1 15/20] arm: socfpga: smc: Add memory coherency support to mailbox command

Quoted 29 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

As cache is enabled in U-Boot and disabled in ATF(BL31). We need to perform cache flush of buffers that are shared between U-Boot and ATF using secure monitor calls.

---
  arch/arm/mach-socfpga/smc_api.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
arch/arm/mach-socfpga/smc_api.c +2 -1
index ebaa0b8fa17..dac888c399f 100644
@@ -1,9 +1,10 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
- * Copyright (C) 2020 Intel Corporation <www.intel.com>
+ * Copyright (C) 2020-2024 Intel Corporation <www.intel.com>
   *
   */
 
+#include <cpu_func.h>
  #include <asm/ptrace.h>
  #include <asm/system.h>
  #include <linux/errno.h>

arch/arm/mach-socfpga/smc_api.c int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32 *resp_buf_len, · line 46

Quoted 7 lines
arch/arm/mach-socfpga/smc_api.c +3 -1
@@ -40,10 +41,16 @@ int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32 *resp_buf_len,
  	args[2] = len;
  	args[3] = urgent;
  	args[4] = (u64)resp_buf;
-	if (resp_buf_len)
+
+	if (arg && len > 0)
+		flush_dcache_range((u64)arg, (u64)arg + len);

If really needed, the cast should be some uintptr_t

#47 lore raw

RE: [PATCH v1 15/20] arm: socfpga: smc: Add memory coherency support to mailbox command

Hi,

Quoted 43 lines

-----Original Message-----
From: Marek Vasut <[email protected]>
Sent: Saturday, September 21, 2024 9:59 PM
To: Chee, Tien Fong <[email protected]>; [email protected]
Cc: Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>; Rao, Mahesh <[email protected]>
Subject: Re: [PATCH v1 15/20] arm: socfpga: smc: Add memory coherency support to mailbox command

arch/arm/mach-socfpga/smc_api.c int smc_send_mailbox(u32 cmd, u32 len, u32 *arg,

Quoted 30 lines · On 9/20/24 9:02 AM, [email protected] wrote:

From: Tien Fong Chee <[email protected]>

As cache is enabled in U-Boot and disabled in ATF(BL31). We need to perform cache flush of buffers that are shared between U-Boot and ATF using secure monitor calls.

---
  arch/arm/mach-socfpga/smc_api.c | 13 ++++++++++---
  1 file changed, 10 insertions(+), 3 deletions(-)
(quoted diff) +0 -0

b/arch/arm/mach-socfpga/smc_api.c index ebaa0b8fa17..dac888c399f 100644

arch/arm/mach-socfpga/smc_api.c +2 -1
@@ -1,9 +1,10 @@
  // SPDX-License-Identifier: GPL-2.0+
  /*
- * Copyright (C) 2020 Intel Corporation <www.intel.com>
+ * Copyright (C) 2020-2024 Intel Corporation <www.intel.com>
   *
   */
 
+#include <cpu_func.h>
  #include <asm/ptrace.h>
  #include <asm/system.h>
  #include <linux/errno.h>
@@ -40,10 +41,16 @@ int smc_send_mailbox(u32 cmd, u32 len, u32 *arg,

u8 urgent, u32 *resp_buf_len,

Quoted 8 lines

arch/arm/mach-socfpga/smc_api.c int smc_send_mailbox(u32 cmd, u32 len, u32 *arg, u8 urgent, u32 *resp_buf_len, · line 46

Quoted 7 lines
arch/arm/mach-socfpga/smc_api.c +3 -1
  	args[2] = len;
  	args[3] = urgent;
  	args[4] = (u64)resp_buf;
-	if (resp_buf_len)
+
+	if (arg && len > 0)
+		flush_dcache_range((u64)arg, (u64)arg + len);

If really needed, the cast should be some uintptr_t

Sure, we will fix it.

Regards,
Tien Fong

#48 lore raw

PATCH 16/20 ddr: altera: Add DDR driver for Agilex5 series

In reply to [email protected]

From: Tingting Meng <[email protected]>

Adding DDR driver support for Agilex5 series.

---
 MAINTAINERS                                   |   2 +
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi      | 251 +++++++
 arch/arm/dts/socfpga_agilex5.dtsi             |   7 +
 arch/arm/mach-socfpga/include/mach/firewall.h |  23 +-
 drivers/ddr/altera/Makefile                   |   1 +
 drivers/ddr/altera/iossm_mailbox.c            | 613 ++++++++++++++++++
 drivers/ddr/altera/iossm_mailbox.h            | 186 ++++++
 drivers/ddr/altera/sdram_agilex5.c            | 377 +++++++++++
 drivers/ddr/altera/sdram_soc64.c              |  78 ++-
 drivers/ddr/altera/sdram_soc64.h              |  32 +-
 10 files changed, 1547 insertions(+), 23 deletions(-)
 create mode 100644 drivers/ddr/altera/iossm_mailbox.c
 create mode 100644 drivers/ddr/altera/iossm_mailbox.h
 create mode 100644 drivers/ddr/altera/sdram_agilex5.c
MAINTAINERS +2 -0
index 2050ae24df8..1837d283b2f 100644
@@ -146,8 +146,10 @@ ARM ALTERA SOCFPGA
 M:	Marek Vasut <[email protected]>
 M:	Simon Goldschmidt <[email protected]>
 M:	Tien Fong Chee <[email protected]>
+M:	Tingting Meng <[email protected]>
 S:	Maintained
 T:	git https://source.denx.de/u-boot/custodians/u-boot-socfpga.git
+F:	drivers/ddr/altera/
 F:	arch/arm/mach-socfpga/
 F:	drivers/sysreset/sysreset_socfpga*
 
arch/arm/dts/socfpga_agilex5-u-boot.dtsi +251 -0

269 lines not on this page · raw message

arch/arm/dts/socfpga_agilex5.dtsi +7 -0
index 03b55040497..4f17d8fc21e 100644
@@ -544,6 +544,13 @@
 			status = "disabled";
 		};
 
+		sdr: sdr@18000000 {
+			compatible = "intel,sdr-ctl-agilex5";
+			reg = <0x18000000 0x400000>;
+			resets = <&rst DDRSCH_RESET>;
+			bootph-all;
+		};
+
 		/* QSPI address not available yet */
 		qspi: spi@108d2000 {
 			compatible = "cdns,qspi-nor";
arch/arm/mach-socfpga/include/mach/firewall.h +19 -4
index 5cb7f23f8f0..9c3f3313af6 100644
@@ -1,7 +1,6 @@
-/* SPDX-License-Identifier: GPL-2.0
- *
- * Copyright (C) 2017-2019 Intel Corporation <www.intel.com>
- *
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2017-2024 Intel Corporation <www.intel.com>
  */
 
 #ifndef	_FIREWALL_H_
@@ -126,11 +125,27 @@ struct socfpga_firwall_l4_sys {
 #define FW_MPU_DDR_SCR_NONMPUREGION0ADDR_LIMITEXT	0x9c
 #define FW_MPU_DDR_SCR_NONMPUREGION0ADDR_LIMITEXT_FIELD	0xff
 
+/* Firewall F2SDRAM DDR SCR registers */
+#define FW_F2SDRAM_DDR_SCR_EN				0x00
+#define FW_F2SDRAM_DDR_SCR_EN_SET			0x04
+#define FW_F2SDRAM_DDR_SCR_REGION0ADDR_BASE		0x10
+#define FW_F2SDRAM_DDR_SCR_REGION0ADDR_BASEEXT		0x14
+#define FW_F2SDRAM_DDR_SCR_REGION0ADDR_LIMIT		0x18
+#define FW_F2SDRAM_DDR_SCR_REGION0ADDR_LIMITEXT		0x1c
+
 #define MPUREGION0_ENABLE				BIT(0)
 #define NONMPUREGION0_ENABLE				BIT(8)
 
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
+#define FW_MPU_DDR_SCR_WRITEL(data, reg)		\
+	writel(data, SOCFPGA_FW_DDR_CCU_DMI0_ADDRESS + (reg)); \
+	writel(data, SOCFPGA_FW_DDR_CCU_DMI1_ADDRESS + (reg))
+#define FW_F2SDRAM_DDR_SCR_WRITEL(data, reg)		\
+	writel(data, SOCFPGA_FW_TBU2NOC_ADDRESS + (reg))
+#else
 #define FW_MPU_DDR_SCR_WRITEL(data, reg)		\
 	writel(data, SOCFPGA_FW_MPU_DDR_SCR_ADDRESS + (reg))
+#endif
 
 void firewall_setup(void);
 
drivers/ddr/altera/Makefile +1 -0
index 9fa5d85a27e..117868b6d01 100644
@@ -12,4 +12,5 @@ obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += sdram_arria10.o
 obj-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += sdram_soc64.o sdram_s10.o
 obj-$(CONFIG_TARGET_SOCFPGA_AGILEX) += sdram_soc64.o sdram_agilex.o
 obj-$(CONFIG_TARGET_SOCFPGA_N5X) += sdram_soc64.o sdram_n5x.o
+obj-$(CONFIG_TARGET_SOCFPGA_AGILEX5) += sdram_soc64.o sdram_agilex5.o iossm_mailbox.o
 endif
drivers/ddr/altera/iossm_mailbox.c new file +613 -0

613 lines not on this page · raw message

drivers/ddr/altera/iossm_mailbox.h new file +186 -0

186 lines not on this page · raw message

drivers/ddr/altera/sdram_agilex5.c new file +377 -0

377 lines not on this page · raw message

drivers/ddr/altera/sdram_soc64.c +70 -8

138 lines not on this page · raw message

drivers/ddr/altera/sdram_soc64.h +21 -11
index 87a70a861ba..f75a1e47cc3 100644
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 /*
- * Copyright (C) 2017-2019 Intel Corporation <www.intel.com>
+ * Copyright (C) 2017-2024 Intel Corporation <www.intel.com>
  */
 
 #ifndef	_SDRAM_SOC64_H_
@@ -13,11 +13,19 @@ struct altera_sdram_priv {
 	struct reset_ctl_bulk resets;
 };
 
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
+struct altera_sdram_plat {
+	fdt_addr_t mpfe_base_addr;
+	bool dualport;
+	bool dualemif;
+};
+#else
 struct altera_sdram_plat {
 	void __iomem *hmc;
 	void __iomem *ddr_sch;
 	void __iomem *iomhc;
 };
+#endif
 
 /* ECC HMC registers */
 #define DDRIOCTRL			0x8
@@ -65,6 +73,8 @@ struct altera_sdram_plat {
 #define CTRLCFG0			0x28
 #define CTRLCFG1			0x2c
 #define CTRLCFG3                        0x34
+#define CTRLCFG5                        0x3c
+#define CTRLCFG6                        0x40
 #define DRAMTIMING0			0x50
 #define CALTIMING0			0x7c
 #define CALTIMING1			0x80
@@ -79,7 +89,7 @@ struct altera_sdram_plat {
 #define NIOSRESERVED2			0x118
 
 #define DRAMADDRW_CFG_COL_ADDR_WIDTH(x)			\
-	(((x) >> 0) & 0x1F)
+	((x) & 0x1F)
 #define DRAMADDRW_CFG_ROW_ADDR_WIDTH(x)			\
 	(((x) >> 5) & 0x1F)
 #define DRAMADDRW_CFG_BANK_ADDR_WIDTH(x)		\
@@ -90,7 +100,7 @@ struct altera_sdram_plat {
 	(((x) >> 16) & 0x7)
 
 #define CTRLCFG0_CFG_MEMTYPE(x)				\
-	(((x) >> 0) & 0xF)
+	((x) & 0xF)
 #define CTRLCFG0_CFG_DIMM_TYPE(x)			\
 	(((x) >> 4) & 0x7)
 #define CTRLCFG0_CFG_AC_POS(x)				\
@@ -99,17 +109,17 @@ struct altera_sdram_plat {
 	(((x) >> 9) & 0x1F)
 
 #define CTRLCFG1_CFG_DBC3_BURST_LEN(x)			\
-	(((x) >> 0) & 0x1F)
+	((x) & 0x1F)
 #define CTRLCFG1_CFG_ADDR_ORDER(x)			\
 	(((x) >> 5) & 0x3)
 #define CTRLCFG1_CFG_CTRL_EN_ECC(x)			\
 	(((x) >> 7) & 0x1)
 
 #define DRAMTIMING0_CFG_TCL(x)				\
-	(((x) >> 0) & 0x7F)
+	((x) & 0x7F)
 
 #define CALTIMING0_CFG_ACT_TO_RDWR(x)			\
-	(((x) >> 0) & 0x3F)
+	((x) & 0x3F)
 #define CALTIMING0_CFG_ACT_TO_PCH(x)			\
 	(((x) >> 6) & 0x3F)
 #define CALTIMING0_CFG_ACT_TO_ACT(x)			\
@@ -118,7 +128,7 @@ struct altera_sdram_plat {
 	(((x) >> 18) & 0x3F)
 
 #define CALTIMING1_CFG_RD_TO_RD(x)			\
-	(((x) >> 0) & 0x3F)
+	((x) & 0x3F)
 #define CALTIMING1_CFG_RD_TO_RD_DC(x)			\
 	(((x) >> 6) & 0x3F)
 #define CALTIMING1_CFG_RD_TO_RD_DB(x)			\
@@ -129,7 +139,7 @@ struct altera_sdram_plat {
 	(((x) >> 24) & 0x3F)
 
 #define CALTIMING2_CFG_RD_TO_WR_DB(x)			\
-	(((x) >> 0) & 0x3F)
+	((x) & 0x3F)
 #define CALTIMING2_CFG_RD_TO_WR_PCH(x)			\
 	(((x) >> 6) & 0x3F)
 #define CALTIMING2_CFG_RD_AP_TO_VALID(x)		\
@@ -140,7 +150,7 @@ struct altera_sdram_plat {
 	(((x) >> 24) & 0x3F)
 
 #define CALTIMING3_CFG_WR_TO_WR_DB(x)			\
-	(((x) >> 0) & 0x3F)
+	((x) & 0x3F)
 #define CALTIMING3_CFG_WR_TO_RD(x)			\
 	(((x) >> 6) & 0x3F)
 #define CALTIMING3_CFG_WR_TO_RD_DC(x)			\
@@ -151,7 +161,7 @@ struct altera_sdram_plat {
 	(((x) >> 24) & 0x3F)
 
 #define CALTIMING4_CFG_WR_AP_TO_VALID(x)		\
-	(((x) >> 0) & 0x3F)
+	((x) & 0x3F)
 #define CALTIMING4_CFG_PCH_TO_VALID(x)			\
 	(((x) >> 6) & 0x3F)
 #define CALTIMING4_CFG_PCH_ALL_TO_VALID(x)		\
@@ -162,7 +172,7 @@ struct altera_sdram_plat {
 	(((x) >> 26) & 0x3F)
 
 #define CALTIMING9_CFG_4_ACT_TO_ACT(x)			\
-	(((x) >> 0) & 0xFF)
+	((x) & 0xFF)
 
 /* Firewall DDR scheduler MPFE */
 #define FW_HMC_ADAPTOR_REG_ADDR			0xf8020004
Signature · 1 line
2.25.1
#49 lore raw

PATCH 17/20 arm: socfpga: agilex5: Add SPL for Agilex5 SoCFPGA

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Add SPL support for Agilex5 SoCFPGA.

---
 arch/arm/mach-socfpga/Makefile      |  3 ++
 arch/arm/mach-socfpga/spl_agilex5.c | 84 +++++++++++++++++++++++++++++
 2 files changed, 87 insertions(+)
 create mode 100644 arch/arm/mach-socfpga/spl_agilex5.c
arch/arm/mach-socfpga/Makefile +3 -0
index 32b3e7a57e2..3fbe3d4fa63 100644
@@ -66,6 +66,8 @@ obj-y	+= reset_manager_s10.o
 obj-y	+= wrap_handoff_soc64.o
 obj-y	+= wrap_pll_config_soc64.o
 obj-y	+= ccu_ncore3.o
+obj-y	+= system_manager_soc64.o
+obj-y	+= timer_s10.o
 endif
 
 ifdef CONFIG_TARGET_SOCFPGA_N5X
@@ -109,6 +111,7 @@ obj-y	+= spl_n5x.o
 endif
 ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
 obj-y	+= spl_soc64.o
+obj-y	+= spl_agilex5.o
 endif
 else
 obj-$(CONFIG_SPL_ATF) += secure_reg_helper.o
arch/arm/mach-socfpga/spl_agilex5.c new file +84 -0

84 lines not on this page · raw message

Signature · 1 line
2.25.1
#50 lore raw

PATCH 18/20 configs: socfpga: soc64: agilex5: Enable XGMAC

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Enable XGMAC for SoCFPGA Agilex5 devkit.

---
 configs/socfpga_agilex5_defconfig | 1 +
 1 file changed, 1 insertion(+)
configs/socfpga_agilex5_defconfig +1 -0
index 81bbe967dcf..a4a5064d9c2 100644
@@ -92,3 +92,4 @@ CONFIG_WDT=y
 CONFIG_PANIC_HANG=y
 CONFIG_SPL_CRC32=y
 # CONFIG_EFI_LOADER is not set
+CONFIG_DWC_ETH_XGMAC=y
Signature · 1 line
2.25.1
#51 lore raw

PATCH 19/20 arm: socfpga: soc64: Add support for board_boot_order()

In reply to [email protected]

From: Tien Fong Chee <[email protected]>

Add board_boot_order() to retrieve the list of boot devices from spl-boot-order property in device tree. This board_boot_order() would be used for all Intel SOC64 devices.

---
 arch/arm/mach-socfpga/spl_soc64.c | 103 ++++++++++++++++++++++++++++++
 1 file changed, 103 insertions(+)
arch/arm/mach-socfpga/spl_soc64.c +103 -0
index 3bfe4bb9dd3..9bfa15e9ded 100644
@@ -15,6 +15,109 @@ u32 spl_boot_device(void)
 	return BOOT_DEVICE_MMC1;
 }
 
+/* This function is to map specified node onto SPL boot devices */
+static int spl_node_to_boot_device(int node)
+{
+	const void *blob = gd->fdt_blob;
+	struct udevice *parent;
+	const char *prop;
+
+	if (!uclass_get_device_by_of_offset(UCLASS_MMC, node, &parent))
+		return BOOT_DEVICE_MMC1;
+	else if (!uclass_get_device_by_of_offset(UCLASS_SPI_FLASH, node, &parent))
+		return BOOT_DEVICE_SPI;
+	else if (!uclass_get_device_by_of_offset(UCLASS_MTD, node, &parent))
+		return BOOT_DEVICE_NAND;
+
+	prop = fdt_getprop(blob, node, "device_type", NULL);
+	if (prop) {
+		if (!strcmp(prop, "memory"))
+			return BOOT_DEVICE_RAM;
+
+		printf("%s: unknown device_type %s\n", __func__, prop);
+	}
+
+	return -ENODEV;
+}
+
+static void default_spl_boot_list(u32 *spl_boot_list, int length)
+{
+	spl_boot_list[0] = spl_boot_device();
+
+	if (length > 1)
+		spl_boot_list[1] = BOOT_DEVICE_SPI;
+
+	if (length > 2)
+		spl_boot_list[2] = BOOT_DEVICE_NAND;
+}
+
+void board_boot_order(u32 *spl_boot_list)
+{
+	int idx = 0;
+	const void *blob = gd->fdt_blob;
+	int chosen_node = fdt_path_offset(blob, "/chosen");
+	const char *conf;
+	int elem;
+	int boot_device;
+	int node;
+	int length;
+
+	/* expect valid initialized spl_boot_list */
+	if (!spl_boot_list)
+		return;
+
+	length = 1;
+	while (spl_boot_list[length] == spl_boot_list[length - 1])
+		length++;
+
+	debug("%s: chosen_node is %d\n", __func__, chosen_node);
+	if (chosen_node < 0) {
+		printf("%s: /chosen not found, using default\n", __func__);
+		default_spl_boot_list(spl_boot_list, length);
+		return;
+	}
+
+	for (elem = 0;
+	    (conf = fdt_stringlist_get(blob, chosen_node,
+			"u-boot,spl-boot-order", elem, NULL));
+	    elem++) {
+		if (idx >= length) {
+			printf("%s: limit %d to spl_boot_list exceeded\n", __func__,
+			       length);
+			break;
+		}
+
+		/* Resolve conf item as a path in device tree */
+		node = fdt_path_offset(blob, conf);
+		if (node < 0) {
+			debug("%s: could not find %s in FDT\n", __func__, conf);
+			continue;
+		}
+
+		/* Try to map spl node back onto SPL boot devices */
+		boot_device = spl_node_to_boot_device(node);
+		if (boot_device < 0) {
+			debug("%s: could not map node @%x to a boot-device\n",
+			      __func__, node);
+			continue;
+		}
+
+		spl_boot_list[idx] = boot_device;
+		debug("%s: spl_boot_list[%d] = %u\n", __func__, idx,
+		      spl_boot_list[idx]);
+		idx++;
+	}
+
+	if (idx == 0) {
+		if (!conf && !elem) {
+			printf("%s: spl-boot-order invalid, using default\n", __func__);
+			default_spl_boot_list(spl_boot_list, length);
+		} else {
+			printf("%s: no valid element spl-boot-order list\n", __func__);
+		}
+	}
+}
+
 #if IS_ENABLED(CONFIG_SPL_MMC)
 u32 spl_boot_mode(const u32 boot_device)
 {
Signature · 1 line
2.25.1
#52 lore raw

PATCH 20/20 configs: socfpga: soc64: agilex5: Enable QSPI boot with UBI / UBIFS

In reply to [email protected]

From: Alif Zakuan Yuslaimi <[email protected]>

Add the required configuration in the U-Boot env to enable Linux QSPI boot with UBI / UBIFS.

---
 configs/socfpga_agilex5_defconfig      | 1 +
 include/configs/socfpga_soc64_common.h | 5 +++++
 2 files changed, 6 insertions(+)
configs/socfpga_agilex5_defconfig +1 -0
index a4a5064d9c2..4ac118f1fec 100644
@@ -37,6 +37,7 @@ CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
 # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
 CONFIG_SPL_CACHE=y
 CONFIG_SPL_SPI_FLASH_MTD=y
+CONFIG_SPL_MTD=y
 CONFIG_SPL_SPI_LOAD=y
 CONFIG_SYS_SPI_U_BOOT_OFFS=0x04000000
 CONFIG_SPL_ATF=y
include/configs/socfpga_soc64_common.h +5 -0
index b7ee1dbf201..7a44f042165 100644
@@ -56,6 +56,11 @@
 
 #define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
 	"bootcmd_qspi=ubi detach; sf probe && " \
+	"setenv mtdids 'nor0=nor0,nand0=nand.0' && " \
+	"setenv mtdparts 'mtdparts=nor0:66m(u-boot),190m(root); " \
+	"nand.0:2m(nand_uboot),500m(nand_root)' && " \
+	"env select UBI; saveenv && " \
+	"ubi part root && " \
 	"if ubi part root && ubi readvol ${scriptaddr} script; " \
 	"then echo QSPI: Running script from UBIFS; " \
 	"elif sf read ${scriptaddr} ${qspiscriptaddr} ${scriptsize}; " \
Signature · 1 line
2.25.1
#53 lore raw
In reply to [email protected]

Hi,

Quoted 62 lines · On Fri, 20 Sept 2024 at 09:03, <[email protected]> wrote:

From: Tien Fong Chee <[email protected]>

This patch set introduces boot support for the Altera SoCFPGA Agilex 5 platform in U-Boot. The changes include:
1. Board-specific configurations and setup required to enable Agilex 5 operation in U-Boot.
2. Integration of cache coherency unit (CCU) initialization routine, including CCU conguration in DT.
3. Clock, firewall (configured in DT), SMMU, low level initialization specific to Agilex 5.
4. Integration of memory initialization routine, including DDR setup.

This patch set has been tested on Agilex 5 devkit with QSPI boot (UBI/UBIFS) and RAM boot (TFTP & ARM DS debugger).

Alif Zakuan Yuslaimi (1):
configs: socfpga: soc64: agilex5: Enable QSPI boot with UBI / UBIFS

Tien Fong Chee (18):
arm: socfpga: agilex5: Add new system manager base addresses
arm: socfpga: Add support for agilex5 clock manager
linker: Add SPL linker script for SoC64 devices
arm: socfpga: agilex5: Add low level initialization
arm: socfpga: Add handoff data support for SoCFPGA Agilex5 device
arm: dts: agilex5: Add HPS cache coherency unit configuration settings
arm: dts: agilex5: Add firewall configure settings
arm: dts: agilex5: Enable XGMAC
sysreset: Add reset support to SoCFPGA Agilex5 device
arm: socfpga: agilex5: Enable cache flush for system memory cache in
CCU
arm: socfpga: agilex5: Add SMMU initialization
arm: socfpga: agilex5: Update CPU info
arm: socfpga: Export board ID as U-Boot environment variable
configs: agilex5: Add configuration for malloc pool
arm: socfpga: smc: Add memory coherency support to mailbox command
arm: socfpga: agilex5: Add SPL for Agilex5 SoCFPGA
configs: socfpga: soc64: agilex5: Enable XGMAC
arm: socfpga: soc64: Add support for board_boot_order()

Tingting Meng (1):
ddr: altera: Add DDR driver for Agilex5 series

 MAINTAINERS                                   |   2 +
 arch/arm/Kconfig                              |   1 +
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi      | 660 ++++++++++++++++++
 arch/arm/dts/socfpga_agilex5.dtsi             |   7 +
 .../arm/dts/socfpga_agilex5_socdk-u-boot.dtsi |  33 +
 arch/arm/mach-socfpga/Makefile                |   6 +
 arch/arm/mach-socfpga/ccu_ncore3.c            |  64 ++
 arch/arm/mach-socfpga/include/mach/firewall.h |  23 +-
 .../mach-socfpga/include/mach/handoff_soc64.h |   4 +-
 arch/arm/mach-socfpga/include/mach/misc.h     |   1 +
 .../include/mach/reset_manager_soc64.h        |  12 +-
 .../include/mach/system_manager_soc64.h       | 129 ++--
 arch/arm/mach-socfpga/lowlevel_init_agilex5.S |  57 ++
 arch/arm/mach-socfpga/misc.c                  |  24 +-
 arch/arm/mach-socfpga/misc_soc64.c            |  12 +-
 arch/arm/mach-socfpga/smc_api.c               |  13 +-
 arch/arm/mach-socfpga/spl_agilex5.c           |  84 +++
 arch/arm/mach-socfpga/spl_soc64.c             | 120 +++-
 arch/arm/mach-socfpga/u-boot-spl-soc64.lds    |  80 +++
Quoted 8 lines
 arch/arm/mach-socfpga/wrap_handoff_soc64.c    |  10 +-
 configs/socfpga_agilex5_defconfig             |   6 +
 drivers/ddr/altera/Makefile                   |   1 +
 drivers/ddr/altera/iossm_mailbox.c            | 613 ++++++++++++++++
 drivers/ddr/altera/iossm_mailbox.h            | 186 +++++
 drivers/ddr/altera/sdram_agilex5.c            | 377 ++++++++++
 drivers/ddr/altera/sdram_soc64.c              |  78 ++-
 drivers/ddr/altera/sdram_soc64.h              |  32 +-

Can we please put RAM drivers in drivers/ram ? Also, do make sure they actually use UCLASS_RAM

Quoted 14 lines
 drivers/sysreset/Kconfig                      |   7 +
 drivers/sysreset/Makefile                     |   1 +
 drivers/sysreset/sysreset_socfpga_agilex5.c   |  47 ++
 include/configs/socfpga_soc64_common.h        |   5 +
 31 files changed, 2605 insertions(+), 90 deletions(-)
 create mode 100644 arch/arm/mach-socfpga/ccu_ncore3.c
 create mode 100644 arch/arm/mach-socfpga/lowlevel_init_agilex5.S
 create mode 100644 arch/arm/mach-socfpga/spl_agilex5.c
 create mode 100644 arch/arm/mach-socfpga/u-boot-spl-soc64.lds
 create mode 100644 drivers/ddr/altera/iossm_mailbox.c
 create mode 100644 drivers/ddr/altera/iossm_mailbox.h
 create mode 100644 drivers/ddr/altera/sdram_agilex5.c
 create mode 100644 drivers/sysreset/sysreset_socfpga_agilex5.c
Quoted 3 lines

--
2.25.1

Regards,
Simon

#54 lore raw

Hi,

Quoted 86 lines

-----Original Message-----
From: Simon Glass <[email protected]>
Sent: Friday, September 20, 2024 3:26 PM
To: Chee, Tien Fong <[email protected]>
Cc: [email protected]; Marek Vasut <[email protected]>; Simon Goldschmidt <[email protected]>; Meng, Tingting <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Hea, Kok Kiang <[email protected]>
Subject: Re: [PATCH v1 00/20] SoCFPGA: Add Boot Support for Agilex 5 in U- Boot

Hi,

Quoted 62 lines · On Fri, 20 Sept 2024 at 09:03, <[email protected]> wrote:

From: Tien Fong Chee <[email protected]>

This patch set introduces boot support for the Altera SoCFPGA Agilex 5 platform in U-Boot. The changes include:
1. Board-specific configurations and setup required to enable Agilex 5 operation in U-Boot.
2. Integration of cache coherency unit (CCU) initialization routine, including CCU conguration in DT.
3. Clock, firewall (configured in DT), SMMU, low level initialization specific to Agilex 5.
4. Integration of memory initialization routine, including DDR setup.

This patch set has been tested on Agilex 5 devkit with QSPI boot (UBI/UBIFS) and RAM boot (TFTP & ARM DS debugger).

Alif Zakuan Yuslaimi (1):
configs: socfpga: soc64: agilex5: Enable QSPI boot with UBI / UBIFS

Tien Fong Chee (18):
arm: socfpga: agilex5: Add new system manager base addresses
arm: socfpga: Add support for agilex5 clock manager
linker: Add SPL linker script for SoC64 devices
arm: socfpga: agilex5: Add low level initialization
arm: socfpga: Add handoff data support for SoCFPGA Agilex5 device
arm: dts: agilex5: Add HPS cache coherency unit configuration settings
arm: dts: agilex5: Add firewall configure settings
arm: dts: agilex5: Enable XGMAC
sysreset: Add reset support to SoCFPGA Agilex5 device
arm: socfpga: agilex5: Enable cache flush for system memory cache in
CCU
arm: socfpga: agilex5: Add SMMU initialization
arm: socfpga: agilex5: Update CPU info
arm: socfpga: Export board ID as U-Boot environment variable
configs: agilex5: Add configuration for malloc pool
arm: socfpga: smc: Add memory coherency support to mailbox command
arm: socfpga: agilex5: Add SPL for Agilex5 SoCFPGA
configs: socfpga: soc64: agilex5: Enable XGMAC
arm: socfpga: soc64: Add support for board_boot_order()

Tingting Meng (1):
ddr: altera: Add DDR driver for Agilex5 series

 MAINTAINERS                                   |   2 +
 arch/arm/Kconfig                              |   1 +
 arch/arm/dts/socfpga_agilex5-u-boot.dtsi      | 660 ++++++++++++++++++
 arch/arm/dts/socfpga_agilex5.dtsi             |   7 +
 .../arm/dts/socfpga_agilex5_socdk-u-boot.dtsi |  33 +
 arch/arm/mach-socfpga/Makefile                |   6 +
 arch/arm/mach-socfpga/ccu_ncore3.c            |  64 ++
 arch/arm/mach-socfpga/include/mach/firewall.h |  23 +-
 .../mach-socfpga/include/mach/handoff_soc64.h |   4 +-
 arch/arm/mach-socfpga/include/mach/misc.h     |   1 +
 .../include/mach/reset_manager_soc64.h        |  12 +-
 .../include/mach/system_manager_soc64.h       | 129 ++--
 arch/arm/mach-socfpga/lowlevel_init_agilex5.S |  57 ++
 arch/arm/mach-socfpga/misc.c                  |  24 +-
 arch/arm/mach-socfpga/misc_soc64.c            |  12 +-
 arch/arm/mach-socfpga/smc_api.c               |  13 +-
 arch/arm/mach-socfpga/spl_agilex5.c           |  84 +++
 arch/arm/mach-socfpga/spl_soc64.c             | 120 +++-
 arch/arm/mach-socfpga/u-boot-spl-soc64.lds    |  80 +++
Quoted 8 lines
 arch/arm/mach-socfpga/wrap_handoff_soc64.c    |  10 +-
 configs/socfpga_agilex5_defconfig             |   6 +
 drivers/ddr/altera/Makefile                   |   1 +
 drivers/ddr/altera/iossm_mailbox.c            | 613 ++++++++++++++++
 drivers/ddr/altera/iossm_mailbox.h            | 186 +++++
 drivers/ddr/altera/sdram_agilex5.c            | 377 ++++++++++
 drivers/ddr/altera/sdram_soc64.c              |  78 ++-
 drivers/ddr/altera/sdram_soc64.h              |  32 +-
Quoted 2 lines

Can we please put RAM drivers in drivers/ram ? Also, do make sure they actually use UCLASS_RAM

The RAM here means for DDR, and UCLASS_RAM is used in DDR driver.

[...]

Regards,
Tien Fong