linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Renesas RZ/N1D SMP enabler
@ 2018-04-17 12:47 Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 1/3] dt-bindings: cpu: Add Renesas RZ/N1D SMP enable method Michel Pollet
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Michel Pollet @ 2018-04-17 12:47 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Russell King, Florian Fainelli,
	Frank Rowand, Maxime Ripard, Andreas Färber, Chen-Yu Tsai,
	Rajendra Nayak, Juri Lelli, Carlo Caione, devicetree,
	linux-kernel, linux-arm-kernel

*WARNING -- this requires the base RZ/N1 base patches (v5) already posted

This patch series is for enabling the second CA7 of the RZ/N1D.
It's based on a spin_table method, and it reuses the same binding
property as that driver.

v2:
  + Added suggestions from Florian Fainelli
  + Use __pa_symbol()
  + Simplified logic in prepare_cpu()
  + Reordered the patches
  + Rebased on RZN1 Base patch v5

*** BLURB HERE ***

Michel Pollet (3):
  dt-bindings: cpu: Add Renesas RZ/N1D SMP enable method.
  arm: shmobile: Add the RZ/N1D SMP enabler driver
  ARM: dts: Renesas RZ/N1D SMP enable method

 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 arch/arm/boot/dts/r9a06g032.dtsi               |  2 +
 arch/arm/mach-shmobile/Makefile                |  1 +
 arch/arm/mach-shmobile/smp-r9a06g032.c         | 85 ++++++++++++++++++++++++++
 4 files changed, 89 insertions(+)
 create mode 100644 arch/arm/mach-shmobile/smp-r9a06g032.c

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/3] dt-bindings: cpu: Add Renesas RZ/N1D SMP enable method.
  2018-04-17 12:47 [PATCH v2 0/3] Renesas RZ/N1D SMP enabler Michel Pollet
@ 2018-04-17 12:48 ` Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 2/3] arm: shmobile: Add the RZ/N1D SMP enabler driver Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 3/3] ARM: dts: Renesas RZ/N1D SMP enable method Michel Pollet
  2 siblings, 0 replies; 4+ messages in thread
From: Michel Pollet @ 2018-04-17 12:48 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Russell King, Greg Kroah-Hartman,
	Frank Rowand, Kevin Hilman, Stefan Wahren, Andreas Färber,
	Carlo Caione, Chen-Yu Tsai, Juri Lelli, devicetree, linux-kernel,
	linux-arm-kernel

Add a special enable method for second CA8 of the Renesas RZ/N1D
(R9A06G032).

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index 29e1dc5..b395d107 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -219,6 +219,7 @@ described below.
 			    "qcom,kpss-acc-v1"
 			    "qcom,kpss-acc-v2"
 			    "renesas,apmu"
+			    "renesas,r9a06g032-smp"
 			    "rockchip,rk3036-smp"
 			    "rockchip,rk3066-smp"
 			    "ste,dbx500-smp"
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 2/3] arm: shmobile: Add the RZ/N1D SMP enabler driver
  2018-04-17 12:47 [PATCH v2 0/3] Renesas RZ/N1D SMP enabler Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 1/3] dt-bindings: cpu: Add Renesas RZ/N1D SMP enable method Michel Pollet
@ 2018-04-17 12:48 ` Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 3/3] ARM: dts: Renesas RZ/N1D SMP enable method Michel Pollet
  2 siblings, 0 replies; 4+ messages in thread
From: Michel Pollet @ 2018-04-17 12:48 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Russell King, Andreas Färber,
	Rajendra Nayak, Maxime Ripard, Frank Rowand, Florian Fainelli,
	Carlo Caione, Juri Lelli, devicetree, linux-kernel,
	linux-arm-kernel

The Renesas RZ/N1D second CA7 is parked in a ROM pen at boot time, it
requires a special enable method to get it started.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 arch/arm/mach-shmobile/Makefile        |  1 +
 arch/arm/mach-shmobile/smp-r9a06g032.c | 85 ++++++++++++++++++++++++++++++++++
 2 files changed, 86 insertions(+)
 create mode 100644 arch/arm/mach-shmobile/smp-r9a06g032.c

diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index 1939f52..d7fc98f 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -34,6 +34,7 @@ smp-$(CONFIG_ARCH_SH73A0)	+= smp-sh73a0.o headsmp-scu.o platsmp-scu.o
 smp-$(CONFIG_ARCH_R8A7779)	+= smp-r8a7779.o headsmp-scu.o platsmp-scu.o
 smp-$(CONFIG_ARCH_R8A7790)	+= smp-r8a7790.o
 smp-$(CONFIG_ARCH_R8A7791)	+= smp-r8a7791.o
+smp-$(CONFIG_ARCH_R9A06G032)	+= smp-r9a06g032.o
 smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o headsmp-scu.o platsmp-scu.o
 
 # PM objects
diff --git a/arch/arm/mach-shmobile/smp-r9a06g032.c b/arch/arm/mach-shmobile/smp-r9a06g032.c
new file mode 100644
index 0000000..a536e89
--- /dev/null
+++ b/arch/arm/mach-shmobile/smp-r9a06g032.c
@@ -0,0 +1,85 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * RZ/N1D Second CA7 enabler.
+ *
+ * Copyright (C) 2018 Renesas Electronics Europe Limited
+ *
+ * Michel Pollet <michel.pollet@bp.renesas.com>, <buserror@gmail.com>
+ * Derived from action,s500-smp
+ */
+
+#include <linux/delay.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/smp.h>
+#include <asm/cacheflush.h>
+#include <asm/smp_plat.h>
+#include <asm/smp_scu.h>
+
+/*
+ * The second CPU is parked in ROM at boot time. It requires waking it after
+ * writing an address into the BOOTADDR register of sysctrl.
+ *
+ * So the default value of the "cpu-release-addr" corresponds to BOOTADDR...
+ *
+ * *However* the BOOTADDR register is not available when the kernel
+ * starts in NONSEC mode.
+ *
+ * So for NONSEC mode, the bootloader re-parks the second CPU into a pen
+ * in SRAM, and changes the "cpu-release-addr" of linux's DT to a SRAM address,
+ * which is not restricted.
+ */
+
+static void __iomem *cpu_bootaddr;
+
+static DEFINE_SPINLOCK(cpu_lock);
+
+static int rzn1_smp_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	if (!cpu_bootaddr)
+		return -ENODEV;
+
+	spin_lock(&cpu_lock);
+
+	writel(__pa_symbol(secondary_startup), cpu_bootaddr);
+	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+	spin_unlock(&cpu_lock);
+
+	return 0;
+}
+
+static void __init rzn1_smp_prepare_cpus(unsigned int max_cpus)
+{
+	struct device_node *dn;
+	int ret;
+	u32 bootaddr;
+
+	dn = of_get_cpu_node(1, NULL);
+	if (!dn) {
+		pr_err("CPU#1: missing device tree node\n");
+		return;
+	}
+	/*
+	 * Determine the address from which the CPU is polling.
+	 * The bootloader *does* change this property
+	 */
+	ret = of_property_read_u32(dn, "cpu-release-addr", &bootaddr);
+	of_node_put(dn);
+	if (ret) {
+		pr_err("CPU#1: invalid cpu-release-addr property\n");
+		return;
+	}
+	pr_info("CPU#1: cpu-release-addr %08x\n", (u32)bootaddr);
+
+	cpu_bootaddr = ioremap(bootaddr, sizeof(bootaddr));
+	if (!cpu_bootaddr)
+		pr_err("CPU#1: cpu-release-addr map failed\n");
+}
+
+static const struct smp_operations rzn1_smp_ops __initconst = {
+	.smp_prepare_cpus = rzn1_smp_prepare_cpus,
+	.smp_boot_secondary = rzn1_smp_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(rzn1_smp, "renesas,r9a06g032-smp", &rzn1_smp_ops);
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v2 3/3] ARM: dts: Renesas RZ/N1D SMP enable method
  2018-04-17 12:47 [PATCH v2 0/3] Renesas RZ/N1D SMP enabler Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 1/3] dt-bindings: cpu: Add Renesas RZ/N1D SMP enable method Michel Pollet
  2018-04-17 12:48 ` [PATCH v2 2/3] arm: shmobile: Add the RZ/N1D SMP enabler driver Michel Pollet
@ 2018-04-17 12:48 ` Michel Pollet
  2 siblings, 0 replies; 4+ messages in thread
From: Michel Pollet @ 2018-04-17 12:48 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Russell King, Kevin Hilman,
	Andy Gross, Maxime Ripard, Andreas Färber, Carlo Caione,
	Frank Rowand, Juri Lelli, devicetree, linux-kernel,
	linux-arm-kernel

Add a special enable method for the second CA7 of the Renesas RZ/N1D
(R9A06G032), as well as the default value for the "cpu-release-addr"
property.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
---
 arch/arm/boot/dts/r9a06g032.dtsi | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/boot/dts/r9a06g032.dtsi b/arch/arm/boot/dts/r9a06g032.dtsi
index 23c56d7..170376d 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -33,6 +33,8 @@
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <1>;
+			enable-method = "renesas,r9a06g032-smp";
+			cpu-release-addr = <0x4000c204>;
 		};
 	};
 
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-04-17 12:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 12:47 [PATCH v2 0/3] Renesas RZ/N1D SMP enabler Michel Pollet
2018-04-17 12:48 ` [PATCH v2 1/3] dt-bindings: cpu: Add Renesas RZ/N1D SMP enable method Michel Pollet
2018-04-17 12:48 ` [PATCH v2 2/3] arm: shmobile: Add the RZ/N1D SMP enabler driver Michel Pollet
2018-04-17 12:48 ` [PATCH v2 3/3] ARM: dts: Renesas RZ/N1D SMP enable method Michel Pollet

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).