1b4315306SDan Handley /* 2b5fa6563SSandrine Bailleux * Copyright (c) 2015-2016, ARM Limited and Contributors. All rights reserved. 3b4315306SDan Handley * 4b4315306SDan Handley * Redistribution and use in source and binary forms, with or without 5b4315306SDan Handley * modification, are permitted provided that the following conditions are met: 6b4315306SDan Handley * 7b4315306SDan Handley * Redistributions of source code must retain the above copyright notice, this 8b4315306SDan Handley * list of conditions and the following disclaimer. 9b4315306SDan Handley * 10b4315306SDan Handley * Redistributions in binary form must reproduce the above copyright notice, 11b4315306SDan Handley * this list of conditions and the following disclaimer in the documentation 12b4315306SDan Handley * and/or other materials provided with the distribution. 13b4315306SDan Handley * 14b4315306SDan Handley * Neither the name of ARM nor the names of its contributors may be used 15b4315306SDan Handley * to endorse or promote products derived from this software without specific 16b4315306SDan Handley * prior written permission. 17b4315306SDan Handley * 18b4315306SDan Handley * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19b4315306SDan Handley * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20b4315306SDan Handley * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21b4315306SDan Handley * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22b4315306SDan Handley * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23b4315306SDan Handley * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24b4315306SDan Handley * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25b4315306SDan Handley * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26b4315306SDan Handley * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27b4315306SDan Handley * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28b4315306SDan Handley * POSSIBILITY OF SUCH DAMAGE. 29b4315306SDan Handley */ 30b4315306SDan Handley 31b4315306SDan Handley #include <arm_def.h> 32b4315306SDan Handley #include <bl_common.h> 33b4315306SDan Handley #include <console.h> 34b4315306SDan Handley #include <platform_def.h> 35b4315306SDan Handley #include <platform_tsp.h> 36b4315306SDan Handley #include <plat_arm.h> 37b4315306SDan Handley 38b4315306SDan Handley #define BL32_END (unsigned long)(&__BL32_END__) 39b4315306SDan Handley 40b4315306SDan Handley /* Weak definitions may be overridden in specific ARM standard platform */ 41b4315306SDan Handley #pragma weak tsp_early_platform_setup 42b4315306SDan Handley #pragma weak tsp_platform_setup 43b4315306SDan Handley #pragma weak tsp_plat_arch_setup 44b4315306SDan Handley 45b4315306SDan Handley 46b4315306SDan Handley /******************************************************************************* 47b4315306SDan Handley * Initialize the UART 48b4315306SDan Handley ******************************************************************************/ 49b4315306SDan Handley void arm_tsp_early_platform_setup(void) 50b4315306SDan Handley { 51b4315306SDan Handley /* 52b4315306SDan Handley * Initialize a different console than already in use to display 53b4315306SDan Handley * messages from TSP 54b4315306SDan Handley */ 55b4315306SDan Handley console_init(PLAT_ARM_TSP_UART_BASE, PLAT_ARM_TSP_UART_CLK_IN_HZ, 56b4315306SDan Handley ARM_CONSOLE_BAUDRATE); 57b4315306SDan Handley } 58b4315306SDan Handley 59b4315306SDan Handley void tsp_early_platform_setup(void) 60b4315306SDan Handley { 61b4315306SDan Handley arm_tsp_early_platform_setup(); 62b4315306SDan Handley } 63b4315306SDan Handley 64b4315306SDan Handley /******************************************************************************* 65b4315306SDan Handley * Perform platform specific setup placeholder 66b4315306SDan Handley ******************************************************************************/ 67b4315306SDan Handley void tsp_platform_setup(void) 68b4315306SDan Handley { 6927573c59SAchin Gupta plat_arm_gic_driver_init(); 70b4315306SDan Handley } 71b4315306SDan Handley 72b4315306SDan Handley /******************************************************************************* 73b4315306SDan Handley * Perform the very early platform specific architectural setup here. At the 74b4315306SDan Handley * moment this is only intializes the MMU 75b4315306SDan Handley ******************************************************************************/ 76b4315306SDan Handley void tsp_plat_arch_setup(void) 77b4315306SDan Handley { 780af559a8SSandrine Bailleux arm_setup_page_tables(BL32_BASE, 790af559a8SSandrine Bailleux (BL32_END - BL32_BASE), 800af559a8SSandrine Bailleux BL_CODE_BASE, 81ecdc898dSMasahiro Yamada BL_CODE_END, 820af559a8SSandrine Bailleux BL_RO_DATA_BASE, 83ecdc898dSMasahiro Yamada BL_RO_DATA_END 84b4315306SDan Handley #if USE_COHERENT_MEM 85*47497053SMasahiro Yamada , BL_COHERENT_RAM_BASE, 86*47497053SMasahiro Yamada BL_COHERENT_RAM_END 87b4315306SDan Handley #endif 88b4315306SDan Handley ); 89b5fa6563SSandrine Bailleux enable_mmu_el1(0); 90b4315306SDan Handley } 91