Skip to contentSkip to conversation

arm64: versal2: Add support for new AMD Versal Gen 2 SoC

PATCH Applied Michal Simek 2 participants 10 messages May 29, 2024 – Jun 11, 2024

Subsystems (7)
lore
Share & tools
lore
author maintainer
#2 lore raw

PATCH 2/4 soc: versal2: Add SoC driver for AMD Versal Gen 2

In reply to Michal Simek

Communication is happening via firmware interface (SMC) or via direct register reading if firmware driver is not available.

Also enable it via defconfig.

---

 configs/amd_versal2_virt_defconfig |  1 +
 drivers/soc/Kconfig                |  8 ++++
 drivers/soc/Makefile               |  1 +
 drivers/soc/soc_amd_versal2.c      | 77 ++++++++++++++++++++++++++++++
 4 files changed, 87 insertions(+)
 create mode 100644 drivers/soc/soc_amd_versal2.c
configs/amd_versal2_virt_defconfig +1 -0
index 5eea07f03f51..8ef86f1f3830 100644
@@ -119,6 +119,7 @@ CONFIG_ARM_DCC=y
 CONFIG_PL01X_SERIAL=y
 CONFIG_XILINX_UARTLITE=y
 CONFIG_SOC_DEVICE=y
+CONFIG_SOC_AMD_VERSAL2=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_ZYNQ_SPI=y
drivers/soc/Kconfig +8 -0
index 03433bc0e6d2..cee506fe4747 100644
@@ -9,6 +9,14 @@ config SOC_DEVICE
 	  need different parameters or quirks enabled depending on the
 	  specific device variant in use.
 
+config SOC_AMD_VERSAL2
+	bool "Enable SoC Device ID driver for AMD Versal Gen 2"
+	depends on SOC_DEVICE && ARCH_VERSAL2
+	help
+	  Enable this option to select SoC device id driver for AMD Versal Gen 2.
+	  This allows other drivers to verify the SoC familiy & revision using
+	  matching SoC attributes.
+
 config SOC_DEVICE_TI_K3
 	depends on SOC_DEVICE && ARCH_K3
 	bool "Enable SoC Device ID driver for TI K3 SoCs"
drivers/soc/Makefile +1 -0
index 610bf816d40a..5ec89a053165 100644
@@ -2,6 +2,7 @@
 #
 # Makefile for the U-Boot SOC specific device drivers.
 
+obj-$(CONFIG_SOC_AMD_VERSAL2) += soc_amd_versal2.o
 obj-$(CONFIG_SOC_SAMSUNG) += samsung/
 obj-$(CONFIG_SOC_TI) += ti/
 obj-$(CONFIG_SOC_DEVICE) += soc-uclass.o
drivers/soc/soc_amd_versal2.c new file +77 -0

77 lines not on this page · raw message

Signature · 1 line
2.40.1
author maintainer
#3 lore raw

PATCH 3/4 mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2

In reply to Michal Simek

Enable tap delay programming for new SoC and also enable it via defconfig.

---

 configs/amd_versal2_virt_defconfig |  2 ++
 drivers/mmc/zynq_sdhci.c           | 22 ++++++++++++++--------
 2 files changed, 16 insertions(+), 8 deletions(-)
configs/amd_versal2_virt_defconfig +2 -0
index 8ef86f1f3830..b74e69be28c4 100644
@@ -87,6 +87,8 @@ CONFIG_MMC_IO_VOLTAGE=y
 CONFIG_MMC_UHS_SUPPORT=y
 CONFIG_MMC_HS400_SUPPORT=y
 CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_ZYNQ=y
+CONFIG_ZYNQ_SDHCI_MIN_FREQ=100000
 CONFIG_MTD=y
 CONFIG_DM_SPI_FLASH=y
 CONFIG_SPI_FLASH_GIGADEVICE=y
drivers/mmc/zynq_sdhci.c +14 -8
index 8a83adef4342..28d2b456fbf6 100644
@@ -122,7 +122,8 @@ __weak int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
 	return 1;
 }
 
-#if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) || defined(CONFIG_ARCH_VERSAL_NET)
+#if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) || \
+    defined(CONFIG_ARCH_VERSAL_NET) || defined(CONFIG_ARCH_VERSAL2)
 /* Default settings for ZynqMP Clock Phases */
 static const u32 zynqmp_iclk_phases[] = {0, 63, 63, 0, 63,  0,
 					 0, 183, 54,  0, 0};
@@ -156,7 +157,7 @@ static const u8 mode2timing[] = {
 	[MMC_HS_400] = MMC_TIMING_MMC_HS400,
 };
 
-#if defined(CONFIG_ARCH_VERSAL_NET)
+#if defined(CONFIG_ARCH_VERSAL_NET) || defined(CONFIG_ARCH_VERSAL2)
 /**
  * arasan_phy_set_delaychain - Set eMMC delay chain based Input/Output clock
  *
@@ -866,7 +867,8 @@ static int arasan_sdhci_set_tapdelay(struct sdhci_host *host)
 		if (ret)
 			return ret;
 	} else if ((IS_ENABLED(CONFIG_ARCH_VERSAL) ||
-		    IS_ENABLED(CONFIG_ARCH_VERSAL_NET)) &&
+		    IS_ENABLED(CONFIG_ARCH_VERSAL_NET) ||
+		    IS_ENABLED(CONFIG_ARCH_VERSAL2)) &&
 		   device_is_compatible(dev, "xlnx,versal-8.9a")) {
 		ret = sdhci_versal_sampleclk_set_phase(host, iclk_phase);
 		if (ret)
@@ -875,7 +877,8 @@ static int arasan_sdhci_set_tapdelay(struct sdhci_host *host)
 		ret = sdhci_versal_sdcardclk_set_phase(host, oclk_phase);
 		if (ret)
 			return ret;
-	} else if (IS_ENABLED(CONFIG_ARCH_VERSAL_NET) &&
+	} else if ((IS_ENABLED(CONFIG_ARCH_VERSAL_NET) ||
+		    IS_ENABLED(CONFIG_ARCH_VERSAL2)) &&
 		   device_is_compatible(dev, "xlnx,versal-net-emmc")) {
 		if (mmc->clock >= MIN_PHY_CLK_HZ)
 			if (iclk_phase == VERSAL_NET_EMMC_ICLK_PHASE_DDR52_DLY_CHAIN)
@@ -943,7 +946,8 @@ static void arasan_dt_parse_clk_phases(struct udevice *dev)
 	}
 
 	if ((IS_ENABLED(CONFIG_ARCH_VERSAL) ||
-	     IS_ENABLED(CONFIG_ARCH_VERSAL_NET)) &&
+	     IS_ENABLED(CONFIG_ARCH_VERSAL_NET) ||
+	     IS_ENABLED(CONFIG_ARCH_VERSAL2)) &&
 	    device_is_compatible(dev, "xlnx,versal-8.9a")) {
 		for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) {
 			clk_data->clk_phase_in[i] = versal_iclk_phases[i];
@@ -951,7 +955,8 @@ static void arasan_dt_parse_clk_phases(struct udevice *dev)
 		}
 	}
 
-	if (IS_ENABLED(CONFIG_ARCH_VERSAL_NET) &&
+	if ((IS_ENABLED(CONFIG_ARCH_VERSAL_NET) ||
+	     IS_ENABLED(CONFIG_ARCH_VERSAL2)) &&
 	    device_is_compatible(dev, "xlnx,versal-net-emmc")) {
 		for (i = 0; i <= MMC_TIMING_MMC_HS400; i++) {
 			clk_data->clk_phase_in[i] = versal_net_emmc_iclk_phases[i];
@@ -987,7 +992,7 @@ static const struct sdhci_ops arasan_ops = {
 	.platform_execute_tuning	= &arasan_sdhci_execute_tuning,
 	.set_delay = &arasan_sdhci_set_tapdelay,
 	.set_control_reg = &sdhci_set_control_reg,
-#if defined(CONFIG_ARCH_VERSAL_NET)
+#if defined(CONFIG_ARCH_VERSAL_NET) || defined(CONFIG_ARCH_VERSAL2)
 	.config_dll = &arasan_sdhci_config_dll,
 #endif
 };
@@ -1195,7 +1200,8 @@ static int arasan_sdhci_of_to_plat(struct udevice *dev)
 
 	priv->host->name = dev->name;
 
-#if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) || defined(CONFIG_ARCH_VERSAL_NET)
+#if defined(CONFIG_ARCH_ZYNQMP) || defined(CONFIG_ARCH_VERSAL) || defined(CONFIG_ARCH_VERSAL_NET) || \
+    defined(CONFIG_ARCH_VERSAL2)
 	priv->host->ops = &arasan_ops;
 	arasan_dt_parse_clk_phases(dev);
 #endif
Signature · 1 line
2.40.1
author maintainer
#4 lore raw

PATCH 4/4 spi: versal2: Enable spi drivers for Versal Gen 2

In reply to Michal Simek

Enable and update OSPI/QSPI/GQSPI drivers to support Versal Gen 2 SoCs.

---

 configs/amd_versal2_virt_defconfig | 4 +++-
 drivers/spi/Kconfig                | 2 +-
 drivers/spi/cadence_qspi.c         | 3 ++-
 drivers/spi/zynqmp_gqspi.c         | 6 ++++--
 4 files changed, 10 insertions(+), 5 deletions(-)
configs/amd_versal2_virt_defconfig +3 -1
index b74e69be28c4..6e4adddf2c02 100644
@@ -5,7 +5,6 @@ CONFIG_SYS_INIT_SP_BSS_OFFSET=1572864
 CONFIG_ARCH_VERSAL2=y
 CONFIG_TEXT_BASE=0x8000000
 CONFIG_SYS_MALLOC_F_LEN=0x100000
-CONFIG_DM_GPIO=y
 CONFIG_DEFAULT_DEVICE_TREE="amd-versal2-virt"
 CONFIG_OF_LIBFDT_OVERLAY=y
 CONFIG_DM_RESET=y
@@ -124,7 +123,10 @@ CONFIG_SOC_DEVICE=y
 CONFIG_SOC_AMD_VERSAL2=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
+CONFIG_CADENCE_QSPI=y
+CONFIG_CADENCE_OSPI_VERSAL=y
 CONFIG_ZYNQ_SPI=y
+CONFIG_ZYNQMP_GQSPI=y
 CONFIG_TPM2_TIS_SPI=y
 CONFIG_USB=y
 CONFIG_DM_USB_GADGET=y
drivers/spi/Kconfig +1 -1
index 35030ab35561..cd785aefd56e 100644
@@ -156,7 +156,7 @@ config CQSPI_REF_CLK
 
 config CADENCE_OSPI_VERSAL
 	bool "Configure Versal OSPI"
-	depends on (ARCH_VERSAL || ARCH_VERSAL_NET) && CADENCE_QSPI
+	depends on (ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2) && CADENCE_QSPI
 	imply DM_GPIO
 	help
 	  This option is used to enable Versal OSPI DMA operations which
drivers/spi/cadence_qspi.c +2 -1
index 75e522320101..9c466f8695e2 100644
@@ -253,7 +253,8 @@ static int cadence_spi_probe(struct udevice *bus)
 
 	/* Versal and Versal-NET use spi calibration to set read delay */
 	if (CONFIG_IS_ENABLED(ARCH_VERSAL) ||
-	    CONFIG_IS_ENABLED(ARCH_VERSAL_NET))
+	    CONFIG_IS_ENABLED(ARCH_VERSAL_NET) ||
+	    CONFIG_IS_ENABLED(ARCH_VERSAL2))
 		if (priv->read_delay >= 0)
 			priv->read_delay = -1;
 
drivers/spi/zynqmp_gqspi.c +4 -2
index 61349a4da53f..ae795e50b0a5 100644
@@ -106,7 +106,8 @@
 #define TAP_DLY_BYPASS_LQSPI_RX_SHIFT	2
 #define GQSPI_DATA_DLY_ADJ_OFST		0x000001F8
 #define IOU_TAPDLY_BYPASS_OFST !(IS_ENABLED(CONFIG_ARCH_VERSAL) || \
-				 IS_ENABLED(CONFIG_ARCH_VERSAL_NET)) ? \
+				 IS_ENABLED(CONFIG_ARCH_VERSAL_NET) || \
+				 IS_ENABLED(CONFIG_ARCH_VERSAL2)) ? \
 				0xFF180390 : 0xF103003C
 #define GQSPI_LPBK_DLY_ADJ_LPBK_MASK	0x00000020
 #define GQSPI_FREQ_37_5MHZ		37500000
@@ -316,7 +317,8 @@ static void zynqmp_qspi_set_tapdelay(struct udevice *bus, u32 baudrateval)
 		  __func__, clk_rate, baudrateval, reqhz);
 
 	if (!(IS_ENABLED(CONFIG_ARCH_VERSAL) ||
-	      IS_ENABLED(CONFIG_ARCH_VERSAL_NET))) {
+	      IS_ENABLED(CONFIG_ARCH_VERSAL_NET) ||
+	      IS_ENABLED(CONFIG_ARCH_VERSAL2))) {
 		if (reqhz <= GQSPI_FREQ_40MHZ) {
 			tapdlybypass = TAP_DLY_BYPASS_LQSPI_RX_VALUE <<
 					TAP_DLY_BYPASS_LQSPI_RX_SHIFT;
Signature · 1 line
2.40.1

Michal Simek

author maintainer
#0 lore raw

cover arm64: versal2: Add support for new AMD Versal Gen 2 SoC

Hi,

I am sending patches for adding initial support for new AMD Versal Gen 2 SoC. If you want to find out more information please take a look at this page:
https://www.amd.com/en/products/adaptive-socs-and-fpgas/versal.html

Thanks,
Michal

Michal Simek (4):
arm64: versal2: Add support for AMD Versal Gen 2
soc: versal2: Add SoC driver for AMD Versal Gen 2
mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2
spi: versal2: Enable spi drivers for Versal Gen 2

 arch/arm/Kconfig                              |  14 +
 arch/arm/Makefile                             |   1 +
 arch/arm/dts/Makefile                         |   2 +
 arch/arm/dts/amd-versal2-virt.dts             |  11 +
 arch/arm/mach-versal2/Kconfig                 |  55 +++
 arch/arm/mach-versal2/Makefile                |  10 +
 arch/arm/mach-versal2/clk.c                   |  34 ++
 arch/arm/mach-versal2/cpu.c                   |  93 +++++
 arch/arm/mach-versal2/include/mach/hardware.h |  97 +++++
 .../arm/mach-versal2/include/mach/sys_proto.h |   9 +
 board/amd/common                              |   1 +
 board/amd/versal2/Kconfig                     |  16 +
 board/amd/versal2/MAINTAINERS                 |   7 +
 board/amd/versal2/Makefile                    |  11 +
 board/amd/versal2/board.c                     | 343 ++++++++++++++++++
 board/amd/versal2/cmds.c                      |  81 +++++
 board/xilinx/Kconfig                          |   6 +-
 configs/amd_versal2_virt_defconfig            | 150 ++++++++
 drivers/gpio/Kconfig                          |   2 +-
 drivers/mailbox/Kconfig                       |   2 +-
 drivers/mmc/zynq_sdhci.c                      |  22 +-
 drivers/soc/Kconfig                           |   8 +
 drivers/soc/Makefile                          |   1 +
 drivers/soc/soc_amd_versal2.c                 |  77 ++++
 drivers/spi/Kconfig                           |   2 +-
 drivers/spi/cadence_qspi.c                    |   3 +-
 drivers/spi/zynqmp_gqspi.c                    |   6 +-
 env/Kconfig                                   |   6 +-
 include/configs/amd_versal2.h                 | 143 ++++++++
 29 files changed, 1193 insertions(+), 20 deletions(-)
 create mode 100644 arch/arm/dts/amd-versal2-virt.dts
 create mode 100644 arch/arm/mach-versal2/Kconfig
 create mode 100644 arch/arm/mach-versal2/Makefile
 create mode 100644 arch/arm/mach-versal2/clk.c
 create mode 100644 arch/arm/mach-versal2/cpu.c
 create mode 100644 arch/arm/mach-versal2/include/mach/hardware.h
 create mode 100644 arch/arm/mach-versal2/include/mach/sys_proto.h
 create mode 120000 board/amd/common
 create mode 100644 board/amd/versal2/Kconfig
 create mode 100644 board/amd/versal2/MAINTAINERS
 create mode 100644 board/amd/versal2/Makefile
 create mode 100644 board/amd/versal2/board.c
 create mode 100644 board/amd/versal2/cmds.c
 create mode 100644 configs/amd_versal2_virt_defconfig
 create mode 100644 drivers/soc/soc_amd_versal2.c
 create mode 100644 include/configs/amd_versal2.h
Signature · 1 line
2.40.1
author maintainer
#1 lore raw

PATCH 1/4 arm64: versal2: Add support for AMD Versal Gen 2

Add support for AMD Versal Gen 2. SoC is based on Cortex-a78ae 4 cluster/2 cpu core each. A lot of IPs are shared with previous families. There are couple of new IP blocks where the most interesting from user point of view is UFS.

---

 arch/arm/Kconfig                              |  14 +
 arch/arm/Makefile                             |   1 +
 arch/arm/dts/Makefile                         |   2 +
 arch/arm/dts/amd-versal2-virt.dts             |  11 +
 arch/arm/mach-versal2/Kconfig                 |  55 +++
 arch/arm/mach-versal2/Makefile                |  10 +
 arch/arm/mach-versal2/clk.c                   |  34 ++
 arch/arm/mach-versal2/cpu.c                   |  93 +++++
 arch/arm/mach-versal2/include/mach/hardware.h |  97 +++++
 .../arm/mach-versal2/include/mach/sys_proto.h |   9 +
 board/amd/common                              |   1 +
 board/amd/versal2/Kconfig                     |  16 +
 board/amd/versal2/MAINTAINERS                 |   7 +
 board/amd/versal2/Makefile                    |  11 +
 board/amd/versal2/board.c                     | 343 ++++++++++++++++++
 board/amd/versal2/cmds.c                      |  81 +++++
 board/xilinx/Kconfig                          |   6 +-
 configs/amd_versal2_virt_defconfig            | 145 ++++++++
 drivers/gpio/Kconfig                          |   2 +-
 drivers/mailbox/Kconfig                       |   2 +-
 env/Kconfig                                   |   6 +-
 include/configs/amd_versal2.h                 | 143 ++++++++
 22 files changed, 1081 insertions(+), 8 deletions(-)
 create mode 100644 arch/arm/dts/amd-versal2-virt.dts
 create mode 100644 arch/arm/mach-versal2/Kconfig
 create mode 100644 arch/arm/mach-versal2/Makefile
 create mode 100644 arch/arm/mach-versal2/clk.c
 create mode 100644 arch/arm/mach-versal2/cpu.c
 create mode 100644 arch/arm/mach-versal2/include/mach/hardware.h
 create mode 100644 arch/arm/mach-versal2/include/mach/sys_proto.h
 create mode 120000 board/amd/common
 create mode 100644 board/amd/versal2/Kconfig
 create mode 100644 board/amd/versal2/MAINTAINERS
 create mode 100644 board/amd/versal2/Makefile
 create mode 100644 board/amd/versal2/board.c
 create mode 100644 board/amd/versal2/cmds.c
 create mode 100644 configs/amd_versal2_virt_defconfig
 create mode 100644 include/configs/amd_versal2.h
arch/arm/Kconfig +14 -0
index 6d9a4c993c34..db692b2d215a 100644
@@ -1235,6 +1235,18 @@ config ARCH_VERSAL
 	imply BOARD_LATE_INIT
 	imply ENV_VARS_UBOOT_RUNTIME_CONFIG
 
+config ARCH_VERSAL2
+	bool "Support AMD Versal Gen 2 Platform"
+	select ARM64
+	select CLK
+	select DM
+	select DM_MMC if MMC
+	select DM_SERIAL
+	select OF_CONTROL
+	imply BOARD_LATE_INIT
+	imply ENV_VARS_UBOOT_RUNTIME_CONFIG
+	imply ZYNQMP_FIRMWARE
+
 config ARCH_VERSAL_NET
 	bool "Support Xilinx Versal NET Platform"
 	select ARM64
@@ -2317,6 +2329,8 @@ source "arch/arm/mach-zynqmp/Kconfig"
 
 source "arch/arm/mach-versal/Kconfig"
 
+source "arch/arm/mach-versal2/Kconfig"
+
 source "arch/arm/mach-versal-net/Kconfig"
 
 source "arch/arm/mach-zynqmp-r5/Kconfig"
arch/arm/Makefile +1 -0
index 734c6d69926b..dbeedbe544bd 100644
@@ -90,6 +90,7 @@ machine-$(CONFIG_ARCH_OCTEONTX)		+= octeontx
 machine-$(CONFIG_ARCH_OCTEONTX2)	+= octeontx2
 machine-$(CONFIG_ARCH_UNIPHIER)		+= uniphier
 machine-$(CONFIG_ARCH_VERSAL)		+= versal
+machine-$(CONFIG_ARCH_VERSAL2)		+= versal2
 machine-$(CONFIG_ARCH_VERSAL_NET)	+= versal-net
 machine-$(CONFIG_ARCH_ZYNQ)		+= zynq
 machine-$(CONFIG_ARCH_ZYNQMP)		+= zynqmp
arch/arm/dts/Makefile +2 -0
index f7032f1e1755..45f866dd185b 100644
@@ -345,6 +345,8 @@ dtb-$(CONFIG_ARCH_VERSAL) += \
 	versal-mini-qspi-x2-single.dtb \
 	versal-mini-qspi-x2-stacked.dtb \
 	xilinx-versal-virt.dtb
+dtb-$(CONFIG_ARCH_VERSAL2) += \
+	amd-versal2-virt.dtb
 dtb-$(CONFIG_ARCH_VERSAL_NET) += \
 	versal-net-mini.dtb \
 	versal-net-mini-emmc.dtb \
arch/arm/dts/amd-versal2-virt.dts new file +11 -0
new file mode 100644
index 000000000000..3b6cbbac5820
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Empty device tree for amd-versal2-virt board
+ *
+ * Copyright (C) 2024, Advanced Micro Devices, Inc.
+ */
+
+/dts-v1/;
+
+/ {
+};
arch/arm/mach-versal2/Kconfig new file +55 -0

55 lines not on this page · raw message

arch/arm/mach-versal2/Makefile new file +10 -0
new file mode 100644
index 000000000000..96497b1dfd0a
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2021 - 2022, Xilinx, Inc.
+# Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc.
+#
+# Michal Simek <[email protected]>
+#
+
+obj-y	+= clk.o
+obj-y	+= cpu.o
arch/arm/mach-versal2/clk.c new file +34 -0
new file mode 100644
index 000000000000..e73ae9af0761
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2016 - 2022,  Xilinx, Inc.
+ * Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc.
+ *
+ * Michal Simek <[email protected]>
+ */
+
+#include <init.h>
+#include <time.h>
+#include <asm/global_data.h>
+
+DECLARE_GLOBAL_DATA_PTR;
+
+#ifdef CONFIG_CLOCKS
+/**
+ * set_cpu_clk_info - Initialize clock framework
+ *
+ * Return: 0 always.
+ *
+ * This function is called from common code after relocation and sets up the
+ * clock framework. The framework must not be used before this function had been
+ * called.
+ */
+int set_cpu_clk_info(void)
+{
+	gd->cpu_clk = get_tbclk();
+
+	gd->bd->bi_arm_freq = gd->cpu_clk / 1000000;
+	gd->bd->bi_dsp_freq = 0;
+
+	return 0;
+}
+#endif
arch/arm/mach-versal2/cpu.c new file +93 -0

93 lines not on this page · raw message

arch/arm/mach-versal2/include/mach/hardware.h new file +97 -0

97 lines not on this page · raw message

arch/arm/mach-versal2/include/mach/sys_proto.h new file +9 -0
new file mode 100644
index 000000000000..7b1726a7ef40
@@ -0,0 +1,9 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Copyright (C) 2021 - 2022, Xilinx, Inc.
+ * Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc.
+ */
+
+#include <linux/build_bug.h>
+
+void mem_map_fill(void);
board/amd/common new file +1 -0
new file mode 120000
index 000000000000..cd4d172974b5
@@ -0,0 +1 @@
+../xilinx/common/
\ No newline at end of file
board/amd/versal2/Kconfig new file +16 -0
new file mode 100644
index 000000000000..ab46af6935ef
@@ -0,0 +1,16 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2020 - 2022, Xilinx, Inc.
+# Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc.
+#
+if ARCH_VERSAL2
+
+config CMD_VERSAL2
+	bool "Enable Versal Gen 2 specific commands"
+	default y
+	depends on ZYNQMP_FIRMWARE
+	help
+	  Select this to enable AMD Versal Gen 2 specific commands.
+	  Commands like versal2 loadpdi are enabled by this.
+
+endif
board/amd/versal2/MAINTAINERS new file +7 -0
new file mode 100644
index 000000000000..af7913d8db3a
@@ -0,0 +1,7 @@
+XILINX_VERSAL2 BOARDS
+M:	Michal Simek <[email protected]>
+S:	Maintained
+T:	git https://gitlab.denx.de/u-boot/custodians/u-boot-microblaze.git
+F:	arch/arm/dts/versal2*
+F:	board/amd/
+F:	configs/amd*
board/amd/versal2/Makefile new file +11 -0
new file mode 100644
index 000000000000..3a044517f0c7
@@ -0,0 +1,11 @@
+# SPDX-License-Identifier: GPL-2.0
+#
+# Copyright (C) 2021 - 2022, Xilinx, Inc.
+# Copyright (C) 2022 - 2024, Advanced Micro Devices, Inc.
+#
+# Michal Simek <[email protected]>
+#
+
+obj-y	:= board.o
+
+obj-$(CONFIG_CMD_VERSAL2)   += cmds.o
board/amd/versal2/board.c new file +343 -0

343 lines not on this page · raw message

board/amd/versal2/cmds.c new file +81 -0

81 lines not on this page · raw message

board/xilinx/Kconfig +3 -3
index 5c4ad8f1df9a..c7df4ab5781a 100644
@@ -42,7 +42,7 @@ endif
 
 config XILINX_OF_BOARD_DTB_ADDR
 	hex "Default DTB pickup address"
-	default 0x1000 if ARCH_VERSAL || ARCH_VERSAL_NET
+	default 0x1000 if ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2
 	default 0x8000 if MICROBLAZE
 	default 0x100000 if ARCH_ZYNQ || ARCH_ZYNQMP
 	default 0x23000000 if TARGET_XILINX_MBV
@@ -52,10 +52,10 @@ config XILINX_OF_BOARD_DTB_ADDR
 
 config BOOT_SCRIPT_OFFSET
 	hex "Boot script offset"
-	depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || MICROBLAZE || TARGET_XILINX_MBV
+	depends on ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2 || MICROBLAZE || TARGET_XILINX_MBV
 	default 0xFC0000 if ARCH_ZYNQ || MICROBLAZE
 	default 0x3E80000 if ARCH_ZYNQMP
-	default 0x7F80000 if ARCH_VERSAL || ARCH_VERSAL_NET
+	default 0x7F80000 if ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2
 	default 0 if TARGET_XILINX_MBV
 	help
 	   Specifies distro boot script offset in NAND/QSPI/NOR flash.
configs/amd_versal2_virt_defconfig new file +145 -0

145 lines not on this page · raw message

drivers/gpio/Kconfig +1 -1
index b050585389bb..2c0e244b9e41 100644
@@ -487,7 +487,7 @@ config MVEBU_GPIO
 config ZYNQ_GPIO
 	bool "Zynq GPIO driver"
 	depends on DM_GPIO
-	default y if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL
+	default y if ARCH_ZYNQ || ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL2
 	help
 	  Supports GPIO access on Zynq SoC.
 
drivers/mailbox/Kconfig +1 -1
index 47f24e0a02e0..67d5ac1a7422 100644
@@ -54,7 +54,7 @@ config K3_SEC_PROXY
 
 config ZYNQMP_IPI
 	bool "Xilinx ZynqMP IPI controller support"
-	depends on DM_MAILBOX && (ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET)
+	depends on DM_MAILBOX && (ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2)
 	help
 	  This enables support for the Xilinx ZynqMP Inter Processor Interrupt
 	  communication controller.
env/Kconfig +3 -3
index 9641abe371a0..451bab45ea7b 100644
@@ -570,7 +570,7 @@ config ENV_OFFSET
 	default 0xF0000 if ARCH_SUNXI
 	default 0xE0000 if ARCH_ZYNQ
 	default 0x1E00000 if ARCH_ZYNQMP
-	default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET
+	default 0x7F40000 if ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2
 	default 0x0 if ARC
 	default 0x140000 if ARCH_AT91
 	default 0x260000 if ARCH_OMAP2PLUS
@@ -605,7 +605,7 @@ config ENV_SIZE
 	default 0x10000 if ARCH_SUNXI
 	default 0x8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
 	default 0x2000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
-	default 0x8000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET
+	default 0x8000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2
 	default 0x4000 if ARC
 	default 0x1f000
 	help
@@ -615,7 +615,7 @@ config ENV_SECT_SIZE
 	hex "Environment Sector-Size"
 	depends on ENV_IS_IN_FLASH || ENV_IS_IN_SPI_FLASH
 	default 0x2000 if ARCH_ROCKCHIP
-	default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET
+	default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VERSAL_NET || ARCH_VERSAL2
 	default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
 	default 0x20000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH
 	default 0x10000 if ARCH_SUNXI && ENV_IS_IN_SPI_FLASH
include/configs/amd_versal2.h new file +143 -0

143 lines not on this page · raw message

Signature · 1 line
2.40.1
#5 lore raw
In reply to Michal Simek
Quoted 11 lines · Michal Simek

Hi,

I am sending patches for adding initial support for new AMD Versal Gen 2 SoC. If you want to find out more information please take a look at this page:
https://www.amd.com/en/products/adaptive-socs-and-fpgas/versal.html

Thanks,
Michal

Quoted 5 lines

Michal Simek (4):
arm64: versal2: Add support for AMD Versal Gen 2
soc: versal2: Add SoC driver for AMD Versal Gen 2
mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2
spi: versal2: Enable spi drivers for Versal Gen 2

My only concerns are name-related and not-blocking. First, should we perhaps instead have arch/arm/mach-versal/{gen2,net}/ (and presumably gen2-net down the line)? Second, and I see I can't say we should follow the Linux kernel since there's no versal dts files upstream, should we still be "xilinx" and not "amd" ? I do see the kernel shoves all the imx8 (as an example of a modern part) stuff under arch/arm64/boot/dts/freescale/ and if nothing else we should be consistent between projects whenever possible. Thanks.

Signature · 1 line
Tom
author maintainer
#6 lore raw

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 11 lines · Michal Simek

Hi,

I am sending patches for adding initial support for new AMD Versal Gen 2 SoC. If you want to find out more information please take a look at this page:
https://www.amd.com/en/products/adaptive-socs-and-fpgas/versal.html

Thanks,
Michal

Quoted 5 lines

Michal Simek (4):
arm64: versal2: Add support for AMD Versal Gen 2
soc: versal2: Add SoC driver for AMD Versal Gen 2
mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2
spi: versal2: Enable spi drivers for Versal Gen 2

Quoted 3 lines

My only concerns are name-related and not-blocking. First, should we perhaps instead have arch/arm/mach-versal/{gen2,net}/ (and presumably gen2-net down the line)?

There are completely 3 different SOCs only names are similar Versal is 2 cores a72
Versal NET 16 cores a78
Versal Gen 2 8 cores a78
with different features.

Creating subfolders under current mach-versal would be very confusing.
We can definitely try to make it as small as possible but still they are separated families.

We tried to reuse existing platforms but it is hard to keep it in sync that's why new platform is better way to go. But as you know we are trying to reuse for example board/xilinx/common/ folder as much as possible that we don't have code duplication.

Quoted 6 lines

Second, and I see I can't say we should follow
the Linux kernel since there's no versal dts files upstream, should we still be "xilinx" and not "amd" ? I do see the kernel shoves all the imx8 (as an example of a modern part) stuff under arch/arm64/boot/dts/freescale/ and if nothing else we should be consistent between projects whenever possible. Thanks.

I am not going to send DTSes to U-Boot and just push them to Linux kernel at right time. And target is arch/arm64/boot/dts/amd which already exists for old amd socs and elba (pensando). Versal Gen 2 should go there.

It means Versal and Versal NET will be branded under Xilinx and Versal Gen 2 will be branded under AMD. Also we are going to stop to use xlnx, dt prefixes for new IPs and will start to use amd, prefix.

Thanks,
Michal

#7 lore raw
Quoted 26 lines · Michal Simek

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 11 lines · Michal Simek

Hi,

I am sending patches for adding initial support for new AMD Versal Gen 2 SoC. If you want to find out more information please take a look at this page:
https://www.amd.com/en/products/adaptive-socs-and-fpgas/versal.html

Thanks,
Michal

Quoted 5 lines

Michal Simek (4):
arm64: versal2: Add support for AMD Versal Gen 2
soc: versal2: Add SoC driver for AMD Versal Gen 2
mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2
spi: versal2: Enable spi drivers for Versal Gen 2

Quoted 3 lines

My only concerns are name-related and not-blocking. First, should we perhaps instead have arch/arm/mach-versal/{gen2,net}/ (and presumably gen2-net down the line)?

Quoted 5 lines

There are completely 3 different SOCs only names are similar Versal is 2 cores a72
Versal NET 16 cores a78
Versal Gen 2 8 cores a78
with different features.

That's good to know.

Quoted 3 lines

Creating subfolders under current mach-versal would be very confusing. We can definitely try to make it as small as possible but still they are separated families.

Again, I'm not nak'ing things based on the names but I'll point out that arch/arm/mach-k3/{am*,j7*}/ contain a good number of A53 and A72 platforms of varying numbers of cores. But on the other hand, at some level they're all part of the "Keystone 3" generation / family, which is not how the Versal parts are handled.

Quoted 4 lines

We tried to reuse existing platforms but it is hard to keep it in sync that's why new platform is better way to go.
But as you know we are trying to reuse for example board/xilinx/common/ folder as much as possible that we don't have code duplication.

That's also good and reasonable.

Quoted 7 lines
Quoted 6 lines

Second, and I see I can't say we should follow
the Linux kernel since there's no versal dts files upstream, should we still be "xilinx" and not "amd" ? I do see the kernel shoves all the imx8 (as an example of a modern part) stuff under arch/arm64/boot/dts/freescale/ and if nothing else we should be consistent between projects whenever possible. Thanks.

Quoted 7 lines

I am not going to send DTSes to U-Boot and just push them to Linux kernel at right time. And target is arch/arm64/boot/dts/amd which already exists for old amd socs and elba (pensando). Versal Gen 2 should go there.

It means Versal and Versal NET will be branded under Xilinx and Versal Gen 2 will be branded under AMD. Also we are going to stop to use xlnx, dt prefixes for new IPs and will start to use amd, prefix.

My real only concern here is that we're consistent with whatever Linux Kernel people demand. It's bikeshedding I'm really not inclined to argue myself. :)

Signature · 1 line
Tom
author maintainer
#8 lore raw
Quoted 39 lines · Tom Rini
Quoted 26 lines · Michal Simek

Hi Tom,

Quoted 19 lines · Tom Rini
Quoted 11 lines · Michal Simek

Hi,

I am sending patches for adding initial support for new AMD Versal Gen 2 SoC. If you want to find out more information please take a look at this page:
https://www.amd.com/en/products/adaptive-socs-and-fpgas/versal.html

Thanks,
Michal

Quoted 5 lines

Michal Simek (4):
arm64: versal2: Add support for AMD Versal Gen 2
soc: versal2: Add SoC driver for AMD Versal Gen 2
mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2
spi: versal2: Enable spi drivers for Versal Gen 2

Quoted 3 lines

My only concerns are name-related and not-blocking. First, should we perhaps instead have arch/arm/mach-versal/{gen2,net}/ (and presumably gen2-net down the line)?

Quoted 5 lines

There are completely 3 different SOCs only names are similar Versal is 2 cores a72
Versal NET 16 cores a78
Versal Gen 2 8 cores a78
with different features.

That's good to know.

Quoted 3 lines

Creating subfolders under current mach-versal would be very confusing. We can definitely try to make it as small as possible but still they are separated families.

Quoted 5 lines

Again, I'm not nak'ing things based on the names but I'll point out that arch/arm/mach-k3/{am*,j7*}/ contain a good number of A53 and A72 platforms of varying numbers of cores. But on the other hand, at some level they're all part of the "Keystone 3" generation / family, which is not how the Versal parts are handled.

For us it is completely new generation. There are some sub variants which can be handled like that. https://docs.amd.com/v/u/en-US/versal-ai-edge-gen2-psg

AI Edge, AI Core, Prime, Premium, HBM but we trying to handle it via common/shared target. If there is a difference we are trying to handle via DT and enable all drivers via generic defconfig.

We can definitely take a look if make sense to create mach-xilinx or mach-amd.
It would be best if we can pretty much get rid of all these folders but I don't think we get there anytime soon.

Quoted 18 lines
Quoted 4 lines

We tried to reuse existing platforms but it is hard to keep it in sync that's why new platform is better way to go.
But as you know we are trying to reuse for example board/xilinx/common/ folder as much as possible that we don't have code duplication.

That's also good and reasonable.

Quoted 11 lines
Quoted 6 lines

Second, and I see I can't say we should follow
the Linux kernel since there's no versal dts files upstream, should we still be "xilinx" and not "amd" ? I do see the kernel shoves all the imx8 (as an example of a modern part) stuff under arch/arm64/boot/dts/freescale/ and if nothing else we should be consistent between projects whenever possible. Thanks.

I am not going to send DTSes to U-Boot and just push them to Linux kernel at right time. And target is arch/arm64/boot/dts/amd which already exists for old amd socs and elba (pensando). Versal Gen 2 should go there.

Quoted 7 lines
Quoted 3 lines

It means Versal and Versal NET will be branded under Xilinx and Versal Gen 2 will be branded under AMD. Also we are going to stop to use xlnx, dt prefixes for new IPs and will start to use amd, prefix.

My real only concern here is that we're consistent with whatever Linux Kernel people demand. It's bikeshedding I'm really not inclined to argue myself. :)

What we looked in past was if we can put together platforms with gicv2 and gicv3 because there is low level GIC initialization when you run in EL3 but we didn't finish it. I think the first step would be to get rid of include/configs/ files and then we can look at other parts.

Thanks,
Michal

author maintainer Applied
#9 lore raw
In reply to Michal Simek
Quoted 47 lines · Michal Simek

Hi,

I am sending patches for adding initial support for new AMD Versal Gen 2 SoC. If you want to find out more information please take a look at this page:
https://www.amd.com/en/products/adaptive-socs-and-fpgas/versal.html

Thanks,
Michal

Michal Simek (4):
arm64: versal2: Add support for AMD Versal Gen 2
soc: versal2: Add SoC driver for AMD Versal Gen 2
mmc: versal2: Update zynq_sdhci driver to support AMD Versal Gen 2
spi: versal2: Enable spi drivers for Versal Gen 2

  arch/arm/Kconfig                              |  14 +
  arch/arm/Makefile                             |   1 +
  arch/arm/dts/Makefile                         |   2 +
  arch/arm/dts/amd-versal2-virt.dts             |  11 +
  arch/arm/mach-versal2/Kconfig                 |  55 +++
  arch/arm/mach-versal2/Makefile                |  10 +
  arch/arm/mach-versal2/clk.c                   |  34 ++
  arch/arm/mach-versal2/cpu.c                   |  93 +++++
  arch/arm/mach-versal2/include/mach/hardware.h |  97 +++++
  .../arm/mach-versal2/include/mach/sys_proto.h |   9 +
  board/amd/common                              |   1 +
  board/amd/versal2/Kconfig                     |  16 +
  board/amd/versal2/MAINTAINERS                 |   7 +
  board/amd/versal2/Makefile                    |  11 +
  board/amd/versal2/board.c                     | 343 ++++++++++++++++++
  board/amd/versal2/cmds.c                      |  81 +++++
  board/xilinx/Kconfig                          |   6 +-
  configs/amd_versal2_virt_defconfig            | 150 ++++++++
  drivers/gpio/Kconfig                          |   2 +-
  drivers/mailbox/Kconfig                       |   2 +-
  drivers/mmc/zynq_sdhci.c                      |  22 +-
  drivers/soc/Kconfig                           |   8 +
  drivers/soc/Makefile                          |   1 +
  drivers/soc/soc_amd_versal2.c                 |  77 ++++
  drivers/spi/Kconfig                           |   2 +-
  drivers/spi/cadence_qspi.c                    |   3 +-
  drivers/spi/zynqmp_gqspi.c                    |   6 +-
  env/Kconfig                                   |   6 +-
  include/configs/amd_versal2.h                 | 143 ++++++++
  29 files changed, 1193 insertions(+), 20 deletions(-)
Quoted 17 lines

create mode 100644 arch/arm/dts/amd-versal2-virt.dts create mode 100644 arch/arm/mach-versal2/Kconfig create mode 100644 arch/arm/mach-versal2/Makefile create mode 100644 arch/arm/mach-versal2/clk.c
create mode 100644 arch/arm/mach-versal2/cpu.c
create mode 100644 arch/arm/mach-versal2/include/mach/hardware.h create mode 100644 arch/arm/mach-versal2/include/mach/sys_proto.h create mode 120000 board/amd/common
create mode 100644 board/amd/versal2/Kconfig
create mode 100644 board/amd/versal2/MAINTAINERS create mode 100644 board/amd/versal2/Makefile
create mode 100644 board/amd/versal2/board.c
create mode 100644 board/amd/versal2/cmds.c
create mode 100644 configs/amd_versal2_virt_defconfig create mode 100644 drivers/soc/soc_amd_versal2.c create mode 100644 include/configs/amd_versal2.h

Applied.
M