Skip to contentSkip to conversation

[Agilex7 M-series Platform Enablement v1 00/16]

PATCH In review [email protected] 2 participants 21 messages May 17, 2024 – May 20, 2024

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

cover [Agilex7 M-series Platform Enablement v1 00/16]

From: Tingting Meng <[email protected]>

Intel Agilex7 M-Series is the highest peformance FPGA targeted for compute and memory-intensive application,this series is built using intel 7 process technology and expands upon I-Series device feature, offering in-package high bandwidth memory (HBM), memory interfaces for DDR5 SDRAM, and a hard memory Network-on-Chip (NoC) to maximize memory bandwidth. The series of patches include adding clock driver, IOSSM mailbox driver, UIBSSM mailbox driver,
DDR driver and HBM driver needed for Agilex 7 M-Series platform enablement and supports linux boot from SD card.

This series patches based on master branch https://source.denx.de/u-boot/u-boot

Complete compilation check on different devices, ran checkpatch and tested on board

Siew Chin Lim (1):
include: configs: soc64: Use CONFIG_SPL_ATF to differentiate bootfile

Sin Hui Kho (1):
ddr: altera: soc64: Restructure SDRAM firewall function

Teik Heng Chong (5):
arch: arm: mach-socfpga: Improve help info.
clk: altera: Add clock support for Agilex7 M-series
ddr: altera: Add uibssm mailbox for Agilex7 M-series
ddr: altera: soc64: Clean up bit-shift by zero bit
ddr: altera: soc64: Fix dram size calculation in clamshell mode

Wan Yee Lau (9):
arch: arm: dts: Add dts and dtsi for new platform Agilex7 M-series
arch: arm: mach-socfpga: Add Agilex7 M-series mach-socfgpa enablement
arch: arm: mach-socfpga: Update handoff settings for Agilex7 M-series
include: configs: Add config header file for Agilex7 M-series
ddr: altera: Add iossm mailbox for Agilex7 M-series
ddr: altera: Add DDR driver for Agilex7 M-series
arch: arm: mach-socfpga: Update kconfig for new platform Agilex7
M-series
arch: arm: dts: Update Makefile for new platform Agilex7 M-series
configs: Add defconfig for Agilex7 M-series

 arch/arm/Kconfig                              |   7 +-
 arch/arm/dts/Makefile                         |   1 +
 .../dts/socfpga_agilex7m_socdk-u-boot.dtsi    |  80 +++
 arch/arm/dts/socfpga_agilex7m_socdk.dts       | 185 +++++
 arch/arm/dts/socfpga_soc64_u-boot.dtsi        | 127 ++++
 arch/arm/mach-socfpga/Kconfig                 |  19 +
 arch/arm/mach-socfpga/Makefile                |  18 +
 .../include/mach/base_addr_soc64.h            |   6 +-
 .../mach-socfpga/include/mach/clock_manager.h |   2 +-
 .../mach-socfpga/include/mach/handoff_soc64.h |  14 +-
 arch/arm/mach-socfpga/include/mach/misc.h     |   3 +-
 .../include/mach/system_manager_soc64.h       |   7 +-
 arch/arm/mach-socfpga/misc.c                  |   6 +-
 arch/arm/mach-socfpga/spl_agilex7m.c          |  98 +++
 arch/arm/mach-socfpga/wrap_handoff_soc64.c    |   4 +
 board/intel/agilex7m-socdk/MAINTAINERS        |   7 +
 board/intel/agilex7m-socdk/Makefile           |   7 +
 board/intel/agilex7m-socdk/socfpga.c          |   4 +
 configs/socfpga_agilex7m_sdmmc_defconfig      | 114 ++++
 drivers/clk/altera/Makefile                   |   1 +
 drivers/ddr/altera/Makefile                   |   3 +-
 drivers/ddr/altera/iossm_mailbox.c            | 637 ++++++++++++++++++
 drivers/ddr/altera/iossm_mailbox.h            | 182 +++++
 drivers/ddr/altera/sdram_agilex7m.c           | 527 +++++++++++++++
 drivers/ddr/altera/sdram_soc64.c              |  42 +-
 drivers/ddr/altera/sdram_soc64.h              |  40 +-
 drivers/ddr/altera/uibssm_mailbox.c           | 311 +++++++++
 drivers/ddr/altera/uibssm_mailbox.h           | 117 ++++
 include/configs/socfpga_agilex7m_socdk.h      |  12 +
 29 files changed, 2551 insertions(+), 30 deletions(-)
 create mode 100644 arch/arm/dts/socfpga_agilex7m_socdk-u-boot.dtsi
 create mode 100644 arch/arm/dts/socfpga_agilex7m_socdk.dts
 create mode 100644 arch/arm/dts/socfpga_soc64_u-boot.dtsi
 create mode 100644 arch/arm/mach-socfpga/spl_agilex7m.c
 create mode 100644 board/intel/agilex7m-socdk/MAINTAINERS
 create mode 100644 board/intel/agilex7m-socdk/Makefile
 create mode 100644 board/intel/agilex7m-socdk/socfpga.c
 create mode 100644 configs/socfpga_agilex7m_sdmmc_defconfig
 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_agilex7m.c
 create mode 100644 drivers/ddr/altera/uibssm_mailbox.c
 create mode 100644 drivers/ddr/altera/uibssm_mailbox.h
 create mode 100644 include/configs/socfpga_agilex7m_socdk.h
Signature · 1 line
2.25.1
#1 lore raw

PATCH 1/16 arch: arm: dts: Add dts and dtsi for new platform Agilex7 M-series

From: Wan Yee Lau <[email protected]>

Add Agilex7 M-series dtsi and dts for new platform Agilex7 M-series.

---
 ...tsi => socfpga_agilex7m_socdk-u-boot.dtsi} |  37 ++++-
 ...x_socdk.dts => socfpga_agilex7m_socdk.dts} |  66 +++++++--
 arch/arm/dts/socfpga_soc64_u-boot.dtsi        | 127 ++++++++++++++++++
 3 files changed, 213 insertions(+), 17 deletions(-)
 copy arch/arm/dts/{socfpga_agilex_socdk-u-boot.dtsi => socfpga_agilex7m_socdk-u-boot.dtsi} (50%)
 copy arch/arm/dts/{socfpga_agilex_socdk.dts => socfpga_agilex7m_socdk.dts} (63%)
 create mode 100644 arch/arm/dts/socfpga_soc64_u-boot.dtsi
arch/arm/dts/socfpga_agilex7m_socdk-u-boot.dtsi renamed from arch/arm/dts/socfpga_agilex_socdk-u-boot.dtsi +31 -6
similarity index 50%
copy from arch/arm/dts/socfpga_agilex_socdk-u-boot.dtsi
copy to arch/arm/dts/socfpga_agilex7m_socdk-u-boot.dtsi
index 63df28e836..4369f0b545 100644
@@ -2,12 +2,18 @@
 /*
  * U-Boot additions
  *
- * Copyright (C) 2019-2022 Intel Corporation <www.intel.com>
+ * Copyright (C) 2024 Intel Corporation <www.intel.com>
  */
 
 #include "socfpga_agilex-u-boot.dtsi"
+#include "socfpga_soc64_u-boot.dtsi"
 
 /{
+	chosen {
+		stdout-path = "serial0:115200n8";
+		u-boot,spl-boot-order = &mmc;
+	};
+
 	aliases {
 		spi0 = &qspi;
 		i2c0 = &i2c1;
@@ -23,9 +29,7 @@
 	};
 
 	memory {
-		/* 8GB */
-		reg = <0 0x00000000 0 0x80000000>,
-		      <2 0x80000000 1 0x80000000>;
+		reg = <0 0x00000000 0 0x80000000>;
 	};
 };
 
@@ -34,22 +38,43 @@
 	spi-tx-bus-width = <4>;
 	spi-rx-bus-width = <4>;
 	bootph-all;
+	/delete-property/ cdns,read-delay;
 };
 
 &i2c1 {
 	status = "okay";
 };
 
+&nand {
+	status = "okay";
+	nand-bus-width = <16>;
+	bootph-all;
+};
+
 &mmc {
 	drvsel = <3>;
 	smplsel = <0>;
 	bootph-all;
 };
 
-&qspi {
-	status = "okay";
+&sdr {
+	compatible = "intel,sdr-ctl-agilex7m";
+
+	reg = <0xf8020000 0x100>;
+};
+
+&socfpga_l3interconnect_firewall {
+	soc_noc_fw_mpfe_csr_inst_0_mpfe_scr@f8020000 {
+		intel,offset-settings =
+			/* Disable MPFE firewall for SMMU */
+			<0x00000000 0x00010101 0x00010101>;
+	};
 };
 
 &watchdog0 {
 	bootph-all;
 };
+
+&binman {
+	/delete-node/ kernel;
+};
arch/arm/dts/socfpga_agilex7m_socdk.dts renamed from arch/arm/dts/socfpga_agilex_socdk.dts +55 -11

95 lines not on this page · raw message

arch/arm/dts/socfpga_soc64_u-boot.dtsi new file +127 -0

127 lines not on this page · raw message

Signature · 1 line
2.25.1
#2 lore raw

Re: [Agilex7 M-series Platform Enablement v1 01/16] arch: arm: dts: Add dts and dtsi for new platform Agilex7 M-series

Quoted 7 lines · On Fri, May 17, 2024 at 01:26:46PM +0800, [email protected] wrote:

From: Wan Yee Lau <[email protected]>

Add Agilex7 M-series dtsi and dts for new platform Agilex7 M-series.

Quoted 8 lines
---
 ...tsi => socfpga_agilex7m_socdk-u-boot.dtsi} |  37 ++++-
 ...x_socdk.dts => socfpga_agilex7m_socdk.dts} |  66 +++++++--
 arch/arm/dts/socfpga_soc64_u-boot.dtsi        | 127 ++++++++++++++++++
 3 files changed, 213 insertions(+), 17 deletions(-)
 copy arch/arm/dts/{socfpga_agilex_socdk-u-boot.dtsi => socfpga_agilex7m_socdk-u-boot.dtsi} (50%)
 copy arch/arm/dts/{socfpga_agilex_socdk.dts => socfpga_agilex7m_socdk.dts} (63%)
 create mode 100644 arch/arm/dts/socfpga_soc64_u-boot.dtsi

Why can't we use OF_UPSTREAM on these platforms?

Signature · 1 line
Tom
#3 lore raw

RE: [Agilex7 M-series Platform Enablement v1 01/16] arch: arm: dts: Add dts and dtsi for new platform Agilex7 M-series

Quoted 39 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Friday, May 17, 2024 11:08 PM
To: Meng, Tingting <[email protected]>
Cc: [email protected]; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Rayagonda Kokatanur <[email protected]>; Marek <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>; Lau, Wan Yee <[email protected]>
Subject: Re: [Agilex7 M-series Platform Enablement v1 01/16] arch: arm: dts:
Add dts and dtsi for new platform Agilex7 M-series

Quoted 12 lines · On Fri, May 17, 2024 at 01:26:46PM +0800, [email protected] wrote:

From: Wan Yee Lau <[email protected]>

Add Agilex7 M-series dtsi and dts for new platform Agilex7 M-series.

---
 ...tsi => socfpga_agilex7m_socdk-u-boot.dtsi} |  37 ++++-
...x_socdk.dts => socfpga_agilex7m_socdk.dts} |  66 +++++++--
 arch/arm/dts/socfpga_soc64_u-boot.dtsi        | 127 ++++++++++++++++++
 3 files changed, 213 insertions(+), 17 deletions(-)  copy
Quoted 4 lines

arch/arm/dts/{socfpga_agilex_socdk-u-boot.dtsi => socfpga_agilex7m_socdk-u-boot.dtsi} (50%) copy arch/arm/dts/{socfpga_agilex_socdk.dts => socfpga_agilex7m_socdk.dts} (63%) create mode 100644 arch/arm/dts/socfpga_soc64_u-boot.dtsi

Quoted 4 lines

Why can't we use OF_UPSTREAM on these platforms?

--
Tom

ok, Tom, will convert to OF_UPSTREAM

#4 lore raw

PATCH 2/16 arch: arm: mach-socfpga: Add Agilex7 M-series mach-socfgpa enablement

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Add platform related files for new platform Agilex7 M-series.

---
 arch/arm/mach-socfpga/include/mach/misc.h     |  3 +-
 .../{spl_agilex.c => spl_agilex7m.c}          | 45 ++++++++++++-------
 arch/arm/mach-socfpga/wrap_handoff_soc64.c    |  4 ++
 board/intel/agilex7m-socdk/MAINTAINERS        |  7 +++
 board/intel/agilex7m-socdk/socfpga.c          |  4 ++
 5 files changed, 45 insertions(+), 18 deletions(-)
 copy arch/arm/mach-socfpga/{spl_agilex.c => spl_agilex7m.c} (68%)
 create mode 100644 board/intel/agilex7m-socdk/MAINTAINERS
 create mode 100644 board/intel/agilex7m-socdk/socfpga.c
arch/arm/mach-socfpga/include/mach/misc.h +2 -1
index 8460acb00d..e271d2855f 100644
@@ -40,7 +40,8 @@ void socfpga_sdram_remap_zero(void);
 #endif
 
 #if defined(CONFIG_TARGET_SOCFPGA_STRATIX10) || \
-	defined(CONFIG_TARGET_SOCFPGA_AGILEX)
+	defined(CONFIG_TARGET_SOCFPGA_AGILEX) || \
+	defined(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 int is_fpga_config_ready(void);
 #endif
 
arch/arm/mach-socfpga/spl_agilex7m.c renamed from arch/arm/mach-socfpga/spl_agilex.c +28 -17

78 lines not on this page · raw message

arch/arm/mach-socfpga/wrap_handoff_soc64.c +4 -0
index 6aa9bb26b4..8c06b3d59e 100644
@@ -39,6 +39,10 @@ static enum endianness check_endianness(u32 handoff)
 	case SOC64_HANDOFF_DDR_PHY_INIT_ENGINE_MAGIC:
 		debug("%s: PHY engine handoff data\n", __func__);
 		return LITTLE_ENDIAN;
+#elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
+	case SOC64_HANDOFF_MAGIC_DDR:
+		debug("%s: SOC64_HANDOFF_MAGIC_DDR\n", __func__);
+		return BIG_ENDIAN;
 #endif
 	default:
 		debug("%s: Unknown endianness!!\n", __func__);
board/intel/agilex7m-socdk/MAINTAINERS new file +7 -0
new file mode 100644
index 0000000000..feb2916488
@@ -0,0 +1,7 @@
+SOCFPGA BOARD
+M:	Tien Fong Chee <[email protected]>
+M:	Teik Heng Chong <[email protected]>
+S:	Maintained
+F:	board/intel/agilex7m-socdk/
+F:	include/configs/socfpga_agilex7m_socdk.h
+F:	configs/socfpga_agilex7m_sdmmc_defconfig
board/intel/agilex7m-socdk/socfpga.c new file +4 -0
new file mode 100644
index 0000000000..52921d90aa
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Intel Corporation <www.intel.com>
+ */
Signature · 1 line
2.25.1
#5 lore raw

PATCH 3/16 arch: arm: mach-socfpga: Improve help info.

In reply to [email protected]

From: Teik Heng Chong <[email protected]>

To improve help info for bridge enable/disable command.

---
 arch/arm/mach-socfpga/misc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/misc.c +2 -2
index 80ad087034..79f7887519 100644
@@ -210,8 +210,8 @@ static int do_bridge(struct cmd_tbl *cmdtp, int flag, int argc,
 
 U_BOOT_CMD(bridge, 3, 1, do_bridge,
 	   "SoCFPGA HPS FPGA bridge control",
-	   "enable [mask] - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
-	   "bridge disable [mask] - Enable HPS-to-FPGA, FPGA-to-HPS, LWHPS-to-FPGA bridges\n"
+	   "enable [mask] - Enable HPS-to-FPGA (Bit 0), LWHPS-to-FPGA (Bit 1), FPGA-to-HPS (Bit 2) bridges \n"
+	   "bridge disable [mask] - Disable HPS-to-FPGA (Bit 0), LWHPS-to-FPGA (Bit 1), FPGA-to-HPS (Bit 2) bridges\n"
 	   ""
 );
 
Signature · 1 line
2.25.1
#6 lore raw

PATCH 4/16 arch: arm: mach-socfpga: Update handoff settings for Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Handoff settings updated for new platform Agilex7 M-series.

---
 arch/arm/mach-socfpga/include/mach/handoff_soc64.h | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/handoff_soc64.h +12 -2
index d839f28841..747016b436 100644
@@ -28,10 +28,20 @@
 #define SOC64_HANDOFF_OFFSET_DATA	0x10
 #define SOC64_HANDOFF_SIZE		4096
 
-#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_STRATIX10) || \
-	IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX)
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_SOC64) || \
+	IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 #define SOC64_HANDOFF_BASE		0xFFE3F000
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
+#define SOC64_HANDOFF_MISC		(SOC64_HANDOFF_BASE + 0x62C)
+/* DDR handoff */
+#define SOC64_HANDOFF_MAGIC_DDR	0x5344524D
+#define SOC64_HANDOFF_DDR_BASE	(SOC64_HANDOFF_BASE + 0x610)
+#define SOC64_HANDOFF_DDR_LEN	2
+#define SOC64_HANDOFF_DDR_INTERLEAVING_MODE_MASK	BIT(0)
+#define SOC64_HANDOFF_DDR_MEMORY_TYPE_MASK		BIT(0)
+#else
 #define SOC64_HANDOFF_MISC		(SOC64_HANDOFF_BASE + 0x610)
+#endif
 #elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
 #define SOC64_HANDOFF_BASE		0x0007F000
 #elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
Signature · 1 line
2.25.1
#7 lore raw

PATCH 5/16 include: configs: Add config header file for Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Add config header file for new platform Agilex7 M-series.

---
 .../{socfpga_agilex5_socdk.h => socfpga_agilex7m_socdk.h}   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
 copy include/configs/{socfpga_agilex5_socdk.h => socfpga_agilex7m_socdk.h} (55%)
include/configs/socfpga_agilex7m_socdk.h renamed from include/configs/socfpga_agilex5_socdk.h +3 -3
similarity index 55%
copy from include/configs/socfpga_agilex5_socdk.h
copy to include/configs/socfpga_agilex7m_socdk.h
index b5b5bd767f..433556804e 100644
@@ -4,9 +4,9 @@
  *
  */
 
-#ifndef __CONFIG_SOCFGPA_AGILEX5_H__
-#define __CONFIG_SOCFGPA_AGILEX5_H__
+#ifndef __CONFIG_SOCFGPA_AGILEX7M_H__
+#define __CONFIG_SOCFGPA_AGILEX7M_H__
 
 #include <configs/socfpga_soc64_common.h>
 
-#endif	/* __CONFIG_SOCFGPA_AGILEX5_H__ */
+#endif	/* __CONFIG_SOCFGPA_AGILEX7M_H__ */
Signature · 1 line
2.25.1
#8 lore raw

PATCH 6/16 include: configs: soc64: Use CONFIG_SPL_ATF to differentiate bootfile

In reply to [email protected]

From: Siew Chin Lim <[email protected]>

ATF boot flow (SPL->ATF->U-Boot Proper->OS) boot to OS via kernel.itb file using bootm command.

Change to use CONFIG_SPL_ATF to differentiate the bootfile of default environment variable. We shouldn't use CONFIG_FIT because it is enabled by default for U-Boot Proper.

---
 arch/arm/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/Kconfig +3 -0
index a0842e1933..56e190adf6 100644
@@ -21,6 +21,9 @@ config ARM64_CRC32
 	  not be present on all ARMv8.0, but is always present on ARMv8.1 and
 	  newer.
 
+config BOOTFILE
+	default kernel.itb if SPL_ATF && TARGET_SOCFPGA_SOC64
+
 config COUNTER_FREQUENCY
 	int "Timer clock frequency"
 	depends on ARM64 || CPU_V7A
Signature · 1 line
2.25.1
#9 lore raw

PATCH 7/16 clk: altera: Add clock support for Agilex7 M-series

In reply to [email protected]

From: Teik Heng Chong <[email protected]>

Agilex7 M-series reuse the clock driver from Agilex.

---
 arch/arm/mach-socfpga/include/mach/clock_manager.h | 2 +-
 arch/arm/mach-socfpga/misc.c                       | 2 +-
 drivers/clk/altera/Makefile                        | 1 +
 3 files changed, 3 insertions(+), 2 deletions(-)
arch/arm/mach-socfpga/include/mach/clock_manager.h +1 -1
index 6c9d32b9dd..77d97193f5 100644
@@ -26,7 +26,7 @@ int cm_set_qspi_controller_clk_hz(u32 clk_hz);
 #include <asm/arch/clock_manager_arria10.h>
 #elif defined(CONFIG_TARGET_SOCFPGA_STRATIX10)
 #include <asm/arch/clock_manager_s10.h>
-#elif defined(CONFIG_TARGET_SOCFPGA_AGILEX)
+#elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX) || IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 #include <asm/arch/clock_manager_agilex.h>
 #elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX5)
 #include <asm/arch/clock_manager_agilex5.h>
arch/arm/mach-socfpga/misc.c +1 -1
index 79f7887519..5537445e10 100644
@@ -252,7 +252,7 @@ void socfpga_get_managers_addr(void)
 	if (ret)
 		hang();
 
-#ifdef CONFIG_TARGET_SOCFPGA_AGILEX
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX) || IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 	ret = socfpga_get_base_addr("intel,agilex-clkmgr",
 				    &socfpga_clkmgr_base);
 #elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
drivers/clk/altera/Makefile +1 -0
index 61ffa4179a..858f828e53 100644
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_TARGET_SOCFPGA_AGILEX) += clk-agilex.o
+obj-$(CONFIG_TARGET_SOCFPGA_AGILEX7M) += clk-agilex.o
 obj-$(CONFIG_TARGET_SOCFPGA_ARRIA10) += clk-arria10.o
 obj-$(CONFIG_TARGET_SOCFPGA_N5X) += clk-n5x.o
 obj-$(CONFIG_TARGET_SOCFPGA_N5X) += clk-mem-n5x.o
Signature · 1 line
2.25.1
#10 lore raw

PATCH 8/16 ddr: altera: Add iossm mailbox for Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Add iossm mailbox driver for Agilex7 M-series. HPS will interact with IO96B and DDR subsystem through software defined mailbox interface. HPS can retrieve memory interface calibration status, IO96B configuration, memory interfae configuration, trigger calibration and etc with the list of supported mailbox command type and opcode.

---
 drivers/ddr/altera/iossm_mailbox.c | 637 +++++++++++++++++++++++++++++
 drivers/ddr/altera/iossm_mailbox.h | 182 +++++++++
 2 files changed, 819 insertions(+)
 create mode 100644 drivers/ddr/altera/iossm_mailbox.c
 create mode 100644 drivers/ddr/altera/iossm_mailbox.h
drivers/ddr/altera/iossm_mailbox.c new file +637 -0
new file mode 100644
index 0000000000..f84a3a070d
@@ -0,0 +1,637 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Intel Corporation <www.intel.com>
+ */
+
+#include <hang.h>
+#include <string.h>
+#include <wait_bit.h>
+#include <asm/arch/base_addr_soc64.h>
+#include <asm/io.h>
+#include <linux/bitfield.h>
+#include "iossm_mailbox.h"
+
+#define ECC_INTSTATUS_SERR SOCFPGA_SYSMGR_ADDRESS + 0x9C
+#define ECC_INISTATUS_DERR SOCFPGA_SYSMGR_ADDRESS + 0xA0
+#define DDR_CSR_CLKGEN_LOCKED_IO96B0_MASK BIT(16)
+#define DDR_CSR_CLKGEN_LOCKED_IO96B1_MASK BIT(17)
+
+#define DDR_CSR_CLKGEN_LOCKED_IO96B_MASK(x)	(i == 0 ? DDR_CSR_CLKGEN_LOCKED_IO96B0_MASK : \
+							DDR_CSR_CLKGEN_LOCKED_IO96B1_MASK)
+
+#define IO96B_MB_REQ_SETUP(v, w, x, y, z)	usr_req.ip_type = v; \
+						usr_req.ip_id = w; \
+						usr_req.usr_cmd_type = x; \
+						usr_req.usr_cmd_opcode = y; \
+						usr_req.cmd_param[0] = z; \
+						for (n = 1; n < NUM_CMD_PARAM; n++) \
+							usr_req.cmd_param[n] = 0
+#define MAX_RETRY_COUNT		3
+
+#define IO96B0_PLL_A_MASK	BIT(0)
+#define IO96B0_PLL_B_MASK	BIT(1)
+#define IO96B1_PLL_A_MASK	BIT(2)
+#define IO96B1_PLL_B_MASK	BIT(3)
+
+/* supported DDR type list */
+static const char *ddr_type_list[7] = {
+		"DDR4", "DDR5", "DDR5_RDIMM", "LPDDR4", "LPDDR5", "QDRIV", "UNKNOWN"
+};
+
+static int is_ddr_csr_clkgen_locked(u8 io96b_pll)
+{
+	int ret = 0;
+
+	if (FIELD_GET(IO96B0_PLL_A_MASK, io96b_pll)) {
+		ret = wait_for_bit_le32((const void *)(ECC_INTSTATUS_SERR),
+					DDR_CSR_CLKGEN_LOCKED_IO96B0_MASK, true, TIMEOUT, false);
+
+		if (ret) {
+			debug("%s: ddr csr io96b_0 clkgenA locked is timeout\n", __func__);
+			goto err;
+		}
+	}
+
+	if (FIELD_GET(IO96B0_PLL_B_MASK, io96b_pll)) {
+		ret = wait_for_bit_le32((const void *)(ECC_INISTATUS_DERR),
+					DDR_CSR_CLKGEN_LOCKED_IO96B0_MASK, true, TIMEOUT, false);
+
+		if (ret) {
+			debug("%s: ddr csr io96b_0 clkgenB locked is timeout\n", __func__);
+			goto err;
+		}
+	}
+
+	if (FIELD_GET(IO96B1_PLL_A_MASK, io96b_pll)) {
+		ret = wait_for_bit_le32((const void *)(ECC_INTSTATUS_SERR),
+					DDR_CSR_CLKGEN_LOCKED_IO96B1_MASK, true, TIMEOUT, false);
+
+		if (ret) {
+			debug("%s: ddr csr io96b_1 clkgenA locked is timeout\n", __func__);
+			goto err;
+		}
+	}
+
+	if (FIELD_GET(IO96B1_PLL_B_MASK, io96b_pll)) {
+		ret = wait_for_bit_le32((const void *)(ECC_INISTATUS_DERR),
+					DDR_CSR_CLKGEN_LOCKED_IO96B1_MASK, true, TIMEOUT, false);
+
+		if (ret) {
+			debug("%s: ddr csr io96b_1 clkgenB locked is timeout\n", __func__);
+			goto err;
+		}
+	}
+
+err:
+	return ret;
+}
+
+/* Mailbox request function
+ * This function will send the request to IOSSM mailbox and wait for response return
+ *
+ * @io96b_csr_addr: CSR address for the target IO96B
+ * @req:            Structure contain command request for IOSSM mailbox command
+ * @resp_data_len:  User desire extra response data fields other than
+ *					CMD_RESPONSE_DATA_SHORT field on CMD_RESPONSE_STATUS
+ * @resp:           Structure contain responses returned from the requested IOSSM
+ *					mailbox command
+ */
+int io96b_mb_req(phys_addr_t io96b_csr_addr, struct io96b_mb_req req,
+		 u32 resp_data_len, struct io96b_mb_resp *resp)
+{
+	int i, ret;
+	u32 cmd_req, cmd_resp;
+
+	/* Initialized zeros for responses */
+	resp->cmd_resp_status = 0;
+	for (i = 0; i < NUM_CMD_RESPONSE_DATA; i++)
+		resp->cmd_resp_data[i] = 0;
+
+	/* Ensure CMD_REQ is cleared before write any command request */
+	ret = wait_for_bit_le32((const void *)(io96b_csr_addr + IOSSM_CMD_REQ_OFFSET),
+				GENMASK(31, 0), 0, TIMEOUT, false);
+	if (ret) {
+		printf("%s: CMD_REQ not ready\n", __func__);
+
+		return ret;
+	}
+
+	/* Write CMD_PARAM_* */
+	for (i = 0; i < NUM_CMD_PARAM ; i++) {
+		switch (i) {
+		case 0:
+			if (req.cmd_param[0])
+				writel(req.cmd_param[0], io96b_csr_addr + IOSSM_CMD_PARAM_0_OFFSET);
+			break;
+		case 1:
+			if (req.cmd_param[1])
+				writel(req.cmd_param[1], io96b_csr_addr + IOSSM_CMD_PARAM_1_OFFSET);
+			break;
+		case 2:
+			if (req.cmd_param[2])
+				writel(req.cmd_param[2], io96b_csr_addr + IOSSM_CMD_PARAM_2_OFFSET);
+			break;
+		case 3:
+			if (req.cmd_param[3])
+				writel(req.cmd_param[3], io96b_csr_addr + IOSSM_CMD_PARAM_3_OFFSET);
+			break;
+		case 4:
+			if (req.cmd_param[4])
+				writel(req.cmd_param[4], io96b_csr_addr + IOSSM_CMD_PARAM_4_OFFSET);
+			break;
+		case 5:
+			if (req.cmd_param[5])
+				writel(req.cmd_param[5], io96b_csr_addr + IOSSM_CMD_PARAM_5_OFFSET);
+			break;
+		case 6:
+			if (req.cmd_param[6])
+				writel(req.cmd_param[6], io96b_csr_addr + IOSSM_CMD_PARAM_6_OFFSET);
+			break;
+		default:
+			printf("%s: Invalid command parameter\n", __func__);
+		}
+	}
+
+	/* Write CMD_REQ (IP_TYPE, IP_INSTANCE_ID, CMD_TYPE and CMD_OPCODE) */
+	cmd_req = FIELD_PREP(CMD_TARGET_IP_TYPE_MASK, req.ip_type) |
+		FIELD_PREP(CMD_TARGET_IP_INSTANCE_ID_MASK, req.ip_id) |
+		FIELD_PREP(CMD_TYPE_MASK, req.usr_cmd_type) |
+		FIELD_PREP(CMD_OPCODE_MASK, req.usr_cmd_opcode);
+	writel(cmd_req, io96b_csr_addr + IOSSM_CMD_REQ_OFFSET);
+
+	debug("%s: Write 0x%x to IOSSM_CMD_REQ_OFFSET 0x%llx\n", __func__, cmd_req,
+	      io96b_csr_addr + IOSSM_CMD_REQ_OFFSET);
+	/* Read CMD_RESPONSE_READY in CMD_RESPONSE_STATUS */
+	ret = wait_for_bit_le32((const void *)(io96b_csr_addr + IOSSM_CMD_RESPONSE_STATUS_OFFSET),
+				IOSSM_STATUS_COMMAND_RESPONSE_READY, 1, TIMEOUT, false);
+	if (ret) {
+		printf("%s: CMD_RESPONSE ERROR:\n", __func__);
+
+		cmd_resp = readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_STATUS_OFFSET);
+
+		printf("%s: STATUS_GENERAL_ERROR: 0x%lx\n", __func__,
+		       IOSSM_STATUS_GENERAL_ERROR(cmd_resp));
+		printf("%s: STATUS_CMD_RESPONSE_ERROR: 0x%lx\n", __func__,
+		       IOSSM_STATUS_CMD_RESPONSE_ERROR(cmd_resp));
+	}
+
+	/* read CMD_RESPONSE_STATUS */
+	resp->cmd_resp_status = readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_STATUS_OFFSET);
+
+	debug("%s: CMD_RESPONSE_STATUS 0x%llx: 0x%x\n", __func__, io96b_csr_addr +
+	      IOSSM_CMD_RESPONSE_STATUS_OFFSET, resp->cmd_resp_status);
+
+	/* read CMD_RESPONSE_DATA_* */
+	for (i = 0; i < resp_data_len; i++) {
+		switch (i) {
+		case 0:
+			resp->cmd_resp_data[i] =
+					readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_DATA_0_OFFSET);
+
+			debug("%s: IOSSM_CMD_RESPONSE_DATA_0_OFFSET 0x%llx: 0x%x\n", __func__,
+			      io96b_csr_addr + IOSSM_CMD_RESPONSE_DATA_0_OFFSET,
+			      resp->cmd_resp_data[i]);
+			break;
+		case 1:
+			resp->cmd_resp_data[i] =
+					readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_DATA_1_OFFSET);
+
+			debug("%s: IOSSM_CMD_RESPONSE_DATA_1_OFFSET 0x%llx: 0x%x\n", __func__,
+			      io96b_csr_addr + IOSSM_CMD_RESPONSE_DATA_1_OFFSET,
+			      resp->cmd_resp_data[i]);
+			break;
+		case 2:
+			resp->cmd_resp_data[i] =
+					readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_DATA_2_OFFSET);
+
+			debug("%s: IOSSM_CMD_RESPONSE_DATA_2_OFFSET 0x%llx: 0x%x\n", __func__,
+			      io96b_csr_addr + IOSSM_CMD_RESPONSE_DATA_2_OFFSET,
+			      resp->cmd_resp_data[i]);
+			break;
+		default:
+			printf("%s: Invalid response data\n", __func__);
+		}
+	}
+
+	resp->cmd_resp_status = readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_STATUS_OFFSET);
+
+	debug("%s: CMD_RESPONSE_STATUS 0x%llx: 0x%x\n", __func__, io96b_csr_addr +
+	      IOSSM_CMD_RESPONSE_STATUS_OFFSET, resp->cmd_resp_status);
+
+	/* write CMD_RESPONSE_READY = 0 */
+	clrbits_le32((u32 *)(uintptr_t)(io96b_csr_addr + IOSSM_CMD_RESPONSE_STATUS_OFFSET),
+		     IOSSM_STATUS_COMMAND_RESPONSE_READY);
+
+	resp->cmd_resp_status = readl(io96b_csr_addr + IOSSM_CMD_RESPONSE_STATUS_OFFSET);
+
+	debug("%s: CMD_RESPONSE_READY 0x%llx: 0x%x\n", __func__, io96b_csr_addr +
+	      IOSSM_CMD_RESPONSE_STATUS_OFFSET, resp->cmd_resp_status);
+
+	return 0;
+}
+
+/*
+ * Initial function to be called to set memory interface IP type and instance ID
+ * IP type and instance ID need to be determined before sending mailbox command
+ */
+void io96b_mb_init(struct io96b_info *io96b_ctrl)
+{
+	struct io96b_mb_req usr_req;
+	struct io96b_mb_resp usr_resp;
+	u8 ip_type_ret, instance_id_ret;
+	int i, j, k, n;
+
+	debug("%s: num_instance %d\n", __func__, io96b_ctrl->num_instance);
+
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		debug("%s: get memory interface IO96B %d\n", __func__, i);
+
+		IO96B_MB_REQ_SETUP(0,
+				   0,
+				   CMD_GET_SYS_INFO,
+				   GET_MEM_INTF_INFO,
+				   0);
+
+		/* Get memory interface IP type and instance ID (IP identifier) */
+		io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req, 2, &usr_resp);
+
+		debug("%s: get response from memory interface IO96B %d\n", __func__, i);
+
+		/* Retrieve number of memory interface(s) */
+		io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface =
+			IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status) & 0x3;
+
+		debug("%s: IO96B %d: num_mem_interface: 0x%x\n", __func__, i,
+		      io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface);
+
+		/* Retrieve memory interface IP type and instance ID (IP identifier) */
+		j = 0;
+		for (k = 0; k < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; k++) {
+			ip_type_ret = FIELD_GET(INTF_IP_TYPE_MASK, usr_resp.cmd_resp_data[k]);
+			instance_id_ret = FIELD_GET(INTF_INSTANCE_ID_MASK,
+						    usr_resp.cmd_resp_data[k]);
+
+			if (ip_type_ret) {
+				io96b_ctrl->io96b[i].mb_ctrl.ip_type[j] = ip_type_ret;
+				io96b_ctrl->io96b[i].mb_ctrl.ip_id[j] = instance_id_ret;
+
+				debug("%s: IO96B %d mem_interface %d: ip_type_ret: 0x%x\n",
+				      __func__, i, j, ip_type_ret);
+				debug("%s: IO96B %d mem_interface %d: instance_id_ret: 0x%x\n",
+				      __func__, i, j, instance_id_ret);
+
+				j++;
+			}
+		}
+	}
+}
+
+int io96b_cal_status(phys_addr_t addr)
+{
+	int ret;
+	u32 cal_success, cal_fail;
+	phys_addr_t status_addr = addr + IOSSM_STATUS_OFFSET;
+
+	/* Ensure calibration completed */
+	ret = wait_for_bit_le32((const void *)status_addr, IOSSM_STATUS_CAL_BUSY, false,
+				TIMEOUT, false);
+	if (ret) {
+		printf("%s: SDRAM calibration IO96b instance 0x%llx timeout\n", __func__,
+		       status_addr);
+
+		hang();
+	}
+
+	/* Calibration status */
+	cal_success = readl(status_addr) & IOSSM_STATUS_CAL_SUCCESS;
+	cal_fail = readl(status_addr) & IOSSM_STATUS_CAL_FAIL;
+
+	if (cal_success && !cal_fail)
+		return 0;
+	else
+		return -EPERM;
+}
+
+void init_mem_cal(struct io96b_info *io96b_ctrl)
+{
+	int count, i, ret;
+
+	/* Initialize overall calibration status */
+	io96b_ctrl->overall_cal_status = false;
+
+	if (io96b_ctrl->ckgen_lock) {
+		ret = is_ddr_csr_clkgen_locked(io96b_ctrl->io96b_pll);
+		if (ret) {
+			printf("%s: iossm IO96B ckgena_lock is not locked\n", __func__);
+			hang();
+		}
+	}
+
+	/* Check initial calibration status for the assigned IO96B */
+	count = 0;
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		ret = io96b_cal_status(io96b_ctrl->io96b[i].io96b_csr_addr);
+		if (ret) {
+			io96b_ctrl->io96b[i].cal_status = false;
+
+			printf("%s: Initial DDR calibration IO96B_%d failed %d\n", __func__,
+			       i, ret);
+
+			hang();
+		}
+
+		io96b_ctrl->io96b[i].cal_status = true;
+
+		printf("%s: Initial DDR calibration IO96B_%d succeed\n", __func__, i);
+
+		count++;
+	}
+
+	if (count == io96b_ctrl->num_instance)
+		io96b_ctrl->overall_cal_status = true;
+}
+
+/* Trying 3 times re-calibration if initial calibration failed */
+int trig_mem_cal(struct io96b_info *io96b_ctrl)
+{
+	struct io96b_mb_req usr_req;
+	struct io96b_mb_resp usr_resp;
+	bool recal_success;
+	int i, j, k, n;
+	u32 cal_stat_offset;
+	u8 cal_stat, trig_cal_stat;
+	int count = 0;
+
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		if (!io96b_ctrl->io96b[i].cal_status) {
+			for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+				/* Get the memory calibration status for memory interface */
+				IO96B_MB_REQ_SETUP(0,
+						   0,
+						   CMD_TRIG_MEM_CAL_OP,
+						   GET_MEM_CAL_STATUS,
+						   0);
+
+				io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req,
+					     2, &usr_resp);
+
+				recal_success = false;
+
+				/* Re-calibration first memory interface with failed calibration */
+				for (k = 0; k < MAX_RETRY_COUNT; k++) {
+					cal_stat_offset = usr_resp.cmd_resp_data[j];
+					cal_stat = readl(io96b_ctrl->io96b[i].io96b_csr_addr +
+							 cal_stat_offset);
+					if (cal_stat == INTF_MEM_CAL_STATUS_SUCCESS) {
+						recal_success = true;
+						break;
+					}
+
+					IO96B_MB_REQ_SETUP(io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
+							   io96b_ctrl->io96b[i].mb_ctrl.ip_id[j],
+							   CMD_TRIG_MEM_CAL_OP,
+							   TRIG_MEM_CAL,
+							   0);
+
+					io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req,
+						     2, &usr_resp);
+
+					trig_cal_stat =
+					IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status) &
+					BIT(0);
+
+					debug("%s: Memory calibration triggered status = %d\n",
+					      __func__, trig_cal_stat);
+
+					udelay(1);
+
+					IO96B_MB_REQ_SETUP(0,
+							   0,
+							   CMD_TRIG_MEM_CAL_OP,
+							   GET_MEM_CAL_STATUS,
+							   0);
+
+					io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req,
+						     2, &usr_resp);
+				}
+
+				if (!recal_success) {
+					printf("%s: Error as SDRAM calibration failed\n", __func__);
+
+					hang();
+				}
+			}
+
+			io96b_ctrl->io96b[i].cal_status = true;
+			io96b_ctrl->overall_cal_status = io96b_ctrl->io96b[i].cal_status;
+
+			printf("%s: Initial DDR calibration IO96B_%d succeed\n", __func__, i);
+
+			count++;
+		}
+	}
+
+	if (io96b_ctrl->overall_cal_status)
+		debug("%s: Overall SDRAM calibration success\n", __func__);
+
+	return 0;
+}
+
+int get_mem_technology(struct io96b_info *io96b_ctrl)
+{
+	struct io96b_mb_req usr_req;
+	struct io96b_mb_resp usr_resp;
+	int i, j, n;
+	u8 ddr_type_ret;
+
+	/* Initialize ddr type */
+	io96b_ctrl->ddr_type = ddr_type_list[6];
+
+	/* Get and ensure all memory interface(s) same DDR type */
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+			IO96B_MB_REQ_SETUP(io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
+					   io96b_ctrl->io96b[i].mb_ctrl.ip_id[j],
+					   CMD_GET_MEM_INFO,
+					   GET_MEM_TECHNOLOGY,
+					   0);
+
+			io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req, 0, &usr_resp);
+
+			ddr_type_ret =
+				IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status)
+				& GENMASK(2, 0);
+
+			if (!strcmp(io96b_ctrl->ddr_type, "UNKNOWN"))
+				io96b_ctrl->ddr_type = ddr_type_list[ddr_type_ret];
+
+			if (ddr_type_list[ddr_type_ret] != io96b_ctrl->ddr_type) {
+				printf("%s: Mismatch DDR type on IO96B_%d\n", __func__, i);
+
+				return -EINVAL;
+			}
+		}
+	}
+
+	return 0;
+}
+
+int get_mem_width_info(struct io96b_info *io96b_ctrl)
+{
+	struct io96b_mb_req usr_req;
+	struct io96b_mb_resp usr_resp;
+	int i, j, n;
+	u16 memory_size;
+	u16 total_memory_size = 0;
+
+	/* Get all memory interface(s) total memory size on all instance(s) */
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		memory_size = 0;
+		for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+			IO96B_MB_REQ_SETUP(io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
+					   io96b_ctrl->io96b[i].mb_ctrl.ip_id[j],
+					   CMD_GET_MEM_INFO,
+					   GET_MEM_WIDTH_INFO,
+					   0);
+
+			io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req,
+				     2, &usr_resp);
+
+			memory_size = memory_size +
+					(usr_resp.cmd_resp_data[1] & GENMASK(7, 0));
+		}
+
+		if (!memory_size) {
+			printf("%s: Failed to get valid memory size\n", __func__);
+
+			return -EINVAL;
+		}
+
+		io96b_ctrl->io96b[i].size = memory_size;
+
+		total_memory_size = total_memory_size + memory_size;
+	}
+
+	if (!total_memory_size) {
+		printf("%s: Failed to get valid memory size\n", __func__);
+
+		return -EINVAL;
+	}
+
+	io96b_ctrl->overall_size = total_memory_size;
+
+	return 0;
+}
+
+int ecc_enable_status(struct io96b_info *io96b_ctrl)
+{
+	struct io96b_mb_req usr_req;
+	struct io96b_mb_resp usr_resp;
+	int i, j, n;
+	bool ecc_stat_set = false;
+	bool ecc_stat;
+
+	/* Initialize ECC status */
+	io96b_ctrl->ecc_status = false;
+
+	/* Get and ensure all memory interface(s) same ECC status */
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+			IO96B_MB_REQ_SETUP(io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
+					   io96b_ctrl->io96b[i].mb_ctrl.ip_id[j],
+					   CMD_TRIG_CONTROLLER_OP,
+					   ECC_ENABLE_STATUS,
+					   0);
+
+			io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req, 0, &usr_resp);
+
+			ecc_stat = (IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status)
+					& GENMASK(1, 0)) == 0 ? false : true;
+
+			if (!ecc_stat_set) {
+				io96b_ctrl->ecc_status = ecc_stat;
+				ecc_stat_set = true;
+			}
+
+			if (ecc_stat != io96b_ctrl->ecc_status) {
+				printf("%s: Mismatch DDR ECC status on IO96B_%d\n", __func__, i);
+
+				return -EINVAL;
+			}
+		}
+	}
+
+	debug("%s: ECC enable status: %d\n", __func__, io96b_ctrl->ecc_status);
+
+	return 0;
+}
+
+int bist_mem_init_start(struct io96b_info *io96b_ctrl)
+{
+	struct io96b_mb_req usr_req;
+	struct io96b_mb_resp usr_resp;
+	int i, j, n;
+	bool bist_start, bist_success;
+	u32 start;
+
+	/* Full memory initialization BIST performed on all memory interface(s) */
+	for (i = 0; i < io96b_ctrl->num_instance; i++) {
+		for (j = 0; j < io96b_ctrl->io96b[i].mb_ctrl.num_mem_interface; j++) {
+			bist_start = false;
+			bist_success = false;
+
+			/* Start memory initialization BIST on full memory address */
+			IO96B_MB_REQ_SETUP(io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
+					   io96b_ctrl->io96b[i].mb_ctrl.ip_id[j],
+					   CMD_TRIG_CONTROLLER_OP,
+					   BIST_MEM_INIT_START,
+					   BIST_FULL_MEM);
+
+			io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req, 0, &usr_resp);
+
+			bist_start = IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status)
+				& BIT(0);
+
+			if (!bist_start) {
+				printf("%s: Failed to initialize memory on IO96B_%d\n", __func__,
+				       i);
+				printf("%s: BIST_MEM_INIT_START Error code 0x%lx\n", __func__,
+				       IOSSM_STATUS_CMD_RESPONSE_ERROR(usr_resp.cmd_resp_status));
+
+				return -EINVAL;
+			}
+
+			/* Polling for the initiated memory initialization BIST status */
+			start = get_timer(0);
+			while (!bist_success) {
+				IO96B_MB_REQ_SETUP(io96b_ctrl->io96b[i].mb_ctrl.ip_type[j],
+						   io96b_ctrl->io96b[i].mb_ctrl.ip_id[j],
+						   CMD_TRIG_CONTROLLER_OP,
+						   BIST_MEM_INIT_STATUS,
+						   0);
+
+				io96b_mb_req(io96b_ctrl->io96b[i].io96b_csr_addr, usr_req, 0,
+					     &usr_resp);
+
+				bist_success =
+					IOSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status)
+					& BIT(0);
+
+				if (!bist_success && (get_timer(start) > TIMEOUT)) {
+					printf("%s: Timeout initialize memory on IO96B_%d\n",
+					       __func__, i);
+					printf("%s: BIST_MEM_INIT_STATUS Error code 0x%lx\n",
+					       __func__,
+					IOSSM_STATUS_CMD_RESPONSE_ERROR(usr_resp.cmd_resp_status));
+
+					return -ETIMEDOUT;
+				}
+
+				udelay(1);
+			}
+		}
+
+		debug("%s: Memory initialized successfully on IO96B_%d\n", __func__, i);
+	}
+	return 0;
+}
drivers/ddr/altera/iossm_mailbox.h new file +182 -0

182 lines not on this page · raw message

Signature · 1 line
2.25.1
#11 lore raw

PATCH 9/16 ddr: altera: Add uibssm mailbox for Agilex7 M-series

In reply to [email protected]

From: Teik Heng Chong <[email protected]>

Add uibssm mailbox driver for Agilex7 M-series. HPS will interact with UIB and HBM subsystem through software defined mailbox interface. HPS can retrieve memory interface calibration status, UIB configuration, memory interfae configuration, trigger calibration and etc with the list of supported mailbox command type and opcode.

---
 drivers/ddr/altera/uibssm_mailbox.c | 311 ++++++++++++++++++++++++++++
 drivers/ddr/altera/uibssm_mailbox.h | 117 +++++++++++
 2 files changed, 428 insertions(+)
 create mode 100644 drivers/ddr/altera/uibssm_mailbox.c
 create mode 100644 drivers/ddr/altera/uibssm_mailbox.h
drivers/ddr/altera/uibssm_mailbox.c new file +311 -0
new file mode 100644
index 0000000000..a6e2a5f44b
@@ -0,0 +1,311 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2024 Intel Corporation <www.intel.com>
+ */
+#include <hang.h>
+#include <wait_bit.h>
+#include <asm/arch/base_addr_soc64.h>
+#include <asm/io.h>
+#include "uibssm_mailbox.h"
+
+#define MAX_RETRIES 3
+
+int uib_bist_mem_init_start(struct uib_info *uib_ctrl)
+{
+	struct uib_mb_resp usr_resp;
+	bool bist_start = false;
+	bool bist_success = false;
+	u32 start;
+
+	/*
+	 * Full memory initialization BIST performed on all UIB channels
+	 * start memory initialization BIST on full memory address
+	 */
+	uib_mb_req(uib_ctrl->uib[0].uib_csr_addr,
+		   UIB_CMD_TRIG_CONTROLLER_OP,
+		   UIB_BIST_MEM_INIT_START,
+		   UIB_BIST_FULL_MEM, &usr_resp);
+
+	bist_start = UIBSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status) &
+			UIB_BIST_INITIATE_PASS;
+	if (!bist_start) {
+		printf("%s: Failed to initialized memory on UIB\n", __func__);
+
+		return -EINVAL;
+	}
+
+	/* Polling for the initiated memory initialization BIST status */
+	start = get_timer(0);
+	while (!bist_success) {
+		/*
+		 * cmd_param_0 is not used in BIST status request,
+		 * hence set the value to 0
+		 */
+		uib_mb_req(uib_ctrl->uib[0].uib_csr_addr,
+			   UIB_CMD_TRIG_CONTROLLER_OP,
+			   UIB_BIST_MEM_INIT_STATUS,
+			   0, &usr_resp);
+
+		bist_success = UIBSSM_CMD_RESPONSE_DATA_SHORT(usr_resp.cmd_resp_status) & BIT(0);
+		if (!bist_success && (get_timer(start) > TIMEOUT)) {
+			printf("%s: Timeout initialize memory on UIB\n", __func__);
+
+			return -ETIMEDOUT;
+		}
+
+		udelay(1);
+	}
+
+	debug("%s: Memory initialized successfully on UIB\n", __func__);
+
+	return 0;
+}
+
+int uib_cal_status(phys_addr_t addr)
+{
+	int ret = 0;
+	phys_addr_t status_addr = addr + UIB_R_INITSTS_OFFSET;
+
+	/* Ensure calibration completed */
+	ret = wait_for_bit_le32((const void *)status_addr, UIB_R_INITSTS_INITSTS_PASS, true,
+				TIMEOUT, false);
+	if (ret)
+		printf("%s: HBM calibration UIB instance 0x%llx timeout\n", __func__, status_addr);
+
+	return ret;
+}
+
+void uib_init_mem_cal(struct uib_info *uib_ctrl)
+{
+	int i, ret;
+
+	if (!uib_ctrl->num_instance) {
+		uib_ctrl->overall_cal_status = false;
+	} else {
+		uib_ctrl->overall_cal_status = true;
+
+		/* Check initial calibration status for the assigned UIB */
+		for (i = 0; i < uib_ctrl->num_instance; i++) {
+			ret = uib_cal_status(uib_ctrl->uib[i].uib_csr_addr);
+			if (ret) {
+				uib_ctrl->uib[i].cal_status = false;
+				uib_ctrl->overall_cal_status = false;
+
+				printf("%s: Initial HBM calibration UIB_%d failed\n", __func__, i);
+				break;
+			}
+
+			uib_ctrl->uib[i].cal_status = true;
+
+			debug("%s: Initial HBM calibration UIB_%d succeed\n", __func__, i);
+		}
+	}
+}
+
+/* Trying 3 times re-calibration if initial calibration failed */
+void uib_trig_mem_cal(struct uib_info *uib_ctrl)
+{
+	int i, j, cal_stat;
+
+	if (!uib_ctrl->num_instance) {
+		uib_ctrl->overall_cal_status = false;
+	} else {
+		uib_ctrl->overall_cal_status = true;
+
+		for (i = 0; i < uib_ctrl->num_instance; i++) {
+			uib_ctrl->uib[i].cal_status = false;
+
+			/* Initiate Re-calibration */
+			for (j = 0; j < MAX_RETRIES; j++) {
+				clrsetbits_le32(uib_ctrl->uib[i].uib_csr_addr +
+						UIB_R_INITCTL_OFFSET,
+						UIB_R_INITCTL_INITTYPE_MASK |
+						UIB_R_INITCTL_INITREQ_MASK,
+						UIB_R_INITCTL_INITTYPE(UIB_RST_REQUEST_WITH_CAL) |
+						UIB_R_INITCTL_INITREQ(1));
+
+				cal_stat = uib_cal_status(uib_ctrl->uib[i].uib_csr_addr);
+				if (cal_stat)
+					continue;
+
+				debug("%s: HBM re-calibration UIB_%d succeed\n", __func__, i);
+
+				uib_ctrl->uib[i].cal_status = true;
+				break;
+			}
+
+			if (!uib_ctrl->uib[i].cal_status) {
+				uib_ctrl->overall_cal_status = false;
+
+				printf("%s: HBM re-calibration UIB_%d failed\n", __func__, i);
+				break;
+			}
+		}
+	}
+}
+
+static void uib_mailbox_write_request(u32 data, u32 target_write_addr, phys_addr_t csr_addr)
+{
+	int ret;
+
+	/*
+	 * Read from chms0020 MBWRADDR_VALID and ensure its not set or
+	 * wait till it get cleared by controller
+	 */
+	debug("%s: #1 Read MBWRADDR_VALID from UIB_R_MBWRCTL\n", __func__);
+	ret = wait_for_bit_le32((const void *)csr_addr + UIB_R_MBWRCTL,
+				UIB_R_MBWRCTL_MBWRADDR_VALID, false, TIMEOUT, false);
+	if (ret) {
+		printf("%s: TIMEOUT!!! MBWRADDR_VALID is not zero\n", __func__);
+
+		hang();
+	}
+
+	/* Write <target write address> to chms0024 MBWRADDR */
+	debug("%s: #2 Write 0x%x to UIB_R_MBWRADDR\n", __func__, target_write_addr);
+	writel(target_write_addr, csr_addr + UIB_R_MBWRADDR);
+
+	/*
+	 * Write 1 to chms0020 MBWRADDR_VALID to indicate the address is now valid
+	 * for FW to read
+	 */
+	debug("%s: #3 Write 1 to MBWRADDR_VALID for FW to read address\n", __func__);
+	setbits_le32(csr_addr + UIB_R_MBWRCTL, UIB_R_MBWRCTL_MBWRADDR_VALID);
+
+	/*
+	 * Read from chms0020 MBWRDATA_VALID and ensure its not set or
+	 * wait till it get cleared by controller
+	 */
+	debug("%s: #4 Read MBWRDATA_VALID from UIB_R_MBWRCTL\n", __func__);
+	ret = wait_for_bit_le32((const void *)csr_addr + UIB_R_MBWRCTL,
+				UIB_R_MBWRCTL_MBWRDATA_VALID, false, TIMEOUT, false);
+	if (ret) {
+		printf("%s: TIMEOUT!!! MBWRADDR_VALID is not zero\n", __func__);
+
+		hang();
+	}
+
+	/*
+	 * Read from chms0020 MBWRDATA_END and ensure its not set or
+	 * wait till it get cleared by controller
+	 */
+	debug("%s: #5 Read R_MBWRCTL_MBWRDATA_END from UIB_R_MBWRCTL\n", __func__);
+	ret = wait_for_bit_le32((const void *)csr_addr + UIB_R_MBWRCTL,
+				UIB_R_MBWRCTL_MBWRDATA_END, false, TIMEOUT, false);
+	if (ret) {
+		printf("%s: TIMEOUT!!! MBWRDATA_END is not zero\n", __func__);
+
+		hang();
+	}
+
+	/* Write <write data> to chms0028 MMR_MBWRDATA */
+	debug("%s: #6 Write 0x%x to UIB_R_MBWRDATA\n", __func__, data);
+	writel(data, csr_addr + UIB_R_MBWRDATA);
+
+	/*
+	 * Write 1 to chms0020 MBWRDATA_END to indicate if the <write data> is the last burst
+	 * for FW to read for the <target write address>
+	 */
+	debug("%s: #7 Write 1 to MBWRDATA_END to inform FW this is last burst of data to read\n",
+	      __func__);
+	setbits_le32(csr_addr + UIB_R_MBWRCTL, UIB_R_MBWRCTL_MBWRDATA_END);
+
+	/* Write 1 to chms0020 MBWRDATA_VALID to indicate the data is now valid for FW to read */
+	debug("%s: #8 Write 1 to MBWRDATA_VALID for FW to read data\n", __func__);
+	setbits_le32(csr_addr + UIB_R_MBWRCTL, UIB_R_MBWRCTL_MBWRDATA_VALID);
+}
+
+static u32 uib_mailbox_read_request(u32 target_read_addr, phys_addr_t csr_addr)
+{
+	int ret;
+	u32 reg, rd_data = 0;
+
+	/*
+	 * Read from chms0030 MBRDADDR_VALID and ensure its not set or
+	 * wait till it get cleared by controller
+	 */
+	debug("%s: #1 Read MBRDADDR_VALID from UIB_R_MBRDCTL\n", __func__);
+	ret = wait_for_bit_le32((const void *)csr_addr + UIB_R_MBRDCTL,
+				UIB_R_MBRDCTL_MBRDADDR_VALID, false, TIMEOUT, false);
+	if (ret) {
+		printf("%s: TIMEOUT!!! MBRDADDR_VALID is not zero\n", __func__);
+
+		hang();
+	}
+
+	/* Write <target read address> to chms0034 MBRDADDR */
+	debug("%s: #2 Write 0x%x to UIB_R_MBRDADDR\n", __func__, target_read_addr);
+	writel(target_read_addr, csr_addr + UIB_R_MBRDADDR);
+
+	/*
+	 * Write 1 to chms0030 MBRDADDR_VALID to indicate the address is now valid
+	 * for FW to read
+	 */
+	debug("%s: #3 Write 1 to MBRDADDR_VALID for FW to read address\n", __func__);
+	setbits_le32(csr_addr + UIB_R_MBRDCTL, UIB_R_MBRDCTL_MBRDADDR_VALID);
+
+	/*
+	 * Continuously poll the chms0030 MBRDDATA_VALID. If MBRDDATA_VALID are set, read
+	 * chms0038 MBRDDATA and chms0030 MBRDDATA_END to retrieve the <read data> and
+	 * <end of read burst> status accordingly
+	 */
+	debug("%s: #4 Read MBRDDATA_VALID from UIB_R_MBRDCTL\n", __func__);
+	ret = wait_for_bit_le32((const void *)csr_addr + UIB_R_MBRDCTL,
+				UIB_R_MBRDCTL_MBRDDATA_VALID, false, TIMEOUT, false);
+	if (ret) {
+		printf("%s: TIMEOUT!!! MBRDDATA_VALID is not zero\n", __func__);
+
+		hang();
+	}
+
+	reg = readl(csr_addr + UIB_R_MBRRDATA);
+	debug("%s: #5 Read data from UIB_R_MBRRDATA = 0x%x\n", __func__, reg);
+	rd_data = reg;
+
+	reg = readl(csr_addr + UIB_R_MBRDCTL);
+	debug("%s: #6 Read end of read burst status from UIB_R_MBRDCTL = 0x%x\n", __func__, reg);
+
+	/*
+	 * Once done retrieving the data, write 1 to chms0030 MBRDDATA_VALID,
+	 * chms0030 MBRDDATA_END to clear the register
+	 */
+	debug("%s: #7 Write 1 to MBRDDATA_VALID for FW to read address\n", __func__);
+	setbits_le32(csr_addr + UIB_R_MBRDCTL, UIB_R_MBRDCTL_MBRDDATA_VALID |
+			UIB_R_MBWRCTL_MBWRDATA_END);
+
+	return rd_data;
+}
+
+int uib_mb_req(phys_addr_t uib_csr_addr, u32 usr_cmd_type, u32 usr_cmd_opcode,
+	       u32 cmd_param_0, struct uib_mb_resp *resp)
+{
+	u32 cmd_req;
+
+	/* Initialized zeros for responses */
+	resp->cmd_resp_status = 0;
+
+	/* Write CMD_REQ (CMD_TYPE and CMD_OPCODE) */
+	cmd_req = FIELD_PREP(CMD_TYPE_MASK, usr_cmd_type) |
+		FIELD_PREP(CMD_OPCODE_MASK, usr_cmd_opcode);
+	uib_mailbox_write_request(cmd_req, 0, uib_csr_addr);
+
+	debug("%s: Write 0x%x to UIBSSM_CMD_REQ_OFFSET 0x%llx\n", __func__, cmd_req, uib_csr_addr);
+
+	/* Write CMD_PARAM_* */
+	if (cmd_param_0)
+		uib_mailbox_write_request(cmd_param_0, 0, uib_csr_addr);
+	else
+		debug("%s: cmd_param_0 is NULL\n", __func__);
+
+	/* read CMD_RESPONSE_STATUS */
+	resp->cmd_resp_status = uib_mailbox_read_request(0, uib_csr_addr);
+
+	debug("%s: CMD_RESPONSE_STATUS 0x%llx: 0x%x\n", __func__,
+	      uib_csr_addr, resp->cmd_resp_status);
+	debug("%s: STATUS_CMD_RESPONSE_ERROR: 0x%lx\n", __func__,
+	      UIBSSM_CMD_RESPONSE_ERROR(resp->cmd_resp_status));
+	debug("%s: STATUS_GENERAL_ERROR: 0x%lx\n", __func__,
+	      UIBSSM_GENERAL_ERROR(resp->cmd_resp_status));
+
+	return 0;
+}
drivers/ddr/altera/uibssm_mailbox.h new file +117 -0

117 lines not on this page · raw message

Signature · 1 line
2.25.1
#12 lore raw

PATCH 10/16 ddr: altera: Add DDR driver for Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

This is for new platform enablement for Agilex7 M-series. Add DDR driver for Agilex7 M-series. This driver is designed to support DDR and HBM memory. The official HBM handoff is not ready yet, therefore hardcoded handoff is used for HBM driver validation on mUDV board.

---
 .../include/mach/base_addr_soc64.h            |   6 +-
 .../include/mach/system_manager_soc64.h       |   7 +-
 drivers/ddr/altera/Makefile                   |   3 +-
 drivers/ddr/altera/sdram_agilex7m.c           | 527 ++++++++++++++++++
 drivers/ddr/altera/sdram_soc64.c              |  15 +-
 drivers/ddr/altera/sdram_soc64.h              |  15 +-
 6 files changed, 565 insertions(+), 8 deletions(-)
 create mode 100644 drivers/ddr/altera/sdram_agilex7m.c
arch/arm/mach-socfpga/include/mach/base_addr_soc64.h +5 -1
index 65721098b2..1f935fcdec 100644
@@ -45,12 +45,15 @@
 #define SOCFPGA_SDR_SCHEDULER_ADDRESS		0xf8000400
 #define SOCFPGA_HMC_MMR_IO48_ADDRESS		0xf8010000
 #define SOCFPGA_SDR_ADDRESS			0xf8011000
+#define SOCFPGA_FW_MPFE_SCR_ADDRESS		0xf8020000
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX) || \
-	IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
+	IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X) || \
+	IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 #define SOCFPGA_FW_MPU_DDR_SCR_ADDRESS		0xf8020200
 #else
 #define SOCFPGA_FW_MPU_DDR_SCR_ADDRESS		0xf8020100
 #endif
+#define SOCFPGA_F2SDRAM_MGR_ADDRESS		0xf8024000
 #define SOCFPGA_SMMU_ADDRESS			0xfa000000
 #define SOCFPGA_MAILBOX_ADDRESS			0xffa30000
 #define SOCFPGA_UART0_ADDRESS			0xffc02000
@@ -74,6 +77,7 @@
 #define SOCFPGA_FIREWALL_SOC2FPGA		0xffd21200
 #define SOCFPGA_FIREWALL_LWSOC2FPGA		0xffd21300
 #define SOCFPGA_FIREWALL_TCU			0xffd21400
+#define SOCFPGA_FIREWALL_PRIV_MEMORYMAP_PRIV	0xffd24800
 #define SOCFPGA_DMANONSECURE_ADDRESS		0xffda0000
 #define SOCFPGA_DMASECURE_ADDRESS		0xffda1000
 #define SOCFPGA_OCRAM_ADDRESS			0xffe00000
arch/arm/mach-socfpga/include/mach/system_manager_soc64.h +6 -1
index a8009664fe..815bdf8ce1 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_
@@ -103,6 +103,11 @@ void populate_sysmgr_pinmux(void);
 #define ALT_SYSMGR_SCRATCH_REG_0_DDR_RESET_TYPE_MASK	(BIT(29) | BIT(28))
 #define ALT_SYSMGR_SCRATCH_REG_0_DDR_RESET_TYPE_SHIFT	28
 
+#define ALT_SYSMGR_SCRATCH_REG_8_DDR_DBE_MASK		BIT(31)
+#define ALT_SYSMGR_SCRATCH_REG_8_DDR_PROGRESS_MASK	BIT(30)
+#define ALT_SYSMGR_SCRATCH_REG_8_OCRAM_DBE_MASK		BIT(29)
+#define ALT_SYSMGR_SCRATCH_REG_8_IO96B_HPS_MASK		GENMASK(28, 27)
+
 #define SYSMGR_SDMMC				SYSMGR_SOC64_SDMMC
 
 #define SYSMGR_ROMCODEGRP_CTRL_WARMRSTCFGPINMUX	BIT(0)
drivers/ddr/altera/Makefile +2 -1
index 9fa5d85a27..1dac088b39 100644
@@ -4,7 +4,7 @@
 # Wolfgang Denk, DENX Software Engineering, [email protected].
 #
 # (C) Copyright 2010, Thomas Chou <[email protected]>
-# Copyright (C) 2014-2021 Altera Corporation <www.altera.com>
+# Copyright (C) 2014-2024 Altera Corporation <www.altera.com>
 
 ifdef CONFIG_$(SPL_)ALTERA_SDRAM
 obj-$(CONFIG_TARGET_SOCFPGA_GEN5) += sdram_gen5.o sequencer.o
@@ -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_AGILEX7M) += sdram_soc64.o sdram_agilex7m.o iossm_mailbox.o uibssm_mailbox.o
 endif
drivers/ddr/altera/sdram_agilex7m.c new file +527 -0

527 lines not on this page · raw message

drivers/ddr/altera/sdram_soc64.c +11 -4
index 4716abfc9a..a0cc9be25e 100644
@@ -1,7 +1,6 @@
 // SPDX-License-Identifier: GPL-2.0
 /*
- * Copyright (C) 2016-2022 Intel Corporation <www.intel.com>
- *
+ * Copyright (C) 2016-2024 Intel Corporation <www.intel.com>
  */
 
 #include <common.h>
@@ -28,6 +27,7 @@
 
 #define PGTABLE_OFF	0x4000
 
+#if !IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 u32 hmc_readl(struct altera_sdram_plat *plat, u32 reg)
 {
 	return readl(plat->iomhc + reg);
@@ -99,6 +99,7 @@ int emif_reset(struct altera_sdram_plat *plat)
 	debug("DDR: %s triggered successly\n", __func__);
 	return 0;
 }
+#endif
 
 #if !IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
 int poll_hmc_clock_status(void)
@@ -322,7 +323,12 @@ static int altera_sdram_of_to_plat(struct udevice *dev)
 	/* These regs info are part of DDR handoff in bitstream */
 #if IS_ENABLED(CONFIG_TARGET_SOCFPGA_N5X)
 	return 0;
-#endif
+#elif IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
+	addr = dev_read_addr_index(dev, 0);
+	if (addr == FDT_ADDR_T_NONE)
+		return -EINVAL;
+	plat->mpfe_base_addr = addr;
+#else
 
 	addr = dev_read_addr_index(dev, 0);
 	if (addr == FDT_ADDR_T_NONE)
@@ -338,7 +344,7 @@ static int altera_sdram_of_to_plat(struct udevice *dev)
 	if (addr == FDT_ADDR_T_NONE)
 		return -EINVAL;
 	plat->hmc = (void __iomem *)addr;
-
+#endif
 	return 0;
 }
 
@@ -385,6 +391,7 @@ static const struct udevice_id altera_sdram_ids[] = {
 	{ .compatible = "altr,sdr-ctl-s10" },
 	{ .compatible = "intel,sdr-ctl-agilex" },
 	{ .compatible = "intel,sdr-ctl-n5x" },
+	{ .compatible = "intel,sdr-ctl-agilex7m" },
 	{ /* sentinel */ }
 };
 
drivers/ddr/altera/sdram_soc64.h +14 -1
index 87a70a861b..02019ac9e5 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,24 @@ struct altera_sdram_priv {
 	struct reset_ctl_bulk resets;
 };
 
+#if IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
+enum memory_type {
+	DDR_MEMORY = 0,
+	HBM_MEMORY
+};
+
+struct altera_sdram_plat {
+	fdt_addr_t mpfe_base_addr;
+	bool multichannel_interleaving;
+	enum memory_type mem_type;
+};
+#else
 struct altera_sdram_plat {
 	void __iomem *hmc;
 	void __iomem *ddr_sch;
 	void __iomem *iomhc;
 };
+#endif
 
 /* ECC HMC registers */
 #define DDRIOCTRL			0x8
Signature · 1 line
2.25.1
#13 lore raw

PATCH 11/16 ddr: altera: soc64: Restructure SDRAM firewall function

In reply to [email protected]

From: Sin Hui Kho <[email protected]>

Restructure SDRAM firewall function. Move the non-F2SDRAM firewall configuration to an individual function, in preparation to support F2SDRAM firewall configuration.

---
 drivers/ddr/altera/sdram_soc64.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/ddr/altera/sdram_soc64.c +8 -3
index a0cc9be25e..8f2085f3a0 100644
@@ -253,7 +253,7 @@ phys_size_t sdram_calculate_size(struct altera_sdram_plat *plat)
 	return size;
 }
 
-void sdram_set_firewall(struct bd_info *bd)
+static void sdram_set_firewall_non_f2sdram(struct bd_info *bd)
 {
 	u32 i;
 	phys_size_t value;
@@ -289,7 +289,7 @@ void sdram_set_firewall(struct bd_info *bd)
 				      FW_MPU_DDR_SCR_NONMPUREGION0ADDR_BASEEXT +
 				      (i * 4 * sizeof(u32)));
 
-		/* Setting non-secure MPU limit and limit extexded */
+		/* Setting non-secure MPU limit and limit extended */
 		value = bd->bi_dram[i].start + bd->bi_dram[i].size - 1;
 
 		lower = lower_32_bits(value);
@@ -302,7 +302,7 @@ void sdram_set_firewall(struct bd_info *bd)
 				      FW_MPU_DDR_SCR_MPUREGION0ADDR_LIMITEXT +
 				      (i * 4 * sizeof(u32)));
 
-		/* Setting non-secure Non-MPU limit and limit extexded */
+		/* Setting non-secure Non-MPU limit and limit extended */
 		FW_MPU_DDR_SCR_WRITEL(lower,
 				      FW_MPU_DDR_SCR_NONMPUREGION0ADDR_LIMIT +
 				      (i * 4 * sizeof(u32)));
@@ -315,6 +315,11 @@ void sdram_set_firewall(struct bd_info *bd)
 	}
 }
 
+void sdram_set_firewall(struct bd_info *bd)
+{
+	sdram_set_firewall_non_f2sdram(bd);
+}
+
 static int altera_sdram_of_to_plat(struct udevice *dev)
 {
 	struct altera_sdram_plat *plat = dev_get_plat(dev);
Signature · 1 line
2.25.1
#14 lore raw

PATCH 12/16 ddr: altera: soc64: Clean up bit-shift by zero bit

In reply to [email protected]

From: Teik Heng Chong <[email protected]>

Clean up bit-shift by zero bit

---
 drivers/ddr/altera/sdram_soc64.h | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/ddr/altera/sdram_soc64.h +10 -10
index 02019ac9e5..add7df01a5 100644
@@ -92,7 +92,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)		\
@@ -103,7 +103,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)				\
@@ -112,17 +112,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)			\
@@ -131,7 +131,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)			\
@@ -142,7 +142,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)		\
@@ -153,7 +153,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)			\
@@ -164,7 +164,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)		\
@@ -175,7 +175,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
#15 lore raw

PATCH 13/16 ddr: altera: soc64: Fix dram size calculation in clamshell mode

In reply to [email protected]

From: Teik Heng Chong <[email protected]>

This patch is to fix wrong memory size calculation in clamshell mode

---
 drivers/ddr/altera/sdram_soc64.c | 16 +++++++++++++++-
 drivers/ddr/altera/sdram_soc64.h |  5 +++++
 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/ddr/altera/sdram_soc64.c +15 -1
index 8f2085f3a0..27580cce2f 100644
@@ -27,6 +27,9 @@
 
 #define PGTABLE_OFF	0x4000
 
+#define SINGLE_RANK_CLAMSHELL	0xC3C3
+#define DUAL_RANK_CLAMSHELL	0xA5A5
+
 #if !IS_ENABLED(CONFIG_TARGET_SOCFPGA_AGILEX7M)
 u32 hmc_readl(struct altera_sdram_plat *plat, u32 reg)
 {
@@ -240,8 +243,19 @@ phys_size_t sdram_calculate_size(struct altera_sdram_plat *plat)
 {
 	u32 dramaddrw = hmc_readl(plat, DRAMADDRW);
 
+	u32 reg_ctrlcfg6_value = hmc_readl(plat, CTRLCFG6);
+	u32 cs_rank = CTRLCFG6_CFG_CS_CHIP(reg_ctrlcfg6_value);
+	u32 cs_addr_width;
+
+	if (cs_rank == SINGLE_RANK_CLAMSHELL)
+		cs_addr_width = 0;
+	else if (cs_rank == DUAL_RANK_CLAMSHELL)
+		cs_addr_width = 1;
+	else
+		cs_addr_width = DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw);
+
 	phys_size_t size = (phys_size_t)1 <<
-			(DRAMADDRW_CFG_CS_ADDR_WIDTH(dramaddrw) +
+			(cs_addr_width +
 			 DRAMADDRW_CFG_BANK_GRP_ADDR_WIDTH(dramaddrw) +
 			 DRAMADDRW_CFG_BANK_ADDR_WIDTH(dramaddrw) +
 			 DRAMADDRW_CFG_ROW_ADDR_WIDTH(dramaddrw) +
drivers/ddr/altera/sdram_soc64.h +5 -0
index add7df01a5..8b3b53cf5d 100644
@@ -78,6 +78,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
@@ -118,6 +120,9 @@ struct altera_sdram_plat {
 #define CTRLCFG1_CFG_CTRL_EN_ECC(x)			\
 	(((x) >> 7) & 0x1)
 
+#define CTRLCFG6_CFG_CS_CHIP(x)				\
+	((x) & 0xFFFF)
+
 #define DRAMTIMING0_CFG_TCL(x)				\
 	((x) & 0x7F)
 
Signature · 1 line
2.25.1
#16 lore raw

PATCH 14/16 arch: arm: mach-socfpga: Update kconfig for new platform Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Update Kconfig for new platform Agilex7 M-series.

---
 arch/arm/Kconfig              |  4 +++-
 arch/arm/mach-socfpga/Kconfig | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)
arch/arm/Kconfig +3 -1
index 56e190adf6..f68b680d82 100644
@@ -32,7 +32,9 @@ config COUNTER_FREQUENCY
 			ROCKCHIP_RK3288 || ROCKCHIP_RK322X || ROCKCHIP_RK3036
 	default 25000000 if ARCH_LX2160A || ARCH_LX2162A || ARCH_LS1088A
 	default 100000000 if ARCH_ZYNQMP
-	default 200000000 if ARCH_SOCFPGA && ARM64 && TARGET_SOCFPGA_AGILEX5
+	default 400000000 if ARCH_SOCFPGA && ARM64 && !TARGET_SOCFPGA_AGILEX7M
+	default 200000000 if ARCH_SOCFPGA && ARM64 && TARGET_SOCFPGA_AGILEX5 && \
+			TARGET_SOCFPGA_AGILEX7M
 	default 0
 	help
 	  For platforms with ARMv8-A and ARMv7-A which features a system
arch/arm/mach-socfpga/Kconfig +19 -0
index 1008232cac..2ca6336f21 100644
@@ -59,6 +59,18 @@ config TARGET_SOCFPGA_AGILEX
 	select SPL_CLK if SPL
 	select TARGET_SOCFPGA_SOC64
 
+config TARGET_SOCFPGA_AGILEX7M
+	bool
+	select ARMV8_MULTIENTRY
+	select ARMV8_SET_SMPEN
+	select BINMAN if SPL_ATF
+	select CLK
+	select FPGA_INTEL_SDM_MAILBOX
+	select GICV2
+	select NCORE_CACHE
+	select SPL_CLK if SPL
+	select TARGET_SOCFPGA_SOC64
+
 config TARGET_SOCFPGA_AGILEX5
 	bool
 	select BINMAN if SPL_ATF
@@ -139,6 +151,10 @@ config TARGET_SOCFPGA_AGILEX_SOCDK
 	bool "Intel SOCFPGA SoCDK (Agilex)"
 	select TARGET_SOCFPGA_AGILEX
 
+config TARGET_SOCFPGA_AGILEX7M_SOCDK
+	bool "Intel SOCFPGA SoCDK (Agilex7 M-series)"
+	select TARGET_SOCFPGA_AGILEX7M
+
 config TARGET_SOCFPGA_AGILEX5_SOCDK
 	bool "Intel SOCFPGA SoCDK (Agilex5)"
 	select TARGET_SOCFPGA_AGILEX5
@@ -216,6 +232,7 @@ config TARGET_SOCFPGA_TERASIC_SOCKIT
 endchoice
 
 config SYS_BOARD
+	default "agilex7m-socdk" if TARGET_SOCFPGA_AGILEX7M_SOCDK
 	default "agilex5-socdk" if TARGET_SOCFPGA_AGILEX5_SOCDK
 	default "agilex-socdk" if TARGET_SOCFPGA_AGILEX_SOCDK
 	default "arria5-socdk" if TARGET_SOCFPGA_ARRIA5_SOCDK
@@ -238,6 +255,7 @@ config SYS_BOARD
 	default "vining_fpga" if TARGET_SOCFPGA_SOFTING_VINING_FPGA
 
 config SYS_VENDOR
+	default "intel" if TARGET_SOCFPGA_AGILEX7M_SOCDK
 	default "intel" if TARGET_SOCFPGA_AGILEX5_SOCDK
 	default "intel" if TARGET_SOCFPGA_AGILEX_SOCDK
 	default "intel" if TARGET_SOCFPGA_N5X_SOCDK
@@ -261,6 +279,7 @@ config SYS_SOC
 	default "socfpga"
 
 config SYS_CONFIG_NAME
+	default "socfpga_agilex7m_socdk" if TARGET_SOCFPGA_AGILEX7M_SOCDK
 	default "socfpga_agilex5_socdk" if TARGET_SOCFPGA_AGILEX5_SOCDK
 	default "socfpga_agilex_socdk" if TARGET_SOCFPGA_AGILEX_SOCDK
 	default "socfpga_arria5_secu1" if TARGET_SOCFPGA_ARRIA5_SECU1
Signature · 1 line
2.25.1
#17 lore raw

PATCH 15/16 arch: arm: dts: Update Makefile for new platform Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Update Makefile to support Agilex7 M-series platform enablement.

---
 arch/arm/dts/Makefile               |  1 +
 arch/arm/mach-socfpga/Makefile      | 18 ++++++++++++++++++
 board/intel/agilex7m-socdk/Makefile |  7 +++++++
 3 files changed, 26 insertions(+)
 create mode 100644 board/intel/agilex7m-socdk/Makefile
arch/arm/dts/Makefile +1 -0
index 7b7788f755..c056e0e78e 100644
@@ -547,6 +547,7 @@ dtb-$(CONFIG_TARGET_THUNDERX_88XX) += thunderx-88xx.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) +=				\
 	socfpga_agilex_socdk.dtb			\
 	socfpga_agilex5_socdk.dtb			\
+	socfpga_agilex7m_socdk.dtb			\
 	socfpga_arria5_secu1.dtb			\
 	socfpga_arria5_socdk.dtb			\
 	socfpga_arria10_chameleonv3_270_2.dtb		\
arch/arm/mach-socfpga/Makefile +18 -0
index 67c6a8dfec..856fd597f6 100644
@@ -65,6 +65,21 @@ obj-y	+= reset_manager_s10.o
 obj-y	+= wrap_pll_config_soc64.o
 endif
 
+ifdef CONFIG_TARGET_SOCFPGA_AGILEX7M
+obj-y	+= clock_manager_agilex.o
+obj-y	+= lowlevel_init_soc64.o
+obj-y	+= mailbox_s10.o
+obj-y	+= misc_soc64.o
+obj-y	+= mmu-arm64_s10.o
+obj-y	+= reset_manager_s10.o
+obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)	+= secure_vab.o
+obj-y	+= system_manager_soc64.o
+obj-y	+= timer_s10.o
+obj-$(CONFIG_SOCFPGA_SECURE_VAB_AUTH)	+= vab.o
+obj-y	+= wrap_handoff_soc64.o
+obj-y	+= wrap_pll_config_soc64.o
+endif
+
 ifdef CONFIG_TARGET_SOCFPGA_N5X
 obj-y	+= clock_manager_n5x.o
 obj-y	+= lowlevel_init_soc64.o
@@ -107,6 +122,9 @@ endif
 ifdef CONFIG_TARGET_SOCFPGA_AGILEX5
 obj-y	+= spl_soc64.o
 endif
+ifdef CONFIG_TARGET_SOCFPGA_AGILEX7M
+obj-y	+= spl_agilex7m.o
+endif
 else
 obj-$(CONFIG_SPL_ATF) += secure_reg_helper.o
 obj-$(CONFIG_SPL_ATF) += smc_api.o
board/intel/agilex7m-socdk/Makefile new file +7 -0
new file mode 100644
index 0000000000..ff5d9dde3b
@@ -0,0 +1,7 @@
+
+# Copyright (C) 2024 Intel Corporation <www.intel.com>
+#
+# SPDX-License-Identifier:	GPL-2.0
+#
+
+obj-y	:= socfpga.o
Signature · 1 line
2.25.1
#18 lore raw

PATCH 16/16 configs: Add defconfig for Agilex7 M-series

In reply to [email protected]

From: Wan Yee Lau <[email protected]>

Add defconfig for Agilex7 M-series.

---
 ...onfig => socfpga_agilex7m_sdmmc_defconfig} | 110 +++++++++---------
 1 file changed, 54 insertions(+), 56 deletions(-)
 copy configs/{socfpga_agilex5_defconfig => socfpga_agilex7m_sdmmc_defconfig} (56%)
configs/socfpga_agilex7m_sdmmc_defconfig renamed from configs/socfpga_agilex5_defconfig +54 -56
similarity index 56%
copy from configs/socfpga_agilex5_defconfig
copy to configs/socfpga_agilex7m_sdmmc_defconfig
index f39954aea8..12414e2e5f 100644
@@ -1,50 +1,69 @@
 CONFIG_ARM=y
+CONFIG_COUNTER_FREQUENCY=400000000
 CONFIG_SPL_LDSCRIPT="arch/arm/mach-socfpga/u-boot-spl-soc64.lds"
-CONFIG_SYS_SPI_U_BOOT_OFFS=0x04000000
 CONFIG_ARCH_SOCFPGA=y
-CONFIG_TEXT_BASE=0x80200000
+CONFIG_TEXT_BASE=0x200000
 CONFIG_SYS_MALLOC_F_LEN=0x2000
-CONFIG_NR_DRAM_BANKS=2
+CONFIG_NR_DRAM_BANKS=1
 CONFIG_ENV_SIZE=0x2000
 CONFIG_ENV_OFFSET=0x04100000
+CONFIG_ENV_SECT_SIZE=0x20000
+CONFIG_SYS_SPI_U_BOOT_OFFS=0x04000000
 CONFIG_DM_GPIO=y
-CONFIG_DEFAULT_DEVICE_TREE="socfpga_agilex5_socdk"
-CONFIG_TARGET_SOCFPGA_AGILEX5_SOCDK=y
-CONFIG_IDENT_STRING="socfpga_agilex5"
+CONFIG_DEFAULT_DEVICE_TREE="socfpga_agilex7m_socdk"
+CONFIG_SPL_TEXT_BASE=0xFFE00000
+CONFIG_TARGET_SOCFPGA_AGILEX7M_SOCDK=y
+CONFIG_IDENT_STRING="socfpga_agilex7m"
 CONFIG_SPL_FS_FAT=y
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
 CONFIG_SPL_FIT_SIGNATURE=y
 CONFIG_SPL_LOAD_FIT=y
-CONFIG_SPL_LOAD_FIT_ADDRESS=0x82000000
+CONFIG_SPL_LOAD_FIT_ADDRESS=0x02000000
+CONFIG_SYS_LOAD_ADDR=0x02000000
 # CONFIG_USE_SPL_FIT_GENERATOR is not set
-CONFIG_QSPI_BOOT=y
+# CONFIG_NAND_BOOT is not set
+# CONFIG_QSPI_BOOT is not set
 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_LEGACY_IMAGE_FORMAT=y
+CONFIG_BOOTARGS="earlycon panic=-1"
 # CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
+CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x300000
+CONFIG_SPL_MAX_SIZE=0x40000
+CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
+CONFIG_SPL_BSS_START_ADDR=0x3ff00000
+# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
+CONFIG_SPL_STACK=0xffe3f000
+CONFIG_SPL_SYS_MALLOC=y
+CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
+CONFIG_CUSTOM_SPL_SYS_MALLOC_ADDR=0x3fa00000
+CONFIG_SPL_SYS_MALLOC_SIZE=0x500000
+CONFIG_SPL_BSS_MAX_SIZE=0x100000
 CONFIG_SPL_CRC32=y
+CONFIG_SPL_MTD_SUPPORT=y
+# CONFIG_SPL_NAND_SUPPORT is not set
 CONFIG_SPL_CACHE=y
+CONFIG_SPL_SPI_LOAD=y
 CONFIG_SPL_ATF=y
 CONFIG_SPL_ATF_NO_PLATFORM_PARAM=y
-CONFIG_SYS_PROMPT="SOCFPGA_AGILEX5 # "
+CONFIG_SYS_PROMPT="SOCFPGA_AGILEX7M # "
 CONFIG_CMD_NVEDIT_SELECT=y
 CONFIG_CMD_MEMTEST=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_I2C=y
-CONFIG_CMD_SF=y
-CONFIG_DOS_PARTITION=y
-CONFIG_SPL_DOS_PARTITION=y
-CONFIG_SPL_SYS_DISABLE_DCACHE_OPS=y
+CONFIG_CMD_MMC=y
 CONFIG_CMD_MTD=y
-# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
+# CONFIG_CMD_NAND_TRIMFFS is not set
+# CONFIG_CMD_NAND_LOCK_UNLOCK is not set
 CONFIG_CMD_SPI=y
 CONFIG_CMD_USB=y
 CONFIG_CMD_CACHE=y
 CONFIG_SPL_SPI_FLASH_MTD=y
 CONFIG_SPI_FLASH_MTD=y
-CONFIG_SPL_MTD_SUPPORT=y
+CONFIG_MTDIDS_DEFAULT="nand0=ffb90000.nand.0"
+CONFIG_MTDPARTS_DEFAULT="mtdparts=ffb90000.nand.0:2m(u-boot),-(root)"
+# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
 CONFIG_CMD_UBI=y
 CONFIG_CMD_UBIFS=y
 CONFIG_MTD_UBI=y
@@ -53,9 +72,8 @@ CONFIG_MTD_UBI_BEB_LIMIT=20
 # CONFIG_ISO_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
 CONFIG_OF_LIST=""
-CONFIG_ENV_IS_IN_UBI=y
-CONFIG_ENV_UBI_PART="root"
-CONFIG_ENV_UBI_VOLUME="env"
+CONFIG_ENV_IS_IN_FAT=y
+CONFIG_ENV_FAT_DEVICE_AND_PART="0:1"
 CONFIG_SYS_RELOC_GD_ENV_ADDR=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_SPL_DM_SEQ_ALIAS=y
@@ -65,52 +83,32 @@ CONFIG_DWAPB_GPIO=y
 CONFIG_DM_I2C=y
 CONFIG_SYS_I2C_DW=y
 CONFIG_MISC=y
+CONFIG_MMC_DW=y
+CONFIG_SYS_MMC_MAX_BLK_COUNT=256
 CONFIG_MTD=y
 CONFIG_DM_MTD=y
+# CONFIG_NAND_DENALI_DT is not set
+# CONFIG_SYS_NAND_U_BOOT_LOCATIONS is not set
+CONFIG_SYS_NAND_U_BOOT_OFFS=0x0
+CONFIG_SYS_NAND_U_BOOT_OFFS_REDUND=0x100000
+CONFIG_SPL_NAND_FRAMEWORK=y
 CONFIG_SF_DEFAULT_MODE=0x2003
 CONFIG_SPI_FLASH_SPANSION=y
 CONFIG_SPI_FLASH_STMICRO=y
-CONFIG_UBI_SILENCE_MSG=y
+CONFIG_PHY_MICREL=y
+CONFIG_PHY_MICREL_KSZ90X1=y
 CONFIG_DM_ETH=y
-CONFIG_RGMII=y
+CONFIG_ETH_DESIGNWARE=y
+CONFIG_MII=y
 CONFIG_DM_RESET=y
 CONFIG_SYS_NS16550_MEM32=y
 CONFIG_SPI=y
-CONFIG_CADENCE_QSPI=y
-CONFIG_DESIGNWARE_SPI=y
+# CONFIG_CADENCE_QSPI is not set
+# CONFIG_DESIGNWARE_SPI is not set
 CONFIG_USB=y
+CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
-CONFIG_USB_XHCI_HCD=y
-CONFIG_UBIFS_SILENCE_MSG=y
+CONFIG_DESIGNWARE_WATCHDOG=y
+CONFIG_WDT=y
 # CONFIG_SPL_USE_TINY_PRINTF is not set
 CONFIG_PANIC_HANG=y
-CONFIG_SPL_SPI_LOAD=y
-CONFIG_SYS_LOAD_ADDR=0x82000000
-CONFIG_WDT=y
-CONFIG_CMD_WDT=y
-CONFIG_DESIGNWARE_WATCHDOG=y
-CONFIG_SPL_WDT=y
-CONFIG_WATCHDOG_AUTOSTART=n
-CONFIG_TIMER=y
-CONFIG_DESIGNWARE_APB_TIMER=y
-CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
-CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80300000
-CONFIG_SPL_MAX_SIZE=0x40000
-CONFIG_SPL_HAS_BSS_LINKER_SECTION=y
-CONFIG_SPL_BSS_START_ADDR=0xbff00000
-# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
-CONFIG_SPL_STACK=0x7f000
-CONFIG_SYS_SPL_MALLOC=y
-CONFIG_HAS_CUSTOM_SPL_MALLOC_START=y
-CONFIG_CUSTOM_SYS_SPL_MALLOC_ADDR=0xbfa00000
-CONFIG_SYS_SPL_MALLOC_SIZE=0x500000
-CONFIG_SPL_BSS_MAX_SIZE=0x100000
-# CONFIG_EFI_LOADER is not set
-CONFIG_I3C=y
-CONFIG_DW_I3C_MASTER=y
-CONFIG_CMD_I3C=y
-CONFIG_SYS_MAXARGS=32
-CONFIG_CMD_TIMER=y
-# CONFIG_BOOTFILE="Image" is not set for CONFIG_SPL_ATF=y
-CONFIG_USE_BOOTFILE=y
-CONFIG_BOOTFILE="kernel.itb"
Signature · 1 line
2.25.1
#19 lore raw

Re: [Agilex7 M-series Platform Enablement v1 16/16] configs: Add defconfig for Agilex7 M-series

Quoted 11 lines · On Fri, May 17, 2024 at 01:27:01PM +0800, [email protected] wrote:

From: Wan Yee Lau <[email protected]>

Add defconfig for Agilex7 M-series.

---
 ...onfig => socfpga_agilex7m_sdmmc_defconfig} | 110 +++++++++---------
 1 file changed, 54 insertions(+), 56 deletions(-)
 copy configs/{socfpga_agilex5_defconfig => socfpga_agilex7m_sdmmc_defconfig} (56%)

You need to put this in a MAINTAINERS file.

Signature · 1 line
Tom
#20 lore raw

RE: [Agilex7 M-series Platform Enablement v1 16/16] configs: Add defconfig for Agilex7 M-series

Quoted 35 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Friday, May 17, 2024 11:16 PM
To: Meng, Tingting <[email protected]>
Cc: [email protected]; Lukasz Majewski <[email protected]>; Sean Anderson <[email protected]>; Rayagonda Kokatanur <[email protected]>; Marek <[email protected]>; Simon <[email protected]>; Chee, Tien Fong <[email protected]>; Hea, Kok Kiang <[email protected]>; Maniyam, Dinesh <[email protected]>; Ng, Boon Khai <[email protected]>; Yuslaimi, Alif Zakuan <[email protected]>; Chong, Teik Heng <[email protected]>; Zamri, Muhammad Hazim Izzat <[email protected]>; Lim, Jit Loon <[email protected]>; Tang, Sieu Mun <[email protected]>; Lau, Wan Yee <[email protected]>
Subject: Re: [Agilex7 M-series Platform Enablement v1 16/16] configs: Add defconfig for Agilex7 M-series

Quoted 7 lines · On Fri, May 17, 2024 at 01:27:01PM +0800, [email protected] wrote:

From: Wan Yee Lau <[email protected]>

Add defconfig for Agilex7 M-series.

Quoted 6 lines
---
 ...onfig => socfpga_agilex7m_sdmmc_defconfig} | 110
+++++++++---------
 1 file changed, 54 insertions(+), 56 deletions(-)  copy

configs/{socfpga_agilex5_defconfig =>
socfpga_agilex7m_sdmmc_defconfig} (56%)

Quoted 4 lines

You need to put this in a MAINTAINERS file.

--
Tom

Will add it. Thanks so much.