stm32mp1: dynamically detect op-tee presence
authorPatrick Delaunay <patrick.delaunay@st.com>
Wed, 18 Mar 2020 08:22:49 +0000 (09:22 +0100)
committerPatrick Delaunay <patrick.delaunay@st.com>
Thu, 14 May 2020 07:02:12 +0000 (09:02 +0200)
Activate OP-TEE driver for trusted and optee defconfig.

This driver allows detection of TEE presence for boot from flash;
CONFIG_STM32MP1_OPTEE is also removed.

Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
arch/arm/mach-stm32mp/Kconfig
arch/arm/mach-stm32mp/fdt.c
board/dhelectronics/dh_stm32mp1/board.c
board/st/common/stm32mp_mtdparts.c
board/st/stm32mp1/stm32mp1.c
configs/stm32mp15_optee_defconfig
configs/stm32mp15_trusted_defconfig

index ba965e7b3b314da53dc73b4c8062c53306bbfd64..314f284dcf04f35a2da1c2f80b68f2772d91a601 100644 (file)
@@ -86,16 +86,6 @@ config TARGET_DH_STM32MP1_PDK2
 
 endchoice
 
-config STM32MP1_OPTEE
-       bool "Support trusted boot with TF-A and OP-TEE"
-       depends on TFABOOT
-       default n
-       help
-               Say Y here to enable boot with TF-A and OP-TEE
-               Trusted boot chain is :
-               BootRom => TF-A.stm32 (clock & DDR) => OP-TEE => U-Boot.stm32
-               OP-TEE monitor provides ST SMC to access to secure resources
-
 config SYS_TEXT_BASE
        default 0xC0100000
 
index ae82270e4241f0e8c0e388ace2004bab2bb5dbc6..21b5f09728c26ce39904a18a8e200e44076020ea 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <common.h>
 #include <fdt_support.h>
+#include <tee.h>
 #include <asm/arch/sys_proto.h>
 #include <dt-bindings/pinctrl/stm32-pinfunc.h>
 #include <linux/io.h>
@@ -322,7 +323,8 @@ int ft_system_setup(void *blob, bd_t *bd)
                                       "st,package", pkg, false);
        }
 
-       if (!CONFIG_IS_ENABLED(STM32MP1_OPTEE))
+       if (!CONFIG_IS_ENABLED(OPTEE) ||
+           !tee_find_device(NULL, NULL, NULL, NULL))
                stm32_fdt_disable_optee(blob);
 
        return ret;
index 873fa86e53c623f127aedd770bdab28fc7267c85..ec1edd5c6887165688b5e076ce5041f01c9868e9 100644 (file)
@@ -116,9 +116,7 @@ int checkboard(void)
        const char *fdt_compat;
        int fdt_compat_len;
 
-       if (IS_ENABLED(CONFIG_STM32MP1_OPTEE))
-               mode = "trusted with OP-TEE";
-       else if (IS_ENABLED(CONFIG_TFABOOT))
+       if (IS_ENABLED(CONFIG_TFABOOT))
                mode = "trusted";
        else
                mode = "basic";
index d4c0a7db9fbf8d18392248dbcbcabdaca38b5a5a..2b6413be16697bbd49d8fb841e3254993828c94b 100644 (file)
@@ -9,6 +9,7 @@
 #include <env_internal.h>
 #include <mtd.h>
 #include <mtd_node.h>
+#include <tee.h>
 
 #define MTDPARTS_LEN           256
 #define MTDIDS_LEN             128
@@ -49,7 +50,7 @@ static void board_get_mtdparts(const char *dev,
                strncat(mtdparts, ",", MTDPARTS_LEN);
        }
 
-       if (CONFIG_IS_ENABLED(STM32MP1_OPTEE) && tee) {
+       if (tee) {
                strncat(mtdparts, tee, MTDPARTS_LEN);
                strncat(mtdparts, ",", MTDPARTS_LEN);
        }
@@ -72,7 +73,8 @@ void board_mtdparts_default(const char **mtdids, const char **mtdparts)
                return;
        }
 
-       if (CONFIG_IS_ENABLED(STM32MP1_OPTEE))
+       if (CONFIG_IS_ENABLED(OPTEE) &&
+           tee_find_device(NULL, NULL, NULL, NULL))
                tee = true;
 
        memset(parts, 0, sizeof(parts));
index 3ccb12d817db08c324ffb4f3716f8bc2be27471f..496ca56a1458beb300faa2b12192b80088d30a70 100644 (file)
@@ -87,9 +87,7 @@ int checkboard(void)
        const char *fdt_compat;
        int fdt_compat_len;
 
-       if (IS_ENABLED(CONFIG_STM32MP1_OPTEE))
-               mode = "trusted with OP-TEE";
-       else if (IS_ENABLED(TFABOOT))
+       if (IS_ENABLED(CONFIG_TFABOOT))
                mode = "trusted";
        else
                mode = "basic";
index 443e2c40b78f6dd4a24097600931f99996e33f47..d5406643155bcf764bf71df9331d7a24d2026704 100644 (file)
@@ -5,7 +5,6 @@ CONFIG_SYS_MALLOC_F_LEN=0x3000
 CONFIG_ENV_OFFSET=0x280000
 CONFIG_ENV_SECT_SIZE=0x40000
 CONFIG_TARGET_ST_STM32MP15x=y
-CONFIG_STM32MP1_OPTEE=y
 CONFIG_ENV_OFFSET_REDUND=0x2C0000
 CONFIG_DISTRO_DEFAULTS=y
 CONFIG_FIT=y
@@ -114,6 +113,9 @@ CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_STM32_SPI=y
+CONFIG_TEE=y
+CONFIG_OPTEE=y
+# CONFIG_OPTEE_TA_AVB is not set
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_DM_USB_GADGET=y
index 33f6926fa9e43e1710b10a6f83575738ffd85b82..637b1f0d709a31e84a0fa56e92d5205d3e959be8 100644 (file)
@@ -110,6 +110,9 @@ CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_STM32_QSPI=y
 CONFIG_STM32_SPI=y
+CONFIG_TEE=y
+CONFIG_OPTEE=y
+# CONFIG_OPTEE_TA_AVB is not set
 CONFIG_USB=y
 CONFIG_DM_USB=y
 CONFIG_DM_USB_GADGET=y