blob: e9c4ab5c4cb577dcea2aed46509c10394fd26599 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Dan Handley2b6b5742015-03-19 19:17:53 +00002 * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
Achin Gupta4f6ad662013-10-25 09:08:21 +01003 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Achin Gupta4f6ad662013-10-25 09:08:21 +01005 */
6
Antonio Nino Diaz664adb62016-05-17 09:48:10 +01007#include <generic_delay_timer.h>
Juan Castillofd383b42015-12-01 16:10:15 +00008#include <mmio.h>
Dan Handley2b6b5742015-03-19 19:17:53 +00009#include <plat_arm.h>
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000010#include <sp804_delay_timer.h>
11#include <v2m_def.h>
12#include "fvp_def.h"
Dan Handleyed6ff952014-05-14 17:44:19 +010013#include "fvp_private.h"
Achin Gupta4f6ad662013-10-25 09:08:21 +010014
Achin Gupta4f6ad662013-10-25 09:08:21 +010015
Vikram Kanigiria3a5e4a2014-05-15 18:27:15 +010016void bl2_early_platform_setup(meminfo_t *mem_layout)
Achin Gupta4f6ad662013-10-25 09:08:21 +010017{
Dan Handley2b6b5742015-03-19 19:17:53 +000018 arm_bl2_early_platform_setup(mem_layout);
Achin Gupta4f6ad662013-10-25 09:08:21 +010019
20 /* Initialize the platform config for future decision making */
Dan Handleyea451572014-05-15 14:53:30 +010021 fvp_config_setup();
Vikram Kanigirid8c9d262014-05-16 18:48:12 +010022}
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000023
24void bl2_platform_setup(void)
25{
26 arm_bl2_platform_setup();
27
Antonio Nino Diaz664adb62016-05-17 09:48:10 +010028#if FVP_USE_SP804_TIMER
Juan Castillofd383b42015-12-01 16:10:15 +000029 /* 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
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000033 /* Initialize delay timer driver using SP804 dual timer 0 */
34 sp804_timer_init(V2M_SP804_TIMER0_BASE,
35 SP804_TIMER_CLKMULT, SP804_TIMER_CLKDIV);
Antonio Nino Diaz664adb62016-05-17 09:48:10 +010036#else
37 generic_delay_timer_init();
38#endif /* FVP_USE_SP804_TIMER */
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000039}