• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * (C) Copyright 2015-2019 Rockchip Electronics Co., Ltd
4  */
5 
6 #include <common.h>
7 #include <debug_uart.h>
8 #include <asm/io.h>
9 #include <asm/arch-rockchip/bootrom.h>
10 #include <asm/arch-rockchip/sdram_rk3036.h>
11 
12 #define TIMER_LOAD_COUNT_L	0x00
13 #define TIMER_LOAD_COUNT_H	0x04
14 #define TIMER_CONTROL_REG	0x10
15 #define TIMER_EN	0x1
16 #define	TIMER_FMODE	(0 << 1)
17 #define	TIMER_RMODE	(1 << 1)
18 
rockchip_stimer_init(void)19 void rockchip_stimer_init(void)
20 {
21 	asm volatile("mcr p15, 0, %0, c14, c0, 0"
22 		     : : "r"(COUNTER_FREQUENCY));
23 
24 	writel(0, CONFIG_ROCKCHIP_STIMER_BASE + TIMER_CONTROL_REG);
25 	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE);
26 	writel(0xffffffff, CONFIG_ROCKCHIP_STIMER_BASE + 4);
27 	writel(TIMER_EN | TIMER_FMODE, CONFIG_ROCKCHIP_STIMER_BASE +
28 	       TIMER_CONTROL_REG);
29 }
30 
board_init_f(ulong dummy)31 void board_init_f(ulong dummy)
32 {
33 #ifdef CONFIG_DEBUG_UART
34 	debug_uart_init();
35 #endif
36 
37 	/* Init secure timer */
38 	rockchip_stimer_init();
39 	/* Init ARM arch timer in arch/arm/cpu/armv7/arch_timer.c */
40 	timer_init();
41 
42 	sdram_init();
43 
44 	/* return to maskrom */
45 	back_to_bootrom(BROM_BOOT_NEXTSTAGE);
46 }
47 
48 /* Place Holders */
board_init_r(gd_t * id,ulong dest_addr)49 void board_init_r(gd_t *id, ulong dest_addr)
50 {
51 	/*
52 	 * Function attribute is no-return
53 	 * This Function never executes
54 	 */
55 	while (1)
56 		;
57 }
58