blob: f1c0262ae5730adcb1c289d16e686f55690440f5 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Dinh Nguyen77754402012-10-04 06:46:02 +00002/*
3 * Copyright (C) 2012 Altera Corporation <www.altera.com>
Dinh Nguyen77754402012-10-04 06:46:02 +00004 */
5
6#include <common.h>
7#include <asm/io.h>
8#include <asm/arch/timer.h>
9
Marek Vasut2110eea2014-09-08 14:08:45 +020010#define TIMER_LOAD_VAL 0xFFFFFFFF
11
Dinh Nguyen77754402012-10-04 06:46:02 +000012static const struct socfpga_timer *timer_base = (void *)CONFIG_SYS_TIMERBASE;
13
14/*
15 * Timer initialization
16 */
17int timer_init(void)
18{
19 writel(TIMER_LOAD_VAL, &timer_base->load_val);
20 writel(TIMER_LOAD_VAL, &timer_base->curr_val);
21 writel(readl(&timer_base->ctrl) | 0x3, &timer_base->ctrl);
22 return 0;
23}