aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/clocksource
diff options
context:
space:
mode:
authorAndrew Bresticker <abrestic@chromium.org>2014-10-20 15:03:58 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-11-24 01:45:14 -0500
commitfa5635a277171021d364f6a3fab4addce8f358d2 (patch)
tree9fff06b8d87eba632d5abc5346733cd01b368658 /drivers/clocksource
parent53a7bc815a139a524f1d60c32b70455f02b87a6d (diff)
MIPS: Move GIC clocksource driver to drivers/clocksource/
Move the GIC clocksource driver to drivers/clocksource/mips-gic-timer.c. Signed-off-by: Andrew Bresticker <abrestic@chromium.org> Cc: Daniel Lezcano <daniel.lezcano@linaro.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Jason Cooper <jason@lakedaemon.net> Cc: Paul Burton <paul.burton@imgtec.com> Cc: Qais Yousef <qais.yousef@imgtec.com> Cc: John Crispin <blogic@openwrt.org> Cc: linux-mips@linux-mips.org Cc: linux-kernel@vger.kernel.org Patchwork: https://patchwork.linux-mips.org/patch/8133/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'drivers/clocksource')
-rw-r--r--drivers/clocksource/Kconfig4
-rw-r--r--drivers/clocksource/Makefile1
-rw-r--r--drivers/clocksource/mips-gic-timer.c32
3 files changed, 37 insertions, 0 deletions
diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig
index 90420600e1eb..cb7e7f417a60 100644
--- a/drivers/clocksource/Kconfig
+++ b/drivers/clocksource/Kconfig
@@ -223,4 +223,8 @@ config CLKSRC_VERSATILE
223 ARM Versatile, RealView and Versatile Express reference 223 ARM Versatile, RealView and Versatile Express reference
224 platforms. 224 platforms.
225 225
226config CLKSRC_MIPS_GIC
227 bool
228 depends on MIPS_GIC
229
226endmenu 230endmenu
diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile
index 756f6f10efa0..e23fc2d5fc27 100644
--- a/drivers/clocksource/Makefile
+++ b/drivers/clocksource/Makefile
@@ -46,3 +46,4 @@ obj-$(CONFIG_CLKSRC_METAG_GENERIC) += metag_generic.o
46obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o 46obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST) += dummy_timer.o
47obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o 47obj-$(CONFIG_ARCH_KEYSTONE) += timer-keystone.o
48obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o 48obj-$(CONFIG_CLKSRC_VERSATILE) += versatile.o
49obj-$(CONFIG_CLKSRC_MIPS_GIC) += mips-gic-timer.o
diff --git a/drivers/clocksource/mips-gic-timer.c b/drivers/clocksource/mips-gic-timer.c
new file mode 100644
index 000000000000..0bf28e6aca7a
--- /dev/null
+++ b/drivers/clocksource/mips-gic-timer.c
@@ -0,0 +1,32 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2012 MIPS Technologies, Inc. All rights reserved.
7 */
8#include <linux/init.h>
9#include <linux/irqchip/mips-gic.h>
10#include <linux/time.h>
11
12static cycle_t gic_hpt_read(struct clocksource *cs)
13{
14 return gic_read_count();
15}
16
17static struct clocksource gic_clocksource = {
18 .name = "GIC",
19 .read = gic_hpt_read,
20 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
21};
22
23void __init gic_clocksource_init(unsigned int frequency)
24{
25 /* Set clocksource mask. */
26 gic_clocksource.mask = CLOCKSOURCE_MASK(gic_get_count_width());
27
28 /* Calculate a somewhat reasonable rating value. */
29 gic_clocksource.rating = 200 + frequency / 10000000;
30
31 clocksource_register_hz(&gic_clocksource, frequency);
32}