Skip to content

Commit 8932a95

Browse files
avpateldlezcano
authored andcommitted
clocksource/drivers/timer-riscv: Set CLOCK_EVT_FEAT_C3STOP based on DT
We should set CLOCK_EVT_FEAT_C3STOP for a clock_event_device only when riscv,timer-cannot-wake-cpu DT property is present in the RISC-V timer DT node. This way CLOCK_EVT_FEAT_C3STOP feature is set for clock_event_device based on RISC-V platform capabilities rather than having it set for all RISC-V platforms. Signed-off-by: Anup Patel <[email protected]> Reviewed-by: Conor Dooley <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Daniel Lezcano <[email protected]>
1 parent e2bcf2d commit 8932a95

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

drivers/clocksource/timer-riscv.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
#include <asm/timex.h>
2929

3030
static DEFINE_STATIC_KEY_FALSE(riscv_sstc_available);
31+
static bool riscv_timer_cannot_wake_cpu;
3132

3233
static int riscv_clock_next_event(unsigned long delta,
3334
struct clock_event_device *ce)
@@ -85,6 +86,8 @@ static int riscv_timer_starting_cpu(unsigned int cpu)
8586

8687
ce->cpumask = cpumask_of(cpu);
8788
ce->irq = riscv_clock_event_irq;
89+
if (riscv_timer_cannot_wake_cpu)
90+
ce->features |= CLOCK_EVT_FEAT_C3STOP;
8891
clockevents_config_and_register(ce, riscv_timebase, 100, 0x7fffffff);
8992

9093
enable_percpu_irq(riscv_clock_event_irq,
@@ -139,6 +142,13 @@ static int __init riscv_timer_init_dt(struct device_node *n)
139142
if (cpuid != smp_processor_id())
140143
return 0;
141144

145+
child = of_find_compatible_node(NULL, NULL, "riscv,timer");
146+
if (child) {
147+
riscv_timer_cannot_wake_cpu = of_property_read_bool(child,
148+
"riscv,timer-cannot-wake-cpu");
149+
of_node_put(child);
150+
}
151+
142152
domain = NULL;
143153
child = of_get_compatible_child(n, "riscv,cpu-intc");
144154
if (!child) {

0 commit comments

Comments
 (0)