]> git.ipfire.org Git - thirdparty/u-boot.git/blame - arch/arm/mach-socfpga/timer.c
SPDX: Convert all of our single license tags to Linux Kernel style
[thirdparty/u-boot.git] / arch / arm / mach-socfpga / timer.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0+
77754408
DN
2/*
3 * Copyright (C) 2012 Altera Corporation <www.altera.com>
77754408
DN
4 */
5
6#include <common.h>
7#include <asm/io.h>
8#include <asm/arch/timer.h>
9
2110eeaf
MV
10#define TIMER_LOAD_VAL 0xFFFFFFFF
11
77754408
DN
12static 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}