]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
parisc: Detect 64-bit free running platform counter
authorHelge Deller <deller@gmx.de>
Fri, 6 Feb 2026 20:59:56 +0000 (21:59 +0100)
committerHelge Deller <deller@gmx.de>
Fri, 6 Feb 2026 23:45:19 +0000 (00:45 +0100)
Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/time.c

index c17e2249115f5455d4b8daa3205450ff29caeea5..94dc48455dc677dff8f6756cad1e399cd71c2ec9 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/rtc.h>
 #include <linux/platform_device.h>
 #include <asm/processor.h>
+#include <asm/pdcpat.h>
 
 static u64 cr16_clock_freq;
 static unsigned long clocktick;
@@ -99,6 +100,22 @@ void parisc_clockevent_init(void)
        clockevents_config_and_register(cd, cr16_clock_freq, min_delta, max_delta);
 }
 
+static void parisc_find_64bit_counter(void)
+{
+#ifdef CONFIG_64BIT
+       uint64_t *pclock;
+       unsigned long freq, unique;
+       int ret;
+
+       ret = pdc_pat_pd_get_platform_counter(&pclock, &freq, &unique);
+       if (ret == PDC_OK)
+               pr_info("64-bit counter found at %px, freq: %lu, unique: %lu\n",
+                       pclock, freq, unique);
+       else
+               pr_info("64-bit counter not found.\n");
+#endif
+}
+
 unsigned long notrace profile_pc(struct pt_regs *regs)
 {
        unsigned long pc = instruction_pointer(regs);
@@ -213,6 +230,9 @@ void __init time_init(void)
 
        parisc_clockevent_init();
 
+       /* check for free-running 64-bit platform counter */
+       parisc_find_64bit_counter();
+
        /* register at clocksource framework */
        clocksource_register_hz(&clocksource_cr16, cr16_clock_freq);
 }