aboutsummaryrefslogtreecommitdiff
path: root/lib/utils/timer
diff options
context:
space:
mode:
authorInochi Amaoto <inochiama@outlook.com>2023-12-27 08:46:11 +0800
committerAnup Patel <anup@brainfault.org>2023-12-27 11:57:33 +0530
commitba29293dc947e13fa2e63de7ed289d7bb9b540f4 (patch)
treebea7f6343a8320a81f81f7f17006b70f189b7cc0 /lib/utils/timer
parent63e09ad3f77218e34fb6cc1df88bedde9b9f38cb (diff)
downloadopensbi-ba29293dc947e13fa2e63de7ed289d7bb9b540f4.zip
opensbi-ba29293dc947e13fa2e63de7ed289d7bb9b540f4.tar.gz
opensbi-ba29293dc947e13fa2e63de7ed289d7bb9b540f4.tar.bz2
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>
Diffstat (limited to 'lib/utils/timer')
-rw-r--r--lib/utils/timer/fdt_timer_mtimer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/utils/timer/fdt_timer_mtimer.c b/lib/utils/timer/fdt_timer_mtimer.c
index 3ba6b8f..9e27e3a 100644
--- a/lib/utils/timer/fdt_timer_mtimer.c
+++ b/lib/utils/timer/fdt_timer_mtimer.c
@@ -38,13 +38,14 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff,
struct timer_mtimer_node *mtn, *n;
struct aclint_mtimer_data *mt;
const struct timer_mtimer_quirks *quirks = match->data;
+ bool is_clint = quirks && quirks->is_clint;
mtn = sbi_zalloc(sizeof(*mtn));
if (!mtn)
return SBI_ENOMEM;
mt = &mtn->data;
- rc = fdt_parse_aclint_node(fdt, nodeoff, true,
+ rc = fdt_parse_aclint_node(fdt, nodeoff, true, !is_clint,
&addr[0], &size[0], &addr[1], &size[1],
&mt->first_hartid, &mt->hart_count);
if (rc) {
@@ -60,7 +61,7 @@ static int timer_mtimer_cold_init(void *fdt, int nodeoff,
return rc;
}
- if (quirks && quirks->is_clint) { /* SiFive CLINT */
+ if (is_clint) { /* SiFive CLINT */
/* Set CLINT addresses */
mt->mtimecmp_addr = addr[0] + ACLINT_DEFAULT_MTIMECMP_OFFSET;
mt->mtimecmp_size = ACLINT_DEFAULT_MTIMECMP_SIZE;