Fix patch and compilation failures in crust support patch

This commit is contained in:
Gunjan Gupta
2023-12-13 07:37:08 +05:30
committed by Igor
parent f78c95e798
commit 80f7e4a61d

View File

@@ -1,4 +1,4 @@
From 566bc30291896e38b62dcf4677a7f99502e88021 Mon Sep 17 00:00:00 2001
From 2a8511ddcad03f6b192272aea7848f70b1dd726e Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 17 Apr 2021 13:33:54 -0500
Subject: [PATCH 1/9] sunxi: binman: Enable SPL FIT loading for 32-bit SoCs
@@ -41,7 +41,7 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
3 files changed, 34 insertions(+), 18 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index da8efdea71..309df7b05d 100644
index 3f70503b61b..e9724e39338 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1169,6 +1169,7 @@ config ARCH_SUNXI
@@ -53,7 +53,7 @@ index da8efdea71..309df7b05d 100644
imply SPL_POWER
imply SPL_SERIAL
diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index af419c7e59..1353d6e668 100644
index a0c8abb7033..3c6ec626ea6 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -1,13 +1,19 @@
@@ -83,7 +83,7 @@ index af419c7e59..1353d6e668 100644
#endif
/ {
@@ -37,30 +43,33 @@
@@ -44,30 +50,33 @@
filename = "spl/sunxi-spl.bin";
};
@@ -122,7 +122,7 @@ index af419c7e59..1353d6e668 100644
compression = "none";
load = <BL31_ADDR>;
entry = <BL31_ADDR>;
@@ -70,6 +79,7 @@
@@ -77,6 +86,7 @@
missing-msg = "atf-bl31-sunxi";
};
};
@@ -130,7 +130,7 @@ index af419c7e59..1353d6e668 100644
#ifdef SCP_ADDR
scp {
@@ -98,12 +108,16 @@
@@ -105,12 +115,16 @@
@config-SEQ {
description = "NAME";
@@ -151,7 +151,7 @@ index af419c7e59..1353d6e668 100644
};
};
diff --git a/common/spl/Kconfig b/common/spl/Kconfig
index 2c042ad306..4e52529e69 100644
index 25cd18afda7..8176cd59cf8 100644
--- a/common/spl/Kconfig
+++ b/common/spl/Kconfig
@@ -76,7 +76,9 @@ config SPL_SIZE_LIMIT_PROVIDE_STACK
@@ -173,7 +173,7 @@ index 2c042ad306..4e52529e69 100644
default 0x0 if ARCH_MTMIPS
default TPL_MAX_SIZE if TPL_MAX_SIZE > SPL_MAX_SIZE
default SPL_MAX_SIZE
@@ -576,8 +578,7 @@ config SPL_MD5
@@ -568,8 +570,7 @@ config SYS_MMCSD_RAW_MODE_EMMC_BOOT_PARTITION
config SPL_FIT_IMAGE_TINY
bool "Remove functionality from SPL FIT loading to reduce size"
depends on SPL_FIT
@@ -187,7 +187,7 @@ index 2c042ad306..4e52529e69 100644
2.34.1
From 501729188de546502d939c3cedee7ec1ecb04a7b Mon Sep 17 00:00:00 2001
From 86a09f129dc685411c05086239a8befbb715b716 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Oct 2021 22:00:22 -0500
Subject: [PATCH 2/9] sunxi: psci: Avoid hanging when CPU 0 is hot-unplugged
@@ -203,12 +203,12 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
1 file changed, 17 insertions(+), 3 deletions(-)
diff --git a/arch/arm/cpu/armv7/sunxi/psci.c b/arch/arm/cpu/armv7/sunxi/psci.c
index e1d3638b5c..738ea8f281 100644
index 5cb8cfa6cf3..098e2b12bf0 100644
--- a/arch/arm/cpu/armv7/sunxi/psci.c
+++ b/arch/arm/cpu/armv7/sunxi/psci.c
@@ -38,6 +38,15 @@
#define SUN8I_R40_PWR_CLAMP(cpu) (0x120 + (cpu) * 0x4)
#define SUN8I_R40_SRAMC_SOFT_ENTRY_REG0 (0xbc)
@@ -65,6 +65,15 @@
#define SUNXI_R_CPUCFG_BASE 0
#endif
+static inline u32 __secure cp15_read_mpidr(void)
+{
@@ -222,7 +222,7 @@ index e1d3638b5c..738ea8f281 100644
static void __secure cp15_write_cntp_tval(u32 tval)
{
asm volatile ("mcr p15, 0, %0, c14, c2, 0" : : "r" (tval));
@@ -281,9 +290,14 @@ s32 __secure psci_cpu_off(void)
@@ -331,9 +340,14 @@ s32 __secure psci_cpu_off(void)
{
psci_cpu_off_common();
@@ -244,7 +244,7 @@ index e1d3638b5c..738ea8f281 100644
2.34.1
From e9e05a2a43d1641d2d864a06d38f190ee8538211 Mon Sep 17 00:00:00 2001
From 1f66111fddccfea38c7100f26b716880e23fb00b Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Oct 2021 17:12:57 -0500
Subject: [PATCH 3/9] sunxi: psci: Add support for H3 CPU 0 hotplug
@@ -267,16 +267,16 @@ PLL_PERIPH0 must be bypassed to prevent AHB1 from temporarily running at
Signed-off-by: Samuel Holland <samuel@sholland.org>
---
Makefile | 17 +++++++++++++++++
arch/arm/cpu/armv7/sunxi/psci.c | 31 +++++++++++++++++++++++++++++++
arch/arm/cpu/armv7/sunxi/psci.c | 33 +++++++++++++++++++++++++++++++++
arch/arm/dts/sunxi-u-boot.dtsi | 23 ++++++++++++++++++++++-
include/configs/sun8i.h | 4 ++++
4 files changed, 74 insertions(+), 1 deletion(-)
4 files changed, 76 insertions(+), 1 deletion(-)
diff --git a/Makefile b/Makefile
index 8b030f31be..6810784142 100644
index 750bbdb1b71..7ef706d79f1 100644
--- a/Makefile
+++ b/Makefile
@@ -1014,6 +1014,23 @@ ifeq ($(CONFIG_ARCH_ROCKCHIP)_$(CONFIG_SPL_FRAMEWORK),y_)
@@ -1024,6 +1024,23 @@ ifeq ($(CONFIG_ARCH_ROCKCHIP)_$(CONFIG_SPL_FRAMEWORK),y_)
INPUTS-y += u-boot.img
endif
@@ -301,7 +301,7 @@ index 8b030f31be..6810784142 100644
$(if $(CONFIG_SPL_X86_16BIT_INIT),spl/u-boot-spl.bin) \
$(if $(CONFIG_TPL_X86_16BIT_INIT),tpl/u-boot-tpl.bin)
diff --git a/arch/arm/cpu/armv7/sunxi/psci.c b/arch/arm/cpu/armv7/sunxi/psci.c
index 738ea8f281..e6bfd193e4 100644
index 098e2b12bf0..889190792e7 100644
--- a/arch/arm/cpu/armv7/sunxi/psci.c
+++ b/arch/arm/cpu/armv7/sunxi/psci.c
@@ -10,6 +10,7 @@
@@ -310,38 +310,46 @@ index 738ea8f281..e6bfd193e4 100644
+#include <asm/arch/clock.h>
#include <asm/arch/cpu.h>
#include <asm/arch/cpucfg.h>
#include <asm/arch/prcm.h>
@@ -141,6 +142,13 @@ static void __secure sunxi_set_entry_address(void *entry)
(struct sunxi_cpucfg_reg *)SUNXI_CPUCFG_BASE;
writel((u32)entry, &cpucfg->priv0);
#include <asm/armv7.h>
#include <asm/gic.h>
@@ -31,7 +32,9 @@
#define SUNXI_CPU_RST(cpu) (0x40 + (cpu) * 0x40 + 0x0)
#define SUNXI_CPU_STATUS(cpu) (0x40 + (cpu) * 0x40 + 0x8)
#define SUNXI_GEN_CTRL (0x184)
+#define SUNXI_SUPER_STANDY_FLAG (0x1a0)
#define SUNXI_PRIV0 (0x1a4)
+#define SUNXI_PRIV1 (0x1a8)
#define SUN7I_CPU1_PWR_CLAMP (0x1b0)
#define SUN7I_CPU1_PWROFF (0x1b4)
#define SUNXI_DBG_CTRL1 (0x1e4)
@@ -138,6 +141,13 @@ static void __secure sunxi_cpu_set_entry(int __always_unused cpu, void *entry)
SUNXI_R_CPUCFG_BASE + SUN8I_R528_SOFT_ENTRY);
} else {
writel((u32)entry, SUNXI_CPUCFG_BASE + SUNXI_PRIV0);
+
+#ifdef CONFIG_MACH_SUN8I_H3
+ /* Redirect CPU 0 to the secure monitor via the resume shim. */
+ writel(0x16aaefe8, &cpucfg->super_standy_flag);
+ writel(0xaa16efe8, &cpucfg->super_standy_flag);
+ writel(SUNXI_RESUME_BASE, &cpucfg->priv1);
+#endif
+ if (IS_ENABLED(CONFIG_MACH_SUN8I_H3) {
+ /* Redirect CPU 0 to the secure monitor via the resume shim. */
+ writel(0x16aaefe8, SUNXI_CPUCFG_BASE + SUNXI_SUPER_STANDY_FLAG);
+ writel(0xaa16efe8, SUNXI_CPUCFG_BASE + SUNXI_SUPER_STANDY_FLAG);
+ writel(SUNXI_RESUME_BASE, SUNXI_CPUCFG_BASE + SUNXI_PRIV1);
+ }
}
}
#endif
@@ -255,9 +263,12 @@ out:
@@ -307,7 +317,10 @@ out:
int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32 pc,
u32 context_id)
{
+ struct sunxi_ccm_reg *ccu = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
struct sunxi_cpucfg_reg *cpucfg =
(struct sunxi_cpucfg_reg *)SUNXI_CPUCFG_BASE;
u32 cpu = (mpidr & 0x3);
+ u32 cpu_clk;
+ u32 bus_clk;
/* store target PC and context id */
psci_save(cpu, pc, context_id);
@@ -274,12 +285,32 @@ int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32 pc,
@@ -324,12 +337,32 @@ int __secure psci_cpu_on(u32 __always_unused unused, u32 mpidr, u32 pc,
/* Lock CPU (Disable external debug access) */
clrbits_le32(&cpucfg->dbg_ctrl1, BIT(cpu));
sunxi_cpu_set_locking(cpu, true);
+ if (IS_ENABLED(CONFIG_MACH_SUN8I_H3) && cpu == 0) {
+ /* Save registers that will be clobbered by the BROM. */
@@ -356,7 +364,7 @@ index 738ea8f281..e6bfd193e4 100644
sunxi_cpu_set_power(cpu, true);
/* De-assert reset on target CPU */
writel(BIT(1) | BIT(0), &cpucfg->cpu[cpu].rst);
sunxi_cpu_set_reset(cpu, false);
+ if (IS_ENABLED(CONFIG_MACH_SUN8I_H3) && cpu == 0) {
+ /* Spin until the BROM has clobbered the clock registers. */
@@ -369,11 +377,11 @@ index 738ea8f281..e6bfd193e4 100644
+ clrbits_le32(&ccu->pll6_cfg, BIT(25));
+ }
+
/* Unlock CPU (Disable external debug access) */
setbits_le32(&cpucfg->dbg_ctrl1, BIT(cpu));
/* Unlock CPU (Reenable external debug access) */
sunxi_cpu_set_locking(cpu, false);
diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index 1353d6e668..5d45157598 100644
index 3c6ec626ea6..55b2dbd7992 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -6,7 +6,11 @@
@@ -389,7 +397,7 @@ index 1353d6e668..5d45157598 100644
#define BL31_ADDR 0x00044000
#define SCP_ADDR 0x00050000
#elif defined(CONFIG_MACH_SUN50I_H6)
@@ -81,6 +85,20 @@
@@ -88,6 +92,20 @@
};
#endif
@@ -410,7 +418,7 @@ index 1353d6e668..5d45157598 100644
#ifdef SCP_ADDR
scp {
description = "SCP firmware";
@@ -114,6 +132,9 @@
@@ -121,6 +139,9 @@
firmware = "uboot";
#endif
loadables =
@@ -421,7 +429,7 @@ index 1353d6e668..5d45157598 100644
"scp",
#endif
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
index 608a055892..98e68e068b 100644
index 608a055892d..98e68e068bd 100644
--- a/include/configs/sun8i.h
+++ b/include/configs/sun8i.h
@@ -8,6 +8,10 @@
@@ -439,7 +447,7 @@ index 608a055892..98e68e068b 100644
2.34.1
From 1ebddf814b3f2efeeeabf473c34c366a734688f5 Mon Sep 17 00:00:00 2001
From e856c2fd27de2bf3da5882ec773285e1960e181e Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Oct 2021 14:58:27 -0500
Subject: [PATCH 4/9] remoteproc: Add a driver for the Allwinner AR100
@@ -453,7 +461,7 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
create mode 100644 drivers/remoteproc/sun6i_ar100_rproc.c
diff --git a/drivers/remoteproc/Kconfig b/drivers/remoteproc/Kconfig
index 27e4a60ff5..bcaf6a2753 100644
index 781de530aff..73b2bc5cfe1 100644
--- a/drivers/remoteproc/Kconfig
+++ b/drivers/remoteproc/Kconfig
@@ -41,6 +41,15 @@ config REMOTEPROC_STM32_COPRO
@@ -473,7 +481,7 @@ index 27e4a60ff5..bcaf6a2753 100644
bool "Support for TI's K3 based ARM64 remoteproc driver"
select REMOTEPROC
diff --git a/drivers/remoteproc/Makefile b/drivers/remoteproc/Makefile
index fbe9c172bc..9529844b2a 100644
index e09ed1aa4d4..6e788662ce7 100644
--- a/drivers/remoteproc/Makefile
+++ b/drivers/remoteproc/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_$(SPL_)REMOTEPROC) += rproc-uclass.o rproc-elf-loader.o
@@ -486,7 +494,7 @@ index fbe9c172bc..9529844b2a 100644
obj-$(CONFIG_REMOTEPROC_TI_K3_R5F) += ti_k3_r5f_rproc.o
diff --git a/drivers/remoteproc/sun6i_ar100_rproc.c b/drivers/remoteproc/sun6i_ar100_rproc.c
new file mode 100644
index 0000000000..c94f6c752b
index 00000000000..c94f6c752bd
--- /dev/null
+++ b/drivers/remoteproc/sun6i_ar100_rproc.c
@@ -0,0 +1,111 @@
@@ -605,7 +613,7 @@ index 0000000000..c94f6c752b
2.34.1
From 53bf73ab3356bc4c05cf4570661cf52e5a0ddc8e Mon Sep 17 00:00:00 2001
From 617f16f5ec1e38620b162746559f01d32108291d Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Oct 2021 15:04:16 -0500
Subject: [PATCH 5/9] arm: dts: sunxi: h3: Add nodes for AR100 remoteproc
@@ -616,7 +624,7 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
1 file changed, 14 insertions(+)
diff --git a/arch/arm/dts/sun8i-h3.dtsi b/arch/arm/dts/sun8i-h3.dtsi
index eac2349a23..b88dcd4272 100644
index eac2349a238..b88dcd42720 100644
--- a/arch/arm/dts/sun8i-h3.dtsi
+++ b/arch/arm/dts/sun8i-h3.dtsi
@@ -170,6 +170,14 @@
@@ -651,7 +659,7 @@ index eac2349a23..b88dcd4272 100644
2.34.1
From 681163212274988bb6d826232da09289c6c2b0ea Mon Sep 17 00:00:00 2001
From ccd19c93d7ba4f9ffc77e2a4acce7f97023fb6fc Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 17 Apr 2021 13:33:54 -0500
Subject: [PATCH 6/9] sunxi: Enable support for SCP firmware on H3
@@ -669,7 +677,7 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
3 files changed, 12 insertions(+)
diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index 5d45157598..36b55c8b80 100644
index 55b2dbd7992..b8585dea2a6 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -9,6 +9,7 @@
@@ -681,7 +689,7 @@ index 5d45157598..36b55c8b80 100644
#elif defined(CONFIG_MACH_SUN50I) || defined(CONFIG_MACH_SUN50I_H5)
#define BL31_ADDR 0x00044000
diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index ca9c1cd9e2..289a9d93cb 100644
index ec45ed3e05f..95513a651b1 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -19,6 +19,7 @@
@@ -692,7 +700,7 @@ index ca9c1cd9e2..289a9d93cb 100644
#include <axp_pmic.h>
#include <generic-phy.h>
#include <phy-sun4i-usb.h>
@@ -881,6 +882,13 @@ int board_late_init(void)
@@ -866,6 +867,13 @@ int board_late_init(void)
usb_ether_init();
#endif
@@ -707,7 +715,7 @@ index ca9c1cd9e2..289a9d93cb 100644
}
diff --git a/include/configs/sun8i.h b/include/configs/sun8i.h
index 98e68e068b..506ce35707 100644
index 98e68e068bd..506ce357078 100644
--- a/include/configs/sun8i.h
+++ b/include/configs/sun8i.h
@@ -12,6 +12,9 @@
@@ -724,7 +732,7 @@ index 98e68e068b..506ce35707 100644
2.34.1
From 56b6ac0956fe69cb30d42042d8e20c4fdca4b906 Mon Sep 17 00:00:00 2001
From 9058b73486acedc5230679232574c678ef346546 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Oct 2021 22:43:26 -0500
Subject: [PATCH 7/9] arm: psci: Add definitions for PSCI v1.1
@@ -744,10 +752,10 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
4 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
index e33e53636a..7d58d1837b 100644
index 4eb34b7b449..ec3d31e7505 100644
--- a/arch/arm/cpu/armv7/Kconfig
+++ b/arch/arm/cpu/armv7/Kconfig
@@ -80,6 +80,9 @@ choice
@@ -91,6 +91,9 @@ choice
help
Select the supported PSCI version.
@@ -758,7 +766,7 @@ index e33e53636a..7d58d1837b 100644
bool "PSCI V1.0"
diff --git a/arch/arm/include/asm/psci.h b/arch/arm/include/asm/psci.h
index 7343b941ef..27c2d15521 100644
index 7343b941ef0..27c2d15521f 100644
--- a/arch/arm/include/asm/psci.h
+++ b/arch/arm/include/asm/psci.h
@@ -22,9 +22,9 @@
@@ -782,10 +790,10 @@ index 7343b941ef..27c2d15521 100644
/* 1KB stack per core */
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 87d1c77e8b..bcbb999b49 100644
index 0eae857e73a..63f0c4c39ea 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -557,16 +557,20 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop);
@@ -558,16 +558,20 @@ void mmu_page_table_flush(unsigned long start, unsigned long stop);
#ifdef CONFIG_ARMV7_PSCI
void psci_arch_cpu_entry(void);
void psci_arch_init(void);
@@ -812,7 +820,7 @@ index 87d1c77e8b..bcbb999b49 100644
#endif /* __ASSEMBLY__ */
diff --git a/arch/arm/lib/psci-dt.c b/arch/arm/lib/psci-dt.c
index 903b335704..ea9d1c8355 100644
index 903b3357048..ea9d1c8355c 100644
--- a/arch/arm/lib/psci-dt.c
+++ b/arch/arm/lib/psci-dt.c
@@ -66,6 +66,8 @@ int fdt_psci(void *fdt)
@@ -828,7 +836,7 @@ index 903b335704..ea9d1c8355 100644
2.34.1
From d40b63cac6dcffa2f3b199cca3775138edccbbeb Mon Sep 17 00:00:00 2001
From ff51f57f8cdbeeef4366f0c95675b8641bc6dcef Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Oct 2021 23:01:05 -0500
Subject: [PATCH 8/9] sunxi: psci: Delegate PSCI to SCPI
@@ -847,10 +855,10 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
create mode 100644 arch/arm/cpu/armv7/sunxi/psci-scpi.c
diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
index 7d58d1837b..cbcae209dc 100644
index ec3d31e7505..9dccc122538 100644
--- a/arch/arm/cpu/armv7/Kconfig
+++ b/arch/arm/cpu/armv7/Kconfig
@@ -75,6 +75,7 @@ config ARMV7_PSCI
@@ -86,6 +86,7 @@ config ARMV7_PSCI
choice
prompt "Supported PSCI version"
depends on ARMV7_PSCI
@@ -859,7 +867,7 @@ index 7d58d1837b..cbcae209dc 100644
default ARMV7_PSCI_1_0
help
diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile
index 3e975b366c..6473b9acbd 100644
index 3e975b366c4..6473b9acbde 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -13,8 +13,12 @@ obj-$(CONFIG_MACH_SUN6I) += sram.o
@@ -877,7 +885,7 @@ index 3e975b366c..6473b9acbd 100644
obj-y += fel_utils.o
diff --git a/arch/arm/cpu/armv7/sunxi/psci-scpi.c b/arch/arm/cpu/armv7/sunxi/psci-scpi.c
new file mode 100644
index 0000000000..cf85292a8f
index 00000000000..9672eae8aef
--- /dev/null
+++ b/arch/arm/cpu/armv7/sunxi/psci-scpi.c
@@ -0,0 +1,451 @@
@@ -889,7 +897,6 @@ index 0000000000..cf85292a8f
+
+#include <common.h>
+#include <asm/arch/cpu.h>
+#include <asm/arch/cpucfg.h>
+#include <asm/armv7.h>
+#include <asm/gic.h>
+#include <asm/io.h>
@@ -926,6 +933,10 @@ index 0000000000..cf85292a8f
+#define RX_IRQ(n) BIT(0 + 2 * (n))
+#define TX_IRQ(n) BIT(1 + 2 * (n))
+
+#define SUNXI_SUPER_STANDY_FLAG (0x1a0)
+#define SUNXI_PRIV0 (0x1a4)
+#define SUNXI_PRIV1 (0x1a8)
+
+enum {
+ CORE_POWER_LEVEL = 0,
+ CLUSTER_POWER_LEVEL = 1,
@@ -1276,16 +1287,13 @@ index 0000000000..cf85292a8f
+#else
+static void __secure sunxi_set_entry_address(void *entry)
+{
+ struct sunxi_cpucfg_reg *cpucfg =
+ (struct sunxi_cpucfg_reg *)SUNXI_CPUCFG_BASE;
+
+ writel((u32)entry, &cpucfg->priv0);
+ writel((u32)entry, SUNXI_CPUCFG_BASE + SUNXI_PRIV0);
+
+#ifdef CONFIG_MACH_SUN8I_H3
+ /* Redirect CPU 0 to the secure monitor via the resume shim. */
+ writel(0x16aaefe8, &cpucfg->super_standy_flag);
+ writel(0xaa16efe8, &cpucfg->super_standy_flag);
+ writel(SUNXI_RESUME_BASE, &cpucfg->priv1);
+ writel(0x16aaefe8, SUNXI_CPUCFG_BASE + SUNXI_SUPER_STANDY_FLAG);
+ writel(0xaa16efe8, SUNXI_CPUCFG_BASE + SUNXI_SUPER_STANDY_FLAG);
+ writel(SUNXI_RESUME_BASE, SUNXI_CPUCFG_BASE + SUNXI_PRIV1);
+#endif
+}
+#endif
@@ -1336,7 +1344,7 @@ index 0000000000..cf85292a8f
2.34.1
From adc8ea72a2d4c0600339a7afed8b1f98f3c07844 Mon Sep 17 00:00:00 2001
From 51ff2947b4a9acab17a0b86215f902046d546a2e Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Wed, 8 Jun 2022 07:55:54 -0500
Subject: [PATCH 9/9] sunxi: Enable SCP/SCPI on A33 as well
@@ -1351,10 +1359,10 @@ Signed-off-by: Samuel Holland <samuel@sholland.org>
5 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/arch/arm/cpu/armv7/Kconfig b/arch/arm/cpu/armv7/Kconfig
index cbcae209dc..6a515ed6d5 100644
index 9dccc122538..e60b0049ea1 100644
--- a/arch/arm/cpu/armv7/Kconfig
+++ b/arch/arm/cpu/armv7/Kconfig
@@ -75,7 +75,7 @@ config ARMV7_PSCI
@@ -86,7 +86,7 @@ config ARMV7_PSCI
choice
prompt "Supported PSCI version"
depends on ARMV7_PSCI
@@ -1364,7 +1372,7 @@ index cbcae209dc..6a515ed6d5 100644
default ARMV7_PSCI_1_0
help
diff --git a/arch/arm/cpu/armv7/sunxi/Makefile b/arch/arm/cpu/armv7/sunxi/Makefile
index 6473b9acbd..033042666f 100644
index 6473b9acbde..033042666f0 100644
--- a/arch/arm/cpu/armv7/sunxi/Makefile
+++ b/arch/arm/cpu/armv7/sunxi/Makefile
@@ -13,7 +13,7 @@ obj-$(CONFIG_MACH_SUN6I) += sram.o
@@ -1377,10 +1385,10 @@ index 6473b9acbd..033042666f 100644
else
obj-$(CONFIG_ARMV7_PSCI) += psci.o
diff --git a/arch/arm/cpu/armv7/sunxi/psci-scpi.c b/arch/arm/cpu/armv7/sunxi/psci-scpi.c
index cf85292a8f..717c37c124 100644
index 9672eae8aef..50628693ac1 100644
--- a/arch/arm/cpu/armv7/sunxi/psci-scpi.c
+++ b/arch/arm/cpu/armv7/sunxi/psci-scpi.c
@@ -24,7 +24,11 @@
@@ -23,7 +23,11 @@
#define MPIDR_AFFLVL0(mpidr) (mpidr & 0xf)
#define MPIDR_AFFLVL1(mpidr) (mpidr >> 8 & 0xf)
@@ -1393,7 +1401,7 @@ index cf85292a8f..717c37c124 100644
#define SCPI_RX_CHANNEL 1
diff --git a/arch/arm/dts/sun8i-a23-a33.dtsi b/arch/arm/dts/sun8i-a23-a33.dtsi
index 84c6d9379a..826bcddcdf 100644
index a0cac966af3..a26edbbf317 100644
--- a/arch/arm/dts/sun8i-a23-a33.dtsi
+++ b/arch/arm/dts/sun8i-a23-a33.dtsi
@@ -138,6 +138,14 @@
@@ -1424,7 +1432,7 @@ index 84c6d9379a..826bcddcdf 100644
};
};
diff --git a/arch/arm/dts/sunxi-u-boot.dtsi b/arch/arm/dts/sunxi-u-boot.dtsi
index 36b55c8b80..a152b1f787 100644
index b8585dea2a6..ee76b16563e 100644
--- a/arch/arm/dts/sunxi-u-boot.dtsi
+++ b/arch/arm/dts/sunxi-u-boot.dtsi
@@ -6,11 +6,11 @@