linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC
@ 2025-11-07  6:33 Enlin Mu
  2025-11-17  2:13 ` enlin.mu
  2025-11-17  9:36 ` Manivannan Sadhasivam
  0 siblings, 2 replies; 4+ messages in thread
From: Enlin Mu @ 2025-11-07  6:33 UTC (permalink / raw)
  To: mani, daniel.lezcano, tglx, linux-arm-kernel, linux-unisoc,
	linux-kernel, enlin.mu, enlin.mu

From: Enlin Mu <enlin.mu@unisoc.com>

The current system log timestamp accuracy is tick, which can not
meet the usage requirements and needs to reach nanoseconds.
Therefore, the sched_clock_register funciton needs to be add.

Signed-off-by: Enlin Mu <enlin.mu@unisoc.com>
---
 drivers/clocksource/timer-rda.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/clocksource/timer-rda.c b/drivers/clocksource/timer-rda.c
index fd1199c189bf..0be8e05970e2 100644
--- a/drivers/clocksource/timer-rda.c
+++ b/drivers/clocksource/timer-rda.c
@@ -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);
-- 
2.39.5



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC
  2025-11-07  6:33 [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC Enlin Mu
@ 2025-11-17  2:13 ` enlin.mu
  2025-11-17  9:36 ` Manivannan Sadhasivam
  1 sibling, 0 replies; 4+ messages in thread
From: enlin.mu @ 2025-11-17  2:13 UTC (permalink / raw)
  To: mani, daniel.lezcano, tglx, linux-arm-kernel, linux-unisoc,
	linux-kernel, enlin.mu

Hi Everyone

Who can help review this patch?

thanks

On 2025/11/7 14:33, Enlin Mu wrote:
> From: Enlin Mu <enlin.mu@unisoc.com>
> 
> The current system log timestamp accuracy is tick, which can not
> meet the usage requirements and needs to reach nanoseconds.
> Therefore, the sched_clock_register funciton needs to be add.
> 
> Signed-off-by: Enlin Mu <enlin.mu@unisoc.com>
> ---
>   drivers/clocksource/timer-rda.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/timer-rda.c b/drivers/clocksource/timer-rda.c
> index fd1199c189bf..0be8e05970e2 100644
> --- a/drivers/clocksource/timer-rda.c
> +++ b/drivers/clocksource/timer-rda.c
> @@ -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);



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC
  2025-11-07  6:33 [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC Enlin Mu
  2025-11-17  2:13 ` enlin.mu
@ 2025-11-17  9:36 ` Manivannan Sadhasivam
  2025-11-17 10:20   ` enlin.mu
  1 sibling, 1 reply; 4+ messages in thread
From: Manivannan Sadhasivam @ 2025-11-17  9:36 UTC (permalink / raw)
  To: Enlin Mu
  Cc: daniel.lezcano, tglx, linux-arm-kernel, linux-unisoc,
	linux-kernel, enlin.mu

On Fri, Nov 07, 2025 at 02:33:47PM +0800, Enlin Mu wrote:
> From: Enlin Mu <enlin.mu@unisoc.com>
> 
> The current system log timestamp accuracy is tick, which can not
> meet the usage requirements and needs to reach nanoseconds.

Which 'usage requirement' you are referring here?

> Therefore, the sched_clock_register funciton needs to be add.
> 
> Signed-off-by: Enlin Mu <enlin.mu@unisoc.com>

But I'm happy to see a patch from Unisoc for RDA Micro SoC :)

- Mani

> ---
>  drivers/clocksource/timer-rda.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/clocksource/timer-rda.c b/drivers/clocksource/timer-rda.c
> index fd1199c189bf..0be8e05970e2 100644
> --- a/drivers/clocksource/timer-rda.c
> +++ b/drivers/clocksource/timer-rda.c
> @@ -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);
> -- 
> 2.39.5
> 

-- 
மணிவண்ணன் சதாசிவம்


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC
  2025-11-17  9:36 ` Manivannan Sadhasivam
@ 2025-11-17 10:20   ` enlin.mu
  0 siblings, 0 replies; 4+ messages in thread
From: enlin.mu @ 2025-11-17 10:20 UTC (permalink / raw)
  To: Manivannan Sadhasivam
  Cc: daniel.lezcano, tglx, linux-arm-kernel, linux-unisoc,
	linux-kernel, enlin.mu



On 2025/11/17 17:36, Manivannan Sadhasivam wrote:
> On Fri, Nov 07, 2025 at 02:33:47PM +0800, Enlin Mu wrote:
>> From: Enlin Mu <enlin.mu@unisoc.com>
>>
>> The current system log timestamp accuracy is tick, which can not
>> meet the usage requirements and needs to reach nanoseconds.
> 
> Which 'usage requirement' you are referring here?
Hi Mani

When using this chip,the timestamp accuracy of the kernel log is tick,
which makes it difficult to analyze some system exceptions.
Therefore, it is neccessary to adujst the accuracy of the sched_clock 
function.

> 
>> Therefore, the sched_clock_register funciton needs to be add.
>>
>> Signed-off-by: Enlin Mu <enlin.mu@unisoc.com>
> 
> But I'm happy to see a patch from Unisoc for RDA Micro SoC :)
> 
> - Mani
> 
>> ---
>>   drivers/clocksource/timer-rda.c | 9 ++++++++-
>>   1 file changed, 8 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/clocksource/timer-rda.c b/drivers/clocksource/timer-rda.c
>> index fd1199c189bf..0be8e05970e2 100644
>> --- a/drivers/clocksource/timer-rda.c
>> +++ b/drivers/clocksource/timer-rda.c
>> @@ -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);
>> -- 
>> 2.39.5
>>
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-17 10:20 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-07  6:33 [PATCH V2] clocksource/drivers/rda: Add sched_clock_register for RDA8810PL SoC Enlin Mu
2025-11-17  2:13 ` enlin.mu
2025-11-17  9:36 ` Manivannan Sadhasivam
2025-11-17 10:20   ` enlin.mu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).