Skip to contentSkip to conversation

ARM: rockchip: smp: enable secondary rk3066a/rk3188 CPUs

PATCH Superseded Johan Jonker 2 participants 2 messages Oct 13 – Oct 16

Subsystems (3)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ARM: rockchip: smp: enable secondary rk3066a/rk3188 CPUs

Early Rockchip SoCs like rk3066a and rk3188 had boot loaders that remapped the boot ROM and the internal memory. Currently U-boot makes use of a common board file without remapping resulting in the secondary CPUs power up hanging in a wait loop.

Make the various boot loader methods work by:

* add code that disables remapping on both rk3066 and rk3188
* change to use the same boot ROM path for all socs in rockchip_boot_secondary()
* drop the rockchip_smp_prepare_sram() part

---
 arch/arm/mach-rockchip/Makefile  |   2 +-
 arch/arm/mach-rockchip/core.h    |  10 ----
 arch/arm/mach-rockchip/headsmp.S |  16 ------
 arch/arm/mach-rockchip/platsmp.c | 105 +++++++++++++++------------------------
 4 files changed, 42 insertions(+), 91 deletions(-)
arch/arm/mach-rockchip/Makefile +1 -1
index 62596d5deb88..d05123a7b711 100644
@@ -3,4 +3,4 @@ CFLAGS_platsmp.o := -march=armv7-a
 
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip.o
 obj-$(CONFIG_PM_SLEEP) += pm.o sleep.o
-obj-$(CONFIG_SMP) += headsmp.o platsmp.o
+obj-$(CONFIG_SMP) += platsmp.o
arch/arm/mach-rockchip/core.h deleted +0 -10
deleted file mode 100644
index fabcaa66607c..000000000000
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2013 MundoReader S.L.
- * Author: Heiko Stuebner <[email protected]>
- */
-
-extern char rockchip_secondary_trampoline;
-extern char rockchip_secondary_trampoline_end;
-
-extern unsigned long rockchip_boot_fn;
arch/arm/mach-rockchip/headsmp.S deleted +0 -16
deleted file mode 100644
index 37a7ea524a16..000000000000
@@ -1,16 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2013 MundoReader S.L.
- * Author: Heiko Stuebner <[email protected]>
- */
-#include <linux/linkage.h>
-#include <linux/init.h>
-
-ENTRY(rockchip_secondary_trampoline)
-	ldr	pc, 1f
-ENDPROC(rockchip_secondary_trampoline)
-	.globl	rockchip_boot_fn
-rockchip_boot_fn:
-1:	.space	4
-
-ENTRY(rockchip_secondary_trampoline_end)
arch/arm/mach-rockchip/platsmp.c +41 -64

133 lines not on this page · raw message

---
base-commit: 9d80aa4617b32f5054c5aa471d06b66704854935
change-id: 20261013-cpu-v2-b69fbe516813

Best regards,

Signature · 1 line
Johan Jonker <[email protected]>
maintainer
#1 lore raw

Hi Johan,

Am Dienstag, 13. Oktober 2026, 18:20:49 Mitteleuropäische Sommerzeit schrieb Johan Jonker via B4 Relay:

Quoted 7 lines

From: Johan Jonker <[email protected]>

Early Rockchip SoCs like rk3066a and rk3188 had boot loaders that remapped the boot ROM and the internal memory. Currently U-boot makes use of a common board file without remapping resulting in the secondary CPUs power up hanging in a wait loop.

Quoted 7 lines

Make the various boot loader methods work by:

* add code that disables remapping on both rk3066 and rk3188
* change to use the same boot ROM path for all socs in rockchip_boot_secondary()
* drop the rockchip_smp_prepare_sram() part

in general this seems to work on both my rk3188-rock and rk3066-marsboard, after I did some changes:

arch/arm/mach-rockchip/core.h line 10

Quoted 13 lines
arch/arm/mach-rockchip/core.h deleted +0 -10
@@ -1,10 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-/*
- * Copyright (c) 2013 MundoReader S.L.
- * Author: Heiko Stuebner <[email protected]>
- */
-
-extern char rockchip_secondary_trampoline;
-extern char rockchip_secondary_trampoline_end;
-
-extern unsigned long rockchip_boot_fn;

that file is included rockchip.c as well, not sure why that is in there, but this include needs to be removed too.

[...]

Quoted 4 lines
arch/arm/mach-rockchip/platsmp.c +0 -0
index f659d894bfae..ece17e9cbaca 100644

[...]

Quoted 15 lines
arch/arm/mach-rockchip/platsmp.c +8 -2
@@ -320,9 +279,27 @@ static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus)
 	for (i = 1; i < ncores; i++)
 		pmu_set_power_domain(0 + i, false);
 
+	/* Make sure that the remap function is disabled */
 	if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) {
-		if (rockchip_smp_prepare_sram(node)) {
-			of_node_put(node);
+		unsigned int reg;
+		int ret;
+
+		if (of_machine_is_compatible("rockchip,rk3066a")) {
+			reg = RK3066_GRF_SOC_CON0;
+			grf = syscon_regmap_lookup_by_compatible("rockchip,rk3066-grf");
+		} else {

arch/arm/mach-rockchip/platsmp.c static void __init rockchip_smp_prepare_cpus(unsigned int max_cpus) · line 300

Quoted 10 lines
arch/arm/mach-rockchip/platsmp.c +10 -0
+			reg = RK3188_GRF_SOC_CON0;
+			grf = syscon_regmap_lookup_by_compatible("rockchip,rk3188-grf");
+		}
+
+		if (IS_ERR(grf)) {
+			pr_err("%s: could not find grf dt node\n", __func__);
+			return;
+		}
+
+		ret = regmap_update_bits(grf, reg, NOC_REMAP, 0);

the GRF registers use highword-masks, so this should probably be like

	ret = regmap_write(grf, reg, NOC_REMAP << 16);

enabling the NOC_REMAP bit for writing and thus having "0" written to that bit.

Heiko