summaryrefslogtreecommitdiff
path: root/plat/socionext/uniphier/uniphier_bl1_setup.c
blob: da7740ad17d233defb03c72fbe02d91aa8b9f4f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/*
 * Copyright (c) 2017, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <arch_helpers.h>
#include <bl_common.h>
#include <console.h>
#include <debug.h>
#include <errno.h>
#include <platform.h>
#include <platform_def.h>
#include <xlat_mmu_helpers.h>

#include "uniphier.h"

void bl1_early_platform_setup(void)
{
	uniphier_console_setup();
}

void bl1_plat_arch_setup(void)
{
	uniphier_mmap_setup(UNIPHIER_SEC_DRAM_BASE, UNIPHIER_SEC_DRAM_SIZE,
			    NULL);
	enable_mmu_el3(0);
}

void bl1_platform_setup(void)
{
	unsigned int soc;
	int ret;

	soc = uniphier_get_soc_id();
	if (soc == UNIPHIER_SOC_UNKNOWN) {
		ERROR("unsupported SoC\n");
		plat_error_handler(-ENOTSUP);
	}

	ret = uniphier_io_setup(soc);
	if (ret) {
		ERROR("failed to setup io devices\n");
		plat_error_handler(ret);
	}
}

static meminfo_t uniphier_tzram_layout = {
	.total_base = UNIPHIER_SEC_DRAM_BASE,
	.total_size = UNIPHIER_SEC_DRAM_SIZE,
};

meminfo_t *bl1_plat_sec_mem_layout(void)
{
	return &uniphier_tzram_layout;
}