Skip to contentSkip to conversation

enable HiX5HD2 SoC

PATCH Superseded Haojian Zhuang 2 participants 10 messages May 12, 2014

Subsystems (5)

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

cover enable HiX5HD2 SoC

Haifeng Yan (4):
ARM: debug: Rename Hi3716 to HI5XHD2
ARM: hisi: enable hix5hd2 SoC
ARM: hisi: Add hix5hd2 SoC support.
ARM: dts: Add hix5hd2-dkb dts file.

Haojian Zhuang (1):
ARM: config: add ARCH_HIX5HD2 in hi3xxx_defconfig

 arch/arm/Kconfig.debug            |  20 ++--
 arch/arm/boot/dts/Makefile        |   1 +
 arch/arm/boot/dts/hix5hd2-dkb.dts |  56 +++++++++++
 arch/arm/boot/dts/hix5hd2.dtsi    | 189 ++++++++++++++++++++++++++++++++++++++
 arch/arm/configs/hi3xxx_defconfig |   1 +
 arch/arm/mach-hisi/Kconfig        |  13 ++-
 arch/arm/mach-hisi/Makefile       |   1 +
 arch/arm/mach-hisi/core.h         |   3 +
 arch/arm/mach-hisi/headsmp.S      |  39 ++++++++
 arch/arm/mach-hisi/hisilicon.c    |  31 +++++++
 arch/arm/mach-hisi/hotplug.c      |  36 ++++++++
 arch/arm/mach-hisi/platsmp.c      |  70 +++++++++++++-
 12 files changed, 445 insertions(+), 15 deletions(-)
 create mode 100644 arch/arm/boot/dts/hix5hd2-dkb.dts
 create mode 100644 arch/arm/boot/dts/hix5hd2.dtsi
 create mode 100644 arch/arm/mach-hisi/headsmp.S
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/5 ARM: debug: Rename Hi3716 to HI5XHD2

From: Haifeng Yan <[email protected]>

Rename Hisilicon HI3716 to HI5XHD2. And it relies on ARCH_HI5XHD2 instead.

---
 arch/arm/Kconfig.debug | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
arch/arm/Kconfig.debug +10 -10
index 5a311af..df930e5 100644
@@ -215,14 +215,6 @@ choice
 		  Say Y here if you want kernel low-level debugging support
 		  on HI3620 UART.
 
-	config DEBUG_HI3716_UART
-		bool "Hisilicon Hi3716 Debug UART"
-		depends on ARCH_HI3xxx
-		select DEBUG_UART_PL01X
-		help
-		  Say Y here if you want kernel low-level debugging support
-		  on HI3716 UART.
-
 	config DEBUG_HIP04_UART
 		bool "Hisilicon HiP04 Debug UART"
 		depends on ARCH_HIP04
@@ -231,6 +223,14 @@ choice
 		  Say Y here if you want kernel low-level debugging support
 		  on HIP04 UART.
 
+	config DEBUG_HIX5HD2_UART
+		bool "Hisilicon Hix5hd2 Debug UART"
+		depends on ARCH_HIX5HD2
+		select DEBUG_UART_PL01X
+		help
+		  Say Y here if you want kernel low-level debugging support
+		  on Hix5hd2 UART.
+
 	config DEBUG_HIGHBANK_UART
 		bool "Kernel low-level debugging messages via Highbank UART"
 		depends on ARCH_HIGHBANK
@@ -1058,7 +1058,7 @@ config DEBUG_UART_PHYS
 	default 0xf1012000 if ARCH_DOVE || ARCH_KIRKWOOD || ARCH_MV78XX0 || \
 				ARCH_ORION5X
 	default 0xf7fc9000 if DEBUG_BERLIN_UART
-	default 0xf8b00000 if DEBUG_HI3716_UART
+	default 0xf8b00000 if DEBUG_HIX5HD2_UART
 	default 0xfcb00000 if DEBUG_HI3620_UART
 	default 0xfe800000 if ARCH_IOP32X
 	default 0xffc02000 if DEBUG_SOCFPGA_UART
@@ -1101,7 +1101,7 @@ config DEBUG_UART_VIRT
 	default 0xfe230000 if DEBUG_PICOXCELL_UART
 	default 0xfe300000 if DEBUG_BCM_KONA_UART
 	default 0xfe800000 if ARCH_IOP32X
-	default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HI3716_UART
+	default 0xfeb00000 if DEBUG_HI3620_UART || DEBUG_HIX5HD2_UART
 	default 0xfeb24000 if DEBUG_RK3X_UART0
 	default 0xfeb26000 if DEBUG_RK3X_UART1
 	default 0xfeb30c00 if DEBUG_KEYSTONE_UART0
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/5 ARM: debug: Rename Hi3716 to HI5XHD2

Quoted 4 lines · Haojian Zhuang

From: Haifeng Yan <[email protected]>

Rename Hisilicon HI3716 to HI5XHD2. And it relies on ARCH_HI5XHD2 instead.

In general, we never rename platforms in the kernel. Why are you renaming in this case? What is HI5XHD2? All of this should already have been part of the patch description.

-Olof

#3 lore raw

PATCH 2/5 ARM: hisi: enable hix5hd2 SoC

In reply to Haojian Zhuang

From: Haifeng Yan <[email protected]>

Enable HiX5HD2 SoC.
Add ARCH_HIX5HD2 to support Hisilicon x5hd2 SoCs.

---
 arch/arm/mach-hisi/Kconfig | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
arch/arm/mach-hisi/Kconfig +11 -2
index 0a5a49d..94b7ff1 100644
@@ -10,14 +10,14 @@ if ARCH_HISI
 menu "Hisilicon platform type"
 
 config ARCH_HI3xxx
-	bool "Hisilicon Hi36xx/Hi37xx family" if ARCH_MULTI_V7
+	bool "Hisilicon Hi36xx family" if ARCH_MULTI_V7
 	select CACHE_L2X0
 	select HAVE_ARM_SCU if SMP
 	select HAVE_ARM_TWD if SMP
 	select PINCTRL
 	select PINCTRL_SINGLE
 	help
-	  Support for Hisilicon Hi36xx/Hi37xx SoC family
+	  Support for Hisilicon Hi36xx SoC family
 
 config ARCH_HIP04
 	bool "Hisilicon HiP04 Cortex A15 family" if ARCH_MULTI_V7
@@ -28,6 +28,15 @@ config ARCH_HIP04
 	help
 	  Support for Hisilicon HiP04 SoC family
 
+config ARCH_HIX5HD2
+	bool "Hisilicon X5HD2 family" if ARCH_MULTI_V7
+	select CACHE_L2X0
+	select HAVE_ARM_SCU if SMP
+	select HAVE_ARM_TWD if SMP
+	select PINCTRL
+	select PINCTRL_SINGLE
+	help
+	  Support for Hisilicon X5HD2 SoC family
 endmenu
 
 endif
Signature · 1 line
1.9.1
#4 lore raw

PATCH 2/5 ARM: hisi: enable hix5hd2 SoC

Quoted 3 lines · Haojian Zhuang

From: Haifeng Yan <[email protected]>

Enable HiX5HD2 SoC.

What's this SoC? Please provide a brief description of it with your patch.

-Olof

#5 lore raw

PATCH 3/5 ARM: hisi: Add hix5hd2 SoC support.

In reply to Haojian Zhuang

From: Haifeng Yan <[email protected]>

Add SoC support for Hisilicon x5hd2 SoC.

---
 arch/arm/mach-hisi/Makefile    |  1 +
 arch/arm/mach-hisi/core.h      |  3 ++
 arch/arm/mach-hisi/headsmp.S   | 39 +++++++++++++++++++++++
 arch/arm/mach-hisi/hisilicon.c | 31 +++++++++++++++++++
 arch/arm/mach-hisi/hotplug.c   | 36 ++++++++++++++++++++++
 arch/arm/mach-hisi/platsmp.c   | 70 ++++++++++++++++++++++++++++++++++++++++--
 6 files changed, 177 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-hisi/headsmp.S
arch/arm/mach-hisi/Makefile +1 -0
index e7a8640..428daf6 100644
@@ -3,5 +3,6 @@
 #
 
 obj-y	+= hisilicon.o
+obj-$(CONFIG_ARCH_HIX5HD2)	+= headsmp.o
 obj-$(CONFIG_MCPM)		+= platmcpm.o
 obj-$(CONFIG_SMP)		+= platsmp.o hotplug.o
arch/arm/mach-hisi/core.h +3 -0
index 1e60795..be15620 100644
@@ -13,5 +13,8 @@ extern int hi3xxx_cpu_kill(unsigned int cpu);
 extern void hi3xxx_set_cpu(int cpu, bool enable);
 
 extern bool __init hip04_smp_init_ops(void);
+extern void hix5hd2_secondary_startup(void);
+extern struct smp_operations hix5hd2_smp_ops;
+extern void hix5hd2_set_cpu(int cpu, bool enable);
 
 #endif
arch/arm/mach-hisi/headsmp.S new file +39 -0
new file mode 100644
index 0000000..c4b2a95
@@ -0,0 +1,39 @@
+/*
+ *
+ * arch/arm/mach-hisi/headsmp.S
+ *
+ *  Copyright (c) 2014 Hisilicon Limited.
+ *  Copyright (c) 2014 Linaro Ltd.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+	__CPUINIT
+
+ENTRY(hix5hd2_secondary_startup)
+
+	/* set the cpu to SVC32 mode */
+	mrs	r0, cpsr
+	bic	r0, r0, #0x1f  /* r0 = ((~0x1F) & r0) */
+	orr	r0, r0, #0xd3  /* r0 = (0xd3 | r0)    */
+	msr	cpsr, r0
+
+	/* disable MMU stuff and caches */
+	mrc	p15, 0, r0, c1, c0, 0
+	orr	r0, r0, #0x00002000      /* clear bits 13 (--V-)   */
+	bic	r0, r0, #0x00000007      /* clear bits 2:0 (-CAM)  */
+	orr	r0, r0, #0x00000002      /* set bit 1 (--A-) Align */
+	orr	r0, r0, #0x00000800      /* set bit 12 (Z---) BTB  */
+	mcr	p15, 0, r0, c1, c0, 0
+
+	/*
+	 * Invalidate L1 I/D
+	 */
+	mcr	p15, 0, r0, c8, c7, 0    /* invalidate TLBs */
+	mcr	p15, 0, r0, c7, c5, 0    /* invalidate icache */
+	bl	v7_invalidate_l1
+	b	secondary_startup
arch/arm/mach-hisi/hisilicon.c +31 -0
index 6489e57..deaac5b 100644
@@ -26,6 +26,8 @@
 
 #define HI3620_SYSCTRL_PHYS_BASE		0xfc802000
 #define HI3620_SYSCTRL_VIRT_BASE		0xfe802000
+#define HIX5HD2_SYSCTRL_PHYS_BASE		0xf8000000
+#define HIX5HD2_SYSCTRL_VIRT_BASE		0xfe802000
 
 /*
  * This table is only for optimization. Since ioremap() could always share
@@ -45,6 +47,16 @@ static struct map_desc hi3620_io_desc[] __initdata = {
 	},
 };
 
+static struct map_desc hix5hd2_io_desc[] __initdata = {
+	{
+		/* sysctrl */
+		.pfn		= __phys_to_pfn(HIX5HD2_SYSCTRL_PHYS_BASE),
+		.virtual	= HIX5HD2_SYSCTRL_VIRT_BASE,
+		.length		= 0x1000,
+		.type		= MT_DEVICE,
+	},
+};
+
 static void __init hi3620_map_io(void)
 {
 	debug_ll_io_init();
@@ -100,3 +112,22 @@ DT_MACHINE_START(HIP04, "Hisilicon HiP04 (Flattened Device Tree)")
 	.smp_init	= smp_init_ops(hip04_smp_init_ops),
 MACHINE_END
 #endif
+
+static void __init hix5hd2_map_io(void)
+{
+	debug_ll_io_init();
+	iotable_init(hix5hd2_io_desc, ARRAY_SIZE(hix5hd2_io_desc));
+}
+
+/* hix5hd2 series */
+static const char *hix5hd2_compat[] __initconst = {
+	"hisilicon,hix5hd2-dkb",
+	NULL,
+};
+
+DT_MACHINE_START(HIX5HD2_DT, "Hisilicon X5HD2 (Flattened Device Tree)")
+	.map_io		= hix5hd2_map_io,
+	.dt_compat	= hix5hd2_compat,
+	.smp		= smp_ops(hix5hd2_smp_ops),
+	.restart	= hi3xxx_restart,
+MACHINE_END
arch/arm/mach-hisi/hotplug.c +36 -0
index abd441b..8599f57 100644
@@ -57,6 +57,9 @@
 #define CPU0_NEON_SRST_REQ_EN		(1 << 4)
 #define CPU0_SRST_REQ_EN		(1 << 0)
 
+#define HIX5HD2_PERI_CRG20		0x50
+#define CRG20_CPU1_RESET		(1 << 17)
+
 enum {
 	HI3620_CTRL,
 	ERROR_CTRL,
@@ -157,6 +160,39 @@ void hi3xxx_set_cpu(int cpu, bool enable)
 		set_cpu_hi3620(cpu, enable);
 }
 
+void hix5hd2_set_cpu(int cpu, bool enable)
+{
+	u32 val = 0;
+
+	if (!ctrl_base)
+		BUG();
+
+	if (enable) {
+		/* power on cpu1 */
+		val = readl_relaxed(ctrl_base + 0x1000);
+		val &=  ~(0x1 << 8);
+		val |= (0x1 << 7);
+		val &= ~(0x1 << 3);
+		writel_relaxed(val, ctrl_base + 0x1000);
+		/* unreset */
+		val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20);
+		val &= ~CRG20_CPU1_RESET;
+		writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20);
+	} else {
+		/* power down cpu1 */
+		val = readl_relaxed(ctrl_base + 0x1000);
+		val &=  ~(0x1 << 8);
+		val |= (0x1 << 7);
+		val |= (0x1 << 3);
+		writel_relaxed(val, ctrl_base + 0x1000);
+
+		/* reset */
+		val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20);
+		val |= CRG20_CPU1_RESET;
+		writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20);
+	}
+}
+
 static inline void cpu_enter_lowpower(void)
 {
 	unsigned int v;
arch/arm/mach-hisi/platsmp.c +67 -3

93 lines not on this page · raw message

Signature · 1 line
1.9.1
#6 lore raw

PATCH 3/5 ARM: hisi: Add hix5hd2 SoC support.

Quoted 46 lines · Haojian Zhuang

From: Haifeng Yan <[email protected]>

Add SoC support for Hisilicon x5hd2 SoC.

---
 arch/arm/mach-hisi/Makefile    |  1 +
 arch/arm/mach-hisi/core.h      |  3 ++
 arch/arm/mach-hisi/headsmp.S   | 39 +++++++++++++++++++++++
 arch/arm/mach-hisi/hisilicon.c | 31 +++++++++++++++++++
 arch/arm/mach-hisi/hotplug.c   | 36 ++++++++++++++++++++++
 arch/arm/mach-hisi/platsmp.c   | 70 ++++++++++++++++++++++++++++++++++++++++--
 6 files changed, 177 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-hisi/headsmp.S
arch/arm/mach-hisi/Makefile +1 -0
index e7a8640..428daf6 100644
@@ -3,5 +3,6 @@
 #
 
 obj-y	+= hisilicon.o
+obj-$(CONFIG_ARCH_HIX5HD2)	+= headsmp.o
 obj-$(CONFIG_MCPM)		+= platmcpm.o
 obj-$(CONFIG_SMP)		+= platsmp.o hotplug.o
arch/arm/mach-hisi/core.h +3 -0
index 1e60795..be15620 100644
@@ -13,5 +13,8 @@ extern int hi3xxx_cpu_kill(unsigned int cpu);
 extern void hi3xxx_set_cpu(int cpu, bool enable);
 
 extern bool __init hip04_smp_init_ops(void);
+extern void hix5hd2_secondary_startup(void);
+extern struct smp_operations hix5hd2_smp_ops;
+extern void hix5hd2_set_cpu(int cpu, bool enable);
 
 #endif
arch/arm/mach-hisi/headsmp.S new file +0 -0
new file mode 100644
index 0000000..c4b2a95

arch/arm/mach-hisi/headsmp.S line 3

Quoted 3 lines
arch/arm/mach-hisi/headsmp.S new file +3 -0
@@ -0,0 +1,39 @@
+/*
+ *
+ * arch/arm/mach-hisi/headsmp.S

File names in files don't make much sense. I know some platforms have them for legacy reasons, but let's not add new ones.

Quoted 44 lines
arch/arm/mach-hisi/headsmp.S new file +29 -0
+ */
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+	__CPUINIT
+
+ENTRY(hix5hd2_secondary_startup)
+
+	/* set the cpu to SVC32 mode */
+	mrs	r0, cpsr
+	bic	r0, r0, #0x1f  /* r0 = ((~0x1F) & r0) */
+	orr	r0, r0, #0xd3  /* r0 = (0xd3 | r0)    */
+	msr	cpsr, r0
+
+	/* disable MMU stuff and caches */
+	mrc	p15, 0, r0, c1, c0, 0
+	orr	r0, r0, #0x00002000      /* clear bits 13 (--V-)   */
+	bic	r0, r0, #0x00000007      /* clear bits 2:0 (-CAM)  */
+	orr	r0, r0, #0x00000002      /* set bit 1 (--A-) Align */
+	orr	r0, r0, #0x00000800      /* set bit 12 (Z---) BTB  */
+	mcr	p15, 0, r0, c1, c0, 0
+
+	/*
+	 * Invalidate L1 I/D
+	 */
+	mcr	p15, 0, r0, c8, c7, 0    /* invalidate TLBs */
+	mcr	p15, 0, r0, c7, c5, 0    /* invalidate icache */
+	bl	v7_invalidate_l1
+	b	secondary_startup
arch/arm/mach-hisi/hisilicon.c +2 -0
index 6489e57..deaac5b 100644
@@ -26,6 +26,8 @@
 
 #define HI3620_SYSCTRL_PHYS_BASE		0xfc802000
 #define HI3620_SYSCTRL_VIRT_BASE		0xfe802000
+#define HIX5HD2_SYSCTRL_PHYS_BASE		0xf8000000
+#define HIX5HD2_SYSCTRL_VIRT_BASE		0xfe802000
 
 /*
  * This table is only for optimization. Since ioremap() could always share
@@ -45,6 +47,16 @@ static struct map_desc hi3620_io_desc[] __initdata = {
 	},

arch/arm/mach-hisi/hisilicon.c static struct map_desc hi3620_io_desc[] __initdata = { · line 57

Quoted 10 lines
arch/arm/mach-hisi/hisilicon.c +8 -0
 };
 
+static struct map_desc hix5hd2_io_desc[] __initdata = {
+	{
+		/* sysctrl */
+		.pfn		= __phys_to_pfn(HIX5HD2_SYSCTRL_PHYS_BASE),
+		.virtual	= HIX5HD2_SYSCTRL_VIRT_BASE,
+		.length		= 0x1000,
+		.type		= MT_DEVICE,
+	},

This already has an entry in the DT, you shouldn't need a io_desc for it?

Quoted 99 lines
arch/arm/mach-hisi/hotplug.c +36 -0
index abd441b..8599f57 100644
@@ -57,6 +57,9 @@
 #define CPU0_NEON_SRST_REQ_EN		(1 << 4)
 #define CPU0_SRST_REQ_EN		(1 << 0)
 
+#define HIX5HD2_PERI_CRG20		0x50
+#define CRG20_CPU1_RESET		(1 << 17)
+
 enum {
 	HI3620_CTRL,
 	ERROR_CTRL,
@@ -157,6 +160,39 @@ void hi3xxx_set_cpu(int cpu, bool enable)
 		set_cpu_hi3620(cpu, enable);
 }
 
+void hix5hd2_set_cpu(int cpu, bool enable)
+{
+	u32 val = 0;
+
+	if (!ctrl_base)
+		BUG();
+
+	if (enable) {
+		/* power on cpu1 */
+		val = readl_relaxed(ctrl_base + 0x1000);
+		val &=  ~(0x1 << 8);
+		val |= (0x1 << 7);
+		val &= ~(0x1 << 3);
+		writel_relaxed(val, ctrl_base + 0x1000);
+		/* unreset */
+		val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20);
+		val &= ~CRG20_CPU1_RESET;
+		writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20);
+	} else {
+		/* power down cpu1 */
+		val = readl_relaxed(ctrl_base + 0x1000);
+		val &=  ~(0x1 << 8);
+		val |= (0x1 << 7);
+		val |= (0x1 << 3);
+		writel_relaxed(val, ctrl_base + 0x1000);
+
+		/* reset */
+		val = readl_relaxed(ctrl_base + HIX5HD2_PERI_CRG20);
+		val |= CRG20_CPU1_RESET;
+		writel_relaxed(val, ctrl_base + HIX5HD2_PERI_CRG20);
+	}
+}
+
 static inline void cpu_enter_lowpower(void)
 {
 	unsigned int v;
arch/arm/mach-hisi/platsmp.c +11 -3
index 471f1ee..3f83921 100644
@@ -17,6 +17,8 @@
 
 #include "core.h"
 
+#define HIX5HD2_BOOT_ADDRESS		0xffff0000
+
 static void __iomem *ctrl_base;
 
 void hi3xxx_set_cpu_jump(int cpu, void *jump_addr)
@@ -35,11 +37,9 @@ int hi3xxx_get_cpu_jump(int cpu)
 	return readl_relaxed(ctrl_base + ((cpu - 1) << 2));
 }
 
-static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
+static void __init hisi_enable_scu_a9(void)
 {
-	struct device_node *np = NULL;
 	unsigned long base = 0;
-	u32 offset = 0;
 	void __iomem *scu_base = NULL;
 
 	if (scu_a9_has_base()) {
@@ -52,6 +52,14 @@ static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
 		scu_enable(scu_base);
 		iounmap(scu_base);
 	}
+}
+
+static void __init hi3xxx_smp_prepare_cpus(unsigned int max_cpus)
+{
+	struct device_node *np = NULL;
+	u32 offset = 0;
+
+	hisi_enable_scu_a9();
 	if (!ctrl_base) {
 		np = of_find_compatible_node(NULL, NULL, "hisilicon,sysctrl");
 		if (!np) {
@@ -87,3 +95,59 @@ struct smp_operations hi3xxx_smp_ops __initdata = {
 	.cpu_kill		= hi3xxx_cpu_kill,
 #endif
 };

arch/arm/mach-hisi/platsmp.c struct smp_operations hi3xxx_smp_ops __initdata = { · line 107

Quoted 10 lines
arch/arm/mach-hisi/platsmp.c +10 -0
+
+static void __init hix5hd2_smp_prepare_cpus(unsigned int max_cpus)
+{
+	struct device_node *np = NULL;
+
+	hisi_enable_scu_a9();
+
+	if (ctrl_base)
+		return;
+	np = of_find_compatible_node(NULL, NULL, "hisilicon,cpuctrl");

I don't see this documented anywhere. This needs a binding doc.

arch/arm/mach-hisi/platsmp.c struct smp_operations hi3xxx_smp_ops __initdata = { · line 119

Quoted 12 lines
arch/arm/mach-hisi/platsmp.c +12 -0
+	if (np) {
+		ctrl_base = of_iomap(np, 0);
+		if (!ctrl_base) {
+			pr_err("failed to map address\n");
+			return;
+		}
+	}
+}
+
+
+/*
+ * copy startup code to sram, and flash cache.

'flush' cache? I don't see you flushing cache here anywhere.

arch/arm/mach-hisi/platsmp.c struct smp_operations hi3xxx_smp_ops __initdata = { · line 130

Quoted 11 lines
arch/arm/mach-hisi/platsmp.c +11 -0
+ * @start_addr: slave start phy address
+ * @jump_addr: slave jump phy address
+ */
+void hix5hd2_set_scu_boot_addr(unsigned int start_addr, unsigned int jump_addr)
+{
+	void __iomem *virt;
+
+	virt = ioremap(start_addr, PAGE_SIZE);
+
+	*(unsigned int *)virt++ = 0xe51ff004; /* ldr  pc, [pc, #-4] */
+	*(unsigned int *)virt++ = jump_addr;  /* pc jump phy address */

Ouch. If you ioremap, then you need to use the io accessors. No open coding like this.

arch/arm/mach-hisi/platsmp.c struct smp_operations hi3xxx_smp_ops __initdata = { · line 136

Quoted 6 lines
arch/arm/mach-hisi/platsmp.c +6 -0
+	iounmap(virt);
+}
+
+static int hix5hd2_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned int jumpaddr;

phys_addr_t (then there's no need to cast below).

arch/arm/mach-hisi/platsmp.c struct smp_operations hi3xxx_smp_ops __initdata = { · line 140

Quoted 3 lines
arch/arm/mach-hisi/platsmp.c +3 -0
+	jumpaddr = (unsigned int)virt_to_phys(hix5hd2_secondary_startup);
+	hix5hd2_set_scu_boot_addr(HIX5HD2_BOOT_ADDRESS, jumpaddr);
+	hix5hd2_set_cpu(cpu, true);

Since you manually call set_cpu here, and just take two separate code paths through that function depending on the second argument, you might as well split it into two functions (hix5hd2_start_cpu() for this case, for example).

-Olof

#7 lore raw

PATCH 4/5 ARM: dts: Add hix5hd2-dkb dts file.

In reply to Haojian Zhuang

From: Haifeng Yan <[email protected]>

Add dts file for Hisilicon x5hd2 development kit board.

---
 arch/arm/boot/dts/Makefile        |   1 +
 arch/arm/boot/dts/hix5hd2-dkb.dts |  56 +++++++++++
 arch/arm/boot/dts/hix5hd2.dtsi    | 189 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 246 insertions(+)
 create mode 100644 arch/arm/boot/dts/hix5hd2-dkb.dts
 create mode 100644 arch/arm/boot/dts/hix5hd2.dtsi
arch/arm/boot/dts/Makefile +1 -0
index 7119bca..54249d9 100644
@@ -78,6 +78,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
 	exynos5440-sd5v1.dtb \
 	exynos5440-ssdk5440.dtb
 dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb
+dtb-$(CONFIG_ARCH_HIX5HD2) += hix5hd2-dkb.dtb
 dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
 	ecx-2000.dtb
 dtb-$(CONFIG_ARCH_HIP04) += hip04-d01.dtb
arch/arm/boot/dts/hix5hd2-dkb.dts new file +56 -0

56 lines not on this page · raw message

arch/arm/boot/dts/hix5hd2.dtsi new file +189 -0

189 lines not on this page · raw message

Signature · 1 line
1.9.1
#8 lore raw

PATCH 4/5 ARM: dts: Add hix5hd2-dkb dts file.

Quoted 37 lines · Haojian Zhuang

From: Haifeng Yan <[email protected]>

Add dts file for Hisilicon x5hd2 development kit board.

---
 arch/arm/boot/dts/Makefile        |   1 +
 arch/arm/boot/dts/hix5hd2-dkb.dts |  56 +++++++++++
 arch/arm/boot/dts/hix5hd2.dtsi    | 189 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 246 insertions(+)
 create mode 100644 arch/arm/boot/dts/hix5hd2-dkb.dts
 create mode 100644 arch/arm/boot/dts/hix5hd2.dtsi
arch/arm/boot/dts/Makefile +1 -0
index 7119bca..54249d9 100644
@@ -78,6 +78,7 @@ dtb-$(CONFIG_ARCH_EXYNOS) += exynos4210-origen.dtb \
 	exynos5440-sd5v1.dtb \
 	exynos5440-ssdk5440.dtb
 dtb-$(CONFIG_ARCH_HI3xxx) += hi3620-hi4511.dtb
+dtb-$(CONFIG_ARCH_HIX5HD2) += hix5hd2-dkb.dtb
 dtb-$(CONFIG_ARCH_HIGHBANK) += highbank.dtb \
 	ecx-2000.dtb
 dtb-$(CONFIG_ARCH_HIP04) += hip04-d01.dtb
arch/arm/boot/dts/hix5hd2-dkb.dts new file +5 -0
new file mode 100644
index 0000000..644458a
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2013 Linaro Ltd.
+ * Copyright (c) 2013 Hisilicon Limited.
+ *
+ *  This program is free software; you can redistribute it and/or modify

arch/arm/boot/dts/hix5hd2-dkb.dts line 15

Quoted 10 lines
arch/arm/boot/dts/hix5hd2-dkb.dts new file +10 -0
+ *  it under the terms of the GNU General Public License version 2 as
+ *  publishhed by the Free Software Foundation.
+ */
+
+/dts-v1/;
+#include "hix5hd2.dtsi"
+
+/ {
+	model = "Hisilicon HiX5HD2 Development Board";
+	compatible = "hisilicon,hix5hd2-dkb";

This should have a compatible of the SoC as well (as less specific).

Quoted 27 lines
arch/arm/boot/dts/hix5hd2-dkb.dts new file +27 -0
+	chosen {
+		bootargs = "console=ttyAMA0,115200";
+	};
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			compatible = "arm,cortex-a9";
+			device_type = "cpu";
+			reg = <0>;
+			next-level-cache = <&l2>;
+		};
+
+		cpu at 1 {
+			compatible = "arm,cortex-a9";
+			device_type = "cpu";
+			reg = <1>;
+			next-level-cache = <&l2>;
+		};
+	};
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x80000000>;
+	};

arch/arm/boot/dts/hix5hd2-dkb.dts line 53

Quoted 10 lines
arch/arm/boot/dts/hix5hd2-dkb.dts new file +10 -0
+
+	soc {
+		amba {
+			timer0: timer at f8002000 {
+				status = "okay";
+			};
+
+			uart0: uart at f8b00000 {
+				status = "okay";
+			};

This is much easier if you use a label-based syntax:

&uart0 {
	status = "okay";
};

Then you don't need to mirror the hierarchy, etc.

Quoted 9 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +3 -0
new file mode 100644
index 0000000..d8a3ad4
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2013 Linaro Ltd.
+ * Copyright (c) 2013 Hisilicon Limited.

arch/arm/boot/dts/hix5hd2.dtsi line 13

Quoted 10 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +10 -0
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * publishhed by the Free Software Foundation.
+ */
+
+#include "skeleton.dtsi"
+#include <dt-bindings/clock/hix5hd2-clock.h>
+
+/ {

You might want to add the compatible string here that will be shared for all boards of this platform. Each dts will of course override it, but it makes it easy for them to see what they should append to their more specific compatible values.

Quoted 114 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +114 -0
+	aliases {
+		serial0 = &uart0;
+	};
+
+	gic: interrupt-controller at f8a01000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <0>;
+		interrupt-controller;
+		/* gic dist base, gic cpu base */
+		reg = <0xf8a01000 0x1000>, <0xf8a00100 0x100>;
+	};
+
+	soc {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "simple-bus";
+		device_type = "soc";
+		interrupt-parent = <&gic>;
+		ranges;
+
+		amba {
+			#address-cells = <1>;
+			#size-cells = <1>;
+			compatible = "arm,amba-bus";
+			ranges;
+
+			timer0: timer at f8002000 {
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0xf8002000 0x1000>;
+				/* timer00 & timer01 */
+				interrupts = <0 24 4>;
+				clocks = <&clock HIX5HD2_FIXED_24M>;
+				status = "disabled";
+			};
+
+			timer1: timer at f8a29000 {
+				/*
+				 * Only used in NORMAL state, not available ins
+				 * SLOW or DOZE state.
+				 * The rate is fixed in 24MHz.
+				 */
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0xf8a29000 0x1000>;
+				/* timer10 & timer11 */
+				interrupts = <0 25 4>;
+				clocks = <&clock HIX5HD2_FIXED_24M>;
+				status = "disabled";
+			};
+
+			timer2: timer at f8a2a000 {
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0xf8a2a000 0x1000>;
+				/* timer20 & timer21 */
+				interrupts = <0 26 4>;
+				clocks = <&clock HIX5HD2_FIXED_24M>;
+				status = "disabled";
+			};
+
+			timer3: timer at f8a2b000 {
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0xf8a2b000 0x1000>;
+				/* timer30 & timer31 */
+				interrupts = <0 27 4>;
+				clocks = <&clock HIX5HD2_FIXED_24M>;
+				status = "disabled";
+			};
+
+			timer4: timer at f8a81000 {
+				compatible = "arm,sp804", "arm,primecell";
+				reg = <0xf8a81000 0x1000>;
+				/* timer30 & timer31 */
+				interrupts = <0 28 4>;
+				clocks = <&clock HIX5HD2_FIXED_24M>;
+				status = "disabled";
+			};
+
+			uart0: uart at f8b00000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0xf8b00000 0x1000>;
+				interrupts = <0 49 4>;
+				clocks = <&clock HIX5HD2_FIXED_83M>;
+				clock-names = "apb_pclk";
+				status = "disabled";
+			};
+
+			uart1: uart at f8006000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0xf8006000 0x1000>;
+				interrupts = <0 50 4>;
+				clocks = <&clock HIX5HD2_FIXED_83M>;
+				clock-names = "apb_pclk";
+				status = "disabled";
+			};
+
+			uart2: uart at f8b02000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0xf8b02000 0x1000>;
+				interrupts = <0 51 4>;
+				clocks = <&clock HIX5HD2_FIXED_83M>;
+				clock-names = "apb_pclk";
+				status = "disabled";
+			};
+
+			uart3: uart at f8b03000 {
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0xf8b03000 0x1000>;
+				interrupts = <0 52 4>;
+				clocks = <&clock HIX5HD2_FIXED_83M>;
+				clock-names = "apb_pclk";
+				status = "disabled";
+			};
+
+			uart4: uart at f8b04000 {

arch/arm/boot/dts/hix5hd2.dtsi line 137

Quoted 10 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +10 -0
+				compatible = "arm,pl011", "arm,primecell";
+				reg = <0xf8b04000 0x1000>;
+				interrupts = <0 53 4>;
+				clocks = <&clock HIX5HD2_FIXED_83M>;
+				clock-names = "apb_pclk";
+				status = "disabled";
+			};
+		};
+
+		local_timer at f8a00600 {

local-timer

Quoted 6 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +6 -0
+			compatible = "arm,cortex-a9-twd-timer";
+			reg = <0xf8a00600 0x20>;
+			interrupts = <1 13 0xf01>;
+		};
+
+		l2: l2-cache {

arch/arm/boot/dts/hix5hd2.dtsi line 153

Quoted 10 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +10 -0
+			compatible = "arm,pl310-cache";
+			reg = <0xf8a10000 0x100000>;
+			interrupts = <0 15 4>;
+			cache-unified;
+			cache-level = <2>;
+			hisilicon,l2cache-aux = <0x00050000 0xfff0ffff>;
+		};
+
+		/* unremovable emmc as mmcblk0 */
+		dwmmc_1: dwmmc1 at f9830000 {

The node name should be generic. Most other platforms use "mmc". No enumerating suffix in the node name.

arch/arm/boot/dts/hix5hd2.dtsi line 164

Quoted 11 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +11 -0
+			compatible = "hisilicon,hi3716-dw-mshc";
+			reg = <0xf9830000 0x1000>;
+			interrupts = <0 35 4>;
+			#address-cells = <1>;
+			#size-cells = <0>;
+			clocks = <&clock HIX5HD2_MMC_CIU_RST>, <&clock HIX5HD2_MMC_BIU_CLK>;
+			clock-names = "ciu", "biu";
+		};
+
+
+		sctrl at f8000000 {

system-controller

arch/arm/boot/dts/hix5hd2.dtsi line 171

Quoted 7 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +7 -0
+			compatible = "hisilicon,sysctrl";
+			reg = <0xf8000000 0x1000>;
+			smp_reg = <0xc0>;
+			reboot_reg = <0x4>;
+		};
+
+		clkbase at f8a22000 {

What's this? Needs a binding. Name should probably be something else too (clock-controller?)

Quoted 6 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +6 -0
+			compatible = "hisilicon,clkbase";
+			#address-cells = <1>;
+			#size-cells = <1>;
+			reg = <0xf8a22000 0x1000>;
+			ranges = <0x0 0xf8a22000 0x1000>;
+			clock: clock at 0 {

arch/arm/boot/dts/hix5hd2.dtsi line 187

Quoted 10 lines
arch/arm/boot/dts/hix5hd2.dtsi new file +10 -0
+				compatible = "hisilicon,hix5hd2-clock";
+				reg = <0x0 0x1000>;
+				#clock-cells = <1>;
+			};
+		};
+
+		cpuctrl at f8a22000 {
+			compatible = "hisilicon,cpuctrl";
+			reg = <0xf8a22000 0x2000>;
+		};

Again, as pointed out in one of the other patches, this needs a binding.

-Olof

#9 lore raw

PATCH 5/5 ARM: config: add ARCH_HIX5HD2 in hi3xxx_defconfig

In reply to Haojian Zhuang

Since both ARCH_HI3xxx and ARCH_HIX5HD2 are based on Cortex A9 & they're using similiar kernel features, make them share the same default config.

---
 arch/arm/configs/hi3xxx_defconfig | 1 +
 1 file changed, 1 insertion(+)
arch/arm/configs/hi3xxx_defconfig +1 -0
index 553e1b6..132d8c8 100644
@@ -5,6 +5,7 @@ CONFIG_BLK_DEV_INITRD=y
 CONFIG_RD_LZMA=y
 CONFIG_ARCH_HISI=y
 CONFIG_ARCH_HI3xxx=y
+CONFIG_ARCH_HIX5HD2=y
 CONFIG_SMP=y
 CONFIG_PREEMPT=y
 CONFIG_AEABI=y
Signature · 1 line
1.9.1