blob: 13e74fd9a3a6b1cece1d9caed9502f5eafd4f962 [file] [log] [blame]
Achin Gupta4f6ad662013-10-25 09:08:21 +01001/*
Soby Mathew7d5a2e72018-01-10 15:59:31 +00002 * Copyright (c) 2013-2018, 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 Diaze0f90632018-12-14 00:18:21 +00007#include <drivers/arm/sp804_delay_timer.h>
8#include <drivers/generic_delay_timer.h>
9#include <lib/mmio.h>
10#include <plat/common/platform.h>
11
Dan Handley2b6b5742015-03-19 19:17:53 +000012#include <plat_arm.h>
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000013#include <v2m_def.h>
14#include "fvp_def.h"
Dan Handleyed6ff952014-05-14 17:44:19 +010015#include "fvp_private.h"
Achin Gupta4f6ad662013-10-25 09:08:21 +010016
Soby Mathew7d5a2e72018-01-10 15:59:31 +000017void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1, u_register_t arg2, u_register_t arg3)
Achin Gupta4f6ad662013-10-25 09:08:21 +010018{
Soby Mathew96a1c6b2018-01-15 14:45:33 +000019 arm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
Achin Gupta4f6ad662013-10-25 09:08:21 +010020
21 /* Initialize the platform config for future decision making */
Dan Handleyea451572014-05-15 14:53:30 +010022 fvp_config_setup();
Vikram Kanigirid8c9d262014-05-16 18:48:12 +010023}
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000024
25void bl2_platform_setup(void)
26{
27 arm_bl2_platform_setup();
28
Antonio Nino Diaz664adb62016-05-17 09:48:10 +010029#if FVP_USE_SP804_TIMER
Juan Castillofd383b42015-12-01 16:10:15 +000030 /* 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 mmio_write_32(V2M_SP810_BASE, FVP_SP810_CTRL_TIM0_OV);
33
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000034 /* Initialize delay timer driver using SP804 dual timer 0 */
35 sp804_timer_init(V2M_SP804_TIMER0_BASE,
36 SP804_TIMER_CLKMULT, SP804_TIMER_CLKDIV);
Antonio Nino Diaz664adb62016-05-17 09:48:10 +010037#else
38 generic_delay_timer_init();
39#endif /* FVP_USE_SP804_TIMER */
Ryan Harkinf96fc8f2015-03-17 14:54:01 +000040}