lib: utils/timer: mtimer: only use regname for aclint

The parser will fail if the timer is clint timer and has regname
property. As the regname is only meaningful for aclint, it is more
robust to only check regname for aclint timer.

Fixes: 6112d58 ("lib: utils/fdt: Allow to use reg-names when parsing ACLINT")
Signed-off-by: Inochi Amaoto <inochiama@outlook.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
Inochi Amaoto
2023-12-27 08:46:11 +08:00
committed by Anup Patel
parent 63e09ad3f7
commit ba29293dc9
4 changed files with 9 additions and 6 deletions

View File

@@ -957,7 +957,8 @@ static int fdt_get_aclint_addr_size(void *fdt, int nodeoffset,
return 0;
}
int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer,
int fdt_parse_aclint_node(void *fdt, int nodeoffset,
bool for_timer, bool allow_regname,
unsigned long *out_addr1, unsigned long *out_size1,
unsigned long *out_addr2, unsigned long *out_size2,
u32 *out_first_hartid, u32 *out_hart_count)
@@ -972,7 +973,7 @@ int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer,
!out_first_hartid || !out_hart_count)
return SBI_EINVAL;
if (for_timer && out_addr2 && out_size2 &&
if (for_timer && allow_regname && out_addr2 && out_size2 &&
fdt_getprop(fdt, nodeoffset, "reg-names", NULL))
rc = fdt_get_aclint_addr_size_by_name(fdt, nodeoffset,
out_addr1, out_size1,