public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
* [PATCH 00/10] SMP support for Armada 375 and 38x
@ 2014-03-28 13:06 Thomas Petazzoni
  2014-03-28 13:06 ` [PATCH 01/10] ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c Thomas Petazzoni
                   ` (10 more replies)
  0 siblings, 11 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

Jason, Andrew, Gregory, Sebastian,

This patch series adds SMP support for the Armada 375 and 38x. Most of
the patches are fairly straight-forward, but here is a short overview
of what's going on:

 * Patches 1, 2, 3 make some preparatory clean-ups. Actually, patches
   2 and 3 are not directly related to adding Armada 375 and 38x SMP
   support, but they are related to the SMP support of Armada XP.

 * Patches 4, 5 and 6 add a few bits needed for the SMP support.

 * Patch 7 is adding the SMP support itself. Since both Armada 375 and
   38x are Cortex-A9, their SMP logic is fairly similar, the only
   difference being how to define the boot address of the secondary
   CPU. Therefore, we've used a single smp_operations implementation.

 * Patch 8 add a workaround for a SMP booting bug affecting Armada 375
   Z1 stepping. It requires using the Crypto SRAM loaded with a few
   instructions of code as a replacement of the BootROM for booting
   the secondary processor. For now, the workaround is unconditionally
   applied on all Armada 375 platforms, but as soon as we get access
   to more recent platforms, we'll add a mvebu-soc-id based test to
   only enable the workaround if needed.

 * Patch 9 and 10 add the necessary Device Tree bits to enable SMP on
   Armada 375 and 38x.

In terms of dependencies, we will have 4 interconnected patch series:
Armada 375/38x coherency support, the PMSU rework series, the cpuidle
series, and this Armada 375/38x SMP support series. The relations are
as follows

  ---------------        ---------------------
  | pmsu-rework |        | 375/38x coherency |
  ---------------        ---------------------
        ||   ||                 ||
	||   \\____________     ||
	\/                \/    \/
  ---------------        ---------------
  |   cpuidle   |        | 375/38x SMP |
  ---------------        ---------------

In other words, this 375/38x SMP support series needs *both* the
375/38x coherency patch series to be applied, and the pmsu-rework to
be applied.

If needed, I can merge the 375/38x coherency and 375/38x SMP support
together, but I believe shorter patch series are easier to
review. Just let me know what works best for you.

Thanks!

Thomas

Gregory CLEMENT (4):
  ARM: mvebu: add function to set the resume boot address for Armada 375
  ARM: mvebu: add SMP support for Armada 375 and Armada 38x
  ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1
  ARM: mvebu: add SMP support in the Armada 375 device tree

Thomas Petazzoni (6):
  ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c
  irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver
  irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary
    CPUs
  ARM: mvebu: add Armada 375/38x support in cpu-reset
  ARM: mvebu: add Armada 38x compatible string to pmsu
  ARM: mvebu: add SMP support in the Armada 38x device tree

 .../devicetree/bindings/arm/armada-370-xp-pmsu.txt |  9 +-
 .../devicetree/bindings/arm/armada-cpu-reset.txt   |  2 +
 arch/arm/boot/dts/armada-375.dtsi                  |  5 ++
 arch/arm/boot/dts/armada-38x.dtsi                  | 10 +++
 arch/arm/mach-mvebu/Kconfig                        |  4 +
 arch/arm/mach-mvebu/Makefile                       |  2 +-
 arch/arm/mach-mvebu/armada-370-xp.h                |  2 -
 arch/arm/mach-mvebu/armada-375.h                   | 18 ++++
 arch/arm/mach-mvebu/armada-380.h                   | 18 ++++
 arch/arm/mach-mvebu/board-v7.c                     |  2 +
 arch/arm/mach-mvebu/common.h                       |  6 ++
 arch/arm/mach-mvebu/cpu-reset.c                    |  4 +
 arch/arm/mach-mvebu/headsmp-a9.S                   | 34 ++++++++
 arch/arm/mach-mvebu/platsmp-a9.c                   | 95 ++++++++++++++++++++++
 arch/arm/mach-mvebu/platsmp.c                      | 18 ++--
 arch/arm/mach-mvebu/pmsu.c                         | 27 +-----
 arch/arm/mach-mvebu/system-controller.c            | 15 +++-
 drivers/irqchip/irq-armada-370-xp.c                | 24 +++++-
 18 files changed, 252 insertions(+), 43 deletions(-)
 create mode 100644 arch/arm/mach-mvebu/armada-375.h
 create mode 100644 arch/arm/mach-mvebu/armada-380.h
 create mode 100644 arch/arm/mach-mvebu/headsmp-a9.S
 create mode 100644 arch/arm/mach-mvebu/platsmp-a9.c

-- 
1.8.3.2

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

* [PATCH 01/10] ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
@ 2014-03-28 13:06 ` Thomas Petazzoni
  2014-03-28 13:06 ` [PATCH 02/10] irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver Thomas Petazzoni
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

The pmsu.c driver contained an armada_xp_boot_cpu() function that sets
the boot address of a secondary CPUs and deasserts the reset. However,
the Armada 375 needs a slightly different logic, so it makes more
sense to move this code into the Armada XP specific platsmp.c.

In order to achieve this, the mvebu_pmsu_set_cpu_boot_addr() function
is exported. It will be needed for both the Armada XP and Armada 38x
SMP implementations.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/common.h  |  1 +
 arch/arm/mach-mvebu/platsmp.c | 10 +++++++++-
 arch/arm/mach-mvebu/pmsu.c    | 26 +-------------------------
 3 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index cfb129b..2b88eb0 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -19,6 +19,7 @@
 
 void mvebu_restart(enum reboot_mode mode, const char *cmd);
 int mvebu_cpu_reset_deassert(int cpu);
+void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr);
 
 void armada_xp_cpu_die(unsigned int cpu);
 
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index a6da03f..e98075f 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -77,9 +77,17 @@ static void armada_xp_secondary_init(unsigned int cpu)
 
 static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
+	int ret, hw_cpu;
+
 	pr_info("Booting CPU %d\n", cpu);
 
-	armada_xp_boot_cpu(cpu, armada_xp_secondary_startup);
+	hw_cpu = cpu_logical_map(cpu);
+	mvebu_pmsu_set_cpu_boot_addr(hw_cpu, armada_xp_secondary_startup);
+	ret = mvebu_cpu_reset_deassert(hw_cpu);
+	if (ret) {
+		pr_warn("unable to boot CPU: %d\n", ret);
+		return ret;
+	}
 
 	return 0;
 }
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index 8361281..a1508de 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -41,36 +41,12 @@ static struct of_device_id of_pmsu_table[] = {
 	{ /* end of list */ },
 };
 
-static void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
+void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr)
 {
 	writel(virt_to_phys(boot_addr), pmsu_mp_base +
 		PMSU_BOOT_ADDR_REDIRECT_OFFSET(hw_cpu));
 }
 
-#ifdef CONFIG_SMP
-int armada_xp_boot_cpu(unsigned int cpu_id, void *boot_addr)
-{
-	int hw_cpu, ret;
-
-	if (!pmsu_mp_base) {
-		pr_warn("Can't boot CPU. PMSU is uninitialized\n");
-		return -ENODEV;
-	}
-
-	hw_cpu = cpu_logical_map(cpu_id);
-
-	mvebu_pmsu_set_cpu_boot_addr(hw_cpu, boot_addr);
-
-	ret = mvebu_cpu_reset_deassert(hw_cpu);
-	if (ret) {
-		pr_warn("unable to boot CPU: %d\n", ret);
-		return ret;
-	}
-
-	return 0;
-}
-#endif
-
 static int __init armada_370_xp_pmsu_init(void)
 {
 	struct device_node *np;
-- 
1.8.3.2

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

* [PATCH 02/10] irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
  2014-03-28 13:06 ` [PATCH 01/10] ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c Thomas Petazzoni
@ 2014-03-28 13:06 ` Thomas Petazzoni
  2014-03-28 13:06 ` [PATCH 03/10] irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary CPUs Thomas Petazzoni
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

Instead of having the SoC code in arch/arm/mach-mvebu/platsmp.c do the
set_smp_cross_call() to register the IPI-triggering function, it makes
more sense to do exactly what the GIC driver is doing: let the irqchip
driver do it. This way, it avoids having to expose the
armada_mpic_send_doorbell() function between the irqchip driver and
the SoC code.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/armada-370-xp.h | 1 -
 arch/arm/mach-mvebu/platsmp.c       | 2 --
 drivers/irqchip/irq-armada-370-xp.c | 6 +++++-
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index 991ab32..dd3b8a1 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -21,7 +21,6 @@
 #define ARMADA_370_MAX_CPUS 1
 #define ARMADA_XP_MAX_CPUS  4
 
-void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq);
 void armada_xp_mpic_smp_cpu_init(void);
 void armada_xp_secondary_startup(void);
 extern struct smp_operations armada_xp_smp_ops;
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index e98075f..81bf517 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -98,8 +98,6 @@ static void __init armada_xp_smp_init_cpus(void)
 
 	if (ncores == 0 || ncores > ARMADA_XP_MAX_CPUS)
 		panic("Invalid number of CPUs in DT\n");
-
-	set_smp_cross_call(armada_mpic_send_doorbell);
 }
 
 static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index abb850b..0bf5aef 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -315,7 +315,8 @@ static int armada_370_xp_mpic_irq_map(struct irq_domain *h,
 }
 
 #ifdef CONFIG_SMP
-void armada_mpic_send_doorbell(const struct cpumask *mask, unsigned int irq)
+static void armada_mpic_send_doorbell(const struct cpumask *mask,
+				      unsigned int irq)
 {
 	int cpu;
 	unsigned long map = 0;
@@ -534,6 +535,9 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
 	if (parent_irq <= 0) {
 		irq_set_default_host(armada_370_xp_mpic_domain);
 		set_handle_irq(armada_370_xp_handle_irq);
+#ifdef CONFIG_SMP
+		set_smp_cross_call(armada_mpic_send_doorbell);
+#endif
 	} else {
 		irq_set_chained_handler(parent_irq,
 					armada_370_xp_mpic_handle_cascade_irq);
-- 
1.8.3.2

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

* [PATCH 03/10] irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary CPUs
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
  2014-03-28 13:06 ` [PATCH 01/10] ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c Thomas Petazzoni
  2014-03-28 13:06 ` [PATCH 02/10] irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver Thomas Petazzoni
@ 2014-03-28 13:06 ` Thomas Petazzoni
  2014-03-28 13:07 ` [PATCH 04/10] ARM: mvebu: add Armada 375/38x support in cpu-reset Thomas Petazzoni
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:06 UTC (permalink / raw)
  To: linux-arm-kernel

Some irqchip initialization must be done on secondary CPUs. On mvebu
platforms, this is currently achieved by having the
arch/arm/mach-mvebu/platsmp.c code directly call into a function
exported by the irqchip driver, which isn't really nice.

This commit changes this by using the same solution as the one used in
the GIC driver: the irqchip driver registers a CPU notifier, which is
used to do the secondary CPU IRQ initialization. This way, the irqchip
driver is completely autonomous, and the function no longer needs to
be exposed from the irqchip driver to the SoC code.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/armada-370-xp.h |  1 -
 arch/arm/mach-mvebu/platsmp.c       |  6 ------
 drivers/irqchip/irq-armada-370-xp.c | 18 +++++++++++++++++-
 3 files changed, 17 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-mvebu/armada-370-xp.h b/arch/arm/mach-mvebu/armada-370-xp.h
index dd3b8a1..883b348 100644
--- a/arch/arm/mach-mvebu/armada-370-xp.h
+++ b/arch/arm/mach-mvebu/armada-370-xp.h
@@ -21,7 +21,6 @@
 #define ARMADA_370_MAX_CPUS 1
 #define ARMADA_XP_MAX_CPUS  4
 
-void armada_xp_mpic_smp_cpu_init(void);
 void armada_xp_secondary_startup(void);
 extern struct smp_operations armada_xp_smp_ops;
 #endif
diff --git a/arch/arm/mach-mvebu/platsmp.c b/arch/arm/mach-mvebu/platsmp.c
index 81bf517..10d3890 100644
--- a/arch/arm/mach-mvebu/platsmp.c
+++ b/arch/arm/mach-mvebu/platsmp.c
@@ -70,11 +70,6 @@ static void __init set_secondary_cpus_clock(void)
 	}
 }
 
-static void armada_xp_secondary_init(unsigned int cpu)
-{
-	armada_xp_mpic_smp_cpu_init();
-}
-
 static int armada_xp_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	int ret, hw_cpu;
@@ -130,7 +125,6 @@ static void __init armada_xp_smp_prepare_cpus(unsigned int max_cpus)
 struct smp_operations armada_xp_smp_ops __initdata = {
 	.smp_init_cpus		= armada_xp_smp_init_cpus,
 	.smp_prepare_cpus	= armada_xp_smp_prepare_cpus,
-	.smp_secondary_init	= armada_xp_secondary_init,
 	.smp_boot_secondary	= armada_xp_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_die		= armada_xp_cpu_die,
diff --git a/drivers/irqchip/irq-armada-370-xp.c b/drivers/irqchip/irq-armada-370-xp.c
index 0bf5aef..20d9655 100644
--- a/drivers/irqchip/irq-armada-370-xp.c
+++ b/drivers/irqchip/irq-armada-370-xp.c
@@ -19,6 +19,7 @@
 #include <linux/irq.h>
 #include <linux/interrupt.h>
 #include <linux/irqchip/chained_irq.h>
+#include <linux/cpu.h>
 #include <linux/io.h>
 #include <linux/of_address.h>
 #include <linux/of_irq.h>
@@ -336,7 +337,7 @@ static void armada_mpic_send_doorbell(const struct cpumask *mask,
 		ARMADA_370_XP_SW_TRIG_INT_OFFS);
 }
 
-void armada_xp_mpic_smp_cpu_init(void)
+static void armada_xp_mpic_smp_cpu_init(void)
 {
 	/* Clear pending IPIs */
 	writel(0, per_cpu_int_base + ARMADA_370_XP_IN_DRBEL_CAUSE_OFFS);
@@ -348,6 +349,20 @@ void armada_xp_mpic_smp_cpu_init(void)
 	/* Unmask IPI interrupt */
 	writel(0, per_cpu_int_base + ARMADA_370_XP_INT_CLEAR_MASK_OFFS);
 }
+
+static int armada_xp_mpic_secondary_init(struct notifier_block *nfb,
+					 unsigned long action, void *hcpu)
+{
+	if (action == CPU_STARTING || action == CPU_STARTING_FROZEN)
+		armada_xp_mpic_smp_cpu_init();
+	return NOTIFY_OK;
+}
+
+static struct notifier_block armada_370_xp_mpic_cpu_notifier = {
+	.notifier_call = armada_xp_mpic_secondary_init,
+	.priority = 100,
+};
+
 #endif /* CONFIG_SMP */
 
 static struct irq_domain_ops armada_370_xp_mpic_irq_ops = {
@@ -537,6 +552,7 @@ static int __init armada_370_xp_mpic_of_init(struct device_node *node,
 		set_handle_irq(armada_370_xp_handle_irq);
 #ifdef CONFIG_SMP
 		set_smp_cross_call(armada_mpic_send_doorbell);
+		register_cpu_notifier(&armada_370_xp_mpic_cpu_notifier);
 #endif
 	} else {
 		irq_set_chained_handler(parent_irq,
-- 
1.8.3.2

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

* [PATCH 04/10] ARM: mvebu: add Armada 375/38x support in cpu-reset
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (2 preceding siblings ...)
  2014-03-28 13:06 ` [PATCH 03/10] irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary CPUs Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 13:07 ` [PATCH 05/10] ARM: mvebu: add function to set the resume boot address for Armada 375 Thomas Petazzoni
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

This commit adds new compatible strings for the Armada 375 and Armada
38x SOCs to the cpu-reset code of mach-mvebu. It will allow the
upcoming SMP support for these SOCs to start the secondary CPUs.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 .../devicetree/bindings/arm/armada-cpu-reset.txt       |  2 ++
 arch/arm/mach-mvebu/armada-375.h                       | 18 ++++++++++++++++++
 arch/arm/mach-mvebu/armada-380.h                       | 18 ++++++++++++++++++
 arch/arm/mach-mvebu/cpu-reset.c                        |  4 ++++
 4 files changed, 42 insertions(+)
 create mode 100644 arch/arm/mach-mvebu/armada-375.h
 create mode 100644 arch/arm/mach-mvebu/armada-380.h

diff --git a/Documentation/devicetree/bindings/arm/armada-cpu-reset.txt b/Documentation/devicetree/bindings/arm/armada-cpu-reset.txt
index 384cbf8..27e70df 100644
--- a/Documentation/devicetree/bindings/arm/armada-cpu-reset.txt
+++ b/Documentation/devicetree/bindings/arm/armada-cpu-reset.txt
@@ -7,6 +7,8 @@ Required properties:
   values are:
     marvell,armada-370-cpu-reset
     marvell,armada-xp-cpu-reset
+    marvell,armada-375-cpu-reset
+    marvell,armada-380-cpu-reset
 
 - reg: should be register base and length as documented in the
   datasheet for the CPU reset registers
diff --git a/arch/arm/mach-mvebu/armada-375.h b/arch/arm/mach-mvebu/armada-375.h
new file mode 100644
index 0000000..3da7575
--- /dev/null
+++ b/arch/arm/mach-mvebu/armada-375.h
@@ -0,0 +1,18 @@
+/*
+ * Generic definitions for Marvell Armada 375 SoCs
+ *
+ * Copyright (C) 2014 Marvell
+ *
+ * Gregory CLEMENT <gregory.clement@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __MACH_ARMADA_375_H
+#define __MACH_ARMADA_375_H
+
+#define ARMADA_375_MAX_CPUS 2
+
+#endif /* __MACH_ARMADA_375_H */
diff --git a/arch/arm/mach-mvebu/armada-380.h b/arch/arm/mach-mvebu/armada-380.h
new file mode 100644
index 0000000..fdfc34f
--- /dev/null
+++ b/arch/arm/mach-mvebu/armada-380.h
@@ -0,0 +1,18 @@
+/*
+ * Generic definitions for Marvell Armada 38x SoCs
+ *
+ * Copyright (C) 2014 Marvell
+ *
+ * Gregory CLEMENT <gregory.clement@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#ifndef __MACH_ARMADA_38X_H
+#define __MACH_ARMADA_38X_H
+
+#define ARMADA_380_MAX_CPUS 2
+
+#endif /* __MACH_ARMADA_38X_H */
diff --git a/arch/arm/mach-mvebu/cpu-reset.c b/arch/arm/mach-mvebu/cpu-reset.c
index e3821b1..8b84c94 100644
--- a/arch/arm/mach-mvebu/cpu-reset.c
+++ b/arch/arm/mach-mvebu/cpu-reset.c
@@ -16,10 +16,14 @@
 #include <linux/io.h>
 #include <linux/resource.h>
 #include "armada-370-xp.h"
+#include "armada-375.h"
+#include "armada-380.h"
 
 static struct of_device_id of_cpu_reset_table[] = {
 	{.compatible = "marvell,armada-370-cpu-reset", .data = (void*) ARMADA_370_MAX_CPUS },
 	{.compatible = "marvell,armada-xp-cpu-reset",  .data = (void*) ARMADA_XP_MAX_CPUS },
+	{.compatible = "marvell,armada-375-cpu-reset", .data = (void*) ARMADA_375_MAX_CPUS },
+	{.compatible = "marvell,armada-380-cpu-reset", .data = (void*) ARMADA_380_MAX_CPUS },
 	{ /* end of list */ },
 };
 
-- 
1.8.3.2

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

* [PATCH 05/10] ARM: mvebu: add function to set the resume boot address for Armada 375
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (3 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 04/10] ARM: mvebu: add Armada 375/38x support in cpu-reset Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 13:07 ` [PATCH 06/10] ARM: mvebu: add Armada 38x compatible string to pmsu Thomas Petazzoni
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Gregory CLEMENT <gregory.clement@free-electrons.com>

In order to boot the secondary CPUs on Armada 375, we need to set the
boot address of these CPUs, through a register part of the System
Controller (this deviates from the Armada XP design, where the boot
address was defined using a register part of the PMSU unit).

Therefore, this commit adds a new helper function in the System
Controller driver to set the secondary CPU boot address.

Moreover, it moves the System Controller initialization as an
early_initcall(), since arch_initcall() is too late for an SMP-related
initialization.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/common.h            |  1 +
 arch/arm/mach-mvebu/system-controller.c | 15 ++++++++++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index 2b88eb0..b67fb7a 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -20,6 +20,7 @@
 void mvebu_restart(enum reboot_mode mode, const char *cmd);
 int mvebu_cpu_reset_deassert(int cpu);
 void mvebu_pmsu_set_cpu_boot_addr(int hw_cpu, void *boot_addr);
+void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr);
 
 void armada_xp_cpu_die(unsigned int cpu);
 
diff --git a/arch/arm/mach-mvebu/system-controller.c b/arch/arm/mach-mvebu/system-controller.c
index 1806187..3d4489e 100644
--- a/arch/arm/mach-mvebu/system-controller.c
+++ b/arch/arm/mach-mvebu/system-controller.c
@@ -37,6 +37,8 @@ struct mvebu_system_controller {
 
 	u32 rstoutn_mask_reset_out_en;
 	u32 system_soft_reset;
+
+	u32 resume_boot_addr;
 };
 static struct mvebu_system_controller *mvebu_sc;
 
@@ -52,6 +54,7 @@ static const struct mvebu_system_controller armada_375_system_controller = {
 	.system_soft_reset_offset = 0x58,
 	.rstoutn_mask_reset_out_en = 0x1,
 	.system_soft_reset = 0x1,
+	.resume_boot_addr = 0xd4,
 };
 
 static const struct mvebu_system_controller orion_system_controller = {
@@ -98,6 +101,16 @@ void mvebu_restart(enum reboot_mode mode, const char *cmd)
 		;
 }
 
+#ifdef CONFIG_SMP
+void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr)
+{
+	BUG_ON(system_controller_base == NULL);
+	BUG_ON(mvebu_sc->resume_boot_addr == 0);
+	writel(virt_to_phys(boot_addr), system_controller_base +
+	       mvebu_sc->resume_boot_addr);
+}
+#endif
+
 static int __init mvebu_system_controller_init(void)
 {
 	struct device_node *np;
@@ -115,4 +128,4 @@ static int __init mvebu_system_controller_init(void)
 	return 0;
 }
 
-arch_initcall(mvebu_system_controller_init);
+early_initcall(mvebu_system_controller_init);
-- 
1.8.3.2

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

* [PATCH 06/10] ARM: mvebu: add Armada 38x compatible string to pmsu
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (4 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 05/10] ARM: mvebu: add function to set the resume boot address for Armada 375 Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 13:07 ` [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x Thomas Petazzoni
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

Since the Armada 38x PMSU registers are slightly different than the
Armada 370/XP PMSU ones, we introduce a new compatible string
"armada-380-pmsu" in the PMSU driver. These differences are not
visible for the current usage of the PMSU, but they might become
visible in the future.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt | 9 ++++++---
 arch/arm/mach-mvebu/pmsu.c                                   | 1 +
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt b/Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt
index 9761887..26799ef 100644
--- a/Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt
+++ b/Documentation/devicetree/bindings/arm/armada-370-xp-pmsu.txt
@@ -1,11 +1,14 @@
 Power Management Service Unit(PMSU)
 -----------------------------------
-Available on Marvell SOCs: Armada 370 and Armada XP
+Available on Marvell SOCs: Armada 370, Armada 38x and Armada XP
 
 Required properties:
 
-- compatible: should be "marvell,armada-370-pmsu", whereas
-  "marvell,armada-370-xp-pmsu" is deprecated and will be removed
+- compatible: should be one of:
+  - "marvell,armada-370-pmsu" for Armada 370 or Armada XP
+  - "marvell,armada-380-pmsu" for Armada 38x
+  - "marvell,armada-370-xp-pmsu" was used for Armada 370/XP but is now
+    deprecated and will be removed
 
 - reg: Should contain PMSU registers location and length.
 
diff --git a/arch/arm/mach-mvebu/pmsu.c b/arch/arm/mach-mvebu/pmsu.c
index a1508de..a8796b8 100644
--- a/arch/arm/mach-mvebu/pmsu.c
+++ b/arch/arm/mach-mvebu/pmsu.c
@@ -38,6 +38,7 @@ static void __iomem *pmsu_mp_base;
 static struct of_device_id of_pmsu_table[] = {
 	{ .compatible = "marvell,armada-370-pmsu", },
 	{ .compatible = "marvell,armada-370-xp-pmsu", },
+	{ .compatible = "marvell,armada-380-pmsu", },
 	{ /* end of list */ },
 };
 
-- 
1.8.3.2

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

* [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (5 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 06/10] ARM: mvebu: add Armada 38x compatible string to pmsu Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 18:13   ` Stephen Boyd
  2014-03-28 13:07 ` [PATCH 08/10] ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1 Thomas Petazzoni
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Gregory CLEMENT <gregory.clement@free-electrons.com>

This commit adds the SMP support for Armada 375 and Armada 38x. It
turns out that the SMP logic for both of these SOCs are fairly
similar, the only differences being:

 * A different method to set the secondary CPU boot address

 * An Armada 375 specific workaround needed for the early Z1 stepping,
   added by the following patch.

Other than that, the patch is fairly straightforward and adds the
usual platsmp and headsmp code, defining the smp_operations structure
that is referenced from the DT_MACHINE structures.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/Kconfig      |  4 +++
 arch/arm/mach-mvebu/Makefile     |  2 +-
 arch/arm/mach-mvebu/board-v7.c   |  2 ++
 arch/arm/mach-mvebu/common.h     |  4 +++
 arch/arm/mach-mvebu/headsmp-a9.S | 22 ++++++++++++++
 arch/arm/mach-mvebu/platsmp-a9.c | 63 ++++++++++++++++++++++++++++++++++++++++
 6 files changed, 96 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mvebu/headsmp-a9.S
 create mode 100644 arch/arm/mach-mvebu/platsmp-a9.c

diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
index 8634222..e88d951 100644
--- a/arch/arm/mach-mvebu/Kconfig
+++ b/arch/arm/mach-mvebu/Kconfig
@@ -45,6 +45,8 @@ config MACH_ARMADA_375
 	select ARMADA_375_CLK
 	select CPU_V7
 	select HAVE_ARM_SCU
+	select HAVE_ARM_TWD
+	select HAVE_SMP
 	select MACH_MVEBU_V7
 	select NEON
 	select PINCTRL_ARMADA_375
@@ -60,6 +62,8 @@ config MACH_ARMADA_38X
 	select ARMADA_38X_CLK
 	select CPU_V7
 	select HAVE_ARM_SCU
+	select HAVE_ARM_TWD
+	select HAVE_SMP
 	select MACH_MVEBU_V7
 	select NEON
 	select PINCTRL_ARMADA_38X
diff --git a/arch/arm/mach-mvebu/Makefile b/arch/arm/mach-mvebu/Makefile
index 0e0eab5..18d623f 100644
--- a/arch/arm/mach-mvebu/Makefile
+++ b/arch/arm/mach-mvebu/Makefile
@@ -6,5 +6,5 @@ AFLAGS_coherency_ll.o		:= -Wa,-march=armv7-a
 obj-y				 += system-controller.o mvebu-soc-id.o cpu-reset.o
 obj-$(CONFIG_MACH_MVEBU_V7)      += board-v7.o
 obj-$(CONFIG_ARCH_MVEBU)	 += coherency.o coherency_ll.o pmsu.o
-obj-$(CONFIG_SMP)                += platsmp.o headsmp.o
+obj-$(CONFIG_SMP)                += platsmp.o headsmp.o platsmp-a9.o headsmp-a9.o
 obj-$(CONFIG_HOTPLUG_CPU)        += hotplug.o
diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
index 6260cb8..9ded4b9 100644
--- a/arch/arm/mach-mvebu/board-v7.c
+++ b/arch/arm/mach-mvebu/board-v7.c
@@ -146,6 +146,7 @@ static const char * const armada_375_dt_compat[] = {
 };
 
 DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)")
+	.smp		= smp_ops(mvebu_cortex_a9_smp_ops),
 	.init_time	= mvebu_timer_and_clk_init,
 	.restart	= mvebu_restart,
 	.dt_compat	= armada_375_dt_compat,
@@ -158,6 +159,7 @@ static const char * const armada_38x_dt_compat[] = {
 };
 
 DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)")
+	.smp		= smp_ops(mvebu_cortex_a9_smp_ops),
 	.init_time	= mvebu_timer_and_clk_init,
 	.restart	= mvebu_restart,
 	.dt_compat	= armada_38x_dt_compat,
diff --git a/arch/arm/mach-mvebu/common.h b/arch/arm/mach-mvebu/common.h
index b67fb7a..c05de82 100644
--- a/arch/arm/mach-mvebu/common.h
+++ b/arch/arm/mach-mvebu/common.h
@@ -24,4 +24,8 @@ void mvebu_system_controller_set_cpu_boot_addr(void *boot_addr);
 
 void armada_xp_cpu_die(unsigned int cpu);
 
+#ifdef CONFIG_SMP
+extern struct smp_operations mvebu_cortex_a9_smp_ops;
+#endif
+
 #endif
diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
new file mode 100644
index 0000000..78e66c9
--- /dev/null
+++ b/arch/arm/mach-mvebu/headsmp-a9.S
@@ -0,0 +1,22 @@
+/*
+ * SMP support: Entry point for secondary CPUs of Marvell EBU
+ * Cortex-A9 based SOCs (Armada 375 and Armada 38x).
+ *
+ * Copyright (C) 2014 Marvell
+ *
+ * Gregory CLEMENT <gregory.clement@free-electrons.com>
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/linkage.h>
+#include <linux/init.h>
+
+	__CPUINIT
+ENTRY(mvebu_cortex_a9_secondary_startup)
+	bl      v7_invalidate_l1
+	b	secondary_startup
+ENDPROC(mvebu_cortex_a9_secondary_startup)
diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c
new file mode 100644
index 0000000..f29eb95
--- /dev/null
+++ b/arch/arm/mach-mvebu/platsmp-a9.c
@@ -0,0 +1,63 @@
+/*
+ * Symmetric Multi Processing (SMP) support for Marvell EBU Cortex-A9
+ * based SOCs (Armada 375/38x).
+ *
+ * Copyright (C) 2014 Marvell
+ *
+ * Gregory CLEMENT <gregory.clement@free-electrons.com>
+ * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+ *
+ * This file is licensed under the terms of the GNU General Public
+ * License version 2.  This program is licensed "as is" without any
+ * warranty of any kind, whether express or implied.
+ */
+
+#include <linux/init.h>
+#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/smp.h>
+#include <asm/smp_scu.h>
+#include <asm/smp_plat.h>
+#include "common.h"
+#include "pmsu.h"
+
+extern void mvebu_cortex_a9_secondary_startup(void);
+
+static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
+						    struct task_struct *idle)
+{
+	int ret, hw_cpu;
+
+	pr_info("Booting CPU %d\n", cpu);
+
+	/*
+	 * Write the address of secondary startup into the system-wide
+	 * flags register. The boot monitor waits until it receives a
+	 * soft interrupt, and then the secondary CPU branches to this
+	 * address.
+	 */
+	hw_cpu = cpu_logical_map(cpu);
+
+	if (of_machine_is_compatible("marvell,armada375"))
+		mvebu_system_controller_set_cpu_boot_addr(mvebu_cortex_a9_secondary_startup);
+	else
+		mvebu_pmsu_set_cpu_boot_addr(hw_cpu,
+					     mvebu_cortex_a9_secondary_startup);
+
+	smp_wmb();
+	ret = mvebu_cpu_reset_deassert(hw_cpu);
+	if (ret) {
+		pr_err("Could not start the secondary CPU: %d\n", ret);
+		return ret;
+	}
+	arch_send_wakeup_ipi_mask(cpumask_of(cpu));
+
+	return 0;
+}
+
+struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
+	.smp_boot_secondary	= mvebu_cortex_a9_boot_secondary,
+#ifdef CONFIG_HOTPLUG_CPU
+	.cpu_die		= armada_xp_cpu_die,
+#endif
+};
-- 
1.8.3.2

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

* [PATCH 08/10] ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (6 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 13:07 ` [PATCH 09/10] ARM: mvebu: add SMP support in the Armada 375 device tree Thomas Petazzoni
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Gregory CLEMENT <gregory.clement@free-electrons.com>

Due to internal bootrom issue, CPU[1] initial jump code (four
instructions) should be placed in SRAM memory of the SoC. In order to
achieve this, we have to unmap the BootROM and at some specific
location where the BootROM was place, create a specific MBus window
for the SRAM. This SRAM is initialized with a few instructions of code
that allows to jump into the real secondary CPU boot address.

This workaround will most likely be disabled when newer steppings of
the Armada 375 will be made available, in which case a dynamic test
based on mvebu-soc-id will be added.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/mach-mvebu/headsmp-a9.S | 12 ++++++++++++
 arch/arm/mach-mvebu/platsmp-a9.c | 32 ++++++++++++++++++++++++++++++++
 2 files changed, 44 insertions(+)

diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
index 78e66c9..5925366 100644
--- a/arch/arm/mach-mvebu/headsmp-a9.S
+++ b/arch/arm/mach-mvebu/headsmp-a9.S
@@ -16,6 +16,18 @@
 #include <linux/init.h>
 
 	__CPUINIT
+#define CPU_RESUME_ADDR_REG 0xf10182d4
+
+.global armada_375_smp_cpu1_enable_code_start
+.global armada_375_smp_cpu1_enable_code_end
+
+armada_375_smp_cpu1_enable_code_start:
+	ldr     r0, [pc, #4]
+	ldr     r1, [r0]
+	mov     pc, r1
+	.word   CPU_RESUME_ADDR_REG
+armada_375_smp_cpu1_enable_code_end:
+
 ENTRY(mvebu_cortex_a9_secondary_startup)
 	bl      v7_invalidate_l1
 	b	secondary_startup
diff --git a/arch/arm/mach-mvebu/platsmp-a9.c b/arch/arm/mach-mvebu/platsmp-a9.c
index f29eb95..6c311de 100644
--- a/arch/arm/mach-mvebu/platsmp-a9.c
+++ b/arch/arm/mach-mvebu/platsmp-a9.c
@@ -16,11 +16,36 @@
 #include <linux/io.h>
 #include <linux/of.h>
 #include <linux/smp.h>
+#include <linux/mbus.h>
 #include <asm/smp_scu.h>
 #include <asm/smp_plat.h>
 #include "common.h"
 #include "pmsu.h"
 
+#define CRYPT0_ENG_ID   41
+#define CRYPT0_ENG_ATTR 0x1
+#define SRAM_PHYS_BASE  0xFFFF0000
+
+#define BOOTROM_BASE    0xFFF00000
+#define BOOTROM_SIZE    0x100000
+
+extern unsigned char armada_375_smp_cpu1_enable_code_end;
+extern unsigned char armada_375_smp_cpu1_enable_code_start;
+
+void armada_375_smp_cpu1_enable_wa(void)
+{
+	void __iomem *sram_virt_base;
+
+	mvebu_mbus_del_window(BOOTROM_BASE, BOOTROM_SIZE);
+	mvebu_mbus_add_window_by_id(CRYPT0_ENG_ID, CRYPT0_ENG_ATTR,
+				SRAM_PHYS_BASE, SZ_64K);
+	sram_virt_base = ioremap(SRAM_PHYS_BASE, SZ_64K);
+
+	memcpy(sram_virt_base, &armada_375_smp_cpu1_enable_code_start,
+	       &armada_375_smp_cpu1_enable_code_end
+	       - &armada_375_smp_cpu1_enable_code_start);
+}
+
 extern void mvebu_cortex_a9_secondary_startup(void);
 
 static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
@@ -55,7 +80,14 @@ static int __cpuinit mvebu_cortex_a9_boot_secondary(unsigned int cpu,
 	return 0;
 }
 
+static void __init mvebu_cortex_a9_smp_prepare_cpus(unsigned int max_cpus)
+{
+	if (of_machine_is_compatible("marvell,armada375"))
+		armada_375_smp_cpu1_enable_wa();
+}
+
 struct smp_operations mvebu_cortex_a9_smp_ops __initdata = {
+	.smp_prepare_cpus	= mvebu_cortex_a9_smp_prepare_cpus,
 	.smp_boot_secondary	= mvebu_cortex_a9_boot_secondary,
 #ifdef CONFIG_HOTPLUG_CPU
 	.cpu_die		= armada_xp_cpu_die,
-- 
1.8.3.2

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

* [PATCH 09/10] ARM: mvebu: add SMP support in the Armada 375 device tree
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (7 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 08/10] ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1 Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 13:07 ` [PATCH 10/10] ARM: mvebu: add SMP support in the Armada 38x " Thomas Petazzoni
  2014-03-28 17:42 ` [PATCH 00/10] SMP support for Armada 375 and 38x Andrew Lunn
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

From: Gregory CLEMENT <gregory.clement@free-electrons.com>

Improve the Armada 375 Device Tree to add the CPU reset Device Tree
node, which is necessary to get SMP working.

Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/armada-375.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/armada-375.dtsi b/arch/arm/boot/dts/armada-375.dtsi
index eceab89..b9b901d 100644
--- a/arch/arm/boot/dts/armada-375.dtsi
+++ b/arch/arm/boot/dts/armada-375.dtsi
@@ -325,6 +325,11 @@
 				clocks = <&coreclk 0>;
 			};
 
+			cpurst at 20800 {
+				compatible = "marvell,armada-375-cpu-reset";
+				reg = <0x20800 0x10>;
+			};
+
 			coherency-fabric at 21010 {
 				compatible = "marvell,armada-375-coherency-fabric";
 				reg = <0x21010 0x1c>;
-- 
1.8.3.2

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

* [PATCH 10/10] ARM: mvebu: add SMP support in the Armada 38x device tree
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (8 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 09/10] ARM: mvebu: add SMP support in the Armada 375 device tree Thomas Petazzoni
@ 2014-03-28 13:07 ` Thomas Petazzoni
  2014-03-28 17:42 ` [PATCH 00/10] SMP support for Armada 375 and 38x Andrew Lunn
  10 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 13:07 UTC (permalink / raw)
  To: linux-arm-kernel

This commit improves the Armada 38x Device Tree to add the CPU reset
and PMSU Device Tree nodes, which are necessary to get SMP working.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/arm/boot/dts/armada-38x.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/arch/arm/boot/dts/armada-38x.dtsi b/arch/arm/boot/dts/armada-38x.dtsi
index 2332b20..2b2145e 100644
--- a/arch/arm/boot/dts/armada-38x.dtsi
+++ b/arch/arm/boot/dts/armada-38x.dtsi
@@ -272,11 +272,21 @@
 				clock-names = "nbclk", "fixed";
 			};
 
+			cpurst at 20800 {
+				compatible = "marvell,armada-380-cpu-reset";
+				reg = <0x20800 0x10>;
+			};
+
 			coherency-fabric at 21010 {
 				compatible = "marvell,armada-380-coherency-fabric";
 				reg = <0x21010 0x1c>;
 			};
 
+			pmsu at 22000 {
+				compatible = "marvell,armada-380-pmsu";
+				reg = <0x22000 0x1000>;
+			};
+
 			eth1: ethernet at 30000 {
 				compatible = "marvell,armada-370-neta";
 				reg = <0x30000 0x4000>;
-- 
1.8.3.2

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

* [PATCH 00/10] SMP support for Armada 375 and 38x
  2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
                   ` (9 preceding siblings ...)
  2014-03-28 13:07 ` [PATCH 10/10] ARM: mvebu: add SMP support in the Armada 38x " Thomas Petazzoni
@ 2014-03-28 17:42 ` Andrew Lunn
  10 siblings, 0 replies; 14+ messages in thread
From: Andrew Lunn @ 2014-03-28 17:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 28, 2014 at 02:06:56PM +0100, Thomas Petazzoni wrote:
> Jason, Andrew, Gregory, Sebastian,
> 
> This patch series adds SMP support for the Armada 375 and 38x. Most of
> the patches are fairly straight-forward, but here is a short overview
> of what's going on:
> 
>  * Patches 1, 2, 3 make some preparatory clean-ups. Actually, patches
>    2 and 3 are not directly related to adding Armada 375 and 38x SMP
>    support, but they are related to the SMP support of Armada XP.
> 
>  * Patches 4, 5 and 6 add a few bits needed for the SMP support.
> 
>  * Patch 7 is adding the SMP support itself. Since both Armada 375 and
>    38x are Cortex-A9, their SMP logic is fairly similar, the only
>    difference being how to define the boot address of the secondary
>    CPU. Therefore, we've used a single smp_operations implementation.
> 
>  * Patch 8 add a workaround for a SMP booting bug affecting Armada 375
>    Z1 stepping. It requires using the Crypto SRAM loaded with a few
>    instructions of code as a replacement of the BootROM for booting
>    the secondary processor. For now, the workaround is unconditionally
>    applied on all Armada 375 platforms, but as soon as we get access
>    to more recent platforms, we'll add a mvebu-soc-id based test to
>    only enable the workaround if needed.
> 
>  * Patch 9 and 10 add the necessary Device Tree bits to enable SMP on
>    Armada 375 and 38x.

Not my area of expertise, but it all looks O.K. The only comment,
which i suspect Jason will say sometime soon, is that it would be nice
if the workaround was triggered on the stepping, i.e. the same comment
he made before for another similar workaround.

Acked-by: Andrew Lunn <andrew@lunn.ch>

	  Andrew

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

* [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x
  2014-03-28 13:07 ` [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x Thomas Petazzoni
@ 2014-03-28 18:13   ` Stephen Boyd
  2014-03-28 18:19     ` Thomas Petazzoni
  0 siblings, 1 reply; 14+ messages in thread
From: Stephen Boyd @ 2014-03-28 18:13 UTC (permalink / raw)
  To: linux-arm-kernel

On 03/28/14 06:07, Thomas Petazzoni wrote:
> diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
> index 8634222..e88d951 100644
> --- a/arch/arm/mach-mvebu/Kconfig
> +++ b/arch/arm/mach-mvebu/Kconfig
> @@ -45,6 +45,8 @@ config MACH_ARMADA_375
>  	select ARMADA_375_CLK
>  	select CPU_V7
>  	select HAVE_ARM_SCU
> +	select HAVE_ARM_TWD

This should have "if SMP" appended to it (same for HAVE_ARM_SCU).

>
> diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
> index 6260cb8..9ded4b9 100644
> --- a/arch/arm/mach-mvebu/board-v7.c
> +++ b/arch/arm/mach-mvebu/board-v7.c
> @@ -146,6 +146,7 @@ static const char * const armada_375_dt_compat[] = {
>  };
>  
>  DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)")
> +	.smp		= smp_ops(mvebu_cortex_a9_smp_ops),
>  	.init_time	= mvebu_timer_and_clk_init,
>  	.restart	= mvebu_restart,
>  	.dt_compat	= armada_375_dt_compat,
> @@ -158,6 +159,7 @@ static const char * const armada_38x_dt_compat[] = {
>  };
>  
>  DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)")
> +	.smp		= smp_ops(mvebu_cortex_a9_smp_ops),
>  	.init_time	= mvebu_timer_and_clk_init,
>  	.restart	= mvebu_restart,
>  	.dt_compat	= armada_38x_dt_compat,

You may want to look into using the enable-method property in devicetree
so that you don't have to set the smp ops here. The patch to support
that is sitting in -next as 6c3ff8b11a16 (ARM: Introduce
CPU_METHOD_OF_DECLARE() for cpu hotplug/smp, 2013-10-30).

> diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
> new file mode 100644
> index 0000000..78e66c9
> --- /dev/null
> +++ b/arch/arm/mach-mvebu/headsmp-a9.S
> @@ -0,0 +1,22 @@
> +/*
> + * SMP support: Entry point for secondary CPUs of Marvell EBU
> + * Cortex-A9 based SOCs (Armada 375 and Armada 38x).
> + *
> + * Copyright (C) 2014 Marvell
> + *
> + * Gregory CLEMENT <gregory.clement@free-electrons.com>
> + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> + *
> + * This file is licensed under the terms of the GNU General Public
> + * License version 2.  This program is licensed "as is" without any
> + * warranty of any kind, whether express or implied.
> + */
> +
> +#include <linux/linkage.h>
> +#include <linux/init.h>
> +
> +	__CPUINIT

__CPUINIT is dead. Don't use it.

> +ENTRY(mvebu_cortex_a9_secondary_startup)
> +	bl      v7_invalidate_l1
> +	b	secondary_startup
> +ENDPROC(mvebu_cortex_a9_secondary_startup)
>

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation

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

* [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x
  2014-03-28 18:13   ` Stephen Boyd
@ 2014-03-28 18:19     ` Thomas Petazzoni
  0 siblings, 0 replies; 14+ messages in thread
From: Thomas Petazzoni @ 2014-03-28 18:19 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Stephen Boyd,

On Fri, 28 Mar 2014 11:13:21 -0700, Stephen Boyd wrote:
> On 03/28/14 06:07, Thomas Petazzoni wrote:
> > diff --git a/arch/arm/mach-mvebu/Kconfig b/arch/arm/mach-mvebu/Kconfig
> > index 8634222..e88d951 100644
> > --- a/arch/arm/mach-mvebu/Kconfig
> > +++ b/arch/arm/mach-mvebu/Kconfig
> > @@ -45,6 +45,8 @@ config MACH_ARMADA_375
> >  	select ARMADA_375_CLK
> >  	select CPU_V7
> >  	select HAVE_ARM_SCU
> > +	select HAVE_ARM_TWD
> 
> This should have "if SMP" appended to it (same for HAVE_ARM_SCU).

Thanks, will do. The HAVE_ARM_SCU addition is part of a separate
series, the Armada 375/38x coherency series, so I'll fix it in there.

> > diff --git a/arch/arm/mach-mvebu/board-v7.c b/arch/arm/mach-mvebu/board-v7.c
> > index 6260cb8..9ded4b9 100644
> > --- a/arch/arm/mach-mvebu/board-v7.c
> > +++ b/arch/arm/mach-mvebu/board-v7.c
> > @@ -146,6 +146,7 @@ static const char * const armada_375_dt_compat[] = {
> >  };
> >  
> >  DT_MACHINE_START(ARMADA_375_DT, "Marvell Armada 375 (Device Tree)")
> > +	.smp		= smp_ops(mvebu_cortex_a9_smp_ops),
> >  	.init_time	= mvebu_timer_and_clk_init,
> >  	.restart	= mvebu_restart,
> >  	.dt_compat	= armada_375_dt_compat,
> > @@ -158,6 +159,7 @@ static const char * const armada_38x_dt_compat[] = {
> >  };
> >  
> >  DT_MACHINE_START(ARMADA_38X_DT, "Marvell Armada 380/385 (Device Tree)")
> > +	.smp		= smp_ops(mvebu_cortex_a9_smp_ops),
> >  	.init_time	= mvebu_timer_and_clk_init,
> >  	.restart	= mvebu_restart,
> >  	.dt_compat	= armada_38x_dt_compat,
> 
> You may want to look into using the enable-method property in devicetree
> so that you don't have to set the smp ops here. The patch to support
> that is sitting in -next as 6c3ff8b11a16 (ARM: Introduce
> CPU_METHOD_OF_DECLARE() for cpu hotplug/smp, 2013-10-30).

Hm, ok, I'll have a look into that.

> > diff --git a/arch/arm/mach-mvebu/headsmp-a9.S b/arch/arm/mach-mvebu/headsmp-a9.S
> > new file mode 100644
> > index 0000000..78e66c9
> > --- /dev/null
> > +++ b/arch/arm/mach-mvebu/headsmp-a9.S
> > @@ -0,0 +1,22 @@
> > +/*
> > + * SMP support: Entry point for secondary CPUs of Marvell EBU
> > + * Cortex-A9 based SOCs (Armada 375 and Armada 38x).
> > + *
> > + * Copyright (C) 2014 Marvell
> > + *
> > + * Gregory CLEMENT <gregory.clement@free-electrons.com>
> > + * Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> > + *
> > + * This file is licensed under the terms of the GNU General Public
> > + * License version 2.  This program is licensed "as is" without any
> > + * warranty of any kind, whether express or implied.
> > + */
> > +
> > +#include <linux/linkage.h>
> > +#include <linux/init.h>
> > +
> > +	__CPUINIT
> 
> __CPUINIT is dead. Don't use it.

Sure, will fix, thanks.

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

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

end of thread, other threads:[~2014-03-28 18:19 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-28 13:06 [PATCH 00/10] SMP support for Armada 375 and 38x Thomas Petazzoni
2014-03-28 13:06 ` [PATCH 01/10] ARM: mvebu: move Armada XP specific SMP initialization to platsmp.c Thomas Petazzoni
2014-03-28 13:06 ` [PATCH 02/10] irqchip: irq-armada-370-xp: do the set_smp_cross_call() in the driver Thomas Petazzoni
2014-03-28 13:06 ` [PATCH 03/10] irqchip: irq-armada-370-xp: use cpu notifier to initialize secondary CPUs Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 04/10] ARM: mvebu: add Armada 375/38x support in cpu-reset Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 05/10] ARM: mvebu: add function to set the resume boot address for Armada 375 Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 06/10] ARM: mvebu: add Armada 38x compatible string to pmsu Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 07/10] ARM: mvebu: add SMP support for Armada 375 and Armada 38x Thomas Petazzoni
2014-03-28 18:13   ` Stephen Boyd
2014-03-28 18:19     ` Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 08/10] ARM: mvebu: add workaround for SMP support for Armada 375 stepping Z1 Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 09/10] ARM: mvebu: add SMP support in the Armada 375 device tree Thomas Petazzoni
2014-03-28 13:07 ` [PATCH 10/10] ARM: mvebu: add SMP support in the Armada 38x " Thomas Petazzoni
2014-03-28 17:42 ` [PATCH 00/10] SMP support for Armada 375 and 38x Andrew Lunn

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