1 // SPDX-License-Identifier: BSD-2-Clause 2 /* 3 * Copyright 2020 Pengutronix, Rouven Czerwinski <entwicklung@pengutronix.de> 4 */ 5 #include <drivers/imx_snvs.h> 6 #include <imx.h> 7 #include <tee/tee_fs.h> 8 plat_rpmb_key_is_ready(void)9bool plat_rpmb_key_is_ready(void) 10 { 11 enum snvs_ssm_mode mode = SNVS_SSM_MODE_INIT; 12 enum snvs_security_cfg security = SNVS_SECURITY_CFG_OPEN; 13 bool ssm_secure = false; 14 15 mode = snvs_get_ssm_mode(); 16 security = snvs_get_security_cfg(); 17 ssm_secure = (mode == SNVS_SSM_MODE_TRUSTED || 18 mode == SNVS_SSM_MODE_SECURE); 19 20 /* 21 * On i.MX6SDL and i.MX6DQ, the security cfg always returns 22 * SNVS_SECURITY_CFG_FAB (000), therefore we ignore the security 23 * configuration for this SoC. 24 */ 25 if (soc_is_imx6sdl() || soc_is_imx6dq()) 26 return ssm_secure; 27 28 return ssm_secure && (security == SNVS_SECURITY_CFG_CLOSED); 29 } 30