Skip to content

Commit 62c544b

Browse files
committed
parisc: Detect 64-bit free running platform counter
Signed-off-by: Helge Deller <deller@gmx.de>
1 parent e3217dd commit 62c544b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

arch/parisc/kernel/time.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include <linux/rtc.h>
1717
#include <linux/platform_device.h>
1818
#include <asm/processor.h>
19+
#include <asm/pdcpat.h>
1920

2021
static u64 cr16_clock_freq;
2122
static unsigned long clocktick;
@@ -99,6 +100,22 @@ void parisc_clockevent_init(void)
99100
clockevents_config_and_register(cd, cr16_clock_freq, min_delta, max_delta);
100101
}
101102

103+
static void parisc_find_64bit_counter(void)
104+
{
105+
#ifdef CONFIG_64BIT
106+
uint64_t *pclock;
107+
unsigned long freq, unique;
108+
int ret;
109+
110+
ret = pdc_pat_pd_get_platform_counter(&pclock, &freq, &unique);
111+
if (ret == PDC_OK)
112+
pr_info("64-bit counter found at %px, freq: %lu, unique: %lu\n",
113+
pclock, freq, unique);
114+
else
115+
pr_info("64-bit counter not found.\n");
116+
#endif
117+
}
118+
102119
unsigned long notrace profile_pc(struct pt_regs *regs)
103120
{
104121
unsigned long pc = instruction_pointer(regs);
@@ -213,6 +230,9 @@ void __init time_init(void)
213230

214231
parisc_clockevent_init();
215232

233+
/* check for free-running 64-bit platform counter */
234+
parisc_find_64bit_counter();
235+
216236
/* register at clocksource framework */
217237
clocksource_register_hz(&clocksource_cr16, cr16_clock_freq);
218238
}

0 commit comments

Comments
 (0)