Skip to content

Commit

Permalink
drivers: atmel_rstc: update to compatible with sama7g5
Browse files Browse the repository at this point in the history
Add the compatible string to device match table for sama7g5.
As RSTC is always secure for sama7g5 no need to configure
its security through matrix.

Signed-off-by: Tony Han <tony.han@microchip.com>
  • Loading branch information
TonyHan11 committed Dec 19, 2023
1 parent 5d194bf commit 410a638
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/drivers/atmel_rstc.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,20 @@ void __noreturn atmel_rstc_reset(void)
;
}

/* Non-null reference for compat data */
static const uint8_t rstc_always_secure;

static TEE_Result atmel_rstc_probe(const void *fdt, int node,
const void *compat_data __unused)
const void *compat_data)

{
size_t size = 0;

if (fdt_get_status(fdt, node) != DT_STATUS_OK_SEC)
return TEE_ERROR_BAD_PARAMETERS;

matrix_configure_periph_secure(AT91C_ID_SYS);
if (compat_data != &rstc_always_secure)
matrix_configure_periph_secure(AT91C_ID_SYS);

if (dt_map_dev(fdt, node, &rstc_base, &size, DT_MAP_AUTO) < 0)
return TEE_ERROR_GENERIC;
Expand All @@ -59,6 +63,10 @@ static TEE_Result atmel_rstc_probe(const void *fdt, int node,

static const struct dt_device_match atmel_rstc_match_table[] = {
{ .compatible = "atmel,sama5d3-rstc" },
{
.compatible = "microchip,sama7g5-rstc",
.compat_data = &rstc_always_secure,
},
{ }
};

Expand Down

0 comments on commit 410a638

Please sign in to comment.