Merge tag 'trace-v5.11-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt...
[linux/fpc-iii.git] / drivers / clocksource / timer-versatile.c
blobf5d017b31afac26dff07de5f58ef81a62d4e0ff1
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
4 * Copyright (C) 2014 ARM Limited
5 */
7 #include <linux/clocksource.h>
8 #include <linux/io.h>
9 #include <linux/of.h>
10 #include <linux/of_address.h>
11 #include <linux/sched_clock.h>
13 #define SYS_24MHZ 0x05c
15 static void __iomem *versatile_sys_24mhz;
17 static u64 notrace versatile_sys_24mhz_read(void)
19 return readl(versatile_sys_24mhz);
22 static int __init versatile_sched_clock_init(struct device_node *node)
24 void __iomem *base = of_iomap(node, 0);
26 of_node_clear_flag(node, OF_POPULATED);
28 if (!base)
29 return -ENXIO;
31 versatile_sys_24mhz = base + SYS_24MHZ;
33 sched_clock_register(versatile_sys_24mhz_read, 32, 24000000);
35 return 0;
37 TIMER_OF_DECLARE(vexpress, "arm,vexpress-sysreg",
38 versatile_sched_clock_init);
39 TIMER_OF_DECLARE(versatile, "arm,versatile-sysreg",
40 versatile_sched_clock_init);