aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVarun Wadekar <vwadekar@nvidia.com>2020-05-12 14:04:10 -0700
committervarunw-nvidia <vwadekar@nvidia.com>2020-05-12 22:43:03 +0000
commitb5b2923d9d1676d6f4395cb64d6fe6ca3f4109d4 (patch)
tree01e8a0940080c2261ca09db91563c1b45a876a81
parent4e2887f2da05dc510e9ce1e9d648ef2b5d745649 (diff)
downloadtrusted-firmware-a-b5b2923d9d1676d6f4395cb64d6fe6ca3f4109d4.tar.gz
Tegra: introduce support for SMCCC_ARCH_SOC_ID
This patch returns the SOC version and revision values from the 'plat_get_soc_version' and 'plat_get_soc_revision' handlers. Verified using TFTF SMCCC_ARCH_SOC_ID test. <snip> > Executing 'SMCCC_ARCH_SOC_ID test' TEST COMPLETE Passed SOC Rev = 0x102 SOC Ver = 0x36b0019 <snip> Signed-off-by: Varun Wadekar <vwadekar@nvidia.com> Change-Id: Ibd7101619143b74f6f6660732daeac1a8bca3e44
-rw-r--r--plat/nvidia/tegra/common/tegra_platform.c27
-rw-r--r--plat/nvidia/tegra/include/tegra_platform.h7
2 files changed, 34 insertions, 0 deletions
diff --git a/plat/nvidia/tegra/common/tegra_platform.c b/plat/nvidia/tegra/common/tegra_platform.c
index c1e4209593..e4338b9638 100644
--- a/plat/nvidia/tegra/common/tegra_platform.c
+++ b/plat/nvidia/tegra/common/tegra_platform.c
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2016-2017, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2020, NVIDIA Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -259,3 +260,29 @@ bool tegra_platform_is_virt_dev_kit(void)
{
return ((tegra_get_platform() == TEGRA_PLATFORM_VIRT_DEV_KIT) ? true : false);
}
+
+/*
+ * This function returns soc version which mainly consist of below fields
+ *
+ * soc_version[30:24] = JEP-106 continuation code for the SiP
+ * soc_version[23:16] = JEP-106 identification code with parity bit for the SiP
+ * soc_version[0:15] = chip identification
+ */
+int32_t plat_get_soc_version(void)
+{
+ uint32_t chip_id = ((tegra_get_chipid() >> CHIP_ID_SHIFT) & CHIP_ID_MASK);
+ uint32_t manfid = (JEDEC_NVIDIA_BKID << 24) | (JEDEC_NVIDIA_MFID << 16);
+
+ return (int32_t)(manfid | (chip_id & 0xFFFF));
+}
+
+/*
+ * This function returns soc revision in below format
+ *
+ * soc_revision[8:15] = major version number
+ * soc_revision[0:7] = minor version number
+ */
+int32_t plat_get_soc_revision(void)
+{
+ return (int32_t)((tegra_get_chipid_major() << 8) | tegra_get_chipid_minor());
+}
diff --git a/plat/nvidia/tegra/include/tegra_platform.h b/plat/nvidia/tegra/include/tegra_platform.h
index d83ce48b8d..7dfa4d089a 100644
--- a/plat/nvidia/tegra/include/tegra_platform.h
+++ b/plat/nvidia/tegra/include/tegra_platform.h
@@ -1,5 +1,6 @@
/*
* Copyright (c) 2017-2018, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2020, NVIDIA Corporation. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -30,6 +31,12 @@
#define TEGRA_CHIPID_TEGRA21 U(0x21)
#define TEGRA_CHIPID_TEGRA18 U(0x18)
+/*******************************************************************************
+ * JEDEC Standard Manufacturer's Identification Code and Bank ID
+ ******************************************************************************/
+#define JEDEC_NVIDIA_MFID U(0x6B)
+#define JEDEC_NVIDIA_BKID U(3)
+
#ifndef __ASSEMBLER__
/*