diff mbox

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

Message ID 8892035.WlgqvXCvaR@wasted.cogentembedded.com (mailing list archive)
State Rejected
Delegated to: Simon Horman
Headers show

Commit Message

Sergei Shtylyov June 12, 2016, 9:04 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

Simon Horman June 15, 2016, 2:30 a.m. UTC | #1
Hi Sergei,

On Mon, Jun 13, 2016 at 12:04:43AM +0300, Sergei Shtylyov 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>

I apologise for not raising this earlier.

I would like you to remove SMP support from this series as I do
not wish to merge any more per-SoC C SMP code for Gen-2 SoCs.

Rather, I believe the future is to use generic code to support
the APMU hardware and then describe it in DT. Something like this:

http://www.spinics.net/lists/linux-sh/msg45229.html

As that code is not merged my suggestion is that we merge UP r8a7792 for
now. This is the same approach that has been taken for the r8a7793.

Thanks!
Sergei Shtylyov June 15, 2016, 10:43 a.m. UTC | #2
On 6/15/2016 5:30 AM, Simon Horman 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>
>
> I apologise for not raising this earlier.
>
> I would like you to remove SMP support from this series as I do
> not wish to merge any more per-SoC C SMP code for Gen-2 SoCs.
>
> Rather, I believe the future is to use generic code to support
> the APMU hardware and then describe it in DT. Something like this:
>
> http://www.spinics.net/lists/linux-sh/msg45229.html

    Sigh...

> As that code is not merged my suggestion is that we merge UP r8a7792 for
> now. This is the same approach that has been taken for the r8a7793.

    It should be enough to drop the SMP patch from the series. Could you do it 
or should I repost again?

> Thanks!

MBR, Sergei
Simon Horman June 16, 2016, 5:19 a.m. UTC | #3
On Wed, Jun 15, 2016 at 01:43:48PM +0300, Sergei Shtylyov wrote:
> On 6/15/2016 5:30 AM, Simon Horman 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>
> >
> >I apologise for not raising this earlier.
> >
> >I would like you to remove SMP support from this series as I do
> >not wish to merge any more per-SoC C SMP code for Gen-2 SoCs.
> >
> >Rather, I believe the future is to use generic code to support
> >the APMU hardware and then describe it in DT. Something like this:
> >
> >http://www.spinics.net/lists/linux-sh/msg45229.html
> 
>    Sigh...
> 
> >As that code is not merged my suggestion is that we merge UP r8a7792 for
> >now. This is the same approach that has been taken for the r8a7793.
> 
>    It should be enough to drop the SMP patch from the series. Could you do
> it or should I repost again?

Sure, I think that is reasonable.

I have queued up the series with the following modifications:

* Omitted: "[PATCH v5 05/12] ARM: shmobile: r8a7792: add SMP support"
* Omitted cpu1 node from " [PATCH v5 06/12] ARM: dts: r8a7792: initial SoC device tree"
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
+};