Skip to content

Commit

Permalink
drivers: stm32_rng: embed ETZPC functions when CFG_STM32_ETZPC is set
Browse files Browse the repository at this point in the history
On platforms when CFG_STM32_ETZPC is disabled, ETZPC cannot be
interrogated to get decprot attributes. Therefore do not embed ETZPC
related code.

While there, revert commit 326382a ("drivers: stm32_rng: MP15 RNG is
non-secure when PRNG is enable") and prefer to use ETZPC API.

Signed-off-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
Fixes: d773ec0 ("drivers: stm32_rng: update clock and power management")
Reviewed-by: Etienne Carriere <etienne.carriere@foss.st.com>
  • Loading branch information
GseoC authored and jforissier committed Nov 4, 2024
1 parent f2e5b5e commit 9a0e54f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions core/drivers/stm32_rng.c
Original file line number Diff line number Diff line change
Expand Up @@ -670,13 +670,13 @@ static TEE_Result stm32_rng_probe(const void *fdt, int offs,
if (res)
goto err;

#if defined(CFG_STM32MP15)
#if defined(CFG_STM32MP15) && defined(CFG_STM32_ETZPC)
/* Only STM32MP15 requires a software registering of RNG secure state */
if (IS_ENABLED(CFG_WITH_SOFTWARE_PRNG))
if (etzpc_get_decprot(STM32MP1_ETZPC_RNG1_ID) == ETZPC_DECPROT_NS_RW)
stm32mp_register_non_secure_periph_iomem(stm32_rng->base.pa);
else
stm32mp_register_secure_periph_iomem(stm32_rng->base.pa);
#endif /* defined(CFG_STM32MP15) */
#endif /* defined(CFG_STM32MP15) && defined(CFG_STM32_ETZPC) */

/* Power management implementation expects both or none are set */
assert(stm32_rng->ddata->has_power_optim ==
Expand Down

0 comments on commit 9a0e54f

Please sign in to comment.