+struct jh7110_clkevt { + struct clock_event_device
evt; + struct clocksource cs; + bool cs_is_valid; +
struct clk *clk; + struct reset_control *rst; + u32
rate; + u32 reload_val; + void __iomem *base; +
char name[sizeof("jh7110-timer.chX")]; +}; + +struct jh7110_timer_priv { + struct clk *pclk; + struct reset_control *prst; + struct jh7110_clkevt clkevt[JH7110_TIMER_CH_MAX];
Why do you need several clock events and clock sources ?
This timer has four counters (channels) which run
independently. So each counter can have its own clock event
and clock source to configure different settings.
The kernel only needs one clocksource. Usually multiple
clockevents are per-cpu based system.
The driver does not seem to have a per cpu timer but just initializing multiple clockevents which will end up unused,
wasting energy.
The board of the StarFive JH7110 SoC has two types of timer : riscv-timer and jh7110-timer. It boots by
riscv-timer(clocksource) and the jh7110-timer is optional and
additional. I think I should initialize the four channels of
jh7110-timer as clockevents not clocksource pre-cpu.
If no clocksource is needed on this SoC because riscv timers are
used, then it is not useful to register a clocksource for this
timer and the corresponding code can go away.
If the clockevent is optional why do you need this driver at all?
Hi Daniel,
Sorry, maybe I didn't express it clearly enough. I use this
jh7110-timer as a global timer on the SoC and riscv-timer as cpu
local timer. So these are something different.
These four counters in this jh7110-timer are exactly the same and
independent of each other. If this timer is used as a global timer,
do I use only one or all of the counters to register clocksource and
clockevent?