1 /*
2  * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <generic_delay_timer.h>
8 #include <mmio.h>
9 #include <plat_arm.h>
10 #include <sp804_delay_timer.h>
11 #include <v2m_def.h>
12 #include "fvp_def.h"
13 #include "fvp_private.h"
14 
15 
bl2_early_platform_setup(meminfo_t * mem_layout)16 void bl2_early_platform_setup(meminfo_t *mem_layout)
17 {
18 	arm_bl2_early_platform_setup(mem_layout);
19 
20 	/* Initialize the platform config for future decision making */
21 	fvp_config_setup();
22 }
23 
bl2_platform_setup(void)24 void bl2_platform_setup(void)
25 {
26 	arm_bl2_platform_setup();
27 
28 #if FVP_USE_SP804_TIMER
29 	/* Enable the clock override for SP804 timer 0, which means that no
30 	 * clock dividers are applied and the raw (35 MHz) clock will be used */
31 	mmio_write_32(V2M_SP810_BASE, FVP_SP810_CTRL_TIM0_OV);
32 
33 	/* Initialize delay timer driver using SP804 dual timer 0 */
34 	sp804_timer_init(V2M_SP804_TIMER0_BASE,
35 			SP804_TIMER_CLKMULT, SP804_TIMER_CLKDIV);
36 #else
37 	generic_delay_timer_init();
38 #endif /* FVP_USE_SP804_TIMER */
39 }
40