clocksource: Sched clock source for Versatile Express
authorPawel Moll <pawel.moll@arm.com>
Wed, 16 Apr 2014 17:22:59 +0000 (18:22 +0100)
committerPawel Moll <pawel.moll@arm.com>
Thu, 15 May 2014 16:02:20 +0000 (17:02 +0100)
This patch adds a trival sched clock source using free
running, 24MHz clocked counter present in the ARM Ltd.
reference platforms (Versatile, RealView, Versatile
Express) System Registers block.

This code replaces the call in the VE machine code.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
arch/arm/mach-vexpress/v2m.c
drivers/clocksource/Kconfig
drivers/clocksource/Makefile
drivers/clocksource/versatile.c [new file with mode: 0644]

index 90f04c9b11d2730cbac0d66801c2dc5a2d787fb6..d8a9fd7a695de0325dc28013b6c1029970ea961a 100644 (file)
@@ -418,8 +418,6 @@ void __init v2m_dt_init_early(void)
                        pr_warning("vexpress: DT HBI (%x) is not matching "
                                        "hardware (%x)!\n", dt_hbi, hbi);
        }
-
-       versatile_sched_clock_init(vexpress_get_24mhz_clock_base(), 24000000);
 }
 
 
index 96918e1f26a39bab1d14193114cbdb29f38235b8..2c27b02f0860fe054a820b71ce541c370def942f 100644 (file)
@@ -191,3 +191,14 @@ config EM_TIMER_STI
 
 config CLKSRC_QCOM
        bool
+
+config CLKSRC_VERSATILE
+       bool "ARM Versatile (Express) reference platforms clock source"
+       depends on GENERIC_SCHED_CLOCK
+       select CLKSRC_OF
+       default y if MFD_VEXPRESS_SYSREG
+       help
+         This option enables clock source based on free running
+         counter available in the "System Registers" block of
+         ARM Versatile, RealView and Versatile Express reference
+         platforms.
index 98cb6c51aa878ba9c43e23f7b2ed161ce037e449..6f25bdffc176a21d3fab2cec6810ddf824e96f36 100644 (file)
@@ -39,3 +39,4 @@ obj-$(CONFIG_ARM_GLOBAL_TIMER)                += arm_global_timer.o
 obj-$(CONFIG_CLKSRC_METAG_GENERIC)     += metag_generic.o
 obj-$(CONFIG_ARCH_HAS_TICK_BROADCAST)  += dummy_timer.o
 obj-$(CONFIG_ARCH_KEYSTONE)            += timer-keystone.o
+obj-$(CONFIG_CLKSRC_VERSATILE)         += versatile.o
diff --git a/drivers/clocksource/versatile.c b/drivers/clocksource/versatile.c
new file mode 100644 (file)
index 0000000..e4c50ad
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * Copyright (C) 2014 ARM Limited
+ */
+
+#include <linux/clocksource.h>
+#include <linux/io.h>
+#include <linux/of_address.h>
+#include <linux/sched_clock.h>
+
+#define SYS_24MHZ 0x05c
+
+static void __iomem *versatile_sys_24mhz;
+
+static u32 notrace versatile_sys_24mhz_read(void)
+{
+       return readl(versatile_sys_24mhz);
+}
+
+static void __init versatile_sched_clock_init(struct device_node *node)
+{
+       void __iomem *base = of_iomap(node, 0);
+
+       if (!base)
+               return;
+
+       versatile_sys_24mhz = base + SYS_24MHZ;
+
+       setup_sched_clock(versatile_sys_24mhz_read, 32, 24000000);
+}
+CLOCKSOURCE_OF_DECLARE(versatile, "arm,vexpress-sysreg",
+               versatile_sched_clock_init);
This page took 0.034111 seconds and 5 git commands to generate.