Add a virtual global timer device driver. It uses a global timer
register as timer counter, and it uses mtimecmp CSR of clint as
interrupt source.
Using this virtul timer resolves dual way timer sync issue.
On dual way system, we should enable this driver and on single way
system, we should use standard risc-v clint timer.
1. Add a virtual global timer device driver, it is probed by fdt
sg2042-global-mtimer@70300101c0 {
compatible = "sophgo,sg2042-global-mtimer";
reg = < 0x00000070 0x300101c0 0x00000000 0x00000008
0x00000070 0xac000000 0x00000000 0x00200000>;
clock-frequency = <50000000 50000000>;
};
Its compatible should be "sophgo,sg2042-global-mtimer".
And the first region delcared in reg prop is the address of global
timer. The second region delcared in reg prop is the base of clint
timers.
The first clock in clock-frequency is the actual frequency of global
timer, the second clock is the actual frequency of clint timer.
2. Add a quirk in platform specific code.
Add a function sbi_platform_force_emulate_time_csr, it indicates if
opensbi should skip time CSR detection and make software in
supervisor and user mode use emulated time CSR.
Signed-off-by: Chao Wei <chao.wei@sophgo.com>
42 lines
650 B
Plaintext
42 lines
650 B
Plaintext
# SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
menu "Timer Device Support"
|
|
|
|
config FDT_TIMER
|
|
bool "FDT based timer drivers"
|
|
depends on FDT
|
|
default n
|
|
|
|
if FDT_TIMER
|
|
|
|
config FDT_TIMER_MTIMER
|
|
bool "ACLINT MTIMER FDT driver"
|
|
select TIMER_MTIMER
|
|
default n
|
|
|
|
config FDT_TIMER_PLMT
|
|
bool "Andes PLMT FDT driver"
|
|
select TIMER_PLMT
|
|
default n
|
|
|
|
config FDT_TIMER_SG2042_GMT
|
|
bool "SOPHGO SG2042 global mtimer FDT driver"
|
|
select TIMER_SG2042_GMT
|
|
default n
|
|
|
|
endif
|
|
|
|
config TIMER_MTIMER
|
|
bool "ACLINT MTIMER support"
|
|
default n
|
|
|
|
config TIMER_PLMT
|
|
bool "Andes PLMT support"
|
|
default n
|
|
|
|
config TIMER_SG2042_GMT
|
|
bool "SOPHGO SG2042 GMT support"
|
|
default n
|
|
|
|
endmenu
|