blob: 58fc789e6451534951a169d66ecb4ceefa1ed478 [file] [log] [blame]
Dinh Nguyenad51f7c2012-10-04 06:46:02 +00001/*
2 * Copyright (C) 2012 Altera Corporation <www.altera.com>
3 *
Wolfgang Denkd79de1d2013-07-08 09:37:19 +02004 * SPDX-License-Identifier: GPL-2.0+
Dinh Nguyenad51f7c2012-10-04 06:46:02 +00005 */
6
7#include <common.h>
8#include <asm/io.h>
9#include <asm/arch/timer.h>
10
Dinh Nguyenad51f7c2012-10-04 06:46:02 +000011static const struct socfpga_timer *timer_base = (void *)CONFIG_SYS_TIMERBASE;
12
13/*
14 * Timer initialization
15 */
16int timer_init(void)
17{
18 writel(TIMER_LOAD_VAL, &timer_base->load_val);
19 writel(TIMER_LOAD_VAL, &timer_base->curr_val);
20 writel(readl(&timer_base->ctrl) | 0x3, &timer_base->ctrl);
21 return 0;
22}