Skip to contentSkip to conversation

ARM: hisi: Support Hi3798 SoC

PATCH Superseded David Yang 2 participants 5 messages Mar 16, 2023

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

David Yang

author
#0 lore raw

cover ARM: hisi: Support Hi3798 SoC

This series enables booting Hi3798 SoCs.

David Yang (3):
ARM: hisi: Add S40 IO map
ARM: hisi: Add S5 IO map
ARM: hisi: Support Hi3798 SoC

 arch/arm/mach-hisi/Makefile    |   2 +-
 arch/arm/mach-hisi/core.h      |   6 ++
 arch/arm/mach-hisi/headsmp.S   |  36 ++++++++++
 arch/arm/mach-hisi/hisilicon.c |  70 ++++++++++++++++++
 arch/arm/mach-hisi/hotplug.c   | 120 +++++++++++++++++++++++++++++--
 arch/arm/mach-hisi/platsmp.c   | 128 +++++++++++++++++++++++++++++++++
 6 files changed, 357 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-hisi/headsmp.S
Signature · 1 line
2.39.2
author
#1 lore raw

PATCH 1/3 ARM: hisi: Add S40 IO map

Hisilion S40 platform supports ARM Cortex-A9 processors.

---
 arch/arm/mach-hisi/hisilicon.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
arch/arm/mach-hisi/hisilicon.c +33 -0
index b8d14b369..9f56b0f56 100644
@@ -50,3 +50,36 @@ DT_MACHINE_START(HI3620, "Hisilicon Hi3620 (Flattened Device Tree)")
 	.map_io		= hi3620_map_io,
 	.dt_compat	= hi3xxx_compat,
 MACHINE_END
+
+#define S40_IOCH1_PHYS_BASE		0xf8000000
+#define S40_IOCH1_VIRT_BASE		0xf9000000
+#define S40_IOCH1_SIZE			0x02000000
+
+static struct map_desc s40_io_desc[] __initdata = {
+	{
+		.pfn		= __phys_to_pfn(S40_IOCH1_PHYS_BASE),
+		.virtual	= S40_IOCH1_VIRT_BASE,
+		.length		= S40_IOCH1_SIZE,
+		.type		= MT_DEVICE,
+	},
+};
+
+static void __init s40_map_io(void)
+{
+	debug_ll_io_init();
+	iotable_init(s40_io_desc, ARRAY_SIZE(s40_io_desc));
+}
+
+static const char *const s40_compat[] __initconst = {
+	"hisilicon,hi3798cv200",
+	"hisilicon,hi3796mv200",
+	"hisilicon,hi3798cv200",
+	"hisilicon,hi3798mv200",
+	"hisilicon,hi3798mv300",
+	NULL,
+};
+
+DT_MACHINE_START(S40, "Hisilicon S40 (Flattened Device Tree)")
+	.map_io		= s40_map_io,
+	.dt_compat	= s40_compat,
+MACHINE_END
Signature · 1 line
2.39.2
author
#2 lore raw

PATCH 2/3 ARM: hisi: Add S5 IO map

In reply to David Yang

Hisilion S5 platform supports ARM Cortex-A7 processors.

---
 arch/arm/mach-hisi/hisilicon.c | 37 ++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
arch/arm/mach-hisi/hisilicon.c +37 -0
index 9f56b0f56..f9109df8c 100644
@@ -83,3 +83,40 @@ DT_MACHINE_START(S40, "Hisilicon S40 (Flattened Device Tree)")
 	.map_io		= s40_map_io,
 	.dt_compat	= s40_compat,
 MACHINE_END
+
+#define S5_IOCH2_PHYS_BASE		0xff000000
+#define S5_IOCH2_VIRT_BASE		0xfb000000
+#define S5_IOCH2_SIZE			0x00430000
+
+static struct map_desc s5_io_desc[] __initdata = {
+	{
+		.pfn		= __phys_to_pfn(S5_IOCH2_PHYS_BASE),
+		.virtual	= S5_IOCH2_VIRT_BASE,
+		.length		= S5_IOCH2_SIZE,
+		.type		= MT_DEVICE,
+	},
+	{
+		.pfn		= __phys_to_pfn(S40_IOCH1_PHYS_BASE),
+		.virtual	= S40_IOCH1_VIRT_BASE,
+		.length		= S40_IOCH1_SIZE,
+		.type		= MT_DEVICE,
+	},
+};
+
+static void __init s5_map_io(void)
+{
+	debug_ll_io_init();
+	iotable_init(s5_io_desc, ARRAY_SIZE(s5_io_desc));
+}
+
+static const char *const s5_compat[] __initconst = {
+	"hisilicon,hi3716cv200",
+	"hisilicon,hi3716mv410",
+	"hisilicon,hi3798mv100",
+	NULL,
+};
+
+DT_MACHINE_START(S5, "Hisilicon S5 (Flattened Device Tree)")
+	.map_io		= s5_map_io,
+	.dt_compat	= s5_compat,
+MACHINE_END
Signature · 1 line
2.39.2
author
#3 lore raw

PATCH 3/3 ARM: hisi: Support Hi3798 SoC

In reply to David Yang

Hi3798 are SoC series for IPTV STB, with Cortex A9 or A7 cores.

---
 arch/arm/mach-hisi/Makefile  |   2 +-
 arch/arm/mach-hisi/core.h    |   6 ++
 arch/arm/mach-hisi/headsmp.S |  36 ++++++++++
 arch/arm/mach-hisi/hotplug.c | 120 ++++++++++++++++++++++++++++++--
 arch/arm/mach-hisi/platsmp.c | 128 +++++++++++++++++++++++++++++++++++
 5 files changed, 287 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-hisi/headsmp.S
arch/arm/mach-hisi/Makefile +1 -1
index 39476355e..71e2f67cd 100644
@@ -7,4 +7,4 @@ CFLAGS_platmcpm.o	:= -march=armv7-a
 
 obj-y	+= hisilicon.o
 obj-$(CONFIG_MCPM)		+= platmcpm.o
-obj-$(CONFIG_SMP)		+= platsmp.o hotplug.o
+obj-$(CONFIG_SMP)		+= headsmp.o platsmp.o hotplug.o
arch/arm/mach-hisi/core.h +6 -0
index 61245274f..1ada6503b 100644
@@ -4,6 +4,9 @@
 
 #include <linux/reboot.h>
 
+extern volatile int hisi_pen_release;
+extern void hisi_secondary_startup(void);
+
 extern void hi3xxx_set_cpu_jump(int cpu, void *jump_addr);
 extern int hi3xxx_get_cpu_jump(int cpu);
 extern void secondary_startup(void);
@@ -16,4 +19,7 @@ extern void hix5hd2_set_cpu(int cpu, bool enable);
 extern void hix5hd2_cpu_die(unsigned int cpu);
 
 extern void hip01_set_cpu(int cpu, bool enable);
+
+extern void hi3798_set_cpu(int cpu, bool enable);
+extern void hi3798_cpu_die(unsigned int cpu);
 #endif
arch/arm/mach-hisi/headsmp.S new file +36 -0
new file mode 100644
index 000000000..67cfb584a
@@ -0,0 +1,36 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+/*
+ *  Copyright (c) 2003 ARM Limited
+ *  All Rights Reserved
+ */
+#include <linux/linkage.h>
+#include <linux/init.h>
+#include <asm/assembler.h>
+
+/*
+ * Hisilicon specific entry point for secondary CPUs. This provides
+ * a "holding pen" into which all secondary cores are held until we're
+ * ready for them to initialise.
+ */
+ENTRY(hisi_secondary_startup)
+ ARM_BE8(setend	be)
+	mrc	p15, 0, r0, c0, c0, 5
+	and	r0, r0, #15
+	adr	r4, 1f
+	ldmia	r4, {r5, r6}
+	sub	r4, r4, r5
+	add	r6, r6, r4
+pen:	ldr	r7, [r6]
+	cmp	r7, r0
+	bne	pen
+
+	/*
+	 * we've been released from the holding pen: secondary_stack
+	 * should now contain the SVC stack for this core
+	 */
+	b	secondary_startup
+
+	.align
+1:	.long	.
+	.long	hisi_pen_release
+ENDPROC(hisi_secondary_startup)
arch/arm/mach-hisi/hotplug.c +116 -4

162 lines not on this page · raw message

arch/arm/mach-hisi/platsmp.c +128 -0

140 lines not on this page · raw message

Signature · 1 line
2.39.2
maintainer
#4 lore raw
In reply to David Yang

Hi David,

Quoted 7 lines · David Yang

This series enables booting Hi3798 SoCs.

David Yang (3):
ARM: hisi: Add S40 IO map
ARM: hisi: Add S5 IO map
ARM: hisi: Support Hi3798 SoC

Quoted 9 lines
 arch/arm/mach-hisi/Makefile    |   2 +-
 arch/arm/mach-hisi/core.h      |   6 ++
 arch/arm/mach-hisi/headsmp.S   |  36 ++++++++++
 arch/arm/mach-hisi/hisilicon.c |  70 ++++++++++++++++++
 arch/arm/mach-hisi/hotplug.c   | 120 +++++++++++++++++++++++++++++--
 arch/arm/mach-hisi/platsmp.c   | 128 +++++++++++++++++++++++++++++++++
 6 files changed, 357 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/mach-hisi/headsmp.S

Thanks!
Series are fine to me.
Please add the device tree as well.
And I am not sure whether the ARMv7 based Hi3798 SoCs are out of support or not. I checked our website and it seems current generation SoCs are based on ARMv8.

Best Regards,
Wei