1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2015-2019 Rockchip Electronics Co., Ltd
7 #include <debug_uart.h>
10 #include <asm/arch-rockchip/bootrom.h>
11 #include <asm/arch-rockchip/sdram_rk3036.h>
13 #define TIMER_LOAD_COUNT_L 0x00
14 #define TIMER_LOAD_COUNT_H 0x04
15 #define TIMER_CONTROL_REG 0x10
17 #define TIMER_FMODE (0 << 1)
18 #define TIMER_RMODE (1 << 1)
20 void rockchip_stimer_init(void)
22 asm volatile("mcr p15, 0, %0, c14, c0, 0"
23 : : "r"(COUNTER_FREQUENCY));
25 writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
26 writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
27 writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
28 writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
32 void board_init_f(ulong dummy)
34 #ifdef CONFIG_DEBUG_UART
38 /* Init secure timer */
39 rockchip_stimer_init();
40 /* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
45 /* return to maskrom */
46 back_to_bootrom(BROM_BOOT_NEXTSTAGE);
50 void board_init_r(gd_t *id, ulong dest_addr)
53 * Function attribute is no-return
54 * This Function never executes