Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 1 | /* |
Alexei Fedorov | 896799a | 2019-05-09 12:14:40 +0100 | [diff] [blame] | 2 | * Copyright (c) 2013-2019, ARM Limited and Contributors. All rights reserved. |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 5 | */ |
| 6 | |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 7 | #include <common/tbbr/tbbr_img_def.h> |
Alexei Fedorov | 896799a | 2019-05-09 12:14:40 +0100 | [diff] [blame] | 8 | #include <drivers/arm/smmu_v3.h> |
Aditya Angadi | 20b4841 | 2019-04-16 11:29:14 +0530 | [diff] [blame] | 9 | #include <drivers/arm/sp805.h> |
Alexei Fedorov | 896799a | 2019-05-09 12:14:40 +0100 | [diff] [blame] | 10 | #include <plat/arm/common/arm_config.h> |
Antonio Nino Diaz | bd7b740 | 2019-01-25 14:30:04 +0000 | [diff] [blame] | 11 | #include <plat/arm/common/plat_arm.h> |
Aditya Angadi | 20b4841 | 2019-04-16 11:29:14 +0530 | [diff] [blame] | 12 | #include <plat/arm/common/arm_def.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 13 | #include <plat/common/platform.h> |
Antonio Nino Diaz | e0f9063 | 2018-12-14 00:18:21 +0000 | [diff] [blame] | 14 | #include "fvp_private.h" |
Achin Gupta | 4f6ad66 | 2013-10-25 09:08:21 +0100 | [diff] [blame] | 15 | |
| 16 | /******************************************************************************* |
| 17 | * Perform any BL1 specific platform actions. |
| 18 | ******************************************************************************/ |
| 19 | void bl1_early_platform_setup(void) |
| 20 | { |
Dan Handley | 2b6b574 | 2015-03-19 19:17:53 +0000 | [diff] [blame] | 21 | arm_bl1_early_platform_setup(); |
Sandrine Bailleux | e3060e2 | 2014-06-13 14:48:18 +0100 | [diff] [blame] | 22 | |
Harry Liebel | 30affd5 | 2013-10-30 17:41:48 +0000 | [diff] [blame] | 23 | /* Initialize the platform config for future decision making */ |
Dan Handley | ea45157 | 2014-05-15 14:53:30 +0100 | [diff] [blame] | 24 | fvp_config_setup(); |
James Morrissey | 9d72b4e | 2014-02-10 17:04:32 +0000 | [diff] [blame] | 25 | |
Dan Handley | 2b6b574 | 2015-03-19 19:17:53 +0000 | [diff] [blame] | 26 | /* |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 27 | * Initialize Interconnect for this cluster during cold boot. |
Dan Handley | 2b6b574 | 2015-03-19 19:17:53 +0000 | [diff] [blame] | 28 | * No need for locks as no other CPU is active. |
| 29 | */ |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 30 | fvp_interconnect_init(); |
Dan Handley | 2b6b574 | 2015-03-19 19:17:53 +0000 | [diff] [blame] | 31 | /* |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 32 | * Enable coherency in Interconnect for the primary CPU's cluster. |
Dan Handley | 2b6b574 | 2015-03-19 19:17:53 +0000 | [diff] [blame] | 33 | */ |
Vikram Kanigiri | fbb1301 | 2016-02-15 11:54:14 +0000 | [diff] [blame] | 34 | fvp_interconnect_enable(); |
Vikram Kanigiri | da56743 | 2014-04-15 18:08:08 +0100 | [diff] [blame] | 35 | } |
Aditya Angadi | 20b4841 | 2019-04-16 11:29:14 +0530 | [diff] [blame] | 36 | |
| 37 | void plat_arm_secure_wdt_start(void) |
| 38 | { |
| 39 | sp805_start(ARM_SP805_TWDG_BASE, ARM_TWDG_LOAD_VAL); |
| 40 | } |
| 41 | |
| 42 | void plat_arm_secure_wdt_stop(void) |
| 43 | { |
| 44 | sp805_stop(ARM_SP805_TWDG_BASE); |
| 45 | } |
Alexei Fedorov | 896799a | 2019-05-09 12:14:40 +0100 | [diff] [blame] | 46 | |
| 47 | void bl1_platform_setup(void) |
| 48 | { |
| 49 | arm_bl1_platform_setup(); |
| 50 | |
Alexei Fedorov | 7131d83 | 2019-08-16 14:15:59 +0100 | [diff] [blame] | 51 | /* Initialize System level generic or SP804 timer */ |
| 52 | fvp_timer_init(); |
| 53 | |
Alexei Fedorov | 896799a | 2019-05-09 12:14:40 +0100 | [diff] [blame] | 54 | /* On FVP RevC, initialize SMMUv3 */ |
| 55 | if ((arm_config.flags & ARM_CONFIG_FVP_HAS_SMMUV3) != 0U) |
| 56 | smmuv3_security_init(PLAT_FVP_SMMUV3_BASE); |
| 57 | } |
Ambroise Vincent | fa42c9e | 2019-07-04 14:58:45 +0100 | [diff] [blame] | 58 | |
| 59 | __dead2 void bl1_plat_fwu_done(void *client_cookie, void *reserved) |
| 60 | { |
| 61 | /* Setup the watchdog to reset the system as soon as possible */ |
| 62 | sp805_refresh(ARM_SP805_TWDG_BASE, 1U); |
| 63 | |
| 64 | while (1) |
| 65 | wfi(); |
| 66 | } |