Skip to content

Commit

Permalink
drivers: pm: sam: map SFRBU with DT_MAP_SECURE attribute for sama7g5
Browse files Browse the repository at this point in the history
As sama7g5's SFRBU is always secured map it as secured and do not
need to configure the security through the matrix.

Signed-off-by: Tony Han <tony.han@microchip.com>
Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
  • Loading branch information
TonyHan11 authored and jforissier committed May 8, 2024
1 parent 95acfb1 commit 6e4bc5d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions core/drivers/pm/sam/at91_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,18 +352,24 @@ static TEE_Result at91_pm_dt_dram_init(const void *fdt)

static TEE_Result at91_pm_backup_init(const void *fdt)
{
enum dt_map_dev_directive mapping = DT_MAP_AUTO;
int node = -1;
size_t size = 0;

node = fdt_node_offset_by_compatible(fdt, -1, "atmel,sama5d2-sfrbu");
if (node < 0)
return TEE_ERROR_ITEM_NOT_FOUND;

if (dt_map_dev(fdt, node, &soc_pm.sfrbu, &size, DT_MAP_AUTO) < 0)
if (IS_ENABLED(CFG_SAMA7G5))
mapping = DT_MAP_SECURE;

if (dt_map_dev(fdt, node, &soc_pm.sfrbu, &size, mapping) < 0)
return TEE_ERROR_GENERIC;

if (fdt_get_status(fdt, node) == DT_STATUS_OK_SEC)
matrix_configure_periph_secure(AT91C_ID_SFRBU);
/* for SAMA7G5 SFRBU is always secured, no need to configre */
if (!IS_ENABLED(CFG_SAMA7G5))
matrix_configure_periph_secure(AT91C_ID_SFRBU);

return TEE_SUCCESS;
}
Expand Down

0 comments on commit 6e4bc5d

Please sign in to comment.