linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chen-Yu Tsai <wens@csie.org>
To: Maxime Ripard <maxime.ripard@free-electrons.com>
Cc: Chen-Yu Tsai <wens@csie.org>,
	Nicolas Pitre <nicolas.pitre@linaro.org>,
	Dave Martin <Dave.Martin@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, linux-sunxi@googlegroups.com
Subject: [RFC 6/7] ARM: sunxi: mcpm: Support cpu0 hotplug
Date: Thu, 14 May 2015 14:10:10 +0800	[thread overview]
Message-ID: <1431583811-25780-7-git-send-email-wens@csie.org> (raw)
In-Reply-To: <1431583811-25780-1-git-send-email-wens@csie.org>

This sets the flags that makes BROM jump execution on the
primary core (cpu0)to the SMP software entry code.

Signed-off-by: Chen-Yu Tsai <wens@csie.org>
---
 arch/arm/mach-sunxi/mcpm.c | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/arch/arm/mach-sunxi/mcpm.c b/arch/arm/mach-sunxi/mcpm.c
index 5ea4b488890c..e74e8aab2560 100644
--- a/arch/arm/mach-sunxi/mcpm.c
+++ b/arch/arm/mach-sunxi/mcpm.c
@@ -58,8 +58,12 @@
 #define PRCM_PWR_SWITCH_REG(c, cpu)	(0x140 + 0x10 * (c) + 0x4 * (cpu))
 #define PRCM_CPU_SOFT_ENTRY_REG		0x164
 
+#define CPU0_SUPPORT_HOTPLUG_MAGIC0	0xFA50392F
+#define CPU0_SUPPORT_HOTPLUG_MAGIC1	0x790DCA3A
+
 static void __iomem *cpucfg_base;
 static void __iomem *prcm_base;
+static void __iomem *sram_b_smp_base;
 
 static int sunxi_cpu_power_switch_set(unsigned int cpu, unsigned int cluster,
 				      bool enable)
@@ -93,6 +97,17 @@ static int sunxi_cpu_power_switch_set(unsigned int cpu, unsigned int cluster,
 	return 0;
 }
 
+static void sunxi_cpu0_hotplug_support_set(bool enable)
+{
+	if (enable) {
+		writel(CPU0_SUPPORT_HOTPLUG_MAGIC0, sram_b_smp_base);
+		writel(CPU0_SUPPORT_HOTPLUG_MAGIC1, sram_b_smp_base + 0x4);
+	} else {
+		writel(0x0, sram_b_smp_base);
+		writel(0x0, sram_b_smp_base + 0x4);
+	}
+}
+
 static int sunxi_cpu_powerup(unsigned int cpu, unsigned int cluster)
 {
 	u32 reg;
@@ -101,6 +116,10 @@ static int sunxi_cpu_powerup(unsigned int cpu, unsigned int cluster)
 	if (cpu >= SUNXI_CPUS_PER_CLUSTER || cluster >= SUNXI_NR_CLUSTERS)
 		return -EINVAL;
 
+	/* Set hotplug support magic flags for cpu0 */
+	if (cluster == 0 && cpu == 0)
+		sunxi_cpu0_hotplug_support_set(true);
+
 	/* assert processor power-on reset */
 	reg = readl(prcm_base + PRCM_CPU_PO_RST_CTRL(cluster));
 	reg &= ~PRCM_CPU_PO_RST_CTRL_CORE(cpu);
@@ -441,6 +460,19 @@ static int __init sunxi_mcpm_init(void)
 		return -ENOMEM;
 	}
 
+	node = of_find_compatible_node(NULL, NULL,
+			"allwinner,sun9i-smp-sram");
+	if (!node)
+		return -ENODEV;
+
+	sram_b_smp_base = of_iomap(node, 0);
+	of_node_put(node);
+	if (!sram_b_smp_base) {
+		pr_err("%s: failed to map secure SRAM\n", __func__);
+		iounmap(sram_b_smp_base);
+		return -ENOMEM;
+	}
+
 	ret = mcpm_platform_register(&sunxi_power_ops);
 	if (!ret)
 		ret = mcpm_sync_init(sunxi_power_up_setup);
-- 
2.1.4


  parent reply	other threads:[~2015-05-14  6:11 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-14  6:10 [RFC 0/7] ARM: sun9i: SMP support with Multi-Cluster Power Management Chen-Yu Tsai
2015-05-14  6:10 ` [RFC 1/7] ARM: sun9i: Support SMP on A80 with Multi-Cluster Power Management (MCPM) Chen-Yu Tsai
2015-05-14  6:10 ` [RFC 2/7] ARM: dts: sun9i: Add CCI-400 device nodes for A80 Chen-Yu Tsai
2015-05-17 14:51   ` Maxime Ripard
2015-05-19  7:12     ` Chen-Yu Tsai
2015-05-14  6:10 ` [RFC 3/7] ARM: dts: sun9i: Add CPUCFG device node for A80 dtsi Chen-Yu Tsai
2015-05-14  6:10 ` [RFC 4/7] ARM: dts: sun9i: Add PRCM device node for the " Chen-Yu Tsai
2015-05-17 14:54   ` Maxime Ripard
2015-05-19  3:08     ` Chen-Yu Tsai
2015-05-14  6:10 ` [RFC 5/7] ARM: sunxi: mcpm: Support CPU/cluster power down and hotplugging for cpu1~7 Chen-Yu Tsai
2015-05-14  6:10 ` Chen-Yu Tsai [this message]
2015-05-14  6:10 ` [RFC 7/7] ARM: dts: sun9i: Add secure SRAM node used for MCPM SMP hotplug Chen-Yu Tsai
2015-05-20 10:08   ` Maxime Ripard
2015-05-24 15:55     ` [linux-sunxi] " Chen-Yu Tsai
2015-05-25 21:24       ` Maxime Ripard
2015-05-26 16:47         ` Chen-Yu Tsai
2015-06-11 16:33           ` Maxime Ripard
2015-05-16 10:08 ` [linux-sunxi] [RFC 0/7] ARM: sun9i: SMP support with Multi-Cluster Power Management Ian Campbell
2015-05-17 14:38   ` Maxime Ripard
2015-05-18  5:19     ` Nicolas Pitre
2015-05-18  9:04       ` Maxime Ripard
2015-05-19  2:51   ` Chen-Yu Tsai

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=1431583811-25780-7-git-send-email-wens@csie.org \
    --to=wens@csie.org \
    --cc=Dave.Martin@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sunxi@googlegroups.com \
    --cc=maxime.ripard@free-electrons.com \
    --cc=nicolas.pitre@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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;
as well as URLs for NNTP newsgroup(s).