feat(versal2): update platform version to versal2

Extend board detection with saving information about PS,
PMC and RTL versions. Variables can be use to cover
different behavior based on version and version
information is also printed for chip identification.

Change-Id: Ia37418f6a31426a5763fb89fc76fef91d09df155
Signed-off-by: Saivardhan Thatikonda <saivardhan.thatikonda@amd.com>
diff --git a/plat/amd/versal2/aarch64/common.c b/plat/amd/versal2/aarch64/common.c
index c78d711..8d9e05c 100644
--- a/plat/amd/versal2/aarch64/common.c
+++ b/plat/amd/versal2/aarch64/common.c
@@ -18,7 +18,7 @@
 #include <plat_ipi.h>
 #include <plat_private.h>
 
-uint32_t platform_id, platform_version;
+uint32_t platform_id, platform_version, rtlversion, psversion, pmcversion;
 
 /*
  * Table of regions to map using the MMU.
@@ -77,6 +77,9 @@
 	version_type = mmio_read_32(PMC_TAP_VERSION);
 	platform_id = FIELD_GET((uint32_t)PLATFORM_MASK, version_type);
 	platform_version = FIELD_GET((uint32_t)PLATFORM_VERSION_MASK, version_type);
+	rtlversion = FIELD_GET((uint32_t)RTL_VERSION, version_type);
+	psversion = FIELD_GET((uint32_t)PS_VERSION, version_type);
+	pmcversion = FIELD_GET((uint32_t)PMC_VERSION, version_type);
 
 	if (platform_id == QEMU_COSIM) {
 		platform_id = QEMU;
diff --git a/plat/amd/versal2/bl31_setup.c b/plat/amd/versal2/bl31_setup.c
index 05e4c96..1914830 100644
--- a/plat/amd/versal2/bl31_setup.c
+++ b/plat/amd/versal2/bl31_setup.c
@@ -132,8 +132,12 @@
 
 	setup_console();
 
-	NOTICE("TF-A running on %s %d.%d\n", board_name_decode(),
-	       platform_version / 10U, platform_version % 10U);
+	NOTICE("TF-A running on %s v%d.%d, RTL v%d.%d, PS v%d.%d, PMC v%d.%d\n",
+		board_name_decode(),
+		(platform_version >> 1), platform_version % 10U,
+		(rtlversion >> 1), rtlversion % 10U,
+		(psversion >> 1), psversion % 10U,
+		(pmcversion >> 1), pmcversion % 10U);
 
 	/*
 	 * Do initial security configuration to allow DRAM/device access. On
diff --git a/plat/amd/versal2/include/def.h b/plat/amd/versal2/include/def.h
index 0c43d1b..938b118 100644
--- a/plat/amd/versal2/include/def.h
+++ b/plat/amd/versal2/include/def.h
@@ -45,6 +45,9 @@
 /* For platform detection */
 #define PMC_TAP				U(0xF11A0000)
 #define PMC_TAP_VERSION			(PMC_TAP + 0x4U)
+# define PMC_VERSION			GENMASK(7U, 0U)
+# define PS_VERSION			GENMASK(15U, 8U)
+# define RTL_VERSION			GENMASK(23U, 16U)
 # define PLATFORM_MASK			GENMASK(27U, 24U)
 # define PLATFORM_VERSION_MASK		GENMASK(31U, 28U)
 
diff --git a/plat/amd/versal2/include/plat_private.h b/plat/amd/versal2/include/plat_private.h
index 5a2e5bd..4be2061 100644
--- a/plat/amd/versal2/include/plat_private.h
+++ b/plat/amd/versal2/include/plat_private.h
@@ -41,6 +41,7 @@
 void plat_gic_redistif_off(void);
 
 extern uint32_t cpu_clock, platform_id, platform_version;
+extern uint32_t rtlversion, psversion, pmcversion;
 void board_detection(void);
 const char *board_name_decode(void);
 uint64_t smc_handler(uint32_t smc_fid, uint64_t x1, uint64_t x2, uint64_t x3,