xref: /rk3399_ARM-atf/plat/arm/board/fvp/fvp_bl1_setup.c (revision 436223def6e2ca5e9b9fe66c5e9217857280d44e)
13fc4124cSDan Handley /*
23fc4124cSDan Handley  * Copyright (c) 2013-2015, ARM Limited and Contributors. All rights reserved.
33fc4124cSDan Handley  *
43fc4124cSDan Handley  * Redistribution and use in source and binary forms, with or without
53fc4124cSDan Handley  * modification, are permitted provided that the following conditions are met:
63fc4124cSDan Handley  *
73fc4124cSDan Handley  * Redistributions of source code must retain the above copyright notice, this
83fc4124cSDan Handley  * list of conditions and the following disclaimer.
93fc4124cSDan Handley  *
103fc4124cSDan Handley  * Redistributions in binary form must reproduce the above copyright notice,
113fc4124cSDan Handley  * this list of conditions and the following disclaimer in the documentation
123fc4124cSDan Handley  * and/or other materials provided with the distribution.
133fc4124cSDan Handley  *
143fc4124cSDan Handley  * Neither the name of ARM nor the names of its contributors may be used
153fc4124cSDan Handley  * to endorse or promote products derived from this software without specific
163fc4124cSDan Handley  * prior written permission.
173fc4124cSDan Handley  *
183fc4124cSDan Handley  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
193fc4124cSDan Handley  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
203fc4124cSDan Handley  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
213fc4124cSDan Handley  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
223fc4124cSDan Handley  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
233fc4124cSDan Handley  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
243fc4124cSDan Handley  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
253fc4124cSDan Handley  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
263fc4124cSDan Handley  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
273fc4124cSDan Handley  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
283fc4124cSDan Handley  * POSSIBILITY OF SUCH DAMAGE.
293fc4124cSDan Handley  */
303fc4124cSDan Handley 
313fc4124cSDan Handley #include <plat_arm.h>
32*436223deSYatharth Kochar #include <tbbr_img_def.h>
333fc4124cSDan Handley #include "fvp_private.h"
343fc4124cSDan Handley 
353fc4124cSDan Handley 
363fc4124cSDan Handley /*******************************************************************************
373fc4124cSDan Handley  * Perform any BL1 specific platform actions.
383fc4124cSDan Handley  ******************************************************************************/
393fc4124cSDan Handley void bl1_early_platform_setup(void)
403fc4124cSDan Handley {
413fc4124cSDan Handley 	arm_bl1_early_platform_setup();
423fc4124cSDan Handley 
433fc4124cSDan Handley 	/* Initialize the platform config for future decision making */
443fc4124cSDan Handley 	fvp_config_setup();
453fc4124cSDan Handley 
463fc4124cSDan Handley 	/*
473fc4124cSDan Handley 	 * Initialize CCI for this cluster during cold boot.
483fc4124cSDan Handley 	 * No need for locks as no other CPU is active.
493fc4124cSDan Handley 	 */
503fc4124cSDan Handley 	fvp_cci_init();
513fc4124cSDan Handley 	/*
523fc4124cSDan Handley 	 * Enable CCI coherency for the primary CPU's cluster.
533fc4124cSDan Handley 	 */
543fc4124cSDan Handley 	fvp_cci_enable();
553fc4124cSDan Handley }
56*436223deSYatharth Kochar 
57*436223deSYatharth Kochar /*******************************************************************************
58*436223deSYatharth Kochar  * The following function checks if Firmware update is needed,
59*436223deSYatharth Kochar  * by checking if TOC in FIP image is valid or not.
60*436223deSYatharth Kochar  ******************************************************************************/
61*436223deSYatharth Kochar unsigned int bl1_plat_get_next_image_id(void)
62*436223deSYatharth Kochar {
63*436223deSYatharth Kochar 	if (!arm_io_is_toc_valid())
64*436223deSYatharth Kochar 		return NS_BL1U_IMAGE_ID;
65*436223deSYatharth Kochar 
66*436223deSYatharth Kochar 	return BL2_IMAGE_ID;
67*436223deSYatharth Kochar }
68*436223deSYatharth Kochar 
69