From af1a266670d040d2f4083ff309d732d648afba2a Mon Sep 17 00:00:00 2001 From: Angelos Mouzakitis Date: Tue, 10 Oct 2023 14:33:42 +0000 Subject: Add submodule dependency files Change-Id: Iaf8d18082d3991dec7c0ebbea540f092188eb4ec --- roms/u-boot/arch/arm/mach-mvebu/timer.c | 41 +++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 roms/u-boot/arch/arm/mach-mvebu/timer.c (limited to 'roms/u-boot/arch/arm/mach-mvebu/timer.c') diff --git a/roms/u-boot/arch/arm/mach-mvebu/timer.c b/roms/u-boot/arch/arm/mach-mvebu/timer.c new file mode 100644 index 000000000..557a37877 --- /dev/null +++ b/roms/u-boot/arch/arm/mach-mvebu/timer.c @@ -0,0 +1,41 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) Marvell International Ltd. and its affiliates + * Written-by: Prafulla Wadaskar + * + * Copyright (C) 2015 Stefan Roese + */ + +#include +#include +#include +#include +#include + +#define TIMER_LOAD_VAL 0xffffffff + +static int init_done __section(".data") = 0; + +/* + * Timer initialization + */ +int timer_init(void) +{ + /* Only init the timer once */ + if (init_done) + return 0; + init_done = 1; + + /* load value into timer */ + writel(TIMER_LOAD_VAL, MVEBU_TIMER_BASE + 0x10); + writel(TIMER_LOAD_VAL, MVEBU_TIMER_BASE + 0x14); + +#if defined(CONFIG_ARCH_MVEBU) + /* On Armada XP / 38x ..., the 25MHz clock source needs to be enabled */ + setbits_le32(MVEBU_TIMER_BASE + 0x00, BIT(11)); +#endif + /* enable timer in auto reload mode */ + setbits_le32(MVEBU_TIMER_BASE + 0x00, 0x3); + + return 0; +} -- cgit