Skip to content

Commit 627f3f3

Browse files
muenlindlezcano
authored andcommitted
clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC
The current system log timestamp accuracy is tick based, which can not meet the usage requirements and needs to reach nanoseconds. Therefore, the sched_clock_register function needs to be added. [ dlezcano: Fixed typos ] Signed-off-by: Enlin Mu <enlin.mu@unisoc.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Link: https://patch.msgid.link/20251107063347.3692-1-enlin.mu@linux.dev
1 parent 6a24168 commit 627f3f3

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

drivers/clocksource/timer-rda.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
#include <linux/init.h>
1515
#include <linux/interrupt.h>
16+
#include <linux/sched_clock.h>
1617

1718
#include "timer-of.h"
1819

@@ -153,7 +154,7 @@ static struct timer_of rda_ostimer_of = {
153154
},
154155
};
155156

156-
static u64 rda_hwtimer_read(struct clocksource *cs)
157+
static u64 rda_hwtimer_clocksource_read(void)
157158
{
158159
void __iomem *base = timer_of_base(&rda_ostimer_of);
159160
u32 lo, hi;
@@ -167,6 +168,11 @@ static u64 rda_hwtimer_read(struct clocksource *cs)
167168
return ((u64)hi << 32) | lo;
168169
}
169170

171+
static u64 rda_hwtimer_read(struct clocksource *cs)
172+
{
173+
return rda_hwtimer_clocksource_read();
174+
}
175+
170176
static struct clocksource rda_hwtimer_clocksource = {
171177
.name = "rda-timer",
172178
.rating = 400,
@@ -185,6 +191,7 @@ static int __init rda_timer_init(struct device_node *np)
185191
return ret;
186192

187193
clocksource_register_hz(&rda_hwtimer_clocksource, rate);
194+
sched_clock_register(rda_hwtimer_clocksource_read, 64, rate);
188195

189196
clockevents_config_and_register(&rda_ostimer_of.clkevt, rate,
190197
0x2, UINT_MAX);

0 commit comments

Comments
 (0)