2018-05-06 21:58:06 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
2015-11-17 06:20:27 +00:00
|
|
|
/*
|
2019-07-09 14:00:25 +00:00
|
|
|
* (C) Copyright 2015-2019 Rockchip Electronics Co., Ltd
|
2015-11-17 06:20:27 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <common.h>
|
2015-12-14 04:37:00 +00:00
|
|
|
#include <debug_uart.h>
|
2020-05-10 17:40:02 +00:00
|
|
|
#include <init.h>
|
2015-11-17 06:20:27 +00:00
|
|
|
#include <asm/io.h>
|
2019-03-28 03:01:23 +00:00
|
|
|
#include <asm/arch-rockchip/bootrom.h>
|
|
|
|
#include <asm/arch-rockchip/sdram_rk3036.h>
|
2019-07-09 14:00:25 +00:00
|
|
|
|
|
|
|
#define TIMER_LOAD_COUNT_L 0x00
|
|
|
|
#define TIMER_LOAD_COUNT_H 0x04
|
|
|
|
#define TIMER_CONTROL_REG 0x10
|
|
|
|
#define TIMER_EN 0x1
|
|
|
|
#define TIMER_FMODE (0 << 1)
|
|
|
|
#define TIMER_RMODE (1 << 1)
|
|
|
|
|
|
|
|
void rockchip_stimer_init(void)
|
|
|
|
{
|
|
|
|
asm volatile("mcr p15, 0, %0, c14, c0, 0"
|
2022-04-13 09:47:22 +00:00
|
|
|
: : "r"(CONFIG_COUNTER_FREQUENCY));
|
2019-07-09 14:00:25 +00:00
|
|
|
|
|
|
|
writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
|
|
|
|
writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
|
|
|
|
writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
|
|
|
|
writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
|
|
|
|
TIMER_CONTROL_REG);
|
|
|
|
}
|
2015-11-17 06:20:27 +00:00
|
|
|
|
|
|
|
void board_init_f(ulong dummy)
|
|
|
|
{
|
2019-03-29 01:09:00 +00:00
|
|
|
#ifdef CONFIG_DEBUG_UART
|
2015-12-14 04:37:00 +00:00
|
|
|
debug_uart_init();
|
2015-11-17 06:20:27 +00:00
|
|
|
#endif
|
2019-07-09 14:00:25 +00:00
|
|
|
|
|
|
|
/* Init secure timer */
|
|
|
|
rockchip_stimer_init();
|
|
|
|
/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
|
|
|
|
timer_init();
|
|
|
|
|
2015-11-17 06:20:27 +00:00
|
|
|
sdram_init();
|
|
|
|
|
|
|
|
/* return to maskrom */
|
2017-10-10 14:21:16 +00:00
|
|
|
back_to_bootrom(BROM_BOOT_NEXTSTAGE);
|
2015-11-17 06:20:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Place Holders */
|
|
|
|
void board_init_r(gd_t *id, ulong dest_addr)
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* Function attribute is no-return
|
|
|
|
* This Function never executes
|
|
|
|
*/
|
|
|
|
while (1)
|
|
|
|
;
|
|
|
|
}
|