2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2012-10-04 06:46:02 +00:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2012 Altera Corporation <www.altera.com>
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2012-10-04 06:46:02 +00:00
|
|
|
#include <asm/io.h>
|
|
|
|
#include <asm/arch/timer.h>
|
|
|
|
|
2014-09-08 12:08:45 +00:00
|
|
|
#define TIMER_LOAD_VAL 0xFFFFFFFF
|
|
|
|
|
2012-10-04 06:46:02 +00:00
|
|
|
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;
|
|
|
|
}
|