summaryrefslogtreecommitdiffstats
path: root/drivers/clocksource/arm_architected_timer.c
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2020-02-10 17:30:20 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2020-02-12 08:30:49 +0100
commit37f468f474351b81603f058103945edce206e77a (patch)
treeff6b2c69e466804e0d40e9684a8cbc96246eb24b /drivers/clocksource/arm_architected_timer.c
parentb6b8e9ceaf20c307e6eb7eb967d8398e7f7112f6 (diff)
downloadbarebox-37f468f474351b81603f058103945edce206e77a.tar.gz
barebox-37f468f474351b81603f058103945edce206e77a.tar.xz
clocksource: rename driver for ARMv8 Timer to ARM architected timer
The driver matches against both "arm,armv7-timer" and "arm,armv8-timer" compatibles, thus rename it to better reflect that it's not only ARMv8 specific. Only functional change intended is name changes. The symbol is default y, so the rename shouldn't cause it to get lost with olddefconfig. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'drivers/clocksource/arm_architected_timer.c')
-rw-r--r--drivers/clocksource/arm_architected_timer.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/drivers/clocksource/arm_architected_timer.c b/drivers/clocksource/arm_architected_timer.c
new file mode 100644
index 0000000000..3ca7dfd17d
--- /dev/null
+++ b/drivers/clocksource/arm_architected_timer.c
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2018 Sascha Hauer <s.hauer@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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.
+ *
+ */
+
+#include <common.h>
+#include <init.h>
+#include <clock.h>
+#include <linux/clk.h>
+#include <io.h>
+#include <asm/system.h>
+
+static uint64_t arm_arch_clocksource_read(void)
+{
+ return get_cntpct();
+}
+
+static struct clocksource cs = {
+ .read = arm_arch_clocksource_read,
+ .mask = CLOCKSOURCE_MASK(64),
+ .shift = 0,
+};
+
+static int arm_arch_timer_probe(struct device_d *dev)
+{
+ cs.mult = clocksource_hz2mult(get_cntfrq(), cs.shift);
+
+ return init_clock(&cs);
+}
+
+static struct of_device_id arm_arch_timer_dt_ids[] = {
+ { .compatible = "arm,armv7-timer", },
+ { .compatible = "arm,armv8-timer", },
+ { }
+};
+
+static struct driver_d arm_arch_timer_driver = {
+ .name = "arm-architected-timer",
+ .probe = arm_arch_timer_probe,
+ .of_compatible = DRV_OF_COMPAT(arm_arch_timer_dt_ids),
+};
+postcore_platform_driver(arm_arch_timer_driver);