Commit ea4625c3 authored by Rick Chen's avatar Rick Chen Committed by Greentime Hu

clocksource/drivers/atcpit100: VDSO support

VDSO needs real-time cycle count to ensure the time accuracy.
Unlike others, nds32 architecture does not define clock source,
hence VDSO needs atcpit100 offering real-time cycle count
to derive the correct time.
Signed-off-by: default avatarVincent Chen <vincentc@andestech.com>
Signed-off-by: default avatarRick Chen <rickchen36@gmail.com>
Signed-off-by: default avatarGreentime Hu <green.hu@gmail.com>
parent 35dbb74a
...@@ -18,6 +18,9 @@ ...@@ -18,6 +18,9 @@
#include <linux/of_irq.h> #include <linux/of_irq.h>
#include <linux/of_platform.h> #include <linux/of_platform.h>
#include "timer-of.h" #include "timer-of.h"
#ifdef CONFIG_NDS32
#include <asm/vdso_timer_info.h>
#endif
/* /*
* Definition of register offsets * Definition of register offsets
...@@ -204,6 +207,17 @@ static u64 notrace atcpit100_timer_sched_read(void) ...@@ -204,6 +207,17 @@ static u64 notrace atcpit100_timer_sched_read(void)
return ~readl(timer_of_base(&to) + CH1_CNT); return ~readl(timer_of_base(&to) + CH1_CNT);
} }
#ifdef CONFIG_NDS32
static void fill_vdso_need_info(struct device_node *node)
{
struct resource timer_res;
of_address_to_resource(node, 0, &timer_res);
timer_info.mapping_base = (unsigned long)timer_res.start;
timer_info.cycle_count_down = true;
timer_info.cycle_count_reg_offset = CH1_CNT;
}
#endif
static int __init atcpit100_timer_init(struct device_node *node) static int __init atcpit100_timer_init(struct device_node *node)
{ {
int ret; int ret;
...@@ -242,6 +256,10 @@ static int __init atcpit100_timer_init(struct device_node *node) ...@@ -242,6 +256,10 @@ static int __init atcpit100_timer_init(struct device_node *node)
val = readl(base + INT_EN); val = readl(base + INT_EN);
writel(val | CH0INT0EN, base + INT_EN); writel(val | CH0INT0EN, base + INT_EN);
#ifdef CONFIG_NDS32
fill_vdso_need_info(node);
#endif
return ret; return ret;
} }
......
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