diff mbox

[v3,05/12] ARM: shmobile: r8a7792: add SMP support

Message ID 7848375.HIECFST0Ua@wasted.cogentembedded.com (mailing list archive)
State Superseded
Delegated to: Simon Horman
Headers show

Commit Message

Sergei Shtylyov June 8, 2016, 9:15 p.m. UTC
Add R8A7792 SMP support using the shared APMU code. This SoC has 2 ARM
Cortex-A15  CPU cores.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
Changes in version 3:
- new patch.

 arch/arm/mach-shmobile/Makefile        |    1 
 arch/arm/mach-shmobile/r8a7792.h       |    6 +++
 arch/arm/mach-shmobile/setup-r8a7792.c |    2 +
 arch/arm/mach-shmobile/smp-r8a7792.c   |   62 +++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+)

Comments

Geert Uytterhoeven June 9, 2016, 8:44 a.m. UTC | #1
Hi Sergei,

On Wed, Jun 8, 2016 at 11:15 PM, Sergei Shtylyov
<sergei.shtylyov@cogentembedded.com> wrote:
> Add R8A7792 SMP support using the shared APMU code. This SoC has 2 ARM
> Cortex-A15  CPU cores.
>
> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>
> ---
> Changes in version 3:
> - new patch.
>
>  arch/arm/mach-shmobile/Makefile        |    1
>  arch/arm/mach-shmobile/r8a7792.h       |    6 +++
>  arch/arm/mach-shmobile/setup-r8a7792.c |    2 +
>  arch/arm/mach-shmobile/smp-r8a7792.c   |   62 +++++++++++++++++++++++++++++++++
>  4 files changed, 71 insertions(+)
>
> Index: renesas/arch/arm/mach-shmobile/Makefile
> ===================================================================
> --- renesas.orig/arch/arm/mach-shmobile/Makefile
> +++ renesas/arch/arm/mach-shmobile/Makefile
> @@ -35,6 +35,7 @@ smp-$(CONFIG_ARCH_SH73A0)     += smp-sh73a0.
>  smp-$(CONFIG_ARCH_R8A7779)     += smp-r8a7779.o headsmp-scu.o platsmp-scu.o
>  smp-$(CONFIG_ARCH_R8A7790)     += smp-r8a7790.o
>  smp-$(CONFIG_ARCH_R8A7791)     += smp-r8a7791.o
> +smp-$(CONFIG_ARCH_R8A7792)     += smp-r8a7792.o
>  smp-$(CONFIG_ARCH_EMEV2)       += smp-emev2.o headsmp-scu.o platsmp-scu.o
>
>  # PM objects
> Index: renesas/arch/arm/mach-shmobile/r8a7792.h
> ===================================================================
> --- /dev/null
> +++ renesas/arch/arm/mach-shmobile/r8a7792.h
> @@ -0,0 +1,6 @@
> +#ifndef __ASM_R8A7792_H__
> +#define __ASM_R8A7792_H__
> +
> +extern const struct smp_operations r8a7792_smp_ops;

For new SMP support, you should no longer add an SoC-specific struct
smp_operations, but rely on the DT "enable-method" property, cfr.
"[PATCH v3 00/09] ARM: shmobile: APMU DT support via SMP Enable method V3"
(http://www.spinics.net/lists/linux-sh/msg45229.html).

That series will no longer apply, but I've been carrying (and rebasing) it in
my local tree for quite a while, as it was related to SYSC cleanup (avoiding
your r8a7792_ca15_scu). But unfortunately that depends on the SYSC node always
be present in DT.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds
Sergei Shtylyov June 9, 2016, 11:22 a.m. UTC | #2
On 6/9/2016 11:44 AM, Geert Uytterhoeven wrote:

>> Add R8A7792 SMP support using the shared APMU code. This SoC has 2 ARM
>> Cortex-A15  CPU cores.
>>
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
>>
[...]
>>  # PM objects
>> Index: renesas/arch/arm/mach-shmobile/r8a7792.h
>> ===================================================================
>> --- /dev/null
>> +++ renesas/arch/arm/mach-shmobile/r8a7792.h
>> @@ -0,0 +1,6 @@
>> +#ifndef __ASM_R8A7792_H__
>> +#define __ASM_R8A7792_H__
>> +
>> +extern const struct smp_operations r8a7792_smp_ops;
>
> For new SMP support, you should no longer add an SoC-specific struct
> smp_operations, but rely on the DT "enable-method" property, cfr.
> "[PATCH v3 00/09] ARM: shmobile: APMU DT support via SMP Enable method V3"
> (http://www.spinics.net/lists/linux-sh/msg45229.html).
>
> That series will no longer apply, but I've been carrying (and rebasing) it in
> my local tree for quite a while, as it was related to SYSC cleanup (avoiding
> your r8a7792_ca15_scu). But unfortunately that depends on the SYSC node always
> be present in DT.

    My patch is not against you repo, it's against Simon's repo. If you indeed 
care for these Magnus' patches (abandoned again?), please re-post them and get 
them merged.

> Gr{oetje,eeting}s,
>
>                         Geert

MBR, Sergei
diff mbox

Patch

Index: renesas/arch/arm/mach-shmobile/Makefile
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/Makefile
+++ renesas/arch/arm/mach-shmobile/Makefile
@@ -35,6 +35,7 @@  smp-$(CONFIG_ARCH_SH73A0)	+= smp-sh73a0.
 smp-$(CONFIG_ARCH_R8A7779)	+= smp-r8a7779.o headsmp-scu.o platsmp-scu.o
 smp-$(CONFIG_ARCH_R8A7790)	+= smp-r8a7790.o
 smp-$(CONFIG_ARCH_R8A7791)	+= smp-r8a7791.o
+smp-$(CONFIG_ARCH_R8A7792)	+= smp-r8a7792.o
 smp-$(CONFIG_ARCH_EMEV2)	+= smp-emev2.o headsmp-scu.o platsmp-scu.o
 
 # PM objects
Index: renesas/arch/arm/mach-shmobile/r8a7792.h
===================================================================
--- /dev/null
+++ renesas/arch/arm/mach-shmobile/r8a7792.h
@@ -0,0 +1,6 @@ 
+#ifndef __ASM_R8A7792_H__
+#define __ASM_R8A7792_H__
+
+extern const struct smp_operations r8a7792_smp_ops;
+
+#endif /* __ASM_R8A7792_H__ */
Index: renesas/arch/arm/mach-shmobile/setup-r8a7792.c
===================================================================
--- renesas.orig/arch/arm/mach-shmobile/setup-r8a7792.c
+++ renesas/arch/arm/mach-shmobile/setup-r8a7792.c
@@ -20,6 +20,7 @@ 
 
 #include "common.h"
 #include "rcar-gen2.h"
+#include "r8a7792.h"
 
 static const char * const r8a7792_boards_compat_dt[] __initconst = {
 	"renesas,r8a7792",
@@ -27,6 +28,7 @@  static const char * const r8a7792_boards
 };
 
 DT_MACHINE_START(R8A7792_DT, "Generic R8A7792 (Flattened Device Tree)")
+	.smp		= smp_ops(r8a7792_smp_ops),
 	.init_early	= shmobile_init_delay,
 	.init_late	= shmobile_init_late,
 	.init_time	= rcar_gen2_timer_init,
Index: renesas/arch/arm/mach-shmobile/smp-r8a7792.c
===================================================================
--- /dev/null
+++ renesas/arch/arm/mach-shmobile/smp-r8a7792.c
@@ -0,0 +1,62 @@ 
+/*
+ * SMP support for r8a7792
+ *
+ * Copyright (C) 2014 Renesas Electronics Corporation
+ * Copyright (C) 2016 Cogent  Embedded, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ */
+
+#include <linux/kernel.h>
+#include <linux/init.h>
+#include <linux/smp.h>
+#include <linux/io.h>
+#include <linux/soc/renesas/rcar-sysc.h>
+
+#include <asm/smp_plat.h>
+
+#include "common.h"
+#include "platsmp-apmu.h"
+#include "rcar-gen2.h"
+#include "r8a7792.h"
+
+static struct rcar_sysc_ch r8a7792_ca15_scu = {
+	.chan_offs	= 0x180,	/* PWRSR5 .. PWRER5 */
+	.isr_bit	= 12,		/* CA15-SCU */
+};
+
+static struct rcar_apmu_config r8a7792_apmu_config[] = {
+	{
+		.iomem	= DEFINE_RES_MEM(0xe6152000, 0x188),
+		.cpus	= { 0, 1 },
+	},
+};
+
+static void __init r8a7792_smp_prepare_cpus(unsigned int max_cpus)
+{
+	/* let APMU code install data related to shmobile_boot_vector */
+	shmobile_smp_apmu_prepare_cpus(max_cpus,
+				       r8a7792_apmu_config,
+				       ARRAY_SIZE(r8a7792_apmu_config));
+
+	/* turn on power to SCU */
+	rcar_gen2_pm_init();
+	rcar_sysc_power_up(&r8a7792_ca15_scu);
+}
+
+const struct smp_operations r8a7792_smp_ops __initconst = {
+	.smp_prepare_cpus	= r8a7792_smp_prepare_cpus,
+	.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,
+	.cpu_kill		= shmobile_smp_apmu_cpu_kill,
+#endif
+};