diff --git a/plat/imx/common/imx_sip_handler.c b/plat/imx/common/imx_sip_handler.c index 2e50cf3..a096a06 100644 --- a/plat/imx/common/imx_sip_handler.c +++ b/plat/imx/common/imx_sip_handler.c @@ -102,3 +102,29 @@ 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 a4b8ff2..e7afb3c 100644 --- a/plat/imx/common/imx_sip_svc.c +++ b/plat/imx/common/imx_sip_svc.c @@ -34,6 +34,9 @@ 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 4de2194..3fa6b82 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 @@ 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__ */