From f221878204f940a60759168289125aa1d4a0b164 Mon Sep 17 00:00:00 2001 From: Yanfeng Liu Date: Fri, 12 Jan 2024 09:33:15 +0800 Subject: [PATCH] risc-v/nuttsbi: use ARCH_RV_MMIO_BITS for mtimer access selection Chips like K230 has ARCH_RV64 but only supports 32-bit MMIO. So using ARCH_RV_MMIO_BITS is more proper here. Signed-off-by: Yanfeng Liu --- arch/risc-v/src/nuttsbi/sbi_mtimer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/risc-v/src/nuttsbi/sbi_mtimer.c b/arch/risc-v/src/nuttsbi/sbi_mtimer.c index 4fae0db2b2..e633fc48fb 100644 --- a/arch/risc-v/src/nuttsbi/sbi_mtimer.c +++ b/arch/risc-v/src/nuttsbi/sbi_mtimer.c @@ -66,7 +66,7 @@ void sbi_init_mtimer(uintptr_t mtime, uintptr_t mtimecmp) uint64_t sbi_get_mtime(void) { -#ifdef CONFIG_ARCH_RV64 +#if CONFIG_ARCH_RV_MMIO_BITS == 64 return getreg64(g_mtime); #else uint32_t hi; @@ -86,7 +86,7 @@ uint64_t sbi_get_mtime(void) void sbi_set_mtimecmp(uint64_t value) { uintptr_t mtimecmp = g_mtimecmp + READ_CSR(mhartid) * sizeof(uintptr_t); -#ifdef CONFIG_ARCH_RV64 +#if CONFIG_ARCH_RV_MMIO_BITS == 64 putreg64(value, mtimecmp); #else putreg32(UINT32_MAX, mtimecmp + 4);