1 /*
2  * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
3  *
4  * SPDX-License-Identifier: BSD-3-Clause
5  */
6 
7 #include <arch_helpers.h>
8 #include <bl_common.h>
9 #include <console.h>
10 #include <debug.h>
11 #include <errno.h>
12 #include <platform.h>
13 #include <platform_def.h>
14 #include <xlat_mmu_helpers.h>
15 
16 #include "uniphier.h"
17 
bl1_early_platform_setup(void)18 void bl1_early_platform_setup(void)
19 {
20 	uniphier_console_setup();
21 }
22 
bl1_plat_arch_setup(void)23 void bl1_plat_arch_setup(void)
24 {
25 	uniphier_mmap_setup(UNIPHIER_SEC_DRAM_BASE, UNIPHIER_SEC_DRAM_SIZE,
26 			    NULL);
27 	enable_mmu_el3(0);
28 }
29 
bl1_platform_setup(void)30 void bl1_platform_setup(void)
31 {
32 	unsigned int soc;
33 	int ret;
34 
35 	soc = uniphier_get_soc_id();
36 	if (soc == UNIPHIER_SOC_UNKNOWN) {
37 		ERROR("unsupported SoC\n");
38 		plat_error_handler(-ENOTSUP);
39 	}
40 
41 	ret = uniphier_io_setup(soc);
42 	if (ret) {
43 		ERROR("failed to setup io devices\n");
44 		plat_error_handler(ret);
45 	}
46 }
47 
48 static meminfo_t uniphier_tzram_layout = {
49 	.total_base = UNIPHIER_SEC_DRAM_BASE,
50 	.total_size = UNIPHIER_SEC_DRAM_SIZE,
51 };
52 
bl1_plat_sec_mem_layout(void)53 meminfo_t *bl1_plat_sec_mem_layout(void)
54 {
55 	return &uniphier_tzram_layout;
56 }
57