public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: sergei.shtylyov@cogentembedded•com (Sergei Shtylyov)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3 05/12] ARM: shmobile: r8a7792: add SMP support
Date: Thu, 09 Jun 2016 00:15:17 +0300	[thread overview]
Message-ID: <7848375.HIECFST0Ua@wasted.cogentembedded.com> (raw)
In-Reply-To: <12536856.AsKMEpuejQ@wasted.cogentembedded.com>

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;
+
+#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
+};

  parent reply	other threads:[~2016-06-08 21:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-08 21:01 [PATCH v3 00/12] Add R8A7792/Blanche board support Sergei Shtylyov
2016-06-08 21:11 ` [PATCH v3 04/12] ARM: shmobile: r8a7792: basic SoC support Sergei Shtylyov
2016-06-08 21:15 ` Sergei Shtylyov [this message]
2016-06-09  8:44   ` [PATCH v3 05/12] ARM: shmobile: r8a7792: add SMP support Geert Uytterhoeven
2016-06-09 11:22     ` Sergei Shtylyov
2016-06-08 21:17 ` [PATCH v3 06/12] ARM: dts: r8a7792: initial SoC device tree Sergei Shtylyov
2016-06-09 10:05   ` Geert Uytterhoeven
2016-06-09 20:36     ` Sergei Shtylyov
2016-06-08 21:28 ` [PATCH v3 07/12] ARM: dts: r8a7792: add SYS-DMAC support Sergei Shtylyov
2016-06-08 21:30 ` [PATCH v3 08/12] ARM: dts: r8a7792: add [H]SCIF support Sergei Shtylyov
2016-06-08 21:31 ` [PATCH v3 09/12] ARM: dts: r8a7792: add IRQC support Sergei Shtylyov
2016-06-08 21:35 ` [PATCH v3 11/12] ARM: dts: blanche: initial device tree Sergei Shtylyov
2016-06-08 21:36 ` [PATCH v3 12/12] ARM: dts: blanche: add Ethernet support Sergei Shtylyov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7848375.HIECFST0Ua@wasted.cogentembedded.com \
    --to=sergei.shtylyov@cogentembedded$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox