platform: generic: andes: add Andes SBI call to probe Andes PMA feature

Add a new Andes SBI call to check whether PPMA is supported by hardware
or not.

Signed-off-by: Ben Zong-You Xie <ben717@andestech.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Ben Zong-You Xie
2024-07-23 15:57:26 +08:00
committed by Anup Patel
parent 17100394f9
commit 4a72abb5f4
4 changed files with 25 additions and 2 deletions

View File

@@ -241,7 +241,6 @@ static int andes_fdt_reserved_memory_fixup(void *fdt,
int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
unsigned int pma_regions_count)
{
unsigned long mmsc = csr_read(CSR_MMSC_CFG);
unsigned int dt_populate_cnt;
unsigned int i, j;
unsigned long pa;
@@ -254,7 +253,7 @@ int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
if (pma_regions_count > ANDES_MAX_PMA_REGIONS)
return SBI_EINVAL;
if ((mmsc & MMSC_CFG_PPMA_MASK) == 0)
if (!andes_sbi_probe_pma())
return SBI_ENOTSUPP;
/* Configure the PMA regions */
@@ -290,3 +289,8 @@ int andes_pma_setup_regions(const struct andes_pma_region *pma_regions,
return 0;
}
bool andes_sbi_probe_pma(void)
{
return (csr_read(CSR_MMSC_CFG) & MMSC_CFG_PPMA_MASK) ? true : false;
}