From 2742374414c5891ac37fd4d42ba62c3cff1474c6 Mon Sep 17 00:00:00 2001 From: Nicolas Le Bayon Date: Wed, 2 Dec 2020 16:23:49 +0100 Subject: [PATCH] feat(stm32mp1): add RNG initialization in BL2 for STM32MP13 Initialize RNG driver at platform level for STM32MP13. Change-Id: I64832de43e5f6559a12e26680142db54c88f0b9e Signed-off-by: Nicolas Le Bayon --- plat/st/stm32mp1/bl2_plat_setup.c | 7 +++++++ plat/st/stm32mp1/platform.mk | 7 ++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plat/st/stm32mp1/bl2_plat_setup.c b/plat/st/stm32mp1/bl2_plat_setup.c index 5015f7d16..1fddfccca 100644 --- a/plat/st/stm32mp1/bl2_plat_setup.c +++ b/plat/st/stm32mp1/bl2_plat_setup.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -375,6 +376,12 @@ skip_console_init: } } +#if STM32MP13 + if (stm32_rng_init() != 0) { + panic(); + } +#endif + #if STM32MP15 if (stm32mp_is_auth_supported()) { stm32mp1_auth_ops.check_key = diff --git a/plat/st/stm32mp1/platform.mk b/plat/st/stm32mp1/platform.mk index 2409935c0..7aa55272e 100644 --- a/plat/st/stm32mp1/platform.mk +++ b/plat/st/stm32mp1/platform.mk @@ -117,8 +117,10 @@ endif ifeq ($(STM32MP13),1) STM32_HASH_VER := 4 +STM32_RNG_VER := 4 else # Assuming STM32MP15 STM32_HASH_VER := 2 +STM32_RNG_VER := 2 endif # Boot devices @@ -236,6 +238,7 @@ $(eval $(call assert_numerics,\ $(sort \ PLAT_PARTITION_MAX_ENTRIES \ STM32_HASH_VER \ + STM32_RNG_VER \ STM32_TF_A_COPIES \ STM32_TF_VERSION \ STM32MP_UART_BAUDRATE \ @@ -247,6 +250,7 @@ $(eval $(call add_defines,\ PLAT_PARTITION_MAX_ENTRIES \ PLAT_XLAT_TABLES_DYNAMIC \ STM32_HASH_VER \ + STM32_RNG_VER \ STM32_TF_A_COPIES \ STM32_TF_VERSION \ STM32MP_CRYPTO_ROM_LIB \ @@ -317,7 +321,8 @@ PLAT_BL_COMMON_SOURCES += drivers/arm/tzc/tzc400.c \ ifeq ($(STM32MP13),1) PLAT_BL_COMMON_SOURCES += drivers/st/clk/clk-stm32-core.c \ - drivers/st/clk/clk-stm32mp13.c + drivers/st/clk/clk-stm32mp13.c \ + drivers/st/crypto/stm32_rng.c else PLAT_BL_COMMON_SOURCES += drivers/st/clk/stm32mp1_clk.c endif -- 2.39.5