Switch to "riscv,aclint-mtimer" timer
This commit is contained in:
parent
6576a92ba5
commit
6a57dd004f
38
JOURNAL.md
38
JOURNAL.md
@ -1674,3 +1674,41 @@ It seems that SiFive timer has a very long weird offset:
|
||||
|
||||
We may want to use the ACLINT timer instead. Let's first see where the addresses
|
||||
lay in memory, and then use that to verify we change it to 0x0 and 0x8.
|
||||
|
||||
GGGGGGGGG
|
||||
OpenSBI v1.5
|
||||
____ _____ ____ _____
|
||||
/ __ \ / ____| _ \_ _|
|
||||
| | | |_ __ ___ _ __ | (___ | |_) || |
|
||||
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
|
||||
| |__| | |_) | __/ | | |____) | |_) || |_
|
||||
\____/| .__/ \___|_| |_|_____/|____/_____|
|
||||
| |
|
||||
|_|
|
||||
|
||||
sbi_timer_init: begins
|
||||
sbi_timer_init: got Zicntr extension
|
||||
fdt_timer_cold_init: pos = 0
|
||||
fdt_timer_cold_init: got match, name = riscv,clint0
|
||||
fdt_timer_cold_init: enabled
|
||||
timer_mtimer_cold_init: begins, is_clint = 1
|
||||
timer_mtimer_cold_init: mtime_addr = 0x4000dff8
|
||||
timer_mtimer_cold_init: mtime_size = 0x000b4008
|
||||
timer_mtimer_cold_init: mtime_addr = 0x40006000
|
||||
timer_mtimer_cold_init: mtime_addr = 0x00007ff8
|
||||
fdt_timer_cold_init: drc->cold_init = -3
|
||||
fdt_timer_init: fdt_timer_cold_init failed (-3)
|
||||
sbi_platform_timer: sbi_platform_timer_init failed (-3)
|
||||
init_coldboot: timer init failed (error -3)
|
||||
|
||||
Yeah, those addresses are not what we want. Based on the device tree, the clint
|
||||
must be at 0x40002000, so they should be 40002000 and 40002008. Also I made some
|
||||
typos in the printf command, this is the patch:
|
||||
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_addr = 0x%08lx\n", mt->mtime_addr);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_size = 0x%08lx\n", mt->mtime_size);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_addr = 0x%08lx\n", mt->mtimecmp_addr);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_addr = 0x%08lx\n", mt->mtimecmp_size);
|
||||
|
||||
So, let's fix the patch and switch to the "riscv,aclint-mtimer" timer, which
|
||||
doesn't set any quirk or weird offset.
|
||||
|
@ -99,7 +99,7 @@ index f468730..db20526 100644
|
||||
+ return rc;
|
||||
}
|
||||
diff --git a/lib/utils/timer/fdt_timer_mtimer.c b/lib/utils/timer/fdt_timer_mtimer.c
|
||||
index 9e27e3a..fba48ca 100644
|
||||
index 9e27e3a..cef2ee6 100644
|
||||
--- a/lib/utils/timer/fdt_timer_mtimer.c
|
||||
+++ b/lib/utils/timer/fdt_timer_mtimer.c
|
||||
@@ -8,6 +8,7 @@
|
||||
@ -149,8 +149,8 @@ index 9e27e3a..fba48ca 100644
|
||||
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_addr = 0x%08lx\n", mt->mtime_addr);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_size = 0x%08lx\n", mt->mtime_size);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_addr = 0x%08lx\n", mt->mtimecmp_addr);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtime_addr = 0x%08lx\n", mt->mtimecmp_size);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtimecmp_addr = 0x%08lx\n", mt->mtimecmp_addr);
|
||||
+ sbi_printf("timer_mtimer_cold_init: mtimecmp_size = 0x%08lx\n", mt->mtimecmp_size);
|
||||
+
|
||||
/* Apply additional quirks */
|
||||
if (quirks) {
|
||||
|
@ -234,7 +234,9 @@
|
||||
/*<&CPU0 0x3>, <&CPU0 0x7>,*/
|
||||
/*<&onic_pool 0x3>, <&onic_pool 0x7>,*/
|
||||
/*<&SERIAL 0x3>, <&SERIAL 0x7>*/
|
||||
compatible = "riscv,clint0";
|
||||
|
||||
/* Allows using the "generic" platform in OpenSBI. */
|
||||
compatible = "riscv,aclint-mtimer";
|
||||
};
|
||||
|
||||
/* Guesswork: There must be a timer at 0x40170000 as it is
|
||||
|
Loading…
Reference in New Issue
Block a user