[PATCH v2 0/3] riscv: improve nommu and timer-clint
From: Jisheng Zhang
Date: Sat Apr 06 2024 - 07:35:37 EST
As is known, the sophgo CV1800B contains so called little core, which
is C906 w/o MMU, so I want to run nommu linux on it. This series is
the result of the bring up. After this series, w/ proper dts, we can
run nommu linux on milkv duo's little core.
First of all, patch1 removes the PAGE_OFFSET hardcoding by introducing
DRAM_BASE Kconfig option.
As pointed out by commit ca7810aecdba ("lib: utils/timer: mtimer: add a
quirk for lacking mtime register") of opensbi:
"T-Head developers surely have a different understanding of time CSR and
CLINT's mtime register with SiFive ones, that they did not implement
the mtime register at all -- as shown in openC906 source code, their
time CSR value is just exposed at the top of their processor IP block
and expects an external continous counter, which makes it not
overrideable, and thus mtime register is not implemented, even not for
reading. However, if CLINTEE is not enabled in T-Head's MXSTATUS
extended CSR, these systems still rely on the mtimecmp registers to
generate timer interrupts. This makes it necessary to implement T-Head
C9xx CLINT support in OpenSBI MTIMER driver, which skips implementing
reading mtime register and falls back to default code that reads time
CSR."
So the second patch adds an option CONFIG_CLINT_USE_CSR_INSTEADOF_MTIME
for this purpose.
The last patch adds T-Head C9xxx clint support to timer-clint driver.
Since v1:
- fix c900_clint_timer_init_dt() defined but not used build warning
- add option CONFIG_CLINT_USE_CSR_INSTEADOF_MTIME instead of removing
mtime usage for all platforms, since not all platforms implement the
time CSR in HW in M mode.
- rebase on the timer-clint improvement series
https://lore.kernel.org/linux-riscv/20240406111757.1597-1-jszhang@xxxxxxxxxx/T/#t
Jisheng Zhang (3):
riscv: nommu: remove PAGE_OFFSET hardcoding
clocksource/drivers/timer-clint: Add option to use CSR instead of
mtime
clocksource/drivers/timer-clint: Add T-Head C9xx clint
arch/riscv/Kconfig | 8 +++++++-
arch/riscv/include/asm/timex.h | 6 +++---
drivers/clocksource/Kconfig | 9 +++++++++
drivers/clocksource/timer-clint.c | 31 +++++++++++++++++++++++++++++++
4 files changed, 50 insertions(+), 4 deletions(-)
--
2.43.0