blob: 5c6a6e655bd901081ee55865fc140e4f5123a14e [file] [log] [blame]
Tony Xief6118cc2016-01-15 17:17:32 +08001/*
2 * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * Redistributions of source code must retain the above copyright notice, this
8 * list of conditions and the following disclaimer.
9 *
10 * Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
24 * POSSIBILITY OF SUCH DAMAGE.
25 */
26
Caesar Wangd90f43e2016-10-11 09:36:00 +080027#include <console.h>
28#include <debug.h>
Tony Xief6118cc2016-01-15 17:17:32 +080029#include <platform.h>
Caesar Wangd90f43e2016-10-11 09:36:00 +080030#include <plat_private.h>
Tony Xief6118cc2016-01-15 17:17:32 +080031
32/*****************************************************************************
33 * sram only surpport 32-bits access
34 ******************************************************************************/
35void u32_align_cpy(uint32_t *dst, const uint32_t *src, size_t bytes)
36{
37 uint32_t i;
38
39 for (i = 0; i < bytes; i++)
40 dst[i] = src[i];
41}
Caesar Wangd90f43e2016-10-11 09:36:00 +080042
43void rockchip_plat_sram_mmu_el3(void)
44{
45#ifdef PLAT_EXTRA_LD_SCRIPT
46 size_t sram_size;
47
48 /* sram.text size */
49 sram_size = (char *)&__bl31_sram_text_end -
50 (char *)&__bl31_sram_text_start;
51 mmap_add_region((unsigned long)&__bl31_sram_text_start,
52 (unsigned long)&__bl31_sram_text_start,
53 sram_size, MT_MEMORY | MT_RO | MT_SECURE);
54
55 /* sram.data size */
56 sram_size = (char *)&__bl31_sram_data_end -
57 (char *)&__bl31_sram_data_start;
58 mmap_add_region((unsigned long)&__bl31_sram_data_start,
59 (unsigned long)&__bl31_sram_data_start,
60 sram_size, MT_MEMORY | MT_RW | MT_SECURE);
61#else
62 /* TODO: Support other SoCs, Just support RK3399 now */
63 return;
64#endif
65}
66
67void plat_rockchip_mem_prepare(void)
68{
69 /* The code for resuming cpu from suspend must be excuted in pmusram */
70 plat_rockchip_pmusram_prepare();
71}