Commit c3a8df38 authored by Gilles Chanteperdrix's avatar Gilles Chanteperdrix Committed by Philippe Gerum

ARM: omap2/gpt: add support for user-visible TSC

parent 16d99898
......@@ -537,6 +537,18 @@ static int __init __maybe_unused omap2_sync32k_clocksource_init(void)
return ret;
}
#ifdef CONFIG_IPIPE
static struct __ipipe_tscinfo __maybe_unused tsc_info = {
.type = IPIPE_TSC_TYPE_FREERUNNING,
.u = {
{
.mask = 0xffffffff,
},
},
};
#endif
static void __init omap2_gptimer_clocksource_init(int gptimer_id,
const char *fck_source,
const char *property)
......@@ -548,7 +560,7 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
res = omap_dm_timer_init_one(&clksrc, fck_source, property,
&clocksource_gpt.name,
OMAP_TIMER_NONPOSTED, false);
OMAP_TIMER_NONPOSTED, IS_ENABLED(CONFIG_IPIPE));
BUG_ON(res);
__omap_dm_timer_load_start(&clksrc,
......@@ -556,6 +568,19 @@ static void __init omap2_gptimer_clocksource_init(int gptimer_id,
OMAP_TIMER_NONPOSTED);
sched_clock_register(dmtimer_read_sched_clock, 32, clksrc.rate);
#ifdef CONFIG_IPIPE
{
unsigned long off = OMAP_TIMER_COUNTER_REG & 0xff;
if (clksrc.revision == 2)
off += OMAP_TIMER_V2_FUNC_OFFSET;
tsc_info.freq = clksrc.rate;
tsc_info.counter_vaddr = (unsigned long)clksrc.io_base + off;
tsc_info.u.counter_paddr = clksrc.phys_base + off;
__ipipe_tsc_register(&tsc_info);
}
#endif
if (clocksource_register_hz(&clocksource_gpt, clksrc.rate))
pr_err("Could not register clocksource %s\n",
clocksource_gpt.name);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment