summaryrefslogtreecommitdiff
path: root/arch/arm/mach-socfpga/timer.c
diff options
context:
space:
mode:
authorMasahiro Yamada <yamada.masahiro@socionext.com>2015-04-21 20:38:21 +0900
committerMarek Vasut <marex@denx.de>2015-05-07 05:21:12 +0200
commit05a217212b41c6342fc1c6be0fe49ce28c9afe40 (patch)
treea7178e048809fcd4b3abec3ea398d7dada7cf1aa /arch/arm/mach-socfpga/timer.c
parent7865f4b0b67ea7108117e68166294b7e95a5ede1 (diff)
downloadu-boot-imx-05a217212b41c6342fc1c6be0fe49ce28c9afe40.zip
u-boot-imx-05a217212b41c6342fc1c6be0fe49ce28c9afe40.tar.gz
u-boot-imx-05a217212b41c6342fc1c6be0fe49ce28c9afe40.tar.bz2
ARM: socfpga: move SoC sources to mach-socfpga
Our recent trend is to collect SoC files into arch/arm/mach-(SOC). Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-socfpga/timer.c')
-rw-r--r--arch/arm/mach-socfpga/timer.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/arch/arm/mach-socfpga/timer.c b/arch/arm/mach-socfpga/timer.c
new file mode 100644
index 0000000..253cde3
--- /dev/null
+++ b/arch/arm/mach-socfpga/timer.c
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2012 Altera Corporation <www.altera.com>
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/arch/timer.h>
+
+#define TIMER_LOAD_VAL 0xFFFFFFFF
+
+static const struct socfpga_timer *timer_base = (void *)CONFIG_SYS_TIMERBASE;
+
+/*
+ * Timer initialization
+ */
+int timer_init(void)
+{
+ writel(TIMER_LOAD_VAL, &timer_base->load_val);
+ writel(TIMER_LOAD_VAL, &timer_base->curr_val);
+ writel(readl(&timer_base->ctrl) | 0x3, &timer_base->ctrl);
+ return 0;
+}