Commit 62c544bc authored by Helge Deller's avatar Helge Deller
Browse files

parisc: Detect 64-bit free running platform counter



Signed-off-by: default avatarHelge Deller <deller@gmx.de>
parent e3217ddf
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -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);
}