aboutsummaryrefslogtreecommitdiff
path: root/plat/st
diff options
context:
space:
mode:
authorYann Gautier <yann.gautier@foss.st.com>2021-03-08 15:03:35 +0100
committerYann Gautier <yann.gautier@foss.st.com>2021-05-27 09:54:59 +0200
commit3d201787e8246022b1f193283c12e7cb4bfc83ff (patch)
tree9b0eadc4803ee21168f95d9085ffc006602a9ffd /plat/st
parent92661e01cf558c97fd955285ca26afeacc66da80 (diff)
downloadtrusted-firmware-a-3d201787e8246022b1f193283c12e7cb4bfc83ff.tar.gz
feat(plat/st): implement platform functions for SMCCC_ARCH_SOC_ID
The JEDEC information for STMicroelectronics is: JEDEC_ST_MFID U(0x20) JEDEC_ST_BKID U(0x0) And rely on platform functions to get chip IP and revision. Signed-off-by: Yann Gautier <yann.gautier@foss.st.com> Change-Id: I4fa4ac8bb5583b1871b768decc9fe08e8966ff54
Diffstat (limited to 'plat/st')
-rw-r--r--plat/st/common/include/stm32mp_common.h3
-rw-r--r--plat/st/common/stm32mp_common.c37
2 files changed, 39 insertions, 1 deletions
diff --git a/plat/st/common/include/stm32mp_common.h b/plat/st/common/include/stm32mp_common.h
index 2663da04c6..42d3487024 100644
--- a/plat/st/common/include/stm32mp_common.h
+++ b/plat/st/common/include/stm32mp_common.h
@@ -11,6 +11,9 @@
#include <platform_def.h>
+#define JEDEC_ST_BKID U(0x0)
+#define JEDEC_ST_MFID U(0x20)
+
/* Functions to save and get boot context address given by ROM code */
void stm32mp_save_boot_ctx_address(uintptr_t address);
uintptr_t stm32mp_get_boot_ctx_address(void);
diff --git a/plat/st/common/stm32mp_common.c b/plat/st/common/stm32mp_common.c
index 89d8078386..d3de1e14f3 100644
--- a/plat/st/common/stm32mp_common.c
+++ b/plat/st/common/stm32mp_common.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015-2020, ARM Limited and Contributors. All rights reserved.
+ * Copyright (c) 2015-2021, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
@@ -12,8 +12,10 @@
#include <arch_helpers.h>
#include <common/debug.h>
#include <drivers/st/stm32mp_clkfunc.h>
+#include <lib/smccc.h>
#include <lib/xlat_tables/xlat_tables_v2.h>
#include <plat/common/platform.h>
+#include <services/arm_arch_svc.h>
uintptr_t plat_get_ns_image_entrypoint(void)
{
@@ -111,3 +113,36 @@ int stm32mp_unmap_ddr(void)
return mmap_remove_dynamic_region(STM32MP_DDR_BASE,
STM32MP_DDR_MAX_SIZE);
}
+
+/*****************************************************************************
+ * plat_is_smccc_feature_available() - This function checks whether SMCCC
+ * feature is availabile for platform.
+ * @fid: SMCCC function id
+ *
+ * Return SMC_ARCH_CALL_SUCCESS if SMCCC feature is available and
+ * SMC_ARCH_CALL_NOT_SUPPORTED otherwise.
+ *****************************************************************************/
+int32_t plat_is_smccc_feature_available(u_register_t fid)
+{
+ switch (fid) {
+ case SMCCC_ARCH_SOC_ID:
+ return SMC_ARCH_CALL_SUCCESS;
+ default:
+ return SMC_ARCH_CALL_NOT_SUPPORTED;
+ }
+}
+
+/* Get SOC version */
+int32_t plat_get_soc_version(void)
+{
+ uint32_t chip_id = stm32mp_get_chip_dev_id();
+ uint32_t manfid = SOC_ID_SET_JEP_106(JEDEC_ST_BKID, JEDEC_ST_MFID);
+
+ return (int32_t)(manfid | (chip_id & SOC_ID_IMPL_DEF_MASK));
+}
+
+/* Get SOC revision */
+int32_t plat_get_soc_revision(void)
+{
+ return (int32_t)(stm32mp_get_chip_version() & SOC_ID_REV_MASK);
+}