1 // SPDX-License-Identifier: GPL-2.0+
3 * (C) Copyright 2019 Rockchip Electronics Co., Ltd
7 #include <debug_uart.h>
13 #include <asm/arch-rockchip/bootrom.h>
15 #define TIMER_LOAD_COUNT_L 0x00
16 #define TIMER_LOAD_COUNT_H 0x04
17 #define TIMER_CONTROL_REG 0x10
19 #define TIMER_FMODE BIT(0)
20 #define TIMER_RMODE BIT(1)
22 __weak void rockchip_stimer_init(void)
24 /* If Timer already enabled, don't re-init it */
25 u32 reg = readl(CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
31 asm volatile("mcr p15, 0, %0, c14, c0, 0"
32 : : "r"(COUNTER_FREQUENCY));
35 writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
36 writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
37 writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
38 writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
42 void board_init_f(ulong dummy)
47 #ifdef CONFIG_DEBUG_UART
49 * Debug UART can be used from here if required:
54 * printascii("string");
57 printascii("\nU-Boot TPL " PLAIN_VERSION " (" U_BOOT_DATE " - " \
60 ret = spl_early_init();
62 debug("spl_early_init() failed: %d\n", ret);
66 /* Init secure timer */
67 rockchip_stimer_init();
68 /* Init ARM arch timer in arch/arm/cpu/ */
71 ret = uclass_get_device(UCLASS_RAM, 0, &dev);
73 printf("DRAM init failed: %d\n", ret);
78 void board_return_to_bootrom(void)
80 back_to_bootrom(BROM_BOOT_NEXTSTAGE);
83 u32 spl_boot_device(void)
85 return BOOT_DEVICE_BOOTROM;