From 43db9e00d5837c100c0b2fbbee64a08ab807d1e0 Mon Sep 17 00:00:00 2001 From: thead_admin Date: Tue, 13 Sep 2022 11:04:33 +0800 Subject: Linux_SDK_V0.9.5 --- arch/arm/mach-socfpga/timer.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 arch/arm/mach-socfpga/timer.c (limited to 'arch/arm/mach-socfpga/timer.c') diff --git a/arch/arm/mach-socfpga/timer.c b/arch/arm/mach-socfpga/timer.c new file mode 100644 index 00000000..f1c0262a --- /dev/null +++ b/arch/arm/mach-socfpga/timer.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2012 Altera Corporation + */ + +#include +#include +#include + +#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; +} -- cgit v1.2.3