blob: 05ee762e9e63ac9eb7952742ee6e910ba7d43230 [file] [log] [blame]
Tony Xief6118cc2016-01-15 17:17:32 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
dp-armfa3cf0b2017-05-03 09:38:09 +01004 * SPDX-License-Identifier: BSD-3-Clause
Tony Xief6118cc2016-01-15 17:17:32 +08005 */
6
Caesar Wangd90f43e2016-10-11 09:36:00 +08007#include <console.h>
8#include <debug.h>
Tony Xief6118cc2016-01-15 17:17:32 +08009#include <platform.h>
Caesar Wangd90f43e2016-10-11 09:36:00 +080010#include <plat_private.h>
Tony Xief6118cc2016-01-15 17:17:32 +080011
12/*****************************************************************************
13 * sram only surpport 32-bits access
14 ******************************************************************************/
15void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes)
16{
17 uint32_t i;
18
19 for (i = 0; i < bytes; i++)
20 dst[i] = src[i];
21}
Caesar Wangd90f43e2016-10-11 09:36:00 +080022
23void rockchip_plat_sram_mmu_el3(void)
24{
25#ifdef PLAT_EXTRA_LD_SCRIPT
26 size_t sram_size;
27
28 /* sram.text size */
29 sram_size = (char *)&__bl31_sram_text_end -
30 (char *)&__bl31_sram_text_start;
31 mmap_add_region((unsigned long)&__bl31_sram_text_start,
32 (unsigned long)&__bl31_sram_text_start,
33 sram_size, MT_MEMORY | MT_RO | MT_SECURE);
34
35 /* sram.data size */
36 sram_size = (char *)&__bl31_sram_data_end -
37 (char *)&__bl31_sram_data_start;
38 mmap_add_region((unsigned long)&__bl31_sram_data_start,
39 (unsigned long)&__bl31_sram_data_start,
40 sram_size, MT_MEMORY | MT_RW | MT_SECURE);
Xing Zheng93280b72016-10-26 21:25:26 +080041
42 /* sram.incbin size */
43 sram_size = (char *)&__sram_incbin_end - (char *)&__sram_incbin_start;
44 mmap_add_region((unsigned long)&__sram_incbin_start,
45 (unsigned long)&__sram_incbin_start,
46 sram_size, MT_NON_CACHEABLE | MT_RW | MT_SECURE);
Caesar Wangd90f43e2016-10-11 09:36:00 +080047#else
48 /* TODO: Support other SoCs, Just support RK3399 now */
49 return;
50#endif
51}
52
53void plat_rockchip_mem_prepare(void)
54{
55 /* The code for resuming cpu from suspend must be excuted in pmusram */
56 plat_rockchip_pmusram_prepare();
57}