linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v7 0/3] Renesas R9A06G032 SMP enabler
@ 2018-06-28  8:17 Michel Pollet
  2018-06-28  8:17 ` [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method Michel Pollet
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Michel Pollet @ 2018-06-28  8:17 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Martin Blumenstingl, Florian Fainelli,
	Douglas Anderson, Kevin Hilman, Chen-Yu Tsai, Stefan Wahren,
	Rajendra Nayak, Carlo Caione, devicetree, linux-kernel

*WARNING -- this requires the base R9A06G032 support patches
already posted

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

v7:
 + Moved to drivers/soc/renesas, as requested.
v6:
 + Passed scriptcheck --strict on the driver.
 + Rebased on base patchset v10
v5:
  + Fixed a couple of typos
  + Added the Reviewed-by tags where appropriate
  + Rebased on base patch v9
  + Replaced the dts property with a 64 bits one.
  + Changed the driver to support 32 or 64 bits property.
v4:
  + Geert's comments adressed.
  + Renamed symbols to r9a06g032 to match the rest of patchset
  + Rebased on base patch v8
v3:
  + Removed mentions of rz/?n1d?
  + Rebased on base patch v7
v2:
  + Added suggestions from Florian Fainelli
  + Use __pa_symbol()
  + Simplified logic in prepare_cpu()
  + Reordered the patches
  + Rebased on RZN1 Base patch v5

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

 Documentation/devicetree/bindings/arm/cpus.txt |  1 +
 arch/arm/boot/dts/r9a06g032.dtsi               |  2 +
 drivers/soc/renesas/Makefile                   |  1 +
 drivers/soc/renesas/r9a06g032-smp.c            | 96 ++++++++++++++++++++++++++
 4 files changed, 100 insertions(+)
 create mode 100644 drivers/soc/renesas/r9a06g032-smp.c

-- 
2.7.4


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

* [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method.
  2018-06-28  8:17 [PATCH v7 0/3] Renesas R9A06G032 SMP enabler Michel Pollet
@ 2018-06-28  8:17 ` Michel Pollet
  2018-06-28 12:16   ` Simon Horman
  2018-06-28  8:17 ` [PATCH v7 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver Michel Pollet
  2018-06-28  8:17 ` [PATCH v7 3/3] ARM: dts: Renesas R9A06G032 SMP enable method Michel Pollet
  2 siblings, 1 reply; 7+ messages in thread
From: Michel Pollet @ 2018-06-28  8:17 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Chen-Yu Tsai, Kevin Hilman,
	Maxime Ripard, Florian Fainelli, Rajendra Nayak, Carlo Caione,
	Stefan Wahren, devicetree, linux-kernel

Add a special enable method for second CA7 of the R9A06G032

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
---
 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] 7+ messages in thread

* [PATCH v7 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver
  2018-06-28  8:17 [PATCH v7 0/3] Renesas R9A06G032 SMP enabler Michel Pollet
  2018-06-28  8:17 ` [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method Michel Pollet
@ 2018-06-28  8:17 ` Michel Pollet
  2018-06-28 12:16   ` Simon Horman
  2018-06-28  8:17 ` [PATCH v7 3/3] ARM: dts: Renesas R9A06G032 SMP enable method Michel Pollet
  2 siblings, 1 reply; 7+ messages in thread
From: Michel Pollet @ 2018-06-28  8:17 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Carlo Caione, Martin Blumenstingl,
	Andy Gross, Stefan Wahren, Florian Fainelli, Rajendra Nayak,
	Chen-Yu Tsai, devicetree, linux-kernel

The Renesas R9A06G032 second CA7 is parked in a ROM pen at boot time, it
equires a special enable method to get it started.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/soc/renesas/Makefile        |  1 +
 drivers/soc/renesas/r9a06g032-smp.c | 96 +++++++++++++++++++++++++++++++++++++
 2 files changed, 97 insertions(+)
 create mode 100644 drivers/soc/renesas/r9a06g032-smp.c

diff --git a/drivers/soc/renesas/Makefile b/drivers/soc/renesas/Makefile
index 7dc0f20..44a0d6b1 100644
--- a/drivers/soc/renesas/Makefile
+++ b/drivers/soc/renesas/Makefile
@@ -18,6 +18,7 @@ obj-$(CONFIG_SYSC_R8A77970)	+= r8a77970-sysc.o
 obj-$(CONFIG_SYSC_R8A77980)	+= r8a77980-sysc.o
 obj-$(CONFIG_SYSC_R8A77990)	+= r8a77990-sysc.o
 obj-$(CONFIG_SYSC_R8A77995)	+= r8a77995-sysc.o
+obj-$(CONFIG_ARCH_R9A06G032)	+= r9a06g032-smp.o
 
 # Family
 obj-$(CONFIG_RST_RCAR)		+= rcar-rst.o
diff --git a/drivers/soc/renesas/r9a06g032-smp.c b/drivers/soc/renesas/r9a06g032-smp.c
new file mode 100644
index 0000000..a1926e8
--- /dev/null
+++ b/drivers/soc/renesas/r9a06g032-smp.c
@@ -0,0 +1,96 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * R9A06G032 Second CA7 enabler.
+ *
+ * Copyright (C) 2018 Renesas Electronics Europe Limited
+ *
+ * Michel Pollet <michel.pollet@bp.renesas.com>, <buserror@gmail.com>
+ * Derived from actions,s500-smp
+ */
+
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/smp.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
+r9a06g032_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 r9a06g032_smp_prepare_cpus(unsigned int max_cpus)
+{
+	struct device_node *dn;
+	int ret = -EINVAL, dns;
+	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.
+	 * Note: The property can be either 64 or 32 bits, so handle both cases
+	 */
+	if (of_find_property(dn, "cpu-release-addr", &dns)) {
+		if (dns == sizeof(u64)) {
+			u64 temp;
+
+			ret = of_property_read_u64(dn,
+						   "cpu-release-addr", &temp);
+			bootaddr = temp;
+		} else {
+			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", bootaddr);
+
+	cpu_bootaddr = ioremap(bootaddr, sizeof(bootaddr));
+}
+
+static const struct smp_operations r9a06g032_smp_ops __initconst = {
+	.smp_prepare_cpus = r9a06g032_smp_prepare_cpus,
+	.smp_boot_secondary = r9a06g032_smp_boot_secondary,
+};
+
+CPU_METHOD_OF_DECLARE(r9a06g032_smp,
+		      "renesas,r9a06g032-smp", &r9a06g032_smp_ops);
-- 
2.7.4


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

* [PATCH v7 3/3] ARM: dts: Renesas R9A06G032 SMP enable method
  2018-06-28  8:17 [PATCH v7 0/3] Renesas R9A06G032 SMP enabler Michel Pollet
  2018-06-28  8:17 ` [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method Michel Pollet
  2018-06-28  8:17 ` [PATCH v7 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver Michel Pollet
@ 2018-06-28  8:17 ` Michel Pollet
  2018-06-28 12:18   ` Simon Horman
  2 siblings, 1 reply; 7+ messages in thread
From: Michel Pollet @ 2018-06-28  8:17 UTC (permalink / raw)
  To: linux-renesas-soc, Simon Horman
  Cc: phil.edworthy, Michel Pollet, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Douglas Anderson, Geert Uytterhoeven,
	Rajendra Nayak, Chen-Yu Tsai, Stefan Wahren, Carlo Caione,
	Florian Fainelli, devicetree, linux-kernel

Add a special enable method for the second CA7 of the R9A06G032
as well as the default value for the "cpu-release-addr" property.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 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 353e06f..3e45375 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -30,6 +30,8 @@
 			compatible = "arm,cortex-a7";
 			reg = <1>;
 			clocks = <&sysctrl R9A06G032_CLK_A7MP>;
+			enable-method = "renesas,r9a06g032-smp";
+			cpu-release-addr = <0 0x4000c204>;
 		};
 	};
 
-- 
2.7.4


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

* Re: [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method.
  2018-06-28  8:17 ` [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method Michel Pollet
@ 2018-06-28 12:16   ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2018-06-28 12:16 UTC (permalink / raw)
  To: Michel Pollet
  Cc: linux-renesas-soc, phil.edworthy, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Chen-Yu Tsai, Kevin Hilman,
	Maxime Ripard, Florian Fainelli, Rajendra Nayak, Carlo Caione,
	Stefan Wahren, devicetree, linux-kernel

On Thu, Jun 28, 2018 at 09:17:12AM +0100, Michel Pollet wrote:
> Add a special enable method for second CA7 of the R9A06G032
> 
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> Reviewed-by: Rob Herring <robh@kernel.org>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Reviewed-by: Simon Horman <horms+renesas@verge.net.au>

Thanks, applied.

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

* Re: [PATCH v7 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver
  2018-06-28  8:17 ` [PATCH v7 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver Michel Pollet
@ 2018-06-28 12:16   ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2018-06-28 12:16 UTC (permalink / raw)
  To: Michel Pollet
  Cc: linux-renesas-soc, phil.edworthy, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Carlo Caione, Martin Blumenstingl,
	Andy Gross, Stefan Wahren, Florian Fainelli, Rajendra Nayak,
	Chen-Yu Tsai, devicetree, linux-kernel

On Thu, Jun 28, 2018 at 09:17:13AM +0100, Michel Pollet wrote:
> The Renesas R9A06G032 second CA7 is parked in a ROM pen at boot time, it
> equires a special enable method to get it started.
> 
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks, applied.

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

* Re: [PATCH v7 3/3] ARM: dts: Renesas R9A06G032 SMP enable method
  2018-06-28  8:17 ` [PATCH v7 3/3] ARM: dts: Renesas R9A06G032 SMP enable method Michel Pollet
@ 2018-06-28 12:18   ` Simon Horman
  0 siblings, 0 replies; 7+ messages in thread
From: Simon Horman @ 2018-06-28 12:18 UTC (permalink / raw)
  To: Michel Pollet
  Cc: linux-renesas-soc, phil.edworthy, Michel Pollet, Rob Herring,
	Mark Rutland, Magnus Damm, Douglas Anderson, Geert Uytterhoeven,
	Rajendra Nayak, Chen-Yu Tsai, Stefan Wahren, Carlo Caione,
	Florian Fainelli, devicetree, linux-kernel

On Thu, Jun 28, 2018 at 09:17:14AM +0100, Michel Pollet wrote:
> Add a special enable method for the second CA7 of the R9A06G032
> as well as the default value for the "cpu-release-addr" property.
> 
> Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>

Thanks, applied.

I had to manually resolve a conflict due to updates to the patch
that added this dtsi file (as noted elsewhere). Please check that this is
correct.


From: Michel Pollet <michel.pollet@bp.renesas.com>
Subject: [PATCH] ARM: dts: Renesas R9A06G032 SMP enable method

Add a special enable method for the second CA7 of the R9A06G032
as well as the default value for the "cpu-release-addr" property.

Signed-off-by: Michel Pollet <michel.pollet@bp.renesas.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 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 339d0958011e..afe29c95a006 100644
--- a/arch/arm/boot/dts/r9a06g032.dtsi
+++ b/arch/arm/boot/dts/r9a06g032.dtsi
@@ -29,6 +29,8 @@
 			compatible = "arm,cortex-a7";
 			reg = <1>;
 			clocks = <&sysctrl 84>;
+			enable-method = "renesas,r9a06g032-smp";
+			cpu-release-addr = <0 0x4000c204>;
 		};
 	};
 
-- 
2.11.0


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

end of thread, other threads:[~2018-06-28 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-28  8:17 [PATCH v7 0/3] Renesas R9A06G032 SMP enabler Michel Pollet
2018-06-28  8:17 ` [PATCH v7 1/3] dt-bindings: cpu: Add Renesas R9A06G032 SMP enable method Michel Pollet
2018-06-28 12:16   ` Simon Horman
2018-06-28  8:17 ` [PATCH v7 2/3] arm: shmobile: Add the R9A06G032 SMP enabler driver Michel Pollet
2018-06-28 12:16   ` Simon Horman
2018-06-28  8:17 ` [PATCH v7 3/3] ARM: dts: Renesas R9A06G032 SMP enable method Michel Pollet
2018-06-28 12:18   ` Simon Horman

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).