pmu_sram.c 1.58 KB
Newer Older
Tony Xie's avatar
Tony Xie committed
1
2
3
/*
 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
 *
dp-arm's avatar
dp-arm committed
4
 * SPDX-License-Identifier: BSD-3-Clause
Tony Xie's avatar
Tony Xie committed
5
6
 */

7
8
#include <console.h>
#include <debug.h>
Tony Xie's avatar
Tony Xie committed
9
#include <platform.h>
10
#include <plat_private.h>
Tony Xie's avatar
Tony Xie committed
11
12
13
14
15
16
17
18
19
20
21

/*****************************************************************************
 * sram only surpport 32-bits access
 ******************************************************************************/
void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes)
{
	uint32_t i;

	for (i = 0; i < bytes; i++)
		dst[i] = src[i];
}
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40

void rockchip_plat_sram_mmu_el3(void)
{
#ifdef PLAT_EXTRA_LD_SCRIPT
	size_t sram_size;

	/* sram.text size */
	sram_size = (char *)&__bl31_sram_text_end -
		    (char *)&__bl31_sram_text_start;
	mmap_add_region((unsigned long)&__bl31_sram_text_start,
			(unsigned long)&__bl31_sram_text_start,
			sram_size, MT_MEMORY | MT_RO | MT_SECURE);

	/* sram.data size */
	sram_size = (char *)&__bl31_sram_data_end -
		    (char *)&__bl31_sram_data_start;
	mmap_add_region((unsigned long)&__bl31_sram_data_start,
			(unsigned long)&__bl31_sram_data_start,
			sram_size, MT_MEMORY | MT_RW | MT_SECURE);
41
42
43
44
45
46

	/* sram.incbin size */
	sram_size = (char *)&__sram_incbin_end - (char *)&__sram_incbin_start;
	mmap_add_region((unsigned long)&__sram_incbin_start,
			(unsigned long)&__sram_incbin_start,
			sram_size, MT_NON_CACHEABLE | MT_RW | MT_SECURE);
47
48
49
50
51
52
53
54
55
56
57
#else
	/* TODO: Support other SoCs, Just support RK3399 now */
	return;
#endif
}

void plat_rockchip_mem_prepare(void)
{
	/* The code for resuming cpu from suspend must be excuted in pmusram */
	plat_rockchip_pmusram_prepare();
}