Add qemu 2.4.0
[kvmfornfv.git] / qemu / roms / u-boot / arch / arm / cpu / armv7 / socfpga / timer.c
diff --git a/qemu/roms/u-boot/arch/arm/cpu/armv7/socfpga/timer.c b/qemu/roms/u-boot/arch/arm/cpu/armv7/socfpga/timer.c
new file mode 100644 (file)
index 0000000..58fc789
--- /dev/null
@@ -0,0 +1,22 @@
+/*
+ *  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>
+
+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;
+}