1 /*
2  * Copyright (c) 2019, Arm Limited. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <drivers/arm/sp804_delay_timer.h>
8 #include <drivers/generic_delay_timer.h>
9 #include <lib/mmio.h>
10 #include <plat/arm/common/plat_arm.h>
11 #include <plat/common/platform.h>
12 #include <platform_def.h>
13 
14 #include "fvp_ve_private.h"
15 
bl2_early_platform_setup2(u_register_t arg0,u_register_t arg1,u_register_t arg2,u_register_t arg3)16 void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
17 {
18 	arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
19 
20 	/* Initialize the platform config for future decision making */
21 	fvp_ve_config_setup();
22 }
23 
bl2_platform_setup(void)24 void bl2_platform_setup(void)
25 {
26 	arm_bl2_platform_setup();
27 
28 #if USE_SP804_TIMER
29 	/*
30 	 * Enable the clock override for SP804 timer 0, which means that no
31 	 * clock dividers are applied and the raw (35 MHz) clock will be used
32 	 */
33 	mmio_write_32(V2M_SP810_BASE, FVP_SP810_CTRL_TIM0_OV);
34 
35 	/* Initialize delay timer driver using SP804 dual timer 0 */
36 	sp804_timer_init(V2M_SP804_TIMER0_BASE,
37 			SP804_TIMER_CLKMULT, SP804_TIMER_CLKDIV);
38 #else
39 	generic_delay_timer_init();
40 #endif /* USE_SP804_TIMER */
41 }
42