hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 *  Copyright (C) 2012 Altera Corporation <www.altera.com>
 *
 * SPDX-License-Identifier:    GPL-2.0+
 */
 
#include <common.h>
#include <asm/io.h>
#include <asm/arch/timer.h>
 
#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;
}