mirror of
https://github.com/ARM-software/arm-trusted-firmware.git
synced 2025-04-17 01:54:22 +00:00
feat(st): update the security based on new compatible
From the new binding, the RCC become secured based on the new compatible. This must be done only from the secure OS initialisation. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Change-Id: I7f0a62f22bfcca638ddaefc9563df00f89f01653
This commit is contained in:
parent
99026cff47
commit
812daf916c
4 changed files with 13 additions and 13 deletions
|
@ -1837,11 +1837,6 @@ int stm32mp1_clk_init(void)
|
|||
return -FDT_ERR_NOTFOUND;
|
||||
}
|
||||
|
||||
/* Check status field to disable security */
|
||||
if (!fdt_get_rcc_secure_status()) {
|
||||
mmio_write_32(rcc_base + RCC_TZCR, 0);
|
||||
}
|
||||
|
||||
ret = fdt_rcc_read_uint32_array("st,clksrc", (uint32_t)CLKSRC_NB,
|
||||
clksrc);
|
||||
if (ret < 0) {
|
||||
|
@ -2358,6 +2353,12 @@ static const struct clk_ops stm32mp_clk_ops = {
|
|||
|
||||
int stm32mp1_clk_probe(void)
|
||||
{
|
||||
#if defined(IMAGE_BL32)
|
||||
if (!fdt_get_rcc_secure_state()) {
|
||||
mmio_write_32(stm32mp_rcc_base() + RCC_TZCR, 0U);
|
||||
}
|
||||
#endif
|
||||
|
||||
stm32mp1_osc_init();
|
||||
|
||||
sync_earlyboot_clocks_state();
|
||||
|
|
|
@ -250,24 +250,22 @@ const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp)
|
|||
}
|
||||
|
||||
/*
|
||||
* Get the secure status for rcc node in device tree.
|
||||
* @return: true if rcc is available from secure world, false if not.
|
||||
* Get the secure state for rcc node in device tree.
|
||||
* @return: true if rcc is configured for secure world access, false if not.
|
||||
*/
|
||||
bool fdt_get_rcc_secure_status(void)
|
||||
bool fdt_get_rcc_secure_state(void)
|
||||
{
|
||||
int node;
|
||||
void *fdt;
|
||||
|
||||
if (fdt_get_address(&fdt) == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
node = fdt_get_rcc_node(fdt);
|
||||
if (node < 0) {
|
||||
if (fdt_node_offset_by_compatible(fdt, -1, DT_RCC_SEC_CLK_COMPAT) < 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!(fdt_get_status(node) & DT_SECURE);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -23,7 +23,7 @@ int fdt_rcc_read_uint32_array(const char *prop_name, uint32_t count,
|
|||
uint32_t *array);
|
||||
int fdt_rcc_subnode_offset(const char *name);
|
||||
const fdt32_t *fdt_rcc_read_prop(const char *prop_name, int *lenp);
|
||||
bool fdt_get_rcc_secure_status(void);
|
||||
bool fdt_get_rcc_secure_state(void);
|
||||
|
||||
int fdt_get_clock_id(int node);
|
||||
unsigned long fdt_get_uart_clock_freq(uintptr_t instance);
|
||||
|
|
|
@ -492,5 +492,6 @@ static inline uint32_t tamp_bkpr(uint32_t idx)
|
|||
#define DT_NVMEM_LAYOUT_COMPAT "st,stm32-nvmem-layout"
|
||||
#define DT_PWR_COMPAT "st,stm32mp1,pwr-reg"
|
||||
#define DT_RCC_CLK_COMPAT "st,stm32mp1-rcc"
|
||||
#define DT_RCC_SEC_CLK_COMPAT "st,stm32mp1-rcc-secure"
|
||||
|
||||
#endif /* STM32MP1_DEF_H */
|
||||
|
|
Loading…
Add table
Reference in a new issue