diff options
author | thead_admin <occ_thead@service.alibaba.com> | 2022-09-13 11:04:33 +0800 |
---|---|---|
committer | thead_admin <occ_thead@service.alibaba.com> | 2022-09-13 11:04:33 +0800 |
commit | 43db9e00d5837c100c0b2fbbee64a08ab807d1e0 (patch) | |
tree | b40c0eed02935b6682e8c5c975e3016b6b2f55fe /arch/arm/mach-socfpga/timer.c |
Linux_SDK_V0.9.5Linux_SDK_V0.9.5
Diffstat (limited to 'arch/arm/mach-socfpga/timer.c')
-rw-r--r-- | arch/arm/mach-socfpga/timer.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/arch/arm/mach-socfpga/timer.c b/arch/arm/mach-socfpga/timer.c new file mode 100644 index 00000000..f1c0262a --- /dev/null +++ b/arch/arm/mach-socfpga/timer.c @@ -0,0 +1,23 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2012 Altera Corporation <www.altera.com> + */ + +#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; +} |