-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial version support for rockchip SoCs.(RK322X and next SoCs). This patch adds to support the RK322X. It is one of the Rockchip family SoCs, which is a 4*A7 multi-cores ARM SoCs. plat-rockchip support features: 1.Support SMP cpu boot up and power down; 2.Support system reset; 3.Support GIC driver initialization. make PLATFORM=rockchip-rk322x Signed-off-by: Joseph Chen <chenjh@rock-chips.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
- Loading branch information
1 parent
8e6c6ae
commit 7176a0b
Showing
13 changed files
with
678 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
* Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef PLAT_ROCKCHIP_COMMON_H | ||
#define PLAT_ROCKCHIP_COMMON_H | ||
|
||
/* For SMP cpu bootup, they are common for rockchip platforms */ | ||
#define LOCK_TAG 0xDEADBEAF | ||
#define LOCK_ADDR_OFFSET 4 | ||
#define BOOT_ADDR_OFFSET 8 | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
PLATFORM_FLAVOR ?= rk322x | ||
|
||
ifeq ($(PLATFORM_FLAVOR),rk322x) | ||
include ./core/arch/arm/cpu/cortex-a7.mk | ||
endif | ||
|
||
arm32-platform-aflags += -mfpu=neon | ||
|
||
$(call force,CFG_GENERIC_BOOT,y) | ||
$(call force,CFG_GIC,y) | ||
$(call force,CFG_HWSUPP_MEM_PERM_PXN,y) | ||
$(call force,CFG_PM_STUBS,y) | ||
$(call force,CFG_SECURE_TIME_SOURCE_CNTPCT,y) | ||
$(call force,CFG_PSCI_ARM32,y) | ||
$(call force,CFG_BOOT_SECONDARY_REQUEST,y) | ||
$(call force,CFG_8250_UART,y) | ||
|
||
ta-targets = ta_arm32 | ||
|
||
CFG_WITH_STACK_CANARIES ?= y | ||
CFG_WITH_STATS ?= y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (c) 2017, Linaro Limited | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <asm.S> | ||
#include <arm.h> | ||
#include <arm32_macros.S> | ||
#include <kernel/unwind.h> | ||
|
||
FUNC get_core_pos , : | ||
UNWIND( .fnstart) | ||
/* | ||
* Because mpidr is designed mistake in hardware, ie. core0 is 0xf00, | ||
* core1 is 0xf01..., so we need implement the function to correct this. | ||
*/ | ||
read_mpidr r0 | ||
and r0, r0, #MPIDR_CPU_MASK | ||
bx lr | ||
UNWIND( .fnend) | ||
END_FUNC get_core_pos | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef PLAT_ROCKCHIP_CRU_H | ||
#define PLAT_ROCKCHIP_CRU_H | ||
|
||
#include <platform_config.h> | ||
|
||
#if defined(PLATFORM_FLAVOR_rk322x) | ||
#define CRU_SOFTRST_CON(i) (0x110 + ((i) * 4)) | ||
#define CRU_MODE_CON 0x040 | ||
#define CRU_GLBRST_CFG_BASE 0x140 | ||
#define CRU_FSTRST_VAL_BASE 0x1f0 | ||
#define CRU_SNDRST_VAL_BASE 0x1f4 | ||
#define CRU_FSTRST_VAL 0xfdb9 | ||
#define CRU_SNDRST_VAL 0xeca8 | ||
#define PLLS_SLOW_MODE 0x11030000 | ||
|
||
#define CORE_SOFT_RESET(core) SHIFT_U32(0x100010, (core)) | ||
#define CORE_SOFT_RELEASE(core) SHIFT_U32(0x100000, (core)) | ||
#define CORE_HELD_IN_RESET(core) SHIFT_U32(0x000010, (core)) | ||
#define NONBOOT_CORES_SOFT_RESET 0x00e000e0 | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#ifndef PLAT_ROCKCHIP_GRF_H | ||
#define PLAT_ROCKCHIP_GRF_H | ||
|
||
#if defined(PLATFORM_FLAVOR_rk322x) | ||
#define GRF_CPU_STATUS1 0x524 | ||
|
||
#define CORE_WFE_MASK(core) SHIFT_U32(0x02, (core)) | ||
#define CORE_WFI_MASK(core) SHIFT_U32(0x20, (core)) | ||
#define CORE_WFE_I_MASK(core) (CORE_WFI_MASK(core) | CORE_WFE_MASK(core)) | ||
#endif | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#include "../kernel/kern.ld.S" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
include core/arch/arm/kernel/link.mk |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
/* | ||
* Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <console.h> | ||
#include <drivers/gic.h> | ||
#include <drivers/serial8250_uart.h> | ||
#include <io.h> | ||
#include <kernel/generic_boot.h> | ||
#include <kernel/panic.h> | ||
#include <kernel/pm_stubs.h> | ||
#include <mm/core_memprot.h> | ||
#include <platform_config.h> | ||
#include <stdint.h> | ||
#include <tee/entry_std.h> | ||
#include <tee/entry_fast.h> | ||
|
||
static struct gic_data gic_data; | ||
static struct serial8250_uart_data console_data; | ||
|
||
register_phys_mem(MEM_AREA_IO_SEC, PERIPH_BASE, PERIPH_SIZE); | ||
register_phys_mem(MEM_AREA_IO_NSEC, ISRAM_BASE, ISRAM_SIZE); | ||
|
||
static void main_fiq(void) | ||
{ | ||
panic(); | ||
} | ||
|
||
static const struct thread_handlers handlers = { | ||
.std_smc = tee_entry_std, | ||
.fast_smc = tee_entry_fast, | ||
.nintr = main_fiq, | ||
.cpu_on = pm_do_nothing, | ||
.cpu_off = pm_do_nothing, | ||
.cpu_suspend = pm_do_nothing, | ||
.cpu_resume = pm_do_nothing, | ||
.system_off = pm_do_nothing, | ||
.system_reset = pm_do_nothing, | ||
}; | ||
|
||
void main_init_gic(void) | ||
{ | ||
vaddr_t gicc_base; | ||
vaddr_t gicd_base; | ||
|
||
gicc_base = (vaddr_t)phys_to_virt_io(GICC_BASE); | ||
gicd_base = (vaddr_t)phys_to_virt_io(GICD_BASE); | ||
|
||
if (!gicc_base || !gicd_base) | ||
panic(); | ||
|
||
gic_init(&gic_data, gicc_base, gicd_base); | ||
itr_init(&gic_data.chip); | ||
} | ||
|
||
void main_secondary_init_gic(void) | ||
{ | ||
gic_cpu_init(&gic_data); | ||
} | ||
|
||
const struct thread_handlers *generic_boot_get_handlers(void) | ||
{ | ||
return &handlers; | ||
} | ||
|
||
void console_init(void) | ||
{ | ||
serial8250_uart_init(&console_data, CONSOLE_UART_BASE, | ||
CONSOLE_UART_CLK_IN_HZ, CONSOLE_BAUDRATE); | ||
register_serial_console(&console_data.chip); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <asm.S> | ||
#include <arm.h> | ||
#include <arm32_macros.S> | ||
#include <kernel/unwind.h> | ||
|
||
FUNC plat_cpu_reset_early , : | ||
UNWIND( .fnstart) | ||
|
||
/* Enable SMP bit */ | ||
read_actlr r0 | ||
orr r0, r0, #ACTLR_SMP | ||
write_actlr r0 | ||
bx lr | ||
|
||
UNWIND( .fnend) | ||
END_FUNC plat_cpu_reset_early | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright (C) 2017, Fuzhou Rockchip Electronics Co., Ltd. | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | ||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE | ||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | ||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | ||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | ||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | ||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | ||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | ||
* POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
#include <initcall.h> | ||
#include <io.h> | ||
#include <mm/core_memprot.h> | ||
#include <platform_config.h> | ||
#include <stdint.h> | ||
|
||
#if defined(PLATFORM_FLAVOR_rk322x) | ||
|
||
#define SGRF_SOC_CON(n) ((n) * 4) | ||
#define DDR_SGRF_DDR_CON(n) ((n) * 4) | ||
#define DDR_RGN0_NS BIT32(30) | ||
#define SLAVE_ALL_NS 0xffff0000 | ||
|
||
static TEE_Result platform_init(void) | ||
{ | ||
vaddr_t sgrf_base = (vaddr_t)phys_to_virt_io(SGRF_BASE); | ||
vaddr_t ddrsgrf_base = (vaddr_t)phys_to_virt_io(DDRSGRF_BASE); | ||
|
||
/* Set rgn0 non-secure */ | ||
write32(DDR_RGN0_NS, ddrsgrf_base + DDR_SGRF_DDR_CON(0)); | ||
|
||
/* Initialize all slave non-secure */ | ||
write32(SLAVE_ALL_NS, sgrf_base + SGRF_SOC_CON(7)); | ||
write32(SLAVE_ALL_NS, sgrf_base + SGRF_SOC_CON(8)); | ||
write32(SLAVE_ALL_NS, sgrf_base + SGRF_SOC_CON(9)); | ||
write32(SLAVE_ALL_NS, sgrf_base + SGRF_SOC_CON(10)); | ||
|
||
return TEE_SUCCESS; | ||
} | ||
|
||
#endif | ||
|
||
service_init(platform_init); |
Oops, something went wrong.