Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2016, ARM Limited and Contributors. All rights reserved. |
| 3 | * |
dp-arm | fa3cf0b | 2017-05-03 09:38:09 +0100 | [diff] [blame] | 4 | * SPDX-License-Identifier: BSD-3-Clause |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 5 | */ |
| 6 | |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 7 | #include <console.h> |
| 8 | #include <debug.h> |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 9 | #include <platform.h> |
Caesar Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 10 | #include <plat_private.h> |
Tony Xie | f6118cc | 2016-01-15 17:17:32 +0800 | [diff] [blame] | 11 | |
| 12 | /***************************************************************************** |
| 13 | * sram only surpport 32-bits access |
| 14 | ******************************************************************************/ |
| 15 | void 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 Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 22 | |
| 23 | void 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 Zheng | 93280b7 | 2016-10-26 21:25:26 +0800 | [diff] [blame] | 41 | |
| 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 Wang | d90f43e | 2016-10-11 09:36:00 +0800 | [diff] [blame] | 47 | #else |
| 48 | /* TODO: Support other SoCs, Just support RK3399 now */ |
| 49 | return; |
| 50 | #endif |
| 51 | } |
| 52 | |
| 53 | void 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 | } |