Commit 627f3f37 authored by Enlin Mu's avatar Enlin Mu Committed by Daniel Lezcano
Browse files

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: default avatarEnlin Mu <enlin.mu@unisoc.com>
Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
Link: https://patch.msgid.link/20251107063347.3692-1-enlin.mu@linux.dev
parent 6a241689
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@

#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/sched_clock.h>

#include "timer-of.h"

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

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

static u64 rda_hwtimer_read(struct clocksource *cs)
{
	return rda_hwtimer_clocksource_read();
}

static struct clocksource rda_hwtimer_clocksource = {
	.name           = "rda-timer",
	.rating         = 400,
@@ -185,6 +191,7 @@ static int __init rda_timer_init(struct device_node *np)
		return ret;

	clocksource_register_hz(&rda_hwtimer_clocksource, rate);
	sched_clock_register(rda_hwtimer_clocksource_read, 64, rate);

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