aboutsummaryrefslogtreecommitdiffstats
path: root/plat/imx
diff options
context:
space:
mode:
authorAnson Huang <Anson.Huang@nxp.com>2019-01-18 10:27:48 +0800
committerAnson Huang <Anson.Huang@nxp.com>2019-01-18 11:23:00 +0800
commitdbfa45e8163336daa2b1b8a76fcc74976a6aa6d7 (patch)
tree63e00eb4ae1a782e9894ad5bffcc25ddc04a7aef /plat/imx
parent936840f143ca6eba09a78367afe047136c33a4ee (diff)
downloadplatform_external_arm-trusted-firmware-dbfa45e8163336daa2b1b8a76fcc74976a6aa6d7.tar.gz
platform_external_arm-trusted-firmware-dbfa45e8163336daa2b1b8a76fcc74976a6aa6d7.tar.bz2
platform_external_arm-trusted-firmware-dbfa45e8163336daa2b1b8a76fcc74976a6aa6d7.zip
imx: add i.MX8 SoCs OTP SIP(silicon provider) service support
For NXP's i.MX8 SoCs with system controller inside, OTP is maintained by SCFW, Linux needs to call SMC to trap to TF-A for OTP read/write etc. operations by calling SCFW API. This patch adds OTP SIP service support. Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Diffstat (limited to 'plat/imx')
-rw-r--r--plat/imx/common/imx_sip_handler.c26
-rw-r--r--plat/imx/common/imx_sip_svc.c3
-rw-r--r--plat/imx/common/include/imx_sip_svc.h5
3 files changed, 34 insertions, 0 deletions
diff --git a/plat/imx/common/imx_sip_handler.c b/plat/imx/common/imx_sip_handler.c
index 2e50cf304..a096a0606 100644
--- a/plat/imx/common/imx_sip_handler.c
+++ b/plat/imx/common/imx_sip_handler.c
@@ -102,3 +102,29 @@ int imx_wakeup_src_handler(uint32_t smc_fid,
return SMC_OK;
}
+
+int imx_otp_handler(uint32_t smc_fid,
+ void *handle,
+ u_register_t x1,
+ u_register_t x2)
+{
+ int ret;
+ uint32_t fuse;
+
+ switch (smc_fid) {
+ case IMX_SIP_OTP_READ:
+ ret = sc_misc_otp_fuse_read(ipc_handle, x1, &fuse);
+ SMC_RET2(handle, ret, fuse);
+ break;
+ case IMX_SIP_OTP_WRITE:
+ ret = sc_misc_otp_fuse_write(ipc_handle, x1, x2);
+ SMC_RET1(handle, ret);
+ break;
+ default:
+ ret = SMC_UNK;
+ SMC_RET1(handle, ret);
+ break;
+ }
+
+ return ret;
+}
diff --git a/plat/imx/common/imx_sip_svc.c b/plat/imx/common/imx_sip_svc.c
index a4b8ff297..e7afb3c6b 100644
--- a/plat/imx/common/imx_sip_svc.c
+++ b/plat/imx/common/imx_sip_svc.c
@@ -34,6 +34,9 @@ static uintptr_t imx_sip_handler(unsigned int smc_fid,
break;
case IMX_SIP_WAKEUP_SRC:
SMC_RET1(handle, imx_wakeup_src_handler(smc_fid, x1, x2, x3));
+ case IMX_SIP_OTP_READ:
+ case IMX_SIP_OTP_WRITE:
+ return imx_otp_handler(smc_fid, handle, x1, x2);
#endif
default:
WARN("Unimplemented i.MX SiP Service Call: 0x%x\n", smc_fid);
diff --git a/plat/imx/common/include/imx_sip_svc.h b/plat/imx/common/include/imx_sip_svc.h
index 4de219478..3fa6b82c3 100644
--- a/plat/imx/common/include/imx_sip_svc.h
+++ b/plat/imx/common/include/imx_sip_svc.h
@@ -18,6 +18,9 @@
#define IMX_SIP_WAKEUP_SRC_SCU 0x1
#define IMX_SIP_WAKEUP_SRC_IRQSTEER 0x2
+#define IMX_SIP_OTP_READ 0xC200000A
+#define IMX_SIP_OTP_WRITE 0xC200000B
+
#if (defined(PLAT_IMX8QM) || defined(PLAT_IMX8QX))
int imx_cpufreq_handler(uint32_t smc_fid, u_register_t x1,
u_register_t x2, u_register_t x3);
@@ -25,6 +28,8 @@ int imx_srtc_handler(uint32_t smc_fid, void *handle, u_register_t x1,
u_register_t x2, u_register_t x3, u_register_t x4);
int imx_wakeup_src_handler(uint32_t smc_fid, u_register_t x1,
u_register_t x2, u_register_t x3);
+int imx_otp_handler(uint32_t smc_fid, void *handle,
+ u_register_t x1, u_register_t x2);
#endif
#endif /* __IMX_SIP_SVC_H__ */