Skip to content

Commit

Permalink
drivers: atmel_rtc: 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 RTC 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 410a638 commit 81662dc
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions core/drivers/atmel_rtc.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,11 @@ static struct rtc atmel_rtc = {
.range_max = { 2099, 12, 31, 23, 59, 59, 0 },
};

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

static TEE_Result atmel_rtc_probe(const void *fdt, int node,
const void *compat_data __unused)
const void *compat_data)
{
size_t size = 0;

Expand All @@ -292,7 +295,8 @@ static TEE_Result atmel_rtc_probe(const void *fdt, int node,
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 != &rtc_always_secure)
matrix_configure_periph_secure(AT91C_ID_SYS);

if (dt_map_dev(fdt, node, &rtc_base, &size, DT_MAP_AUTO) < 0)
return TEE_ERROR_GENERIC;
Expand All @@ -309,6 +313,10 @@ static TEE_Result atmel_rtc_probe(const void *fdt, int node,

static const struct dt_device_match atmel_rtc_match_table[] = {
{ .compatible = "atmel,sama5d2-rtc" },
{
.compatible = "microchip,sama7g5-rtc",
.compat_data = &rtc_always_secure,
},
{ }
};

Expand Down

0 comments on commit 81662dc

Please sign in to comment.