Skip to contentSkip to conversation

xilinx: Add SoC Xilinx driver for zynqmp & versal

PATCH Applied Michal Simek 2 participants 6 messages Aug 10, 2021 – Aug 23, 2021

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

cover xilinx: Add SoC Xilinx driver for zynqmp & versal

Hi,

This patch series adds support for SoC Xilinx driver to get SoC family and revision. Print SoC info using print_cpuinfo() at booting stage.

Thanks,
Michal

T Karthik Reddy (4):
soc: xilinx: zynqmp: Add soc_xilinx_zynqmp driver
soc: xilinx: versal: Add soc_xilinx_versal driver
xilinx: common: Add function to print SoC info
xilinx: Enable config to display cpuinfo

 MAINTAINERS                                  |  2 +
 arch/arm/Kconfig                             |  2 +
 arch/arm/mach-versal/cpu.c                   |  5 ++
 arch/arm/mach-versal/include/mach/hardware.h |  4 +
 arch/arm/mach-zynqmp/cpu.c                   |  5 ++
 arch/arm/mach-zynqmp/include/mach/hardware.h |  3 +
 board/xilinx/common/board.c                  | 26 +++++++
 configs/xilinx_versal_virt_defconfig         |  2 +-
 configs/xilinx_zynqmp_virt_defconfig         |  2 +-
 drivers/soc/Kconfig                          | 16 ++++
 drivers/soc/Makefile                         |  2 +
 drivers/soc/soc_xilinx_versal.c              | 76 +++++++++++++++++++
 drivers/soc/soc_xilinx_zynqmp.c              | 78 ++++++++++++++++++++
 13 files changed, 221 insertions(+), 2 deletions(-)
 create mode 100644 drivers/soc/soc_xilinx_versal.c
 create mode 100644 drivers/soc/soc_xilinx_zynqmp.c
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/4 soc: xilinx: zynqmp: Add soc_xilinx_zynqmp driver

From: T Karthik Reddy <[email protected]>

soc_xilinx_zynqmp driver allows identification of family & revision of zynqmp SoC. This driver is selected by CONFIG_SOC_XILINX_ZYNQMP. Add this config to xilinx_zynqmp_virt_defconfig file. Probe this driver using platdata U_BOOT_DEVICE structure which is specified in mach-zynqmp/cpu.c.

---

 MAINTAINERS                                  |  1 +
 arch/arm/Kconfig                             |  1 +
 arch/arm/mach-zynqmp/cpu.c                   |  5 ++
 arch/arm/mach-zynqmp/include/mach/hardware.h |  3 +
 configs/xilinx_zynqmp_virt_defconfig         |  1 +
 drivers/soc/Kconfig                          |  8 ++
 drivers/soc/Makefile                         |  1 +
 drivers/soc/soc_xilinx_zynqmp.c              | 78 ++++++++++++++++++++
 8 files changed, 98 insertions(+)
 create mode 100644 drivers/soc/soc_xilinx_zynqmp.c
MAINTAINERS +1 -0
index 868d4e145ca2..af5a1fedf1d3 100644
@@ -602,6 +602,7 @@ F:	drivers/net/zynq_gem.c
 F:	drivers/serial/serial_zynq.c
 F:	drivers/reset/reset-zynqmp.c
 F:	drivers/rtc/zynqmp_rtc.c
+F:	drivers/soc/soc_xilinx_zynqmp.c
 F:	drivers/spi/zynq_qspi.c
 F:	drivers/spi/zynq_spi.c
 F:	drivers/timer/cadence-ttc.c
arch/arm/Kconfig +1 -0
index 3a745ce126aa..3e8a31f8ad56 100644
@@ -1133,6 +1133,7 @@ config ARCH_ZYNQMP
 	select SPL_SEPARATE_BSS if SPL
 	select SUPPORT_SPL
 	select ZYNQMP_IPI
+	select SOC_DEVICE
 	imply BOARD_LATE_INIT
 	imply CMD_DM
 	imply ENV_VARS_UBOOT_RUNTIME_CONFIG
arch/arm/mach-zynqmp/cpu.c +5 -0
index 29743cae5aab..26e285c24fe0 100644
@@ -15,6 +15,7 @@
 #include <asm/io.h>
 #include <zynqmp_firmware.h>
 #include <asm/cache.h>
+#include <dm/platdata.h>
 
 #define ZYNQ_SILICON_VER_MASK	0xF000
 #define ZYNQ_SILICON_VER_SHIFT	12
@@ -218,3 +219,7 @@ int zynqmp_mmio_read(const u32 address, u32 *value)
 
 	return ret;
 }
+
+U_BOOT_DRVINFO(soc_xilinx_zynqmp) = {
+	.name = "soc_xilinx_zynqmp",
+};
arch/arm/mach-zynqmp/include/mach/hardware.h +3 -0
index 37764990707c..eebf38551c2f 100644
@@ -69,6 +69,9 @@ struct iou_scntr_secure {
 
 #define iou_scntr_secure ((struct iou_scntr_secure *)ZYNQMP_IOU_SCNTR_SECURE)
 
+#define ZYNQMP_PS_VERSION	0xFFCA0044
+#define ZYNQMP_PS_VER_MASK	GENMASK(1, 0)
+
 /* Bootmode setting values */
 #define BOOT_MODES_MASK	0x0000000F
 #define QSPI_MODE_24BIT	0x00000001
configs/xilinx_zynqmp_virt_defconfig +1 -0
index 2c888130fa59..5b2f2f69e461 100644
@@ -160,6 +160,7 @@ CONFIG_DM_SCSI=y
 CONFIG_ARM_DCC=y
 CONFIG_XILINX_UARTLITE=y
 CONFIG_ZYNQ_SERIAL=y
+CONFIG_SOC_XILINX_ZYNQMP=y
 CONFIG_SPI=y
 CONFIG_ZYNQ_SPI=y
 CONFIG_ZYNQMP_GQSPI=y
drivers/soc/Kconfig +8 -0
index 864d00a88538..17fb4c4d65e5 100644
@@ -16,6 +16,14 @@ config SOC_DEVICE_TI_K3
 	  This allows Texas Instruments Keystone 3 SoCs to identify
 	  specifics about the SoC in use.
 
+config SOC_XILINX_ZYNQMP
+	bool "Enable SoC Device ID driver for Xilinx ZynqMP"
+	depends on SOC_DEVICE && ARCH_ZYNQMP
+	help
+	  Enable this option to select SoC device id driver for Xilinx ZynqMP.
+	  This allows other drivers to verify the SoC familiy & revision
+	  using matching SoC attributes.
+
 source "drivers/soc/ti/Kconfig"
 
 endmenu
drivers/soc/Makefile +1 -0
index 9ef20ca5066f..9b26573c71c8 100644
@@ -6,3 +6,4 @@ obj-$(CONFIG_SOC_TI) += ti/
 obj-$(CONFIG_SOC_DEVICE) += soc-uclass.o
 obj-$(CONFIG_SOC_DEVICE_TI_K3) += soc_ti_k3.o
 obj-$(CONFIG_SANDBOX) += soc_sandbox.o
+obj-$(CONFIG_SOC_XILINX_ZYNQMP) += soc_xilinx_zynqmp.o
drivers/soc/soc_xilinx_zynqmp.c new file +78 -0

78 lines not on this page · raw message

Signature · 1 line
2.32.0
#2 lore raw

PATCH 2/4 soc: xilinx: versal: Add soc_xilinx_versal driver

In reply to Michal Simek

From: T Karthik Reddy <[email protected]>

soc_xilinx_versal driver allows identification of family & revision of versal SoC. This driver is selected by CONFIG_SOC_XILINX_VERSAL. Probe this driver using platdata U_BOOT_DEVICE structure which is defined at mach-versal/cpu.c.
Add this config to xilinx_versal_virt_defconfig & xilinx_versal_mini_ospi_defconfig file to select this driver.

---

 MAINTAINERS                                  |  1 +
 arch/arm/Kconfig                             |  1 +
 arch/arm/mach-versal/cpu.c                   |  5 ++
 arch/arm/mach-versal/include/mach/hardware.h |  4 ++
 configs/xilinx_versal_virt_defconfig         |  1 +
 drivers/soc/Kconfig                          |  8 +++
 drivers/soc/Makefile                         |  1 +
 drivers/soc/soc_xilinx_versal.c              | 76 ++++++++++++++++++++
 8 files changed, 97 insertions(+)
 create mode 100644 drivers/soc/soc_xilinx_versal.c
MAINTAINERS +1 -0
index af5a1fedf1d3..4cf0c33c5d58 100644
@@ -546,6 +546,7 @@ S:	Maintained
 T:	git https://source.denx.de/u-boot/custodians/u-boot-microblaze.git
 F:	arch/arm/mach-versal/
 F:	drivers/net/xilinx_axi_mrmac.*
+F:	drivers/soc/soc_xilinx_versal.c
 F:	drivers/watchdog/xilinx_wwdt.c
 N:	(?<!uni)versal
 
arch/arm/Kconfig +1 -0
index 3e8a31f8ad56..0cc4326f2564 100644
@@ -1055,6 +1055,7 @@ config ARCH_VERSAL
 	select DM_SERIAL
 	select GPIO_EXTRA_HEADER
 	select OF_CONTROL
+	select SOC_DEVICE
 	imply BOARD_LATE_INIT
 	imply ENV_VARS_UBOOT_RUNTIME_CONFIG
 
arch/arm/mach-versal/cpu.c +5 -0
index a35aac2c02c2..9dc308bbc3d9 100644
@@ -13,6 +13,7 @@
 #include <asm/arch/hardware.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/cache.h>
+#include <dm/platdata.h>
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -120,3 +121,7 @@ int arm_reserve_mmu(void)
 	return 0;
 }
 #endif
+
+U_BOOT_DRVINFO(soc_xilinx_versal) = {
+	.name = "soc_xilinx_versal",
+};
arch/arm/mach-versal/include/mach/hardware.h +4 -0
index 9af5afd3f3f4..7b728ac11018 100644
@@ -65,6 +65,10 @@ struct crp_regs {
 
 #define crp_base ((struct crp_regs *)VERSAL_CRP_BASEADDR)
 
+#define VERSAL_PS_PMC_VERSION	0xF11A0004
+#define VERSAL_PS_VER_MASK	GENMASK(7, 0)
+#define VERSAL_PS_VER_SHIFT	12
+
 /* Bootmode setting values */
 #define BOOT_MODES_MASK	0x0000000F
 #define QSPI_MODE_24BIT	0x00000001
configs/xilinx_versal_virt_defconfig +1 -0
index c894d32a9259..15fa5b9900c9 100644
@@ -96,6 +96,7 @@ CONFIG_ZYNQ_GEM=y
 CONFIG_ARM_DCC=y
 CONFIG_PL01X_SERIAL=y
 CONFIG_XILINX_UARTLITE=y
+CONFIG_SOC_XILINX_VERSAL=y
 CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_ZYNQ_SPI=y
drivers/soc/Kconfig +8 -0
index 17fb4c4d65e5..292dc41b6fa2 100644
@@ -24,6 +24,14 @@ config SOC_XILINX_ZYNQMP
 	  This allows other drivers to verify the SoC familiy & revision
 	  using matching SoC attributes.
 
+config SOC_XILINX_VERSAL
+	bool "Enable SoC Device ID driver for Xilinx Versal"
+	depends on SOC_DEVICE && ARCH_VERSAL
+	help
+	  Enable this option to select SoC device id driver for Xilinx Versal.
+	  This allows other drivers to verify the SoC familiy & revision using
+	  matching SoC attributes.
+
 source "drivers/soc/ti/Kconfig"
 
 endmenu
drivers/soc/Makefile +1 -0
index 9b26573c71c8..031fa7612f48 100644
@@ -7,3 +7,4 @@ obj-$(CONFIG_SOC_DEVICE) += soc-uclass.o
 obj-$(CONFIG_SOC_DEVICE_TI_K3) += soc_ti_k3.o
 obj-$(CONFIG_SANDBOX) += soc_sandbox.o
 obj-$(CONFIG_SOC_XILINX_ZYNQMP) += soc_xilinx_zynqmp.o
+obj-$(CONFIG_SOC_XILINX_VERSAL) += soc_xilinx_versal.o
drivers/soc/soc_xilinx_versal.c new file +76 -0

76 lines not on this page · raw message

Signature · 1 line
2.32.0
#3 lore raw

PATCH 3/4 xilinx: common: Add function to print SoC info

In reply to Michal Simek

From: T Karthik Reddy <[email protected]>

Add print_cpuinfo() to print SoC info like family & revision. This function depends on CONFIG_DISPLAY_CPUINFO config.

---

 board/xilinx/common/board.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)
board/xilinx/common/board.c +26 -0
index 92b61d83ca47..90c87bab5cff 100644
@@ -18,6 +18,7 @@
 #include <i2c_eeprom.h>
 #include <net.h>
 #include <generated/dt.h>
+#include <soc.h>
 
 #include "fru.h"
 
@@ -440,3 +441,28 @@ int __maybe_unused board_fit_config_name_match(const char *name)
 
 	return -1;
 }
+
+#if defined(CONFIG_DISPLAY_CPUINFO) && !defined(CONFIG_ARCH_ZYNQ)
+int print_cpuinfo(void)
+{
+	struct udevice *soc;
+	char name[SOC_MAX_STR_SIZE];
+	int ret;
+
+	ret = soc_get(&soc);
+	if (ret) {
+		printf("CPU:   UNKNOWN\n");
+		return 0;
+	}
+
+	ret = soc_get_family(soc, name, SOC_MAX_STR_SIZE);
+	if (ret)
+		printf("CPU:   %s\n", name);
+
+	ret = soc_get_revision(soc, name, SOC_MAX_STR_SIZE);
+	if (ret)
+		printf("Silicon: %s\n", name);
+
+	return 0;
+}
+#endif
Signature · 1 line
2.32.0
#4 lore raw

PATCH 4/4 xilinx: Enable config to display cpuinfo

In reply to Michal Simek

From: T Karthik Reddy <[email protected]>

Enable CONFIG_DISPLAY_CPUINFO to display SoC family & revision.

---

 configs/xilinx_versal_virt_defconfig | 1 -
 configs/xilinx_zynqmp_virt_defconfig | 1 -
 2 files changed, 2 deletions(-)
configs/xilinx_versal_virt_defconfig +0 -1
index 15fa5b9900c9..590a2171c114 100644
@@ -16,7 +16,6 @@ CONFIG_FIT_VERBOSE=y
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_BOOTDELAY=5
 CONFIG_USE_PREBOOT=y
-# CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SYS_PROMPT="Versal> "
 CONFIG_CMD_BOOTMENU=y
configs/xilinx_zynqmp_virt_defconfig +0 -1
index 5b2f2f69e461..2d3402857f48 100644
@@ -24,7 +24,6 @@ CONFIG_SPL_LOAD_FIT_ADDRESS=0x10000000
 # CONFIG_ARCH_FIXUP_FDT_MEMORY is not set
 CONFIG_USE_PREBOOT=y
 CONFIG_PREBOOT="scsi reset;usb reset"
-# CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_BOARD_EARLY_INIT_F=y
 CONFIG_BOARD_EARLY_INIT_R=y
 CONFIG_SPL_FPGA=y
Signature · 1 line
2.32.0
Applied
#5 lore raw
In reply to Michal Simek

út 10. 8. 2021 v 15:45 odesílatel Michal Simek <[email protected]> napsal:

Quoted 33 lines

Hi,

This patch series adds support for SoC Xilinx driver to get SoC family and revision. Print SoC info using print_cpuinfo() at booting stage.

Thanks,
Michal

T Karthik Reddy (4):
soc: xilinx: zynqmp: Add soc_xilinx_zynqmp driver
soc: xilinx: versal: Add soc_xilinx_versal driver
xilinx: common: Add function to print SoC info
xilinx: Enable config to display cpuinfo

 MAINTAINERS                                  |  2 +
 arch/arm/Kconfig                             |  2 +
 arch/arm/mach-versal/cpu.c                   |  5 ++
 arch/arm/mach-versal/include/mach/hardware.h |  4 +
 arch/arm/mach-zynqmp/cpu.c                   |  5 ++
 arch/arm/mach-zynqmp/include/mach/hardware.h |  3 +
 board/xilinx/common/board.c                  | 26 +++++++
 configs/xilinx_versal_virt_defconfig         |  2 +-
 configs/xilinx_zynqmp_virt_defconfig         |  2 +-
 drivers/soc/Kconfig                          | 16 ++++
 drivers/soc/Makefile                         |  2 +
 drivers/soc/soc_xilinx_versal.c              | 76 +++++++++++++++++++
 drivers/soc/soc_xilinx_zynqmp.c              | 78 ++++++++++++++++++++
 13 files changed, 221 insertions(+), 2 deletions(-)
 create mode 100644 drivers/soc/soc_xilinx_versal.c
 create mode 100644 drivers/soc/soc_xilinx_zynqmp.c
Quoted 3 lines

--
2.32.0

Applied.
M

Signature · 5 lines
Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel - Xilinx Microblaze
Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP ARM64 SoCs
U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal SoCs