Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Vincent Chen <vincentc@andestech.com>
Signed-off-by: Rick Chen <rickchen36@gmail.com>
Signed-off-by: Greentime Hu <green.hu@gmail.com>

authored by

Rick Chen and committed by
Greentime Hu
ea4625c3 35dbb74a

+18
+18
drivers/clocksource/timer-atcpit100.c
··· 18 18 #include <linux/of_irq.h> 19 19 #include <linux/of_platform.h> 20 20 #include "timer-of.h" 21 + #ifdef CONFIG_NDS32 22 + #include <asm/vdso_timer_info.h> 23 + #endif 21 24 22 25 /* 23 26 * Definition of register offsets ··· 207 204 return ~readl(timer_of_base(&to) + CH1_CNT); 208 205 } 209 206 207 + #ifdef CONFIG_NDS32 208 + static void fill_vdso_need_info(struct device_node *node) 209 + { 210 + struct resource timer_res; 211 + of_address_to_resource(node, 0, &timer_res); 212 + timer_info.mapping_base = (unsigned long)timer_res.start; 213 + timer_info.cycle_count_down = true; 214 + timer_info.cycle_count_reg_offset = CH1_CNT; 215 + } 216 + #endif 217 + 210 218 static int __init atcpit100_timer_init(struct device_node *node) 211 219 { 212 220 int ret; ··· 255 241 /* Enable channel 0 timer0 interrupt */ 256 242 val = readl(base + INT_EN); 257 243 writel(val | CH0INT0EN, base + INT_EN); 244 + 245 + #ifdef CONFIG_NDS32 246 + fill_vdso_need_info(node); 247 + #endif 258 248 259 249 return ret; 260 250 }