mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
atf-rockchip: update rk3568 support
This commit is contained in:
parent
c54f4958dc
commit
af37c0ffb4
@ -10,9 +10,9 @@ PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=https://github.com/ARM-software/arm-trusted-firmware
|
||||
PKG_SOURCE_DATE:=2024-09-09
|
||||
PKG_SOURCE_VERSION:=0631d68d85881d4b8ffa571f49eb8b767c005f6a
|
||||
PKG_MIRROR_HASH:=6e8a83c6ee64faab46e1531948180199fa70194bb2ffec4d4a521c2b2d136cf3
|
||||
PKG_SOURCE_DATE:=2024-09-21
|
||||
PKG_SOURCE_VERSION:=2975ad055bd6e1ea3fc4179e8b785266785f0398
|
||||
PKG_MIRROR_HASH:=6cf6e03b43b3d791153dc93f067c8e078f438923cd0781be047a722342c24fe8
|
||||
|
||||
PKG_MAINTAINER:=Tobias Maedel <openwrt@tbspace.de>
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,140 +0,0 @@
|
||||
From 35cb9811b8cc2099ce11e2c86d9da6786c28a6c6 Mon Sep 17 00:00:00 2001
|
||||
From: XiaoDong Huang <derrick.huang@rock-chips.com>
|
||||
Date: Mon, 17 Jun 2024 10:55:27 +0800
|
||||
Subject: [PATCH] feat(rk3588): enable crypto function
|
||||
|
||||
The CPU crypto is not default on when power up, need to enable it by
|
||||
software.
|
||||
|
||||
Signed-off-by: XiaoDong Huang <derrick.huang@rock-chips.com>
|
||||
Change-Id: Ifee2eab55d9c13cef5f15926fb80016845e2a66d
|
||||
---
|
||||
bl31/aarch64/bl31_entrypoint.S | 9 +++
|
||||
plat/rockchip/rk3588/drivers/pmu/pmu.c | 79 ++++++++++++++++++++++++++
|
||||
plat/rockchip/rk3588/platform.mk | 1 +
|
||||
3 files changed, 89 insertions(+)
|
||||
|
||||
--- a/bl31/aarch64/bl31_entrypoint.S
|
||||
+++ b/bl31/aarch64/bl31_entrypoint.S
|
||||
@@ -16,6 +16,11 @@
|
||||
.globl bl31_entrypoint
|
||||
.globl bl31_warm_entrypoint
|
||||
|
||||
+#ifdef PLAT_RK_BL31_ENTRYPOINT
|
||||
+ .globl plat_rockchip_bl31_entrypoint
|
||||
+ .globl plat_rockchip_bl31_entrypoint_set_sp
|
||||
+#endif
|
||||
+
|
||||
/* -----------------------------------------------------
|
||||
* bl31_entrypoint() is the cold boot entrypoint,
|
||||
* executed only by the primary cpu.
|
||||
@@ -23,6 +28,10 @@
|
||||
*/
|
||||
|
||||
func bl31_entrypoint
|
||||
+#ifdef PLAT_RK_BL31_ENTRYPOINT
|
||||
+ bl plat_rockchip_bl31_entrypoint_set_sp
|
||||
+ bl plat_rockchip_bl31_entrypoint
|
||||
+#endif
|
||||
/* ---------------------------------------------------------------
|
||||
* Stash the previous bootloader arguments x0 - x3 for later use.
|
||||
* ---------------------------------------------------------------
|
||||
--- a/plat/rockchip/rk3588/drivers/pmu/pmu.c
|
||||
+++ b/plat/rockchip/rk3588/drivers/pmu/pmu.c
|
||||
@@ -136,6 +136,22 @@ static __pmusramfunc void dsu_restore_ea
|
||||
|
||||
static __pmusramfunc void ddr_resume(void)
|
||||
{
|
||||
+ /* check the crypto function had been enabled or not */
|
||||
+ if (mmio_read_32(DSUSGRF_BASE + DSU_SGRF_SOC_CON(4)) & BIT(4)) {
|
||||
+ /* enable the crypto function */
|
||||
+ mmio_write_32(DSUSGRF_BASE + DSU_SGRF_SOC_CON(4), BITS_WITH_WMASK(0, 0x1, 4));
|
||||
+ dsb();
|
||||
+ isb();
|
||||
+
|
||||
+ __asm__ volatile ("mov x0, #3\n"
|
||||
+ "dsb sy\n"
|
||||
+ "msr rmr_el3, x0\n"
|
||||
+ "1:\n"
|
||||
+ "isb\n"
|
||||
+ "wfi\n"
|
||||
+ "b 1b\n");
|
||||
+ }
|
||||
+
|
||||
dsu_restore_early();
|
||||
}
|
||||
|
||||
@@ -1437,3 +1453,66 @@ void plat_rockchip_pmu_init(void)
|
||||
|
||||
pm_reg_rgns_init();
|
||||
}
|
||||
+
|
||||
+void bl31_entrypoint(void);
|
||||
+
|
||||
+static uint64_t boot_cpu_save[4];
|
||||
+
|
||||
+void plat_rockchip_bl31_entrypoint_set_sp(uint64_t reg0, uint64_t reg1,
|
||||
+ uint64_t reg2, uint64_t reg3)
|
||||
+{
|
||||
+ __asm__ volatile("mov x10, %0\n" : : "r" (reg0) : );
|
||||
+
|
||||
+ reg0 = PSRAM_SP_TOP;
|
||||
+ __asm__ volatile("mov sp, %0\n" : : "r" (reg0) : );
|
||||
+
|
||||
+ __asm__ volatile("mov %0, x10\n" : "=r" (reg0) : :);
|
||||
+}
|
||||
+
|
||||
+void plat_rockchip_bl31_entrypoint(uint64_t reg0, uint64_t reg1,
|
||||
+ uint64_t reg2, uint64_t reg3)
|
||||
+{
|
||||
+ uint32_t tmp = mmio_read_32(DSUSGRF_BASE + DSU_SGRF_SOC_CON(4));
|
||||
+
|
||||
+ /* check the crypto function had been enabled or not */
|
||||
+ if (tmp & BIT(4)) {
|
||||
+ /* save x0~x3 */
|
||||
+ boot_cpu_save[0] = reg0;
|
||||
+ boot_cpu_save[1] = reg1;
|
||||
+ boot_cpu_save[2] = reg2;
|
||||
+ boot_cpu_save[3] = reg3;
|
||||
+
|
||||
+ /* enable the crypto function */
|
||||
+ mmio_write_32(DSUSGRF_BASE + DSU_SGRF_SOC_CON(4), BITS_WITH_WMASK(0, 0x1, 4));
|
||||
+
|
||||
+ /* remap pmusram to 0xffff0000 */
|
||||
+ mmio_write_32(PMU0SGRF_BASE + PMU0_SGRF_SOC_CON(2), 0x00030001);
|
||||
+ dsb();
|
||||
+ psram_sleep_cfg->pm_flag = PM_WARM_BOOT_BIT;
|
||||
+ cpuson_flags[0] = PMU_CPU_HOTPLUG;
|
||||
+ cpuson_entry_point[0] = (uintptr_t)bl31_entrypoint;
|
||||
+ dsb();
|
||||
+
|
||||
+ /* to enable the crypto function, must reset the core0 */
|
||||
+ __asm__ volatile ("mov x0, #3\n"
|
||||
+ "dsb sy\n"
|
||||
+ "msr rmr_el3, x0\n"
|
||||
+ "1:\n"
|
||||
+ "isb\n"
|
||||
+ "wfi\n"
|
||||
+ "b 1b\n");
|
||||
+ } else {
|
||||
+ /* remap bootrom to 0xffff0000 */
|
||||
+ mmio_write_32(PMU0SGRF_BASE + PMU0_SGRF_SOC_CON(2), 0x00030000);
|
||||
+
|
||||
+ /*
|
||||
+ * the crypto function has been enabled,
|
||||
+ * restore the x0~x3.
|
||||
+ */
|
||||
+ __asm__ volatile ("ldr x0, [%0]\n"
|
||||
+ "ldr x1, [%0 , 0x8]\n"
|
||||
+ "ldr x2, [%0 , 0x10]\n"
|
||||
+ "ldr x3, [%0 , 0x18]\n"
|
||||
+ : : "r" (&boot_cpu_save[0]));
|
||||
+ }
|
||||
+}
|
||||
--- a/plat/rockchip/rk3588/platform.mk
|
||||
+++ b/plat/rockchip/rk3588/platform.mk
|
||||
@@ -96,3 +96,4 @@ ENABLE_SPE_FOR_LOWER_ELS := 0
|
||||
|
||||
$(eval $(call add_define,PLAT_EXTRA_LD_SCRIPT))
|
||||
$(eval $(call add_define,PLAT_SKIP_DFS_TLB_DCACHE_MAINTENANCE))
|
||||
+$(eval $(call add_define,PLAT_RK_BL31_ENTRYPOINT))
|
Loading…
Reference in New Issue
Block a user