public inbox for cip-dev@lists.cip-project.org
 help / color / mirror / Atom feed
* [cip-dev] [PATCH  00/10] Add SMP support for r8a7743
@ 2018-01-31 11:15 Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 01/10] ARM: shmobile: Add pm " Biju Das
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

This patch series aims to add SMP support for r8a7743 SoC.

It is tested against linux-v4.4.112-cip18

Biju Das (4):
  ARM: shmobile: Add pm support for r8a7743
  dt-bindings: apmu: Document r8a7743 support
  ARM: dts: r8a7743: Add APMU node and second CPU core
  ARM: dts: r8a7743: Add OPP table for frequency scaling

Geert Uytterhoeven (4):
  ARM: shmobile: apmu: Move #ifdef CONFIG_SMP to cover more functions
  ARM: shmobile: apmu: Add debug resource reset for secondary CPU boot
  ARM: shmobile: apmu: Allow booting secondary CPU cores in debug mode
  ARM: dts: r8a7743: Add missing clock for secondary CA15 CPU core

Magnus Damm (2):
  ARM: shmobile: apmu: Add APMU DT support via Enable method
  devicetree: bindings: Renesas APMU and SMP Enable method

 Documentation/devicetree/bindings/arm/cpus.txt     |  1 +
 .../devicetree/bindings/power/renesas,apmu.txt     | 29 +++++++
 arch/arm/boot/dts/r8a7743.dtsi                     | 25 ++++++
 arch/arm/mach-shmobile/platsmp-apmu.c              | 94 +++++++++++++++++++++-
 arch/arm/mach-shmobile/pm-rcar-gen2.c              |  3 +
 5 files changed, 150 insertions(+), 2 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,apmu.txt

-- 
2.7.4

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

* [cip-dev] [PATCH 01/10] ARM: shmobile: Add pm support for r8a7743
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 02/10] ARM: shmobile: apmu: Move #ifdef CONFIG_SMP to cover more functions Biju Das
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

Adding pm support for r8a7743 SoC.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 arch/arm/mach-shmobile/pm-rcar-gen2.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm/mach-shmobile/pm-rcar-gen2.c b/arch/arm/mach-shmobile/pm-rcar-gen2.c
index 6815781..94a2759 100644
--- a/arch/arm/mach-shmobile/pm-rcar-gen2.c
+++ b/arch/arm/mach-shmobile/pm-rcar-gen2.c
@@ -82,6 +82,9 @@ void __init rcar_gen2_pm_init(void)
 	} else if (of_machine_is_compatible("renesas,r8a7791")) {
 		boot_vector_addr = RAM;
 		syscier = 0x00111003;
+	} else if (of_machine_is_compatible("renesas,r8a7743")) {
+		boot_vector_addr = RAM;
+		syscier = 0x00101003;
 	}
 
 	/* RAM for jump stub, because BAR requires 256KB aligned address */
-- 
2.7.4

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

* [cip-dev] [PATCH 02/10] ARM: shmobile: apmu: Move #ifdef CONFIG_SMP to cover more functions
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 01/10] ARM: shmobile: Add pm " Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 03/10] ARM: shmobile: apmu: Add APMU DT support via Enable method Biju Das
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

From: Geert Uytterhoeven <geert+renesas@glider.be>

shmobile_smp_apmu_prepare_cpus() is used only if CONFIG_SMP=y.

Hence move the #ifdef to cover shmobile_smp_apmu_prepare_cpus() and all
functions only called by it (apmu_init_cpu() and apmu_parse_cfg()).

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit d3f3fb0cfdcf4cbf69af65e8bfdde65cedf4e53a)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 911884f..cff623f 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -74,6 +74,7 @@ static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu)
 	return p ? fn(p, apmu_cpus[cpu].bit) : -EINVAL;
 }
 
+#ifdef CONFIG_SMP
 static void apmu_init_cpu(struct resource *res, int cpu, int bit)
 {
 	if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem)
@@ -129,7 +130,6 @@ void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
 	apmu_parse_cfg(apmu_init_cpu, apmu_config, num);
 }
 
-#ifdef CONFIG_SMP
 int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	/* For this particular CPU register boot vector */
-- 
2.7.4

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

* [cip-dev] [PATCH 03/10] ARM: shmobile: apmu: Add APMU DT support via Enable method
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 01/10] ARM: shmobile: Add pm " Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 02/10] ARM: shmobile: apmu: Move #ifdef CONFIG_SMP to cover more functions Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 04/10] ARM: shmobile: apmu: Add debug resource reset for secondary CPU boot Biju Das
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

From: Magnus Damm <damm+renesas@opensource.se>

Allow DT configuration of the APMU hardware in the case when the APMU is
pointed out in the DTB via the enable-method. The ability to configure
the APMU via C code is still kept intact to prevent DTB breakage for older
SoCs that do not rely on the enable-method for SMP support.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
[geert: Fix CONFIG_SMP=n build]
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

(cherry picked from commit 5f3bca0db8ac01a73622361f6062939638bf4730)
(Backported APMU DT support via Enable method)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>

Conflicts:
	arch/arm/mach-shmobile/platsmp-apmu.c
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 90 ++++++++++++++++++++++++++++++++++-
 1 file changed, 89 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index cff623f..444765e 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -24,6 +24,7 @@
 #include <asm/suspend.h>
 #include "common.h"
 #include "platsmp-apmu.h"
+#include "rcar-gen2.h"
 
 static struct {
 	void __iomem *iomem;
@@ -118,12 +119,68 @@ static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit),
 	}
 }
 
+static const struct of_device_id apmu_ids[] = {
+	{ .compatible = "renesas,apmu" },
+	{ /*sentinel*/ }
+};
+
+static void apmu_parse_dt(void (*fn)(struct resource *res, int cpu, int bit))
+{
+	struct device_node *np_apmu, *np_cpu;
+	struct resource res;
+	int bit, index;
+	u32 id;
+
+	for_each_matching_node(np_apmu, apmu_ids) {
+		/* only enable the cluster that includes the boot CPU */
+		bool is_allowed = false;
+
+		for (bit = 0; bit < CONFIG_NR_CPUS; bit++) {
+			np_cpu = of_parse_phandle(np_apmu, "cpus", bit);
+			if (np_cpu) {
+				if (!of_property_read_u32(np_cpu, "reg", &id)) {
+					if (id == cpu_logical_map(0)) {
+						is_allowed = true;
+						of_node_put(np_cpu);
+						break;
+					}
+
+				}
+				of_node_put(np_cpu);
+			}
+		}
+		if (!is_allowed)
+			continue;
+
+		for (bit = 0; bit < CONFIG_NR_CPUS; bit++) {
+			np_cpu = of_parse_phandle(np_apmu, "cpus", bit);
+			if (np_cpu) {
+				if (!of_property_read_u32(np_cpu, "reg", &id)) {
+					index = get_logical_index(id);
+					if ((index >= 0) &&
+					    !of_address_to_resource(np_apmu,
+								    0, &res))
+						fn(&res, index, bit);
+				}
+				of_node_put(np_cpu);
+			}
+		}
+	}
+}
+
+static void __init shmobile_smp_apmu_setup_boot(void)
+{
+	/* install boot code shared by all CPUs */
+	shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
+	shmobile_boot_arg = MPIDR_HWID_BITMASK;
+}
+
 void __init shmobile_smp_apmu_prepare_cpus(unsigned int max_cpus,
 					   struct rcar_apmu_config *apmu_config,
 					   int num)
 {
 	/* install boot code shared by all CPUs */
-	shmobile_boot_fn = virt_to_phys(shmobile_smp_boot);
+	shmobile_smp_apmu_setup_boot();
 	shmobile_boot_arg = MPIDR_HWID_BITMASK;
 
 	/* perform per-cpu setup */
@@ -137,7 +194,38 @@ int shmobile_smp_apmu_boot_secondary(unsigned int cpu, struct task_struct *idle)
 
 	return apmu_wrap(cpu, apmu_power_on);
 }
+
+static void __init shmobile_smp_apmu_prepare_cpus_dt(unsigned int max_cpus)
+{
+	shmobile_smp_apmu_setup_boot();
+	apmu_parse_dt(apmu_init_cpu);
+	rcar_gen2_pm_init();
+}
+
+static int shmobile_smp_apmu_boot_secondary_md21(unsigned int cpu,
+						 struct task_struct *idle)
+{
+	/* Error out when hardware debug mode is enabled */
+	if (rcar_gen2_read_mode_pins() & BIT(21)) {
+		pr_warn("Unable to boot CPU%u when MD21 is set\n", cpu);
+		return -ENOTSUPP;
+	}
+
+	return shmobile_smp_apmu_boot_secondary(cpu, idle);
+}
+
+static struct smp_operations apmu_smp_ops __initdata = {
+	.smp_prepare_cpus	= shmobile_smp_apmu_prepare_cpus_dt,
+	.smp_boot_secondary	= shmobile_smp_apmu_boot_secondary_md21,
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_can_disable	= shmobile_smp_cpu_can_disable,
+	.cpu_die		= shmobile_smp_apmu_cpu_die,
+	.cpu_kill		= shmobile_smp_apmu_cpu_kill,
 #endif
+};
+
+CPU_METHOD_OF_DECLARE(shmobile_smp_apmu, "renesas,apmu", &apmu_smp_ops);
+#endif /* CONFIG_SMP */
 
 #if defined(CONFIG_HOTPLUG_CPU) || defined(CONFIG_SUSPEND)
 /* nicked from arch/arm/mach-exynos/hotplug.c */
-- 
2.7.4

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

* [cip-dev] [PATCH 04/10] ARM: shmobile: apmu: Add debug resource reset for secondary CPU boot
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (2 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 03/10] ARM: shmobile: apmu: Add APMU DT support via Enable method Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 05/10] ARM: shmobile: apmu: Allow booting secondary CPU cores in debug mode Biju Das
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

From: Geert Uytterhoeven <geert+renesas@glider.be>

In debug mode (MD21=1), reset requests derived from power-shutoff to the
AP-system CPU cores must be enabled before the AP-system CPU cores
resume from power-shutoff for the first time. Else resume may fail,
causing the system to hang during boot.

As setting these bits is a no-op in normal mode, there's no need to
check the actual state of MD21 first.

Inspired by CPU-specific patches in the BSP by Hisashi Nakamura
<hisashi.nakamura.ak@renesas.com>.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 10f778a97845e8b10af8878af99c9cfe6c31baf9)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>

Conflicts:
	arch/arm/mach-shmobile/platsmp-apmu.c
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 444765e..81a687f 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -35,6 +35,13 @@ static struct {
 #define PSTR_OFFS 0x40
 #define CPUNCR_OFFS(n) (0x100 + (0x10 * (n)))
 
+#define DBGRCR_OFFS	0x180		/* Debug Resource Reset Control Reg. */
+
+/* Debug Resource Reset Control Register */
+#define DBGCPUREN	BIT(24)		/* CPU Other Reset Request Enable */
+#define DBGCPUNREN(n)	BIT((n) + 20)	/* CPUn Reset Request Enable */
+#define DBGCPUPREN	BIT(19)		/* CPU Peripheral Reset Req. Enable */
+
 static int __maybe_unused apmu_power_on(void __iomem *p, int bit)
 {
 	/* request power on */
@@ -78,6 +85,8 @@ static int __maybe_unused apmu_wrap(int cpu, int (*fn)(void __iomem *p, int cpu)
 #ifdef CONFIG_SMP
 static void apmu_init_cpu(struct resource *res, int cpu, int bit)
 {
+	u32 x;
+
 	if ((cpu >= ARRAY_SIZE(apmu_cpus)) || apmu_cpus[cpu].iomem)
 		return;
 
@@ -85,6 +94,11 @@ static void apmu_init_cpu(struct resource *res, int cpu, int bit)
 	apmu_cpus[cpu].bit = bit;
 
 	pr_debug("apmu ioremap %d %d %pr\n", cpu, bit, res);
+
+	/* Setup for debug mode */
+	x = readl(apmu_cpus[cpu].iomem + DBGRCR_OFFS);
+	x |= DBGCPUREN | DBGCPUNREN(bit) | DBGCPUPREN;
+	writel(x, apmu_cpus[cpu].iomem + DBGRCR_OFFS);
 }
 
 static void apmu_parse_cfg(void (*fn)(struct resource *res, int cpu, int bit),
-- 
2.7.4

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

* [cip-dev] [PATCH 05/10] ARM: shmobile: apmu: Allow booting secondary CPU cores in debug mode
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (3 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 04/10] ARM: shmobile: apmu: Add debug resource reset for secondary CPU boot Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 06/10] devicetree: bindings: Renesas APMU and SMP Enable method Biju Das
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

From: Geert Uytterhoeven <geert+renesas@glider.be>

Now debug resource reset is handled properly, allow booting secondary
CPU cores when hardware debug mode is enabled (MD21=1) on SoCs using the
"renesas,apmu" enable method.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Hiep Cao Minh <cm-hiep@jinso.co.jp>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit d03c8f78d03af2a46127537dd1daa67164e53c09)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 arch/arm/mach-shmobile/platsmp-apmu.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/arch/arm/mach-shmobile/platsmp-apmu.c b/arch/arm/mach-shmobile/platsmp-apmu.c
index 81a687f..331409a 100644
--- a/arch/arm/mach-shmobile/platsmp-apmu.c
+++ b/arch/arm/mach-shmobile/platsmp-apmu.c
@@ -216,21 +216,9 @@ static void __init shmobile_smp_apmu_prepare_cpus_dt(unsigned int max_cpus)
 	rcar_gen2_pm_init();
 }
 
-static int shmobile_smp_apmu_boot_secondary_md21(unsigned int cpu,
-						 struct task_struct *idle)
-{
-	/* Error out when hardware debug mode is enabled */
-	if (rcar_gen2_read_mode_pins() & BIT(21)) {
-		pr_warn("Unable to boot CPU%u when MD21 is set\n", cpu);
-		return -ENOTSUPP;
-	}
-
-	return shmobile_smp_apmu_boot_secondary(cpu, idle);
-}
-
 static struct smp_operations apmu_smp_ops __initdata = {
 	.smp_prepare_cpus	= shmobile_smp_apmu_prepare_cpus_dt,
-	.smp_boot_secondary	= shmobile_smp_apmu_boot_secondary_md21,
+	.smp_boot_secondary	= shmobile_smp_apmu_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_can_disable	= shmobile_smp_cpu_can_disable,
 	.cpu_die		= shmobile_smp_apmu_cpu_die,
-- 
2.7.4

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

* [cip-dev] [PATCH 06/10] devicetree: bindings: Renesas APMU and SMP Enable method
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (4 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 05/10] ARM: shmobile: apmu: Allow booting secondary CPU cores in debug mode Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 07/10] dt-bindings: apmu: Document r8a7743 support Biju Das
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

From: Magnus Damm <damm+renesas@opensource.se>

Add DT binding documentation for the APMU hardware and add "renesas,apmu"
to the list of enable methods for the ARM cpus.

Signed-off-by: Magnus Damm <damm+renesas@opensource.se>
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Acked-by: Rob Herring <robh@kernel.org>
Cc: devicetree at vger.kernel.org
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit e454b359b7a0a6f59e3d83394e6d4e598554cb33)
[removed r8a7792,r8a7793 and r8a7794 devices]
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 Documentation/devicetree/bindings/arm/cpus.txt     |  1 +
 .../devicetree/bindings/power/renesas,apmu.txt     | 28 ++++++++++++++++++++++
 2 files changed, 29 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/renesas,apmu.txt

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index 3a07a87..9ef9a20 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -200,6 +200,7 @@ nodes to be present and contain the properties described below.
 			    "qcom,gcc-msm8660"
 			    "qcom,kpss-acc-v1"
 			    "qcom,kpss-acc-v2"
+			    "renesas,apmu"
 			    "rockchip,rk3066-smp"
 			    "ste,dbx500-smp"
 
diff --git a/Documentation/devicetree/bindings/power/renesas,apmu.txt b/Documentation/devicetree/bindings/power/renesas,apmu.txt
new file mode 100644
index 0000000..bc8de21
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/renesas,apmu.txt
@@ -0,0 +1,28 @@
+DT bindings for the Renesas Advanced Power Management Unit
+
+Renesas R-Car line of SoCs utilize one or more APMU hardware units
+for CPU core power domain control including SMP boot and CPU Hotplug.
+
+Required properties:
+
+- compatible: Should be "renesas,<soctype>-apmu", "renesas,apmu" as fallback.
+	      Examples with soctypes are:
+		- "renesas,r8a7790-apmu" (R-Car H2)
+		- "renesas,r8a7791-apmu" (R-Car M2-W)
+
+- reg: Base address and length of the I/O registers used by the APMU.
+
+- cpus: This node contains a list of CPU cores, which should match the order
+  of CPU cores used by the WUPCR and PSTR registers in the Advanced Power
+  Management Unit section of the device's datasheet.
+
+
+Example:
+
+This shows the r8a7791 APMU that can control CPU0 and CPU1.
+
+	apmu at e6152000 {
+		compatible = "renesas,r8a7791-apmu", "renesas,apmu";
+		reg = <0 0xe6152000 0 0x188>;
+		cpus = <&cpu0 &cpu1>;
+	};
-- 
2.7.4

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

* [cip-dev] [PATCH 07/10] dt-bindings: apmu: Document r8a7743 support
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (5 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 06/10] devicetree: bindings: Renesas APMU and SMP Enable method Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 08/10] ARM: dts: r8a7743: Add APMU node and second CPU core Biju Das
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

Document APMU and SMP enable method for RZ/G1M
(also known as r8a7743) SoC.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 304ce59242e11e715bfdc86577771502df99f7cd)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 Documentation/devicetree/bindings/power/renesas,apmu.txt | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/power/renesas,apmu.txt b/Documentation/devicetree/bindings/power/renesas,apmu.txt
index bc8de21..e3a0e55 100644
--- a/Documentation/devicetree/bindings/power/renesas,apmu.txt
+++ b/Documentation/devicetree/bindings/power/renesas,apmu.txt
@@ -1,12 +1,13 @@
 DT bindings for the Renesas Advanced Power Management Unit
 
-Renesas R-Car line of SoCs utilize one or more APMU hardware units
+Renesas R-Car and RZ/G1 SoCs utilize one or more APMU hardware units
 for CPU core power domain control including SMP boot and CPU Hotplug.
 
 Required properties:
 
 - compatible: Should be "renesas,<soctype>-apmu", "renesas,apmu" as fallback.
 	      Examples with soctypes are:
+		- "renesas,r8a7743-apmu" (RZ/G1M)
 		- "renesas,r8a7790-apmu" (R-Car H2)
 		- "renesas,r8a7791-apmu" (R-Car M2-W)
 
-- 
2.7.4

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

* [cip-dev] [PATCH 08/10] ARM: dts: r8a7743: Add APMU node and second CPU core
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (6 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 07/10] dt-bindings: apmu: Document r8a7743 support Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 09/10] ARM: dts: r8a7743: Add OPP table for frequency scaling Biju Das
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

Add DT nodes for the Advanced Power Management Unit (APMU) and the
second CPU core.  Use the enable-method to point out that the APMU
should be used for SMP support.

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 60dce695b097a52e6ea5874aa80301f2e4ac627a)
(removed power domain property, since we don't have sysc driver
in 4.4 kernel to support CA15-CPU1 and CA15-SCU power domains).

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
---
 arch/arm/boot/dts/r8a7743.dtsi | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi
index a9dda28..bd1121a 100644
--- a/arch/arm/boot/dts/r8a7743.dtsi
+++ b/arch/arm/boot/dts/r8a7743.dtsi
@@ -21,6 +21,7 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "renesas,apmu";
 
 		cpu0: cpu at 0 {
 			device_type = "cpu";
@@ -31,6 +32,14 @@
 			next-level-cache = <&L2_CA15>;
 		};
 
+		cpu1: cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a15";
+			reg = <1>;
+			clock-frequency = <1500000000>;
+			next-level-cache = <&L2_CA15>;
+		};
+
 		L2_CA15: cache-controller-0 {
 			compatible = "cache";
 			cache-unified;
@@ -46,6 +55,12 @@
 		#size-cells = <2>;
 		ranges;
 
+		apmu at e6152000 {
+			compatible = "renesas,r8a7743-apmu", "renesas,apmu";
+			reg = <0 0xe6152000 0 0x188>;
+			cpus = <&cpu0 &cpu1>;
+		};
+
 		gic: interrupt-controller at f1001000 {
 			compatible = "arm,gic-400";
 			#interrupt-cells = <3>;
-- 
2.7.4

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

* [cip-dev] [PATCH 09/10] ARM: dts: r8a7743: Add OPP table for frequency scaling
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (7 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 08/10] ARM: dts: r8a7743: Add APMU node and second CPU core Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-01-31 11:15 ` [cip-dev] [PATCH 10/10] ARM: dts: r8a7743: Add missing clock for secondary CA15 CPU core Biju Das
  2018-02-08 21:21 ` [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Ben Hutchings
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

Add needed information inside CPU0 for the generic cpufreq-cpu0 driver.

- clock-latency = 300 us
Approximate worst-case latency to do clock transition for every
OPPs. Using an arbitrary safe value similar to r8a7791(R-Car M2) Soc.

- operating-points = < kHz - uV >
List of 6 operating points. All of them are using the same voltage
since DVS is not supported in RZ/G1 Soc.

Note:This also fixes the below errors seen on kernel logs
[    0.876877] cpu cpu0: dev_pm_opp_get_opp_count: OPP table not found (-19)
[    0.883727] cpu cpu1: cpufreq_init: failed to get clk: -2

Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit 0417814ea140d1bc7e8a5d54e95e17a234b34e49)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>

Conflicts:
	arch/arm/boot/dts/r8a7743.dtsi
---
 arch/arm/boot/dts/r8a7743.dtsi | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi
index bd1121a..e4e0dc3 100644
--- a/arch/arm/boot/dts/r8a7743.dtsi
+++ b/arch/arm/boot/dts/r8a7743.dtsi
@@ -29,7 +29,16 @@
 			reg = <0>;
 			clock-frequency = <1500000000>;
 			clocks = <&cpg_clocks R8A7743_CLK_Z>;
+			clock-latency = <300000>; /* 300 us */
 			next-level-cache = <&L2_CA15>;
+
+			/* kHz - uV - OPPs unknown yet */
+			operating-points = <1500000 1000000>,
+					   <1312500 1000000>,
+					   <1125000 1000000>,
+					   < 937500 1000000>,
+					   < 750000 1000000>,
+					   < 375000 1000000>;
 		};
 
 		cpu1: cpu at 1 {
-- 
2.7.4

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

* [cip-dev] [PATCH 10/10] ARM: dts: r8a7743: Add missing clock for secondary CA15 CPU core
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (8 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 09/10] ARM: dts: r8a7743: Add OPP table for frequency scaling Biju Das
@ 2018-01-31 11:15 ` Biju Das
  2018-02-08 21:21 ` [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Ben Hutchings
  10 siblings, 0 replies; 12+ messages in thread
From: Biju Das @ 2018-01-31 11:15 UTC (permalink / raw)
  To: cip-dev

From: Geert Uytterhoeven <geert+renesas@glider.be>

Currently only the primary CPU in the CA15 cluster has a clocks
property, while the secondary CPU core is driven by the same clock.
Add the missing clocks property to fix this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
(cherry picked from commit a60ddf507dda0ede43b72d348283d8725a5a83c7)
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
Reviewed-by: Chris Paterson <chris.paterson2@renesas.com>

Conflicts:
	arch/arm/boot/dts/r8a7743.dtsi
---
 arch/arm/boot/dts/r8a7743.dtsi | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/boot/dts/r8a7743.dtsi b/arch/arm/boot/dts/r8a7743.dtsi
index e4e0dc3..e755cb9 100644
--- a/arch/arm/boot/dts/r8a7743.dtsi
+++ b/arch/arm/boot/dts/r8a7743.dtsi
@@ -46,6 +46,7 @@
 			compatible = "arm,cortex-a15";
 			reg = <1>;
 			clock-frequency = <1500000000>;
+			clocks = <&cpg_clocks R8A7743_CLK_Z>;
 			next-level-cache = <&L2_CA15>;
 		};
 
-- 
2.7.4

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

* [cip-dev] [PATCH  00/10] Add SMP support for r8a7743
  2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
                   ` (9 preceding siblings ...)
  2018-01-31 11:15 ` [cip-dev] [PATCH 10/10] ARM: dts: r8a7743: Add missing clock for secondary CA15 CPU core Biju Das
@ 2018-02-08 21:21 ` Ben Hutchings
  10 siblings, 0 replies; 12+ messages in thread
From: Ben Hutchings @ 2018-02-08 21:21 UTC (permalink / raw)
  To: cip-dev

On Wed, 2018-01-31 at 11:15 +0000, Biju Das wrote:
> This patch series aims to add SMP support for r8a7743 SoC.
> 
> It is tested against linux-v4.4.112-cip18

All looks good to me.  I've applied and pushed these changes.

Ben.

> Biju Das (4):
> ? ARM: shmobile: Add pm support for r8a7743
> ? dt-bindings: apmu: Document r8a7743 support
> ? ARM: dts: r8a7743: Add APMU node and second CPU core
> ? ARM: dts: r8a7743: Add OPP table for frequency scaling
> 
> Geert Uytterhoeven (4):
> ? ARM: shmobile: apmu: Move #ifdef CONFIG_SMP to cover more functions
> ? ARM: shmobile: apmu: Add debug resource reset for secondary CPU boot
> ? ARM: shmobile: apmu: Allow booting secondary CPU cores in debug mode
> ? ARM: dts: r8a7743: Add missing clock for secondary CA15 CPU core
> 
> Magnus Damm (2):
> ? ARM: shmobile: apmu: Add APMU DT support via Enable method
> ? devicetree: bindings: Renesas APMU and SMP Enable method
> 
> ?Documentation/devicetree/bindings/arm/cpus.txt?????|??1 +
> ?.../devicetree/bindings/power/renesas,apmu.txt?????| 29 +++++++
> ?arch/arm/boot/dts/r8a7743.dtsi?????????????????????| 25 ++++++
> ?arch/arm/mach-shmobile/platsmp-apmu.c??????????????| 94 +++++++++++++++++++++-
> ?arch/arm/mach-shmobile/pm-rcar-gen2.c??????????????|??3 +
> ?5 files changed, 150 insertions(+), 2 deletions(-)
> ?create mode 100644 Documentation/devicetree/bindings/power/renesas,apmu.txt
> 
-- 
Ben Hutchings
Software Developer, Codethink Ltd.

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

end of thread, other threads:[~2018-02-08 21:21 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-31 11:15 [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 01/10] ARM: shmobile: Add pm " Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 02/10] ARM: shmobile: apmu: Move #ifdef CONFIG_SMP to cover more functions Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 03/10] ARM: shmobile: apmu: Add APMU DT support via Enable method Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 04/10] ARM: shmobile: apmu: Add debug resource reset for secondary CPU boot Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 05/10] ARM: shmobile: apmu: Allow booting secondary CPU cores in debug mode Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 06/10] devicetree: bindings: Renesas APMU and SMP Enable method Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 07/10] dt-bindings: apmu: Document r8a7743 support Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 08/10] ARM: dts: r8a7743: Add APMU node and second CPU core Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 09/10] ARM: dts: r8a7743: Add OPP table for frequency scaling Biju Das
2018-01-31 11:15 ` [cip-dev] [PATCH 10/10] ARM: dts: r8a7743: Add missing clock for secondary CA15 CPU core Biju Das
2018-02-08 21:21 ` [cip-dev] [PATCH 00/10] Add SMP support for r8a7743 Ben Hutchings

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox