All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
       [not found] ` <Scott Shu <srv_scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2015-06-18  2:46   ` Scott Shu
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
  0 siblings, 1 reply; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w

This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

This is based on v4.1-rc1 and following patch series:
(1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
(2) Mars Cheng's "Add mt6580 basic chip support" [2]
(3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]

The secondary cores are power off as default on MT6580, this change adds
a new enable-method to turn on power to the cores during booting process.

The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
power domain control. Please check [3] for more information about SCPSYS.

[1] https://lkml.org/lkml/2015/5/16/33
[2] https://lkml.org/lkml/2015/6/3/113
[3] https://lkml.org/lkml/2015/6/9/172


Scott Shu (6):
  Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  soc: Mediatek: Add SCPSYS CPU power domain driver
  ARM: mediatek: add smp bringup code for MT6580
  ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
  ARM: dts: mt6580: enable basic SMP bringup for mt6580

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
 arch/arm/mach-mediatek/Makefile                |   2 +-
 arch/arm/mach-mediatek/generic.h               |  24 +++
 arch/arm/mach-mediatek/hotplug.c               | 228 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/mediatek.c              |   4 +-
 arch/arm/mach-mediatek/platsmp.c               | 107 ++++++++++++
 7 files changed, 389 insertions(+), 2 deletions(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

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

* [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2015-06-18  2:46       ` Scott Shu
  2015-06-18  2:46       ` [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver Scott Shu
                         ` (5 subsequent siblings)
  6 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Scott Shu

For MT6580 SoC platform, the secondary cores are in powered off state
as default, so compared with MT65xx series SoC, one new enable method
is needed. This method using the SPM (System Power Manager) inside
the SCYSYS to control the CPU power.
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index ac2903d..fb80b2e 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
 			    "marvell,armada-380-smp"
 			    "marvell,armada-390-smp"
 			    "marvell,armada-xp-smp"
+			    "mediatek,mt6580-smp"
 			    "mediatek,mt65xx-smp"
 			    "mediatek,mt81xx-tz-smp"
 			    "qcom,gcc-msm8660"
-- 
1.8.1.1.dirty

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

* [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
  2015-06-18  2:46       ` [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform Scott Shu
@ 2015-06-18  2:46       ` Scott Shu
  2015-06-18  2:46       ` [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580 Scott Shu
                         ` (4 subsequent siblings)
  6 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Scott Shu

This adds a CPU power domain driver for the Mediatek SCPSYS unit on
mt6580.
---
 arch/arm/mach-mediatek/Makefile  |   2 +-
 arch/arm/mach-mediatek/generic.h |  24 +++++
 arch/arm/mach-mediatek/hotplug.c | 228 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 2116460..b2e4ef5 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1,4 +1,4 @@
 ifeq ($(CONFIG_SMP),y)
-obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o hotplug.o
 endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/generic.h b/arch/arm/mach-mediatek/generic.h
new file mode 100644
index 0000000..2a0d0c8
--- /dev/null
+++ b/arch/arm/mach-mediatek/generic.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+#ifndef __MACH_MTK_COMMON__
+#define __MACH_MTK_COMMON__
+
+#include <linux/kernel.h>
+
+int spm_cpu_mtcmos_init(void);
+int spm_cpu_mtcmos_on(int cpu);
+int spm_cpu_mtcmos_off(int cpu, bool wfi);
+
+#endif
diff --git a/arch/arm/mach-mediatek/hotplug.c b/arch/arm/mach-mediatek/hotplug.c
new file mode 100644
index 0000000..be0305d
--- /dev/null
+++ b/arch/arm/mach-mediatek/hotplug.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+/* SCPSYS registers */
+#define SPM_POWERON_CONFIG_SET		0x0000
+
+#define SPM_CA7_CPU0_PWR_CON		0x0200
+#define SPM_CA7_CPU1_PWR_CON		0x0218
+#define SPM_CA7_CPU2_PWR_CON		0x021c
+#define SPM_CA7_CPU3_PWR_CON		0x0220
+
+#define SPM_CA7_CPU0_L1_PDN		0x025c
+#define SPM_CA7_CPU1_L1_PDN		0x0264
+#define SPM_CA7_CPU2_L1_PDN		0x026c
+#define SPM_CA7_CPU3_L1_PDN		0x0274
+
+#define SPM_PWR_STATUS			0x060c
+#define SPM_PWR_STATUS_2ND		0x0610
+#define SPM_SLEEP_TIMER_STA		0x0720
+
+/*
+ * bit definition in SPM_CA7_CPUx_PWR_CON
+ */
+#define SRAM_ISOINT_B		BIT(6)
+#define SRAM_CKISO		BIT(5)
+#define PWR_CLK_DIS		BIT(4)
+#define PWR_ON_2ND		BIT(3)
+#define PWR_ON			BIT(2)
+#define PWR_ISO			BIT(1)
+#define PWR_RST_B		BIT(0)
+
+/*
+ * bit definition in SPM_CA7_CPUx_L1_PDN
+ */
+#define L1_PDN_ACK		BIT(8)
+#define L1_PDN			BIT(0)
+
+void __iomem *spm_cpu_base;
+
+u32 spm_cpu_pwr_con[4] = {
+	SPM_CA7_CPU0_PWR_CON,
+	SPM_CA7_CPU1_PWR_CON,
+	SPM_CA7_CPU2_PWR_CON,
+	SPM_CA7_CPU3_PWR_CON,
+};
+
+u32 spm_cpu_l1_pdn[4] = {
+	SPM_CA7_CPU0_L1_PDN,
+	SPM_CA7_CPU1_L1_PDN,
+	SPM_CA7_CPU2_L1_PDN,
+	SPM_CA7_CPU3_L1_PDN,
+};
+
+#define SPM_REGWR_EN		(1U << 0)
+#define SPM_PROJECT_CODE	0x0B16
+
+int spm_cpu_mtcmos_on(int cpu)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	udelay(1);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu))) ||
+		((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu)))) {
+		;
+	}
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power on */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp &= ~L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn) &
+		L1_PDN_ACK) != 0)
+		;
+
+	udelay(1);
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_off(int cpu, bool wfi)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	if (wfi) {
+		while ((readl_relaxed(spm_cpu_base + SPM_SLEEP_TIMER_STA) &
+			(1U << (16 + cpu))) == 0)
+			;
+	}
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power off */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp |= L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn)
+		& L1_PDN_ACK) != L1_PDN_ACK)
+		;
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != 0) ||
+	       ((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != 0))
+		;
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "mediatek,mt6580-scpsys");
+	if (!node) {
+		pr_err("Missing mt6580-scpsys node in the device tree\n");
+		return -EINVAL;
+	}
+
+	spm_cpu_base = of_iomap(node, 0);
+	if (!spm_cpu_base) {
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
-- 
1.8.1.1.dirty

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

* [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
  2015-06-18  2:46       ` [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform Scott Shu
  2015-06-18  2:46       ` [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver Scott Shu
@ 2015-06-18  2:46       ` Scott Shu
  2015-06-18  2:46       ` [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working " Scott Shu
                         ` (3 subsequent siblings)
  6 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Scott Shu

Add support for cpu enable-method "mediatek,mt6580-smp" for booting
secondary CPUs on MT6580.
---
 arch/arm/mach-mediatek/platsmp.c | 107 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 12fefb3..2985913 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -21,10 +21,15 @@
 #include <linux/of_address.h>
 #include <linux/string.h>
 #include <linux/threads.h>
+#include <linux/delay.h>
+#include <asm/cacheflush.h>
+#include "generic.h"
 
 #define MTK_MAX_CPU		8
 #define MTK_SMP_REG_SIZE	0x1000
 
+static DEFINE_SPINLOCK(boot_lock);
+
 struct mtk_smp_boot_info {
 	unsigned long smp_base;
 	unsigned int jump_reg;
@@ -57,6 +62,101 @@ static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	/* Make sure this is visible to other CPUs */
+	smp_wmb();
+	sync_cache_w(&pen_release);
+}
+
+static int mt6580_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * Set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+	write_pen_release(cpu);
+
+	/*
+	 * CPU power on control by SPM
+	 */
+	spm_cpu_mtcmos_on(cpu);
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		/* Read barrier */
+		smp_rmb();
+
+		if (pen_release == -1)
+			break;
+
+		usleep_range(10, 1000);
+	}
+
+	/*
+	 * Now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return (pen_release != -1 ? -EINVAL : 0);
+}
+
+static void mt6580_secondary_init(unsigned int cpu)
+{
+	/*
+	 * Let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	write_pen_release(-1);
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+#define MT6580_INFRACFG_AO	0x10001000
+#define SW_ROM_PD		BIT(31)
+
+static void __init mt6580_smp_prepare_cpus(unsigned int max_cpus)
+{
+	static void __iomem *infracfg_ao_base;
+
+	infracfg_ao_base = ioremap(MT6580_INFRACFG_AO, 0x1000);
+
+	if (!infracfg_ao_base)
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+
+	/* Enable bootrom power down mode */
+	writel_relaxed(readl(infracfg_ao_base + 0x804) | SW_ROM_PD,
+		       infracfg_ao_base + 0x804);
+
+	/* Write the address of slave startup into boot address
+	   register for bootrom power down mode */
+	writel_relaxed(virt_to_phys(secondary_startup_arm),
+		       infracfg_ao_base + 0x800);
+
+	iounmap(infracfg_ao_base);
+
+	/* Initial spm cpu mtcmos memory map */
+	spm_cpu_mtcmos_init();
+}
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	if (!mtk_smp_base)
@@ -143,3 +243,10 @@ static struct smp_operations mt65xx_smp_ops __initdata = {
 	.smp_boot_secondary = mtk_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(mt65xx_smp, "mediatek,mt65xx-smp", &mt65xx_smp_ops);
+
+static struct smp_operations mt6580_smp_ops __initdata = {
+	.smp_prepare_cpus = mt6580_smp_prepare_cpus,
+	.smp_secondary_init = mt6580_secondary_init,
+	.smp_boot_secondary = mt6580_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6580_smp, "mediatek,mt6580-smp", &mt6580_smp_ops);
-- 
1.8.1.1.dirty

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

* [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
                         ` (2 preceding siblings ...)
  2015-06-18  2:46       ` [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580 Scott Shu
@ 2015-06-18  2:46       ` Scott Shu
  2015-06-18  2:46       ` [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file Scott Shu
                         ` (2 subsequent siblings)
  6 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Scott Shu

We enable GTP6 which ungates the arch timer clock.
---
 arch/arm/mach-mediatek/mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6b38d67..469d332 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -28,7 +28,8 @@ static void __init mediatek_timer_init(void)
 {
 	void __iomem *gpt_base = 0;
 
-	if (of_machine_is_compatible("mediatek,mt6589") ||
+	if (of_machine_is_compatible("mediatek,mt6580") ||
+	    of_machine_is_compatible("mediatek,mt6589") ||
 	    of_machine_is_compatible("mediatek,mt8135") ||
 	    of_machine_is_compatible("mediatek,mt8127")) {
 		/* turn on GPT6 which ungates arch timer clocks */
@@ -46,6 +47,7 @@ static void __init mediatek_timer_init(void)
 };
 
 static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6580",
 	"mediatek,mt6589",
 	"mediatek,mt6592",
 	"mediatek,mt8127",
-- 
1.8.1.1.dirty

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

* [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
                         ` (3 preceding siblings ...)
  2015-06-18  2:46       ` [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working " Scott Shu
@ 2015-06-18  2:46       ` Scott Shu
  2015-06-18  2:46       ` [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580 Scott Shu
  2015-06-18 16:12       ` [PATCH 0/6] This series adds SMP support for the MediaTek MT6580 Matthias Brugger
  6 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Scott Shu

This adds the SCPSYS device node to the MT6580 dtsi file.
---
 arch/arm/boot/dts/mt6580.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index ae3cdb6..a974830 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -78,6 +78,11 @@
 		compatible = "simple-bus";
 		ranges;
 
+		scpsys: scpsys@10006000 {
+			compatible = "mediatek,mt6580-scpsys";
+			reg = <0x10006000 0x1000>;
+		};
+
 		timer: timer@10008000 {
 			compatible = "mediatek,mt6580-timer", "mediatek,mt6577-timer";
 			reg = <0x10008000 0x80>;
-- 
1.8.1.1.dirty

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

* [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
                         ` (4 preceding siblings ...)
  2015-06-18  2:46       ` [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file Scott Shu
@ 2015-06-18  2:46       ` Scott Shu
  2015-06-18 16:12       ` [PATCH 0/6] This series adds SMP support for the MediaTek MT6580 Matthias Brugger
  6 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  2:46 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	jades.shih-NuS5LvNUpcJWk0Htik3J/w,
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Scott Shu

Add arch timer node to enable arch-timer support. MT6580 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This set cpu enable-method to enable SMP.
---
 arch/arm/boot/dts/mt6580.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index a974830..a7071b38 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -23,26 +23,31 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "mediatek,mt6580-smp";
 
 		cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x1>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x2>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x3>;
+			clock-frequency = <1700000000>;
 		};
 
 	};
@@ -72,6 +77,21 @@
 		};
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.8.1.1.dirty

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

* [PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
       [not found] <Scott Shu <srv_scott.shu@mediatek.com>
@ 2015-06-18  3:35   ` Scott Shu
  2015-06-18  3:35   ` Scott Shu
  2015-06-18 18:01   ` Scott Shu
  2 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla

This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

This is based on v4.1-rc1 and following patch series:
(1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
(2) Mars Cheng's "Add mt6580 basic chip support" [2]
(3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]

The secondary cores are power off as default on MT6580, this change adds
a new enable-method to turn on power to the cores during booting process.

The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
power domain control. Please check [3] for more information about SCPSYS.

[1] https://lkml.org/lkml/2015/5/16/33
[2] https://lkml.org/lkml/2015/6/3/113
[3] https://lkml.org/lkml/2015/6/9/172


Scott Shu (6):
  Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  soc: Mediatek: Add SCPSYS CPU power domain driver
  ARM: mediatek: add smp bringup code
  ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
  ARM: dts: mt6580: enable basic SMP bringup for MT6580

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
 arch/arm/mach-mediatek/Makefile                |   2 +-
 arch/arm/mach-mediatek/generic.h               |  24 +++
 arch/arm/mach-mediatek/hotplug.c               | 229 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/mediatek.c              |   4 +-
 arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
 7 files changed, 395 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c


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

* [PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-06-18  3:35   ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

This is based on v4.1-rc1 and following patch series:
(1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
(2) Mars Cheng's "Add mt6580 basic chip support" [2]
(3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]

The secondary cores are power off as default on MT6580, this change adds
a new enable-method to turn on power to the cores during booting process.

The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
power domain control. Please check [3] for more information about SCPSYS.

[1] https://lkml.org/lkml/2015/5/16/33
[2] https://lkml.org/lkml/2015/6/3/113
[3] https://lkml.org/lkml/2015/6/9/172


Scott Shu (6):
  Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  soc: Mediatek: Add SCPSYS CPU power domain driver
  ARM: mediatek: add smp bringup code
  ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
  ARM: dts: mt6580: enable basic SMP bringup for MT6580

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
 arch/arm/mach-mediatek/Makefile                |   2 +-
 arch/arm/mach-mediatek/generic.h               |  24 +++
 arch/arm/mach-mediatek/hotplug.c               | 229 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/mediatek.c              |   4 +-
 arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
 7 files changed, 395 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

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

* [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  2015-06-18  3:35   ` Scott Shu
@ 2015-06-18  3:35     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla, Scott Shu

For MT6580 SoC platform, the secondary cores are in powered off state
as default, so compared with MT65xx series SoC, one new enable method
is needed. This method using the SPM (System Power Manager) inside
the SCYSYS to control the CPU power.
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index ac2903d..fb80b2e 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
 			    "marvell,armada-380-smp"
 			    "marvell,armada-390-smp"
 			    "marvell,armada-xp-smp"
+			    "mediatek,mt6580-smp"
 			    "mediatek,mt65xx-smp"
 			    "mediatek,mt81xx-tz-smp"
 			    "qcom,gcc-msm8660"
-- 
1.8.1.1.dirty


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

* [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-06-18  3:35     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

For MT6580 SoC platform, the secondary cores are in powered off state
as default, so compared with MT65xx series SoC, one new enable method
is needed. This method using the SPM (System Power Manager) inside
the SCYSYS to control the CPU power.
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index ac2903d..fb80b2e 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
 			    "marvell,armada-380-smp"
 			    "marvell,armada-390-smp"
 			    "marvell,armada-xp-smp"
+			    "mediatek,mt6580-smp"
 			    "mediatek,mt65xx-smp"
 			    "mediatek,mt81xx-tz-smp"
 			    "qcom,gcc-msm8660"
-- 
1.8.1.1.dirty

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

* [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-06-18  3:35   ` Scott Shu
@ 2015-06-18  3:35     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla, Scott Shu

This adds a CPU power domain driver for the Mediatek SCPSYS unit on
MT6580.
---
 arch/arm/mach-mediatek/Makefile  |   2 +-
 arch/arm/mach-mediatek/generic.h |  24 +++++
 arch/arm/mach-mediatek/hotplug.c | 228 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 2116460..b2e4ef5 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1,4 +1,4 @@
 ifeq ($(CONFIG_SMP),y)
-obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o hotplug.o
 endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/generic.h b/arch/arm/mach-mediatek/generic.h
new file mode 100644
index 0000000..2a0d0c8
--- /dev/null
+++ b/arch/arm/mach-mediatek/generic.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+#ifndef __MACH_MTK_COMMON__
+#define __MACH_MTK_COMMON__
+
+#include <linux/kernel.h>
+
+int spm_cpu_mtcmos_init(void);
+int spm_cpu_mtcmos_on(int cpu);
+int spm_cpu_mtcmos_off(int cpu, bool wfi);
+
+#endif
diff --git a/arch/arm/mach-mediatek/hotplug.c b/arch/arm/mach-mediatek/hotplug.c
new file mode 100644
index 0000000..be0305d
--- /dev/null
+++ b/arch/arm/mach-mediatek/hotplug.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+/* SCPSYS registers */
+#define SPM_POWERON_CONFIG_SET		0x0000
+
+#define SPM_CA7_CPU0_PWR_CON		0x0200
+#define SPM_CA7_CPU1_PWR_CON		0x0218
+#define SPM_CA7_CPU2_PWR_CON		0x021c
+#define SPM_CA7_CPU3_PWR_CON		0x0220
+
+#define SPM_CA7_CPU0_L1_PDN		0x025c
+#define SPM_CA7_CPU1_L1_PDN		0x0264
+#define SPM_CA7_CPU2_L1_PDN		0x026c
+#define SPM_CA7_CPU3_L1_PDN		0x0274
+
+#define SPM_PWR_STATUS			0x060c
+#define SPM_PWR_STATUS_2ND		0x0610
+#define SPM_SLEEP_TIMER_STA		0x0720
+
+/*
+ * bit definition in SPM_CA7_CPUx_PWR_CON
+ */
+#define SRAM_ISOINT_B		BIT(6)
+#define SRAM_CKISO		BIT(5)
+#define PWR_CLK_DIS		BIT(4)
+#define PWR_ON_2ND		BIT(3)
+#define PWR_ON			BIT(2)
+#define PWR_ISO			BIT(1)
+#define PWR_RST_B		BIT(0)
+
+/*
+ * bit definition in SPM_CA7_CPUx_L1_PDN
+ */
+#define L1_PDN_ACK		BIT(8)
+#define L1_PDN			BIT(0)
+
+void __iomem *spm_cpu_base;
+
+u32 spm_cpu_pwr_con[4] = {
+	SPM_CA7_CPU0_PWR_CON,
+	SPM_CA7_CPU1_PWR_CON,
+	SPM_CA7_CPU2_PWR_CON,
+	SPM_CA7_CPU3_PWR_CON,
+};
+
+u32 spm_cpu_l1_pdn[4] = {
+	SPM_CA7_CPU0_L1_PDN,
+	SPM_CA7_CPU1_L1_PDN,
+	SPM_CA7_CPU2_L1_PDN,
+	SPM_CA7_CPU3_L1_PDN,
+};
+
+#define SPM_REGWR_EN		(1U << 0)
+#define SPM_PROJECT_CODE	0x0B16
+
+int spm_cpu_mtcmos_on(int cpu)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	udelay(1);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu))) ||
+		((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu)))) {
+		;
+	}
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power on */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp &= ~L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn) &
+		L1_PDN_ACK) != 0)
+		;
+
+	udelay(1);
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_off(int cpu, bool wfi)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	if (wfi) {
+		while ((readl_relaxed(spm_cpu_base + SPM_SLEEP_TIMER_STA) &
+			(1U << (16 + cpu))) == 0)
+			;
+	}
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power off */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp |= L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn)
+		& L1_PDN_ACK) != L1_PDN_ACK)
+		;
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != 0) ||
+	       ((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != 0))
+		;
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "mediatek,mt6580-scpsys");
+	if (!node) {
+		pr_err("Missing mt6580-scpsys node in the device tree\n");
+		return -EINVAL;
+	}
+
+	spm_cpu_base = of_iomap(node, 0);
+	if (!spm_cpu_base) {
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
-- 
1.8.1.1.dirty


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

* [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-06-18  3:35     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a CPU power domain driver for the Mediatek SCPSYS unit on
MT6580.
---
 arch/arm/mach-mediatek/Makefile  |   2 +-
 arch/arm/mach-mediatek/generic.h |  24 +++++
 arch/arm/mach-mediatek/hotplug.c | 228 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 2116460..b2e4ef5 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1,4 +1,4 @@
 ifeq ($(CONFIG_SMP),y)
-obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o hotplug.o
 endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/generic.h b/arch/arm/mach-mediatek/generic.h
new file mode 100644
index 0000000..2a0d0c8
--- /dev/null
+++ b/arch/arm/mach-mediatek/generic.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+#ifndef __MACH_MTK_COMMON__
+#define __MACH_MTK_COMMON__
+
+#include <linux/kernel.h>
+
+int spm_cpu_mtcmos_init(void);
+int spm_cpu_mtcmos_on(int cpu);
+int spm_cpu_mtcmos_off(int cpu, bool wfi);
+
+#endif
diff --git a/arch/arm/mach-mediatek/hotplug.c b/arch/arm/mach-mediatek/hotplug.c
new file mode 100644
index 0000000..be0305d
--- /dev/null
+++ b/arch/arm/mach-mediatek/hotplug.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+/* SCPSYS registers */
+#define SPM_POWERON_CONFIG_SET		0x0000
+
+#define SPM_CA7_CPU0_PWR_CON		0x0200
+#define SPM_CA7_CPU1_PWR_CON		0x0218
+#define SPM_CA7_CPU2_PWR_CON		0x021c
+#define SPM_CA7_CPU3_PWR_CON		0x0220
+
+#define SPM_CA7_CPU0_L1_PDN		0x025c
+#define SPM_CA7_CPU1_L1_PDN		0x0264
+#define SPM_CA7_CPU2_L1_PDN		0x026c
+#define SPM_CA7_CPU3_L1_PDN		0x0274
+
+#define SPM_PWR_STATUS			0x060c
+#define SPM_PWR_STATUS_2ND		0x0610
+#define SPM_SLEEP_TIMER_STA		0x0720
+
+/*
+ * bit definition in SPM_CA7_CPUx_PWR_CON
+ */
+#define SRAM_ISOINT_B		BIT(6)
+#define SRAM_CKISO		BIT(5)
+#define PWR_CLK_DIS		BIT(4)
+#define PWR_ON_2ND		BIT(3)
+#define PWR_ON			BIT(2)
+#define PWR_ISO			BIT(1)
+#define PWR_RST_B		BIT(0)
+
+/*
+ * bit definition in SPM_CA7_CPUx_L1_PDN
+ */
+#define L1_PDN_ACK		BIT(8)
+#define L1_PDN			BIT(0)
+
+void __iomem *spm_cpu_base;
+
+u32 spm_cpu_pwr_con[4] = {
+	SPM_CA7_CPU0_PWR_CON,
+	SPM_CA7_CPU1_PWR_CON,
+	SPM_CA7_CPU2_PWR_CON,
+	SPM_CA7_CPU3_PWR_CON,
+};
+
+u32 spm_cpu_l1_pdn[4] = {
+	SPM_CA7_CPU0_L1_PDN,
+	SPM_CA7_CPU1_L1_PDN,
+	SPM_CA7_CPU2_L1_PDN,
+	SPM_CA7_CPU3_L1_PDN,
+};
+
+#define SPM_REGWR_EN		(1U << 0)
+#define SPM_PROJECT_CODE	0x0B16
+
+int spm_cpu_mtcmos_on(int cpu)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	udelay(1);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu))) ||
+		((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu)))) {
+		;
+	}
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power on */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp &= ~L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn) &
+		L1_PDN_ACK) != 0)
+		;
+
+	udelay(1);
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_off(int cpu, bool wfi)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	if (wfi) {
+		while ((readl_relaxed(spm_cpu_base + SPM_SLEEP_TIMER_STA) &
+			(1U << (16 + cpu))) == 0)
+			;
+	}
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power off */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp |= L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn)
+		& L1_PDN_ACK) != L1_PDN_ACK)
+		;
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != 0) ||
+	       ((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != 0))
+		;
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "mediatek,mt6580-scpsys");
+	if (!node) {
+		pr_err("Missing mt6580-scpsys node in the device tree\n");
+		return -EINVAL;
+	}
+
+	spm_cpu_base = of_iomap(node, 0);
+	if (!spm_cpu_base) {
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
-- 
1.8.1.1.dirty

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

* [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580
  2015-06-18  3:35   ` Scott Shu
@ 2015-06-18  3:35     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla, Scott Shu

Add support for cpu enable-method "mediatek,mt6580-smp" for booting
secondary CPUs on MT6580.
---
 arch/arm/mach-mediatek/platsmp.c | 107 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 12fefb3..2985913 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -21,10 +21,15 @@
 #include <linux/of_address.h>
 #include <linux/string.h>
 #include <linux/threads.h>
+#include <linux/delay.h>
+#include <asm/cacheflush.h>
+#include "generic.h"
 
 #define MTK_MAX_CPU		8
 #define MTK_SMP_REG_SIZE	0x1000
 
+static DEFINE_SPINLOCK(boot_lock);
+
 struct mtk_smp_boot_info {
 	unsigned long smp_base;
 	unsigned int jump_reg;
@@ -57,6 +62,101 @@ static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	/* Make sure this is visible to other CPUs */
+	smp_wmb();
+	sync_cache_w(&pen_release);
+}
+
+static int mt6580_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * Set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+	write_pen_release(cpu);
+
+	/*
+	 * CPU power on control by SPM
+	 */
+	spm_cpu_mtcmos_on(cpu);
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		/* Read barrier */
+		smp_rmb();
+
+		if (pen_release == -1)
+			break;
+
+		usleep_range(10, 1000);
+	}
+
+	/*
+	 * Now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return (pen_release != -1 ? -EINVAL : 0);
+}
+
+static void mt6580_secondary_init(unsigned int cpu)
+{
+	/*
+	 * Let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	write_pen_release(-1);
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+#define MT6580_INFRACFG_AO	0x10001000
+#define SW_ROM_PD		BIT(31)
+
+static void __init mt6580_smp_prepare_cpus(unsigned int max_cpus)
+{
+	static void __iomem *infracfg_ao_base;
+
+	infracfg_ao_base = ioremap(MT6580_INFRACFG_AO, 0x1000);
+
+	if (!infracfg_ao_base)
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+
+	/* Enable bootrom power down mode */
+	writel_relaxed(readl(infracfg_ao_base + 0x804) | SW_ROM_PD,
+		       infracfg_ao_base + 0x804);
+
+	/* Write the address of slave startup into boot address
+	   register for bootrom power down mode */
+	writel_relaxed(virt_to_phys(secondary_startup_arm),
+		       infracfg_ao_base + 0x800);
+
+	iounmap(infracfg_ao_base);
+
+	/* Initial spm cpu mtcmos memory map */
+	spm_cpu_mtcmos_init();
+}
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	if (!mtk_smp_base)
@@ -143,3 +243,10 @@ static struct smp_operations mt65xx_smp_ops __initdata = {
 	.smp_boot_secondary = mtk_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(mt65xx_smp, "mediatek,mt65xx-smp", &mt65xx_smp_ops);
+
+static struct smp_operations mt6580_smp_ops __initdata = {
+	.smp_prepare_cpus = mt6580_smp_prepare_cpus,
+	.smp_secondary_init = mt6580_secondary_init,
+	.smp_boot_secondary = mt6580_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6580_smp, "mediatek,mt6580-smp", &mt6580_smp_ops);
-- 
1.8.1.1.dirty


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

* [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580
@ 2015-06-18  3:35     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for cpu enable-method "mediatek,mt6580-smp" for booting
secondary CPUs on MT6580.
---
 arch/arm/mach-mediatek/platsmp.c | 107 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 12fefb3..2985913 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -21,10 +21,15 @@
 #include <linux/of_address.h>
 #include <linux/string.h>
 #include <linux/threads.h>
+#include <linux/delay.h>
+#include <asm/cacheflush.h>
+#include "generic.h"
 
 #define MTK_MAX_CPU		8
 #define MTK_SMP_REG_SIZE	0x1000
 
+static DEFINE_SPINLOCK(boot_lock);
+
 struct mtk_smp_boot_info {
 	unsigned long smp_base;
 	unsigned int jump_reg;
@@ -57,6 +62,101 @@ static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	/* Make sure this is visible to other CPUs */
+	smp_wmb();
+	sync_cache_w(&pen_release);
+}
+
+static int mt6580_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * Set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+	write_pen_release(cpu);
+
+	/*
+	 * CPU power on control by SPM
+	 */
+	spm_cpu_mtcmos_on(cpu);
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		/* Read barrier */
+		smp_rmb();
+
+		if (pen_release == -1)
+			break;
+
+		usleep_range(10, 1000);
+	}
+
+	/*
+	 * Now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return (pen_release != -1 ? -EINVAL : 0);
+}
+
+static void mt6580_secondary_init(unsigned int cpu)
+{
+	/*
+	 * Let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	write_pen_release(-1);
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+#define MT6580_INFRACFG_AO	0x10001000
+#define SW_ROM_PD		BIT(31)
+
+static void __init mt6580_smp_prepare_cpus(unsigned int max_cpus)
+{
+	static void __iomem *infracfg_ao_base;
+
+	infracfg_ao_base = ioremap(MT6580_INFRACFG_AO, 0x1000);
+
+	if (!infracfg_ao_base)
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+
+	/* Enable bootrom power down mode */
+	writel_relaxed(readl(infracfg_ao_base + 0x804) | SW_ROM_PD,
+		       infracfg_ao_base + 0x804);
+
+	/* Write the address of slave startup into boot address
+	   register for bootrom power down mode */
+	writel_relaxed(virt_to_phys(secondary_startup_arm),
+		       infracfg_ao_base + 0x800);
+
+	iounmap(infracfg_ao_base);
+
+	/* Initial spm cpu mtcmos memory map */
+	spm_cpu_mtcmos_init();
+}
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	if (!mtk_smp_base)
@@ -143,3 +243,10 @@ static struct smp_operations mt65xx_smp_ops __initdata = {
 	.smp_boot_secondary = mtk_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(mt65xx_smp, "mediatek,mt65xx-smp", &mt65xx_smp_ops);
+
+static struct smp_operations mt6580_smp_ops __initdata = {
+	.smp_prepare_cpus = mt6580_smp_prepare_cpus,
+	.smp_secondary_init = mt6580_secondary_init,
+	.smp_boot_secondary = mt6580_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6580_smp, "mediatek,mt6580-smp", &mt6580_smp_ops);
-- 
1.8.1.1.dirty

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

* [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  2015-06-18  3:35   ` Scott Shu
@ 2015-06-18  3:35     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla, Scott Shu

We enable GTP6 which ungates the arch timer clock.
---
 arch/arm/mach-mediatek/mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6b38d67..469d332 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -28,7 +28,8 @@ static void __init mediatek_timer_init(void)
 {
 	void __iomem *gpt_base = 0;
 
-	if (of_machine_is_compatible("mediatek,mt6589") ||
+	if (of_machine_is_compatible("mediatek,mt6580") ||
+	    of_machine_is_compatible("mediatek,mt6589") ||
 	    of_machine_is_compatible("mediatek,mt8135") ||
 	    of_machine_is_compatible("mediatek,mt8127")) {
 		/* turn on GPT6 which ungates arch timer clocks */
@@ -46,6 +47,7 @@ static void __init mediatek_timer_init(void)
 };
 
 static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6580",
 	"mediatek,mt6589",
 	"mediatek,mt6592",
 	"mediatek,mt8127",
-- 
1.8.1.1.dirty


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

* [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
@ 2015-06-18  3:35     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

We enable GTP6 which ungates the arch timer clock.
---
 arch/arm/mach-mediatek/mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6b38d67..469d332 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -28,7 +28,8 @@ static void __init mediatek_timer_init(void)
 {
 	void __iomem *gpt_base = 0;
 
-	if (of_machine_is_compatible("mediatek,mt6589") ||
+	if (of_machine_is_compatible("mediatek,mt6580") ||
+	    of_machine_is_compatible("mediatek,mt6589") ||
 	    of_machine_is_compatible("mediatek,mt8135") ||
 	    of_machine_is_compatible("mediatek,mt8127")) {
 		/* turn on GPT6 which ungates arch timer clocks */
@@ -46,6 +47,7 @@ static void __init mediatek_timer_init(void)
 };
 
 static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6580",
 	"mediatek,mt6589",
 	"mediatek,mt6592",
 	"mediatek,mt8127",
-- 
1.8.1.1.dirty

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

* [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
  2015-06-18  3:35   ` Scott Shu
@ 2015-06-18  3:35     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla, Scott Shu

This adds the SCPSYS device node to the MT6580 dtsi file.
---
 arch/arm/boot/dts/mt6580.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index ae3cdb6..a974830 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -78,6 +78,11 @@
 		compatible = "simple-bus";
 		ranges;
 
+		scpsys: scpsys@10006000 {
+			compatible = "mediatek,mt6580-scpsys";
+			reg = <0x10006000 0x1000>;
+		};
+
 		timer: timer@10008000 {
 			compatible = "mediatek,mt6580-timer", "mediatek,mt6577-timer";
 			reg = <0x10008000 0x80>;
-- 
1.8.1.1.dirty


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

* [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
@ 2015-06-18  3:35     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the SCPSYS device node to the MT6580 dtsi file.
---
 arch/arm/boot/dts/mt6580.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index ae3cdb6..a974830 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -78,6 +78,11 @@
 		compatible = "simple-bus";
 		ranges;
 
+		scpsys: scpsys at 10006000 {
+			compatible = "mediatek,mt6580-scpsys";
+			reg = <0x10006000 0x1000>;
+		};
+
 		timer: timer at 10008000 {
 			compatible = "mediatek,mt6580-timer", "mediatek,mt6577-timer";
 			reg = <0x10008000 0x80>;
-- 
1.8.1.1.dirty

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

* [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580
  2015-06-18  3:35   ` Scott Shu
@ 2015-06-18  3:35     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: yingjoe.chen
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, robh+dt,
	matthias.bgg, linux, rchintakuntla, Scott Shu

Add arch timer node to enable arch-timer support. MT6580 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This set cpu enable-method to enable SMP.
---
 arch/arm/boot/dts/mt6580.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index a974830..a7071b38 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -23,26 +23,31 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "mediatek,mt6580-smp";
 
 		cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x1>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x2>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x3>;
+			clock-frequency = <1700000000>;
 		};
 
 	};
@@ -72,6 +77,21 @@
 		};
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.8.1.1.dirty


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

* [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580
@ 2015-06-18  3:35     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18  3:35 UTC (permalink / raw)
  To: linux-arm-kernel

Add arch timer node to enable arch-timer support. MT6580 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This set cpu enable-method to enable SMP.
---
 arch/arm/boot/dts/mt6580.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index a974830..a7071b38 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -23,26 +23,31 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "mediatek,mt6580-smp";
 
 		cpu at 0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clock-frequency = <1700000000>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x1>;
+			clock-frequency = <1700000000>;
 		};
 		cpu at 2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x2>;
+			clock-frequency = <1700000000>;
 		};
 		cpu at 3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x3>;
+			clock-frequency = <1700000000>;
 		};
 
 	};
@@ -72,6 +77,21 @@
 		};
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.8.1.1.dirty

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

* Re: [PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
       [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
                         ` (5 preceding siblings ...)
  2015-06-18  2:46       ` [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580 Scott Shu
@ 2015-06-18 16:12       ` Matthias Brugger
       [not found]         ` <CABuKBeK-WLFnrOnPYmGR1cTfecHhq+_QyAqQjJpYfuA_MNW1aw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
  6 siblings, 1 reply; 75+ messages in thread
From: Matthias Brugger @ 2015-06-18 16:12 UTC (permalink / raw)
  To: Scott Shu
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w,
	Mars.Cheng-NuS5LvNUpcJWk0Htik3J/w,
	Jades Shih (施向玨),
	srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w,
	Miles.Chen-NuS5LvNUpcJWk0Htik3J/w,
	moderated list:ARM/Mediatek SoC...,
	MY.Chuang-NuS5LvNUpcJWk0Htik3J/w, Yingjoe Chen

Hi Scott,

2015-06-18 4:46 GMT+02:00 Scott Shu <scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>:
> This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

It's nice to see a new SoC.
For now just one comment (more to follow): I got this series twice,
but in neither the recipients seem to be done right.
Please use scripts/get_maintainer.pl on the whole series to see to
whom you should send the series. Maybe you can just resend it (mark it
in the subject) so that the discussion can happen between all
interested people.

Cheers,
Matthias

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

* [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
       [not found] <Scott Shu <srv_scott.shu@mediatek.com>
       [not found] ` <Scott Shu <srv_scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
@ 2015-06-18 18:01   ` Scott Shu
  2015-06-18 18:01   ` Scott Shu
  2 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek

This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

This is based on v4.1-rc1 and following patch series:
(1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
(2) Mars Cheng's "Add mt6580 basic chip support" [2]
(3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]

The secondary cores are power off as default on MT6580, this change adds
a new enable-method to turn on power to the cores during booting process.

The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
power domain control. Please check [3] for more information about SCPSYS.

[1] https://lkml.org/lkml/2015/5/16/33
[2] https://lkml.org/lkml/2015/6/3/113
[3] https://lkml.org/lkml/2015/6/9/172


Scott Shu (6):
  Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  soc: Mediatek: Add SCPSYS CPU power domain driver
  ARM: mediatek: add smp bringup code
  ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
  ARM: dts: mt6580: enable basic SMP bringup for MT6580

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
 arch/arm/mach-mediatek/Makefile                |   2 +-
 arch/arm/mach-mediatek/generic.h               |  24 +++
 arch/arm/mach-mediatek/hotplug.c               | 229 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/mediatek.c              |   4 +-
 arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
 7 files changed, 395 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c


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

* [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-06-18 18:01   ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek

This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

This is based on v4.1-rc1 and following patch series:
(1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
(2) Mars Cheng's "Add mt6580 basic chip support" [2]
(3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]

The secondary cores are power off as default on MT6580, this change adds
a new enable-method to turn on power to the cores during booting process.

The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
power domain control. Please check [3] for more information about SCPSYS.

[1] https://lkml.org/lkml/2015/5/16/33
[2] https://lkml.org/lkml/2015/6/3/113
[3] https://lkml.org/lkml/2015/6/9/172


Scott Shu (6):
  Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  soc: Mediatek: Add SCPSYS CPU power domain driver
  ARM: mediatek: add smp bringup code
  ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
  ARM: dts: mt6580: enable basic SMP bringup for MT6580

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
 arch/arm/mach-mediatek/Makefile                |   2 +-
 arch/arm/mach-mediatek/generic.h               |  24 +++
 arch/arm/mach-mediatek/hotplug.c               | 229 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/mediatek.c              |   4 +-
 arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
 7 files changed, 395 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

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

* [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-06-18 18:01   ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

This is based on v4.1-rc1 and following patch series:
(1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
(2) Mars Cheng's "Add mt6580 basic chip support" [2]
(3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]

The secondary cores are power off as default on MT6580, this change adds
a new enable-method to turn on power to the cores during booting process.

The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
power domain control. Please check [3] for more information about SCPSYS.

[1] https://lkml.org/lkml/2015/5/16/33
[2] https://lkml.org/lkml/2015/6/3/113
[3] https://lkml.org/lkml/2015/6/9/172


Scott Shu (6):
  Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  soc: Mediatek: Add SCPSYS CPU power domain driver
  ARM: mediatek: add smp bringup code
  ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
  ARM: dts: mt6580: enable basic SMP bringup for MT6580

 Documentation/devicetree/bindings/arm/cpus.txt |   1 +
 arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
 arch/arm/mach-mediatek/Makefile                |   2 +-
 arch/arm/mach-mediatek/generic.h               |  24 +++
 arch/arm/mach-mediatek/hotplug.c               | 229 +++++++++++++++++++++++++
 arch/arm/mach-mediatek/mediatek.c              |   4 +-
 arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
 7 files changed, 395 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

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

* [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

For MT6580 SoC platform, the secondary cores are in powered off state
as default, so compared with MT65xx series SoC, one new enable method
is needed. This method using the SPM (System Power Manager) inside
the SCYSYS to control the CPU power.
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index ac2903d..fb80b2e 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
 			    "marvell,armada-380-smp"
 			    "marvell,armada-390-smp"
 			    "marvell,armada-xp-smp"
+			    "mediatek,mt6580-smp"
 			    "mediatek,mt65xx-smp"
 			    "mediatek,mt81xx-tz-smp"
 			    "qcom,gcc-msm8660"
-- 
1.8.1.1.dirty


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

* [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	rchintakuntla-YGCgFSpz5w/QT0dZR+AlfA,
	lorenzo.pieralisi-5wv7dgnIgG8, marc.ceeeee-Re5JQEeQqe8AvxtiuMwx3w,
	heiko-4mtYJXux2i+zQB+pC5nmwQ, catalin.marinas-5wv7dgnIgG8,
	arnd-r2nGTMty4D4, galak-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w, Scott Shu,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

For MT6580 SoC platform, the secondary cores are in powered off state
as default, so compared with MT65xx series SoC, one new enable method
is needed. This method using the SPM (System Power Manager) inside
the SCYSYS to control the CPU power.
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index ac2903d..fb80b2e 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
 			    "marvell,armada-380-smp"
 			    "marvell,armada-390-smp"
 			    "marvell,armada-xp-smp"
+			    "mediatek,mt6580-smp"
 			    "mediatek,mt65xx-smp"
 			    "mediatek,mt81xx-tz-smp"
 			    "qcom,gcc-msm8660"
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

For MT6580 SoC platform, the secondary cores are in powered off state
as default, so compared with MT65xx series SoC, one new enable method
is needed. This method using the SPM (System Power Manager) inside
the SCYSYS to control the CPU power.
---
 Documentation/devicetree/bindings/arm/cpus.txt | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
index ac2903d..fb80b2e 100644
--- a/Documentation/devicetree/bindings/arm/cpus.txt
+++ b/Documentation/devicetree/bindings/arm/cpus.txt
@@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
 			    "marvell,armada-380-smp"
 			    "marvell,armada-390-smp"
 			    "marvell,armada-xp-smp"
+			    "mediatek,mt6580-smp"
 			    "mediatek,mt65xx-smp"
 			    "mediatek,mt81xx-tz-smp"
 			    "qcom,gcc-msm8660"
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-06-18 18:01   ` Scott Shu
  (?)
@ 2015-06-18 18:01     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

This adds a CPU power domain driver for the Mediatek SCPSYS unit on
MT6580.
---
 arch/arm/mach-mediatek/Makefile  |   2 +-
 arch/arm/mach-mediatek/generic.h |  24 +++++
 arch/arm/mach-mediatek/hotplug.c | 228 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 2116460..b2e4ef5 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1,4 +1,4 @@
 ifeq ($(CONFIG_SMP),y)
-obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o hotplug.o
 endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/generic.h b/arch/arm/mach-mediatek/generic.h
new file mode 100644
index 0000000..2a0d0c8
--- /dev/null
+++ b/arch/arm/mach-mediatek/generic.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+#ifndef __MACH_MTK_COMMON__
+#define __MACH_MTK_COMMON__
+
+#include <linux/kernel.h>
+
+int spm_cpu_mtcmos_init(void);
+int spm_cpu_mtcmos_on(int cpu);
+int spm_cpu_mtcmos_off(int cpu, bool wfi);
+
+#endif
diff --git a/arch/arm/mach-mediatek/hotplug.c b/arch/arm/mach-mediatek/hotplug.c
new file mode 100644
index 0000000..be0305d
--- /dev/null
+++ b/arch/arm/mach-mediatek/hotplug.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+/* SCPSYS registers */
+#define SPM_POWERON_CONFIG_SET		0x0000
+
+#define SPM_CA7_CPU0_PWR_CON		0x0200
+#define SPM_CA7_CPU1_PWR_CON		0x0218
+#define SPM_CA7_CPU2_PWR_CON		0x021c
+#define SPM_CA7_CPU3_PWR_CON		0x0220
+
+#define SPM_CA7_CPU0_L1_PDN		0x025c
+#define SPM_CA7_CPU1_L1_PDN		0x0264
+#define SPM_CA7_CPU2_L1_PDN		0x026c
+#define SPM_CA7_CPU3_L1_PDN		0x0274
+
+#define SPM_PWR_STATUS			0x060c
+#define SPM_PWR_STATUS_2ND		0x0610
+#define SPM_SLEEP_TIMER_STA		0x0720
+
+/*
+ * bit definition in SPM_CA7_CPUx_PWR_CON
+ */
+#define SRAM_ISOINT_B		BIT(6)
+#define SRAM_CKISO		BIT(5)
+#define PWR_CLK_DIS		BIT(4)
+#define PWR_ON_2ND		BIT(3)
+#define PWR_ON			BIT(2)
+#define PWR_ISO			BIT(1)
+#define PWR_RST_B		BIT(0)
+
+/*
+ * bit definition in SPM_CA7_CPUx_L1_PDN
+ */
+#define L1_PDN_ACK		BIT(8)
+#define L1_PDN			BIT(0)
+
+void __iomem *spm_cpu_base;
+
+u32 spm_cpu_pwr_con[4] = {
+	SPM_CA7_CPU0_PWR_CON,
+	SPM_CA7_CPU1_PWR_CON,
+	SPM_CA7_CPU2_PWR_CON,
+	SPM_CA7_CPU3_PWR_CON,
+};
+
+u32 spm_cpu_l1_pdn[4] = {
+	SPM_CA7_CPU0_L1_PDN,
+	SPM_CA7_CPU1_L1_PDN,
+	SPM_CA7_CPU2_L1_PDN,
+	SPM_CA7_CPU3_L1_PDN,
+};
+
+#define SPM_REGWR_EN		(1U << 0)
+#define SPM_PROJECT_CODE	0x0B16
+
+int spm_cpu_mtcmos_on(int cpu)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	udelay(1);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu))) ||
+		((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu)))) {
+		;
+	}
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power on */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp &= ~L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn) &
+		L1_PDN_ACK) != 0)
+		;
+
+	udelay(1);
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_off(int cpu, bool wfi)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	if (wfi) {
+		while ((readl_relaxed(spm_cpu_base + SPM_SLEEP_TIMER_STA) &
+			(1U << (16 + cpu))) == 0)
+			;
+	}
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power off */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp |= L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn)
+		& L1_PDN_ACK) != L1_PDN_ACK)
+		;
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != 0) ||
+	       ((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != 0))
+		;
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "mediatek,mt6580-scpsys");
+	if (!node) {
+		pr_err("Missing mt6580-scpsys node in the device tree\n");
+		return -EINVAL;
+	}
+
+	spm_cpu_base = of_iomap(node, 0);
+	if (!spm_cpu_base) {
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
-- 
1.8.1.1.dirty


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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

This adds a CPU power domain driver for the Mediatek SCPSYS unit on
MT6580.
---
 arch/arm/mach-mediatek/Makefile  |   2 +-
 arch/arm/mach-mediatek/generic.h |  24 +++++
 arch/arm/mach-mediatek/hotplug.c | 228 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 2116460..b2e4ef5 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1,4 +1,4 @@
 ifeq ($(CONFIG_SMP),y)
-obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o hotplug.o
 endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/generic.h b/arch/arm/mach-mediatek/generic.h
new file mode 100644
index 0000000..2a0d0c8
--- /dev/null
+++ b/arch/arm/mach-mediatek/generic.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+#ifndef __MACH_MTK_COMMON__
+#define __MACH_MTK_COMMON__
+
+#include <linux/kernel.h>
+
+int spm_cpu_mtcmos_init(void);
+int spm_cpu_mtcmos_on(int cpu);
+int spm_cpu_mtcmos_off(int cpu, bool wfi);
+
+#endif
diff --git a/arch/arm/mach-mediatek/hotplug.c b/arch/arm/mach-mediatek/hotplug.c
new file mode 100644
index 0000000..be0305d
--- /dev/null
+++ b/arch/arm/mach-mediatek/hotplug.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+/* SCPSYS registers */
+#define SPM_POWERON_CONFIG_SET		0x0000
+
+#define SPM_CA7_CPU0_PWR_CON		0x0200
+#define SPM_CA7_CPU1_PWR_CON		0x0218
+#define SPM_CA7_CPU2_PWR_CON		0x021c
+#define SPM_CA7_CPU3_PWR_CON		0x0220
+
+#define SPM_CA7_CPU0_L1_PDN		0x025c
+#define SPM_CA7_CPU1_L1_PDN		0x0264
+#define SPM_CA7_CPU2_L1_PDN		0x026c
+#define SPM_CA7_CPU3_L1_PDN		0x0274
+
+#define SPM_PWR_STATUS			0x060c
+#define SPM_PWR_STATUS_2ND		0x0610
+#define SPM_SLEEP_TIMER_STA		0x0720
+
+/*
+ * bit definition in SPM_CA7_CPUx_PWR_CON
+ */
+#define SRAM_ISOINT_B		BIT(6)
+#define SRAM_CKISO		BIT(5)
+#define PWR_CLK_DIS		BIT(4)
+#define PWR_ON_2ND		BIT(3)
+#define PWR_ON			BIT(2)
+#define PWR_ISO			BIT(1)
+#define PWR_RST_B		BIT(0)
+
+/*
+ * bit definition in SPM_CA7_CPUx_L1_PDN
+ */
+#define L1_PDN_ACK		BIT(8)
+#define L1_PDN			BIT(0)
+
+void __iomem *spm_cpu_base;
+
+u32 spm_cpu_pwr_con[4] = {
+	SPM_CA7_CPU0_PWR_CON,
+	SPM_CA7_CPU1_PWR_CON,
+	SPM_CA7_CPU2_PWR_CON,
+	SPM_CA7_CPU3_PWR_CON,
+};
+
+u32 spm_cpu_l1_pdn[4] = {
+	SPM_CA7_CPU0_L1_PDN,
+	SPM_CA7_CPU1_L1_PDN,
+	SPM_CA7_CPU2_L1_PDN,
+	SPM_CA7_CPU3_L1_PDN,
+};
+
+#define SPM_REGWR_EN		(1U << 0)
+#define SPM_PROJECT_CODE	0x0B16
+
+int spm_cpu_mtcmos_on(int cpu)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	udelay(1);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu))) ||
+		((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu)))) {
+		;
+	}
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power on */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp &= ~L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn) &
+		L1_PDN_ACK) != 0)
+		;
+
+	udelay(1);
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_off(int cpu, bool wfi)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	if (wfi) {
+		while ((readl_relaxed(spm_cpu_base + SPM_SLEEP_TIMER_STA) &
+			(1U << (16 + cpu))) == 0)
+			;
+	}
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power off */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp |= L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn)
+		& L1_PDN_ACK) != L1_PDN_ACK)
+		;
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != 0) ||
+	       ((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != 0))
+		;
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "mediatek,mt6580-scpsys");
+	if (!node) {
+		pr_err("Missing mt6580-scpsys node in the device tree\n");
+		return -EINVAL;
+	}
+
+	spm_cpu_base = of_iomap(node, 0);
+	if (!spm_cpu_base) {
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

This adds a CPU power domain driver for the Mediatek SCPSYS unit on
MT6580.
---
 arch/arm/mach-mediatek/Makefile  |   2 +-
 arch/arm/mach-mediatek/generic.h |  24 +++++
 arch/arm/mach-mediatek/hotplug.c | 228 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 253 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/mach-mediatek/generic.h
 create mode 100644 arch/arm/mach-mediatek/hotplug.c

diff --git a/arch/arm/mach-mediatek/Makefile b/arch/arm/mach-mediatek/Makefile
index 2116460..b2e4ef5 100644
--- a/arch/arm/mach-mediatek/Makefile
+++ b/arch/arm/mach-mediatek/Makefile
@@ -1,4 +1,4 @@
 ifeq ($(CONFIG_SMP),y)
-obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o
+obj-$(CONFIG_ARCH_MEDIATEK) += platsmp.o hotplug.o
 endif
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek.o
diff --git a/arch/arm/mach-mediatek/generic.h b/arch/arm/mach-mediatek/generic.h
new file mode 100644
index 0000000..2a0d0c8
--- /dev/null
+++ b/arch/arm/mach-mediatek/generic.h
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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.
+ *
+ */
+#ifndef __MACH_MTK_COMMON__
+#define __MACH_MTK_COMMON__
+
+#include <linux/kernel.h>
+
+int spm_cpu_mtcmos_init(void);
+int spm_cpu_mtcmos_on(int cpu);
+int spm_cpu_mtcmos_off(int cpu, bool wfi);
+
+#endif
diff --git a/arch/arm/mach-mediatek/hotplug.c b/arch/arm/mach-mediatek/hotplug.c
new file mode 100644
index 0000000..be0305d
--- /dev/null
+++ b/arch/arm/mach-mediatek/hotplug.c
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2015 Mediatek Inc.
+ * Author: Scott Shu <scott.shu@mediatek.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * 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/init.h>
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/spinlock.h>
+#include <linux/delay.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+#include <linux/of_address.h>
+
+/* SCPSYS registers */
+#define SPM_POWERON_CONFIG_SET		0x0000
+
+#define SPM_CA7_CPU0_PWR_CON		0x0200
+#define SPM_CA7_CPU1_PWR_CON		0x0218
+#define SPM_CA7_CPU2_PWR_CON		0x021c
+#define SPM_CA7_CPU3_PWR_CON		0x0220
+
+#define SPM_CA7_CPU0_L1_PDN		0x025c
+#define SPM_CA7_CPU1_L1_PDN		0x0264
+#define SPM_CA7_CPU2_L1_PDN		0x026c
+#define SPM_CA7_CPU3_L1_PDN		0x0274
+
+#define SPM_PWR_STATUS			0x060c
+#define SPM_PWR_STATUS_2ND		0x0610
+#define SPM_SLEEP_TIMER_STA		0x0720
+
+/*
+ * bit definition in SPM_CA7_CPUx_PWR_CON
+ */
+#define SRAM_ISOINT_B		BIT(6)
+#define SRAM_CKISO		BIT(5)
+#define PWR_CLK_DIS		BIT(4)
+#define PWR_ON_2ND		BIT(3)
+#define PWR_ON			BIT(2)
+#define PWR_ISO			BIT(1)
+#define PWR_RST_B		BIT(0)
+
+/*
+ * bit definition in SPM_CA7_CPUx_L1_PDN
+ */
+#define L1_PDN_ACK		BIT(8)
+#define L1_PDN			BIT(0)
+
+void __iomem *spm_cpu_base;
+
+u32 spm_cpu_pwr_con[4] = {
+	SPM_CA7_CPU0_PWR_CON,
+	SPM_CA7_CPU1_PWR_CON,
+	SPM_CA7_CPU2_PWR_CON,
+	SPM_CA7_CPU3_PWR_CON,
+};
+
+u32 spm_cpu_l1_pdn[4] = {
+	SPM_CA7_CPU0_L1_PDN,
+	SPM_CA7_CPU1_L1_PDN,
+	SPM_CA7_CPU2_L1_PDN,
+	SPM_CA7_CPU3_L1_PDN,
+};
+
+#define SPM_REGWR_EN		(1U << 0)
+#define SPM_PROJECT_CODE	0x0B16
+
+int spm_cpu_mtcmos_on(int cpu)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	udelay(1);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu))) ||
+		((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != (1U << (13 - cpu)))) {
+		;
+	}
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power on */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp &= ~L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn) &
+		L1_PDN_ACK) != 0)
+		;
+
+	udelay(1);
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_off(int cpu, bool wfi)
+{
+	static DEFINE_SPINLOCK(spm_cpu_lock);
+	unsigned long flags;
+	static u32 spmcpu_pwr_con, spmcpu_l1_pdn;
+	unsigned int temp;
+
+	temp = (SPM_PROJECT_CODE << 16) | SPM_REGWR_EN;
+	writel_relaxed(temp, spm_cpu_base + SPM_POWERON_CONFIG_SET);
+
+	spmcpu_pwr_con = spm_cpu_pwr_con[cpu];
+	spmcpu_l1_pdn = spm_cpu_l1_pdn[cpu];
+
+	if (wfi) {
+		while ((readl_relaxed(spm_cpu_base + SPM_SLEEP_TIMER_STA) &
+			(1U << (16 + cpu))) == 0)
+			;
+	}
+
+	spin_lock_irqsave(&spm_cpu_lock, flags);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_ISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= SRAM_CKISO;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~SRAM_ISOINT_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	/* L1 power off */
+	temp = readl_relaxed(spm_cpu_base + spmcpu_l1_pdn);
+	temp |= L1_PDN;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_l1_pdn);
+	while ((readl_relaxed(spm_cpu_base + spmcpu_l1_pdn)
+		& L1_PDN_ACK) != L1_PDN_ACK)
+		;
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_RST_B;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp |= PWR_CLK_DIS;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	temp = readl_relaxed(spm_cpu_base + spmcpu_pwr_con);
+	temp &= ~PWR_ON_2ND;
+	writel_relaxed(temp, spm_cpu_base + spmcpu_pwr_con);
+
+	while (((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS) &
+		(1U << (13 - cpu))) != 0) ||
+	       ((readl_relaxed(spm_cpu_base + SPM_PWR_STATUS_2ND) &
+		(1U << (13 - cpu))) != 0))
+		;
+
+	spin_unlock_irqrestore(&spm_cpu_lock, flags);
+
+	return 0;
+}
+
+int spm_cpu_mtcmos_init(void)
+{
+	struct device_node *node;
+
+	node = of_find_compatible_node(NULL, NULL, "mediatek,mt6580-scpsys");
+	if (!node) {
+		pr_err("Missing mt6580-scpsys node in the device tree\n");
+		return -EINVAL;
+	}
+
+	spm_cpu_base = of_iomap(node, 0);
+	if (!spm_cpu_base) {
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+		return -EINVAL;
+	}
+
+	return 0;
+}
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580
  2015-06-18 18:01   ` Scott Shu
  (?)
@ 2015-06-18 18:01     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

Add support for cpu enable-method "mediatek,mt6580-smp" for booting
secondary CPUs on MT6580.
---
 arch/arm/mach-mediatek/platsmp.c | 107 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 12fefb3..2985913 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -21,10 +21,15 @@
 #include <linux/of_address.h>
 #include <linux/string.h>
 #include <linux/threads.h>
+#include <linux/delay.h>
+#include <asm/cacheflush.h>
+#include "generic.h"
 
 #define MTK_MAX_CPU		8
 #define MTK_SMP_REG_SIZE	0x1000
 
+static DEFINE_SPINLOCK(boot_lock);
+
 struct mtk_smp_boot_info {
 	unsigned long smp_base;
 	unsigned int jump_reg;
@@ -57,6 +62,101 @@ static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	/* Make sure this is visible to other CPUs */
+	smp_wmb();
+	sync_cache_w(&pen_release);
+}
+
+static int mt6580_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * Set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+	write_pen_release(cpu);
+
+	/*
+	 * CPU power on control by SPM
+	 */
+	spm_cpu_mtcmos_on(cpu);
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		/* Read barrier */
+		smp_rmb();
+
+		if (pen_release == -1)
+			break;
+
+		usleep_range(10, 1000);
+	}
+
+	/*
+	 * Now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return (pen_release != -1 ? -EINVAL : 0);
+}
+
+static void mt6580_secondary_init(unsigned int cpu)
+{
+	/*
+	 * Let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	write_pen_release(-1);
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+#define MT6580_INFRACFG_AO	0x10001000
+#define SW_ROM_PD		BIT(31)
+
+static void __init mt6580_smp_prepare_cpus(unsigned int max_cpus)
+{
+	static void __iomem *infracfg_ao_base;
+
+	infracfg_ao_base = ioremap(MT6580_INFRACFG_AO, 0x1000);
+
+	if (!infracfg_ao_base)
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+
+	/* Enable bootrom power down mode */
+	writel_relaxed(readl(infracfg_ao_base + 0x804) | SW_ROM_PD,
+		       infracfg_ao_base + 0x804);
+
+	/* Write the address of slave startup into boot address
+	   register for bootrom power down mode */
+	writel_relaxed(virt_to_phys(secondary_startup_arm),
+		       infracfg_ao_base + 0x800);
+
+	iounmap(infracfg_ao_base);
+
+	/* Initial spm cpu mtcmos memory map */
+	spm_cpu_mtcmos_init();
+}
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	if (!mtk_smp_base)
@@ -143,3 +243,10 @@ static struct smp_operations mt65xx_smp_ops __initdata = {
 	.smp_boot_secondary = mtk_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(mt65xx_smp, "mediatek,mt65xx-smp", &mt65xx_smp_ops);
+
+static struct smp_operations mt6580_smp_ops __initdata = {
+	.smp_prepare_cpus = mt6580_smp_prepare_cpus,
+	.smp_secondary_init = mt6580_secondary_init,
+	.smp_boot_secondary = mt6580_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6580_smp, "mediatek,mt6580-smp", &mt6580_smp_ops);
-- 
1.8.1.1.dirty


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

* [RESEND PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

Add support for cpu enable-method "mediatek,mt6580-smp" for booting
secondary CPUs on MT6580.
---
 arch/arm/mach-mediatek/platsmp.c | 107 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 12fefb3..2985913 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -21,10 +21,15 @@
 #include <linux/of_address.h>
 #include <linux/string.h>
 #include <linux/threads.h>
+#include <linux/delay.h>
+#include <asm/cacheflush.h>
+#include "generic.h"
 
 #define MTK_MAX_CPU		8
 #define MTK_SMP_REG_SIZE	0x1000
 
+static DEFINE_SPINLOCK(boot_lock);
+
 struct mtk_smp_boot_info {
 	unsigned long smp_base;
 	unsigned int jump_reg;
@@ -57,6 +62,101 @@ static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	/* Make sure this is visible to other CPUs */
+	smp_wmb();
+	sync_cache_w(&pen_release);
+}
+
+static int mt6580_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * Set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+	write_pen_release(cpu);
+
+	/*
+	 * CPU power on control by SPM
+	 */
+	spm_cpu_mtcmos_on(cpu);
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		/* Read barrier */
+		smp_rmb();
+
+		if (pen_release == -1)
+			break;
+
+		usleep_range(10, 1000);
+	}
+
+	/*
+	 * Now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return (pen_release != -1 ? -EINVAL : 0);
+}
+
+static void mt6580_secondary_init(unsigned int cpu)
+{
+	/*
+	 * Let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	write_pen_release(-1);
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+#define MT6580_INFRACFG_AO	0x10001000
+#define SW_ROM_PD		BIT(31)
+
+static void __init mt6580_smp_prepare_cpus(unsigned int max_cpus)
+{
+	static void __iomem *infracfg_ao_base;
+
+	infracfg_ao_base = ioremap(MT6580_INFRACFG_AO, 0x1000);
+
+	if (!infracfg_ao_base)
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+
+	/* Enable bootrom power down mode */
+	writel_relaxed(readl(infracfg_ao_base + 0x804) | SW_ROM_PD,
+		       infracfg_ao_base + 0x804);
+
+	/* Write the address of slave startup into boot address
+	   register for bootrom power down mode */
+	writel_relaxed(virt_to_phys(secondary_startup_arm),
+		       infracfg_ao_base + 0x800);
+
+	iounmap(infracfg_ao_base);
+
+	/* Initial spm cpu mtcmos memory map */
+	spm_cpu_mtcmos_init();
+}
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	if (!mtk_smp_base)
@@ -143,3 +243,10 @@ static struct smp_operations mt65xx_smp_ops __initdata = {
 	.smp_boot_secondary = mtk_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(mt65xx_smp, "mediatek,mt65xx-smp", &mt65xx_smp_ops);
+
+static struct smp_operations mt6580_smp_ops __initdata = {
+	.smp_prepare_cpus = mt6580_smp_prepare_cpus,
+	.smp_secondary_init = mt6580_secondary_init,
+	.smp_boot_secondary = mt6580_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6580_smp, "mediatek,mt6580-smp", &mt6580_smp_ops);
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

Add support for cpu enable-method "mediatek,mt6580-smp" for booting
secondary CPUs on MT6580.
---
 arch/arm/mach-mediatek/platsmp.c | 107 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 107 insertions(+)

diff --git a/arch/arm/mach-mediatek/platsmp.c b/arch/arm/mach-mediatek/platsmp.c
index 12fefb3..2985913 100644
--- a/arch/arm/mach-mediatek/platsmp.c
+++ b/arch/arm/mach-mediatek/platsmp.c
@@ -21,10 +21,15 @@
 #include <linux/of_address.h>
 #include <linux/string.h>
 #include <linux/threads.h>
+#include <linux/delay.h>
+#include <asm/cacheflush.h>
+#include "generic.h"
 
 #define MTK_MAX_CPU		8
 #define MTK_SMP_REG_SIZE	0x1000
 
+static DEFINE_SPINLOCK(boot_lock);
+
 struct mtk_smp_boot_info {
 	unsigned long smp_base;
 	unsigned int jump_reg;
@@ -57,6 +62,101 @@ static const struct of_device_id mtk_smp_boot_infos[] __initconst = {
 static void __iomem *mtk_smp_base;
 static const struct mtk_smp_boot_info *mtk_smp_info;
 
+static void __cpuinit write_pen_release(int val)
+{
+	pen_release = val;
+	/* Make sure this is visible to other CPUs */
+	smp_wmb();
+	sync_cache_w(&pen_release);
+}
+
+static int mt6580_boot_secondary(unsigned int cpu, struct task_struct *idle)
+{
+	unsigned long timeout;
+
+	/*
+	 * Set synchronisation state between this boot processor
+	 * and the secondary one
+	 */
+	spin_lock(&boot_lock);
+
+	/*
+	 * The secondary processor is waiting to be released from
+	 * the holding pen - release it, then wait for it to flag
+	 * that it has been released by resetting pen_release.
+	 *
+	 * Note that "pen_release" is the hardware CPU ID, whereas
+	 * "cpu" is Linux's internal ID.
+	 */
+	write_pen_release(cpu);
+
+	/*
+	 * CPU power on control by SPM
+	 */
+	spm_cpu_mtcmos_on(cpu);
+
+	timeout = jiffies + (1 * HZ);
+	while (time_before(jiffies, timeout)) {
+		/* Read barrier */
+		smp_rmb();
+
+		if (pen_release == -1)
+			break;
+
+		usleep_range(10, 1000);
+	}
+
+	/*
+	 * Now the secondary core is starting up let it run its
+	 * calibrations, then wait for it to finish
+	 */
+	spin_unlock(&boot_lock);
+
+	return (pen_release != -1 ? -EINVAL : 0);
+}
+
+static void mt6580_secondary_init(unsigned int cpu)
+{
+	/*
+	 * Let the primary processor know we're out of the
+	 * pen, then head off into the C entry point
+	 */
+	write_pen_release(-1);
+
+	/*
+	 * Synchronise with the boot thread.
+	 */
+	spin_lock(&boot_lock);
+	spin_unlock(&boot_lock);
+}
+
+#define MT6580_INFRACFG_AO	0x10001000
+#define SW_ROM_PD		BIT(31)
+
+static void __init mt6580_smp_prepare_cpus(unsigned int max_cpus)
+{
+	static void __iomem *infracfg_ao_base;
+
+	infracfg_ao_base = ioremap(MT6580_INFRACFG_AO, 0x1000);
+
+	if (!infracfg_ao_base)
+		pr_err("%s: Unable to map I/O memory\n", __func__);
+
+	/* Enable bootrom power down mode */
+	writel_relaxed(readl(infracfg_ao_base + 0x804) | SW_ROM_PD,
+		       infracfg_ao_base + 0x804);
+
+	/* Write the address of slave startup into boot address
+	   register for bootrom power down mode */
+	writel_relaxed(virt_to_phys(secondary_startup_arm),
+		       infracfg_ao_base + 0x800);
+
+	iounmap(infracfg_ao_base);
+
+	/* Initial spm cpu mtcmos memory map */
+	spm_cpu_mtcmos_init();
+}
+
 static int mtk_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
 	if (!mtk_smp_base)
@@ -143,3 +243,10 @@ static struct smp_operations mt65xx_smp_ops __initdata = {
 	.smp_boot_secondary = mtk_boot_secondary,
 };
 CPU_METHOD_OF_DECLARE(mt65xx_smp, "mediatek,mt65xx-smp", &mt65xx_smp_ops);
+
+static struct smp_operations mt6580_smp_ops __initdata = {
+	.smp_prepare_cpus = mt6580_smp_prepare_cpus,
+	.smp_secondary_init = mt6580_secondary_init,
+	.smp_boot_secondary = mt6580_boot_secondary,
+};
+CPU_METHOD_OF_DECLARE(mt6580_smp, "mediatek,mt6580-smp", &mt6580_smp_ops);
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
  2015-06-18 18:01   ` Scott Shu
  (?)
@ 2015-06-18 18:01     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

We enable GTP6 which ungates the arch timer clock.
---
 arch/arm/mach-mediatek/mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6b38d67..469d332 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -28,7 +28,8 @@ static void __init mediatek_timer_init(void)
 {
 	void __iomem *gpt_base = 0;
 
-	if (of_machine_is_compatible("mediatek,mt6589") ||
+	if (of_machine_is_compatible("mediatek,mt6580") ||
+	    of_machine_is_compatible("mediatek,mt6589") ||
 	    of_machine_is_compatible("mediatek,mt8135") ||
 	    of_machine_is_compatible("mediatek,mt8127")) {
 		/* turn on GPT6 which ungates arch timer clocks */
@@ -46,6 +47,7 @@ static void __init mediatek_timer_init(void)
 };
 
 static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6580",
 	"mediatek,mt6589",
 	"mediatek,mt6592",
 	"mediatek,mt8127",
-- 
1.8.1.1.dirty


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

* [RESEND PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

We enable GTP6 which ungates the arch timer clock.
---
 arch/arm/mach-mediatek/mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6b38d67..469d332 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -28,7 +28,8 @@ static void __init mediatek_timer_init(void)
 {
 	void __iomem *gpt_base = 0;
 
-	if (of_machine_is_compatible("mediatek,mt6589") ||
+	if (of_machine_is_compatible("mediatek,mt6580") ||
+	    of_machine_is_compatible("mediatek,mt6589") ||
 	    of_machine_is_compatible("mediatek,mt8135") ||
 	    of_machine_is_compatible("mediatek,mt8127")) {
 		/* turn on GPT6 which ungates arch timer clocks */
@@ -46,6 +47,7 @@ static void __init mediatek_timer_init(void)
 };
 
 static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6580",
 	"mediatek,mt6589",
 	"mediatek,mt6592",
 	"mediatek,mt8127",
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

We enable GTP6 which ungates the arch timer clock.
---
 arch/arm/mach-mediatek/mediatek.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-mediatek/mediatek.c b/arch/arm/mach-mediatek/mediatek.c
index 6b38d67..469d332 100644
--- a/arch/arm/mach-mediatek/mediatek.c
+++ b/arch/arm/mach-mediatek/mediatek.c
@@ -28,7 +28,8 @@ static void __init mediatek_timer_init(void)
 {
 	void __iomem *gpt_base = 0;
 
-	if (of_machine_is_compatible("mediatek,mt6589") ||
+	if (of_machine_is_compatible("mediatek,mt6580") ||
+	    of_machine_is_compatible("mediatek,mt6589") ||
 	    of_machine_is_compatible("mediatek,mt8135") ||
 	    of_machine_is_compatible("mediatek,mt8127")) {
 		/* turn on GPT6 which ungates arch timer clocks */
@@ -46,6 +47,7 @@ static void __init mediatek_timer_init(void)
 };
 
 static const char * const mediatek_board_dt_compat[] = {
+	"mediatek,mt6580",
 	"mediatek,mt6589",
 	"mediatek,mt6592",
 	"mediatek,mt8127",
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

This adds the SCPSYS device node to the MT6580 dtsi file.
---
 arch/arm/boot/dts/mt6580.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index ae3cdb6..a974830 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -78,6 +78,11 @@
 		compatible = "simple-bus";
 		ranges;
 
+		scpsys: scpsys@10006000 {
+			compatible = "mediatek,mt6580-scpsys";
+			reg = <0x10006000 0x1000>;
+		};
+
 		timer: timer@10008000 {
 			compatible = "mediatek,mt6580-timer", "mediatek,mt6577-timer";
 			reg = <0x10008000 0x80>;
-- 
1.8.1.1.dirty


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

* [RESEND PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen-NuS5LvNUpcJWk0Htik3J/w,
	robh+dt-DgEjT+Ai2ygdnm+yROfE0A,
	matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w, linux-lFZ/pmaqli7XmaaqVzeoHQ,
	rchintakuntla-YGCgFSpz5w/QT0dZR+AlfA,
	lorenzo.pieralisi-5wv7dgnIgG8, marc.ceeeee-Re5JQEeQqe8AvxtiuMwx3w,
	heiko-4mtYJXux2i+zQB+pC5nmwQ, catalin.marinas-5wv7dgnIgG8,
	arnd-r2nGTMty4D4, galak-sgV2jX0FEOL9JmXXK+q4OQ
  Cc: srv_wsdupstream-NuS5LvNUpcJWk0Htik3J/w, Scott Shu,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r

This adds the SCPSYS device node to the MT6580 dtsi file.
---
 arch/arm/boot/dts/mt6580.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index ae3cdb6..a974830 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -78,6 +78,11 @@
 		compatible = "simple-bus";
 		ranges;
 
+		scpsys: scpsys@10006000 {
+			compatible = "mediatek,mt6580-scpsys";
+			reg = <0x10006000 0x1000>;
+		};
+
 		timer: timer@10008000 {
 			compatible = "mediatek,mt6580-timer", "mediatek,mt6577-timer";
 			reg = <0x10008000 0x80>;
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

This adds the SCPSYS device node to the MT6580 dtsi file.
---
 arch/arm/boot/dts/mt6580.dtsi | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index ae3cdb6..a974830 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -78,6 +78,11 @@
 		compatible = "simple-bus";
 		ranges;
 
+		scpsys: scpsys at 10006000 {
+			compatible = "mediatek,mt6580-scpsys";
+			reg = <0x10006000 0x1000>;
+		};
+
 		timer: timer at 10008000 {
 			compatible = "mediatek,mt6580-timer", "mediatek,mt6577-timer";
 			reg = <0x10008000 0x80>;
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580
  2015-06-18 18:01   ` Scott Shu
  (?)
@ 2015-06-18 18:01     ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

Add arch timer node to enable arch-timer support. MT6580 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This set cpu enable-method to enable SMP.
---
 arch/arm/boot/dts/mt6580.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index a974830..a7071b38 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -23,26 +23,31 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "mediatek,mt6580-smp";
 
 		cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x1>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x2>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x3>;
+			clock-frequency = <1700000000>;
 		};
 
 	};
@@ -72,6 +77,21 @@
 		};
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.8.1.1.dirty


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

* [RESEND PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak
  Cc: srv_wsdupstream, linux-arm-kernel, linux-kernel, linux-mediatek,
	Scott Shu

Add arch timer node to enable arch-timer support. MT6580 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This set cpu enable-method to enable SMP.
---
 arch/arm/boot/dts/mt6580.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index a974830..a7071b38 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -23,26 +23,31 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "mediatek,mt6580-smp";
 
 		cpu@0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x1>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x2>;
+			clock-frequency = <1700000000>;
 		};
 		cpu@3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x3>;
+			clock-frequency = <1700000000>;
 		};
 
 	};
@@ -72,6 +77,21 @@
 		};
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.8.1.1.dirty

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

* [RESEND PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580
@ 2015-06-18 18:01     ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-06-18 18:01 UTC (permalink / raw)
  To: linux-arm-kernel

Add arch timer node to enable arch-timer support. MT6580 firmware
doesn't correctly setup arch-timer frequency and CNTVOFF, add
properties to workaround this.

This set cpu enable-method to enable SMP.
---
 arch/arm/boot/dts/mt6580.dtsi | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/arch/arm/boot/dts/mt6580.dtsi b/arch/arm/boot/dts/mt6580.dtsi
index a974830..a7071b38 100644
--- a/arch/arm/boot/dts/mt6580.dtsi
+++ b/arch/arm/boot/dts/mt6580.dtsi
@@ -23,26 +23,31 @@
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
+		enable-method = "mediatek,mt6580-smp";
 
 		cpu at 0 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x0>;
+			clock-frequency = <1700000000>;
 		};
 		cpu at 1 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x1>;
+			clock-frequency = <1700000000>;
 		};
 		cpu at 2 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x2>;
+			clock-frequency = <1700000000>;
 		};
 		cpu at 3 {
 			device_type = "cpu";
 			compatible = "arm,cortex-a7";
 			reg = <0x3>;
+			clock-frequency = <1700000000>;
 		};
 
 	};
@@ -72,6 +77,21 @@
 		};
 	};
 
+	timer {
+		compatible = "arm,armv7-timer";
+		interrupt-parent = <&gic>;
+		interrupts = <GIC_PPI 13 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 14 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 11 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>,
+			     <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(4) |
+					  IRQ_TYPE_LEVEL_LOW)>;
+		clock-frequency = <13000000>;
+		arm,cpu-registers-not-fw-configured;
+	};
+
 	soc {
 		#address-cells = <1>;
 		#size-cells = <1>;
-- 
1.8.1.1.dirty

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

* Re: [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
  2015-06-18 18:01   ` Scott Shu
@ 2015-06-18 18:23     ` Alexey Klimov
  -1 siblings, 0 replies; 75+ messages in thread
From: Alexey Klimov @ 2015-06-18 18:23 UTC (permalink / raw)
  To: Scott Shu
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, Linux Kernel Mailing List,
	linux-arm-kernel

On Thu, Jun 18, 2015 at 9:01 PM, Scott Shu <scott.shu@mediatek.com> wrote:
> This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

quad?

> This is based on v4.1-rc1 and following patch series:
> (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
>
> The secondary cores are power off as default on MT6580, this change adds
> a new enable-method to turn on power to the cores during booting process.
>
> The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> power domain control. Please check [3] for more information about SCPSYS.
>
> [1] https://lkml.org/lkml/2015/5/16/33
> [2] https://lkml.org/lkml/2015/6/3/113
> [3] https://lkml.org/lkml/2015/6/9/172
>
>
> Scott Shu (6):
>   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
>   soc: Mediatek: Add SCPSYS CPU power domain driver
>   ARM: mediatek: add smp bringup code
>   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
>   ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
>   ARM: dts: mt6580: enable basic SMP bringup for MT6580

Most of your patches are missing Signed-off-by.


-- 
Best regards, Klimov Alexey

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

* [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-06-18 18:23     ` Alexey Klimov
  0 siblings, 0 replies; 75+ messages in thread
From: Alexey Klimov @ 2015-06-18 18:23 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 18, 2015 at 9:01 PM, Scott Shu <scott.shu@mediatek.com> wrote:
> This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

quad?

> This is based on v4.1-rc1 and following patch series:
> (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
>
> The secondary cores are power off as default on MT6580, this change adds
> a new enable-method to turn on power to the cores during booting process.
>
> The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> power domain control. Please check [3] for more information about SCPSYS.
>
> [1] https://lkml.org/lkml/2015/5/16/33
> [2] https://lkml.org/lkml/2015/6/3/113
> [3] https://lkml.org/lkml/2015/6/9/172
>
>
> Scott Shu (6):
>   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
>   soc: Mediatek: Add SCPSYS CPU power domain driver
>   ARM: mediatek: add smp bringup code
>   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for MT6580
>   ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
>   ARM: dts: mt6580: enable basic SMP bringup for MT6580

Most of your patches are missing Signed-off-by.


-- 
Best regards, Klimov Alexey

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-06-18 18:01     ` Scott Shu
  (?)
@ 2015-06-23  5:53       ` Sascha Hauer
  -1 siblings, 0 replies; 75+ messages in thread
From: Sascha Hauer @ 2015-06-23  5:53 UTC (permalink / raw)
  To: Scott Shu
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel

Hi Scott,

On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> MT6580.

This seems to be support for the very same hardware as I am posting
here:

https://lkml.org/lkml/2015/6/22/41

We should consolidate this.

My driver is currently handles all power domains except the CPUs while
yours handles only the CPUs.
I currently haven't looked whether CPUs can just be part of a power
domain aswell, but if that works this would probably be the way to go.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
Please read the FAQ at  http://www.tux.org/lkml/

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-06-23  5:53       ` Sascha Hauer
  0 siblings, 0 replies; 75+ messages in thread
From: Sascha Hauer @ 2015-06-23  5:53 UTC (permalink / raw)
  To: Scott Shu
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel

Hi Scott,

On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> MT6580.

This seems to be support for the very same hardware as I am posting
here:

https://lkml.org/lkml/2015/6/22/41

We should consolidate this.

My driver is currently handles all power domains except the CPUs while
yours handles only the CPUs.
I currently haven't looked whether CPUs can just be part of a power
domain aswell, but if that works this would probably be the way to go.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-06-23  5:53       ` Sascha Hauer
  0 siblings, 0 replies; 75+ messages in thread
From: Sascha Hauer @ 2015-06-23  5:53 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Scott,

On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> MT6580.

This seems to be support for the very same hardware as I am posting
here:

https://lkml.org/lkml/2015/6/22/41

We should consolidate this.

My driver is currently handles all power domains except the CPUs while
yours handles only the CPUs.
I currently haven't looked whether CPUs can just be part of a power
domain aswell, but if that works this would probably be the way to go.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* RE: [PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
       [not found]         ` <CABuKBeK-WLFnrOnPYmGR1cTfecHhq+_QyAqQjJpYfuA_MNW1aw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2015-06-24  5:56           ` Scott Shu (舒祖襄)
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu (舒祖襄) @ 2015-06-24  5:56 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: scott.shu-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, wsd_upstream,
	Mars Cheng (鄭森友),
	Jades Shih (施向玨),
	Miles Chen (陳民樺),
	moderated list:ARM/Mediatek SoC...,
	MY Chuang (莊明躍),
	Yingjoe Chen (陳英洲)

Hi Matthias,
  Thank you very much. The v1 patchset is submitted. We got some suggestion, so we will submit our 2nd version soon.

Thanks and Best Regards,
Scott Shu
#23931

-----Original Message-----
From: Matthias Brugger [mailto:matthias.bgg@gmail.com] 
Sent: Friday, June 19, 2015 12:12 AM
To: Scott Shu (舒祖襄)
Cc: Yingjoe Chen (陳英洲); scott.shu@gmail.com; moderated list:ARM/Mediatek SoC...; Jades Shih (施向玨); srv_wsdupstream@mediatek.com; Miles Chen (陳民樺); Mars Cheng (鄭森友); MY Chuang (莊明躍)
Subject: Re: [PATCH 0/6] This series adds SMP support for the MediaTek MT6580.

Hi Scott,

2015-06-18 4:46 GMT+02:00 Scott Shu <scott.shu@mediatek.com>:
> This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.

It's nice to see a new SoC.
For now just one comment (more to follow): I got this series twice, but in neither the recipients seem to be done right.
Please use scripts/get_maintainer.pl on the whole series to see to whom you should send the series. Maybe you can just resend it (mark it in the subject) so that the discussion can happen between all interested people.

Cheers,
Matthias

************* Email Confidentiality Notice ********************
The information contained in this e-mail message (including any 
attachments) may be confidential, proprietary, privileged, or otherwise
exempt from disclosure under applicable laws. It is intended to be 
conveyed only to the designated recipient(s). Any use, dissemination, 
distribution, printing, retaining or copying of this e-mail (including its 
attachments) by unintended recipient(s) is strictly prohibited and may 
be unlawful. If you are not an intended recipient of this e-mail, or believe 
that you have received this e-mail in error, please notify the sender 
immediately (by replying to this e-mail), delete any and all copies of 
this e-mail (including any attachments) from your system, and do not
disclose the content of this e-mail to any other person. Thank you!
_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* Re: [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  2015-06-18 18:01     ` Scott Shu
  (?)
@ 2015-06-29  3:03       ` Yingjoe Chen
  -1 siblings, 0 replies; 75+ messages in thread
From: Yingjoe Chen @ 2015-06-29  3:03 UTC (permalink / raw)
  To: Scott Shu, Matthias Brugger, Arnd Bergmann, ibanezchen
  Cc: robh+dt, linux, rchintakuntla, lorenzo.pieralisi, marc.ceeeee,
	heiko, catalin.marinas, galak, srv_wsdupstream, linux-arm-kernel,
	linux-kernel, linux-mediatek

On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> For MT6580 SoC platform, the secondary cores are in powered off state
> as default, so compared with MT65xx series SoC, one new enable method
> is needed. This method using the SPM (System Power Manager) inside
> the SCYSYS to control the CPU power.
> ---
>  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> index ac2903d..fb80b2e 100644
> --- a/Documentation/devicetree/bindings/arm/cpus.txt
> +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> @@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
>  			    "marvell,armada-380-smp"
>  			    "marvell,armada-390-smp"
>  			    "marvell,armada-xp-smp"
> +			    "mediatek,mt6580-smp"
>  			    "mediatek,mt65xx-smp"
>  			    "mediatek,mt81xx-tz-smp"
>  			    "qcom,gcc-msm8660"

Hi

It seems we have 3 different kinds of cpu enable method now, and
mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
change naming before it got merged.

Short summary for these methods:

mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
		Tested on mt6589 by Matthias.
mt6580-smp:     Only first core is alive at boot, so need to wakeup
		other cores using SPM. AFAIK only for mt6580 now.
mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
		trustzone firmware. Suitable for mt8127, mt8135.

I'm not sure about smp for mt6592, maybe Howard or Scott can comment on
it.

Any suggestion on how we should organize these methods?

Joe.C



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

* Re: [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-06-29  3:03       ` Yingjoe Chen
  0 siblings, 0 replies; 75+ messages in thread
From: Yingjoe Chen @ 2015-06-29  3:03 UTC (permalink / raw)
  To: Scott Shu, Matthias Brugger, Arnd Bergmann, ibanezchen
  Cc: robh+dt, linux, rchintakuntla, lorenzo.pieralisi, marc.ceeeee,
	heiko, catalin.marinas, galak, srv_wsdupstream, linux-arm-kernel,
	linux-kernel, linux-mediatek

On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> For MT6580 SoC platform, the secondary cores are in powered off state
> as default, so compared with MT65xx series SoC, one new enable method
> is needed. This method using the SPM (System Power Manager) inside
> the SCYSYS to control the CPU power.
> ---
>  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> index ac2903d..fb80b2e 100644
> --- a/Documentation/devicetree/bindings/arm/cpus.txt
> +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> @@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
>  			    "marvell,armada-380-smp"
>  			    "marvell,armada-390-smp"
>  			    "marvell,armada-xp-smp"
> +			    "mediatek,mt6580-smp"
>  			    "mediatek,mt65xx-smp"
>  			    "mediatek,mt81xx-tz-smp"
>  			    "qcom,gcc-msm8660"

Hi

It seems we have 3 different kinds of cpu enable method now, and
mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
change naming before it got merged.

Short summary for these methods:

mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
		Tested on mt6589 by Matthias.
mt6580-smp:     Only first core is alive at boot, so need to wakeup
		other cores using SPM. AFAIK only for mt6580 now.
mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
		trustzone firmware. Suitable for mt8127, mt8135.

I'm not sure about smp for mt6592, maybe Howard or Scott can comment on
it.

Any suggestion on how we should organize these methods?

Joe.C

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

* [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-06-29  3:03       ` Yingjoe Chen
  0 siblings, 0 replies; 75+ messages in thread
From: Yingjoe Chen @ 2015-06-29  3:03 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> For MT6580 SoC platform, the secondary cores are in powered off state
> as default, so compared with MT65xx series SoC, one new enable method
> is needed. This method using the SPM (System Power Manager) inside
> the SCYSYS to control the CPU power.
> ---
>  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> index ac2903d..fb80b2e 100644
> --- a/Documentation/devicetree/bindings/arm/cpus.txt
> +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> @@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
>  			    "marvell,armada-380-smp"
>  			    "marvell,armada-390-smp"
>  			    "marvell,armada-xp-smp"
> +			    "mediatek,mt6580-smp"
>  			    "mediatek,mt65xx-smp"
>  			    "mediatek,mt81xx-tz-smp"
>  			    "qcom,gcc-msm8660"

Hi

It seems we have 3 different kinds of cpu enable method now, and
mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
change naming before it got merged.

Short summary for these methods:

mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
		Tested on mt6589 by Matthias.
mt6580-smp:     Only first core is alive at boot, so need to wakeup
		other cores using SPM. AFAIK only for mt6580 now.
mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
		trustzone firmware. Suitable for mt8127, mt8135.

I'm not sure about smp for mt6592, maybe Howard or Scott can comment on
it.

Any suggestion on how we should organize these methods?

Joe.C

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-06-23  5:53       ` Sascha Hauer
  (?)
@ 2015-07-03  5:58         ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-03  5:58 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel

Hi Sascha,
   I just wonder can we separate the MTCMOS into cpu and non-cpu part? 
Just like qcom's xcc driver, they put cpu related code under
"arch/arm/mach-xxx" but put the others under "driver".

Thanks,
Scott  

On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> Hi Scott,
> 
> On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > MT6580.
> 
> This seems to be support for the very same hardware as I am posting
> here:
> 
> https://lkml.org/lkml/2015/6/22/41
> 
> We should consolidate this.
> 
> My driver is currently handles all power domains except the CPUs while
> yours handles only the CPUs.
> I currently haven't looked whether CPUs can just be part of a power
> domain aswell, but if that works this would probably be the way to go.
> 
> Sascha
> 
> 



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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-03  5:58         ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-03  5:58 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel

Hi Sascha,
   I just wonder can we separate the MTCMOS into cpu and non-cpu part? 
Just like qcom's xcc driver, they put cpu related code under
"arch/arm/mach-xxx" but put the others under "driver".

Thanks,
Scott  

On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> Hi Scott,
> 
> On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > MT6580.
> 
> This seems to be support for the very same hardware as I am posting
> here:
> 
> https://lkml.org/lkml/2015/6/22/41
> 
> We should consolidate this.
> 
> My driver is currently handles all power domains except the CPUs while
> yours handles only the CPUs.
> I currently haven't looked whether CPUs can just be part of a power
> domain aswell, but if that works this would probably be the way to go.
> 
> Sascha
> 
> 

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-03  5:58         ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-03  5:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sascha,
   I just wonder can we separate the MTCMOS into cpu and non-cpu part? 
Just like qcom's xcc driver, they put cpu related code under
"arch/arm/mach-xxx" but put the others under "driver".

Thanks,
Scott  

On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> Hi Scott,
> 
> On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > MT6580.
> 
> This seems to be support for the very same hardware as I am posting
> here:
> 
> https://lkml.org/lkml/2015/6/22/41
> 
> We should consolidate this.
> 
> My driver is currently handles all power domains except the CPUs while
> yours handles only the CPUs.
> I currently haven't looked whether CPUs can just be part of a power
> domain aswell, but if that works this would probably be the way to go.
> 
> Sascha
> 
> 

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

* Re: [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  2015-06-29  3:03       ` Yingjoe Chen
  (?)
@ 2015-07-11 10:38         ` Yingjoe Chen
  -1 siblings, 0 replies; 75+ messages in thread
From: Yingjoe Chen @ 2015-07-11 10:38 UTC (permalink / raw)
  To: Arnd Bergmann, Matthias Brugger
  Cc: Matthias Brugger, Arnd Bergmann, ibanezchen, lorenzo.pieralisi,
	linux, heiko, catalin.marinas, linux-kernel, srv_wsdupstream,
	marc.ceeeee, robh+dt, linux-mediatek, galak, rchintakuntla,
	linux-arm-kernel

On Mon, 2015-06-29 at 11:03 +0800, Yingjoe Chen wrote:
> On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> > For MT6580 SoC platform, the secondary cores are in powered off state
> > as default, so compared with MT65xx series SoC, one new enable method
> > is needed. This method using the SPM (System Power Manager) inside
> > the SCYSYS to control the CPU power.
> > ---
> >  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> > index ac2903d..fb80b2e 100644
> > --- a/Documentation/devicetree/bindings/arm/cpus.txt
> > +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> > @@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
> >  			    "marvell,armada-380-smp"
> >  			    "marvell,armada-390-smp"
> >  			    "marvell,armada-xp-smp"
> > +			    "mediatek,mt6580-smp"
> >  			    "mediatek,mt65xx-smp"
> >  			    "mediatek,mt81xx-tz-smp"
> >  			    "qcom,gcc-msm8660"
> 
> Hi
> 
> It seems we have 3 different kinds of cpu enable method now, and
> mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
> change naming before it got merged.
> 
> Short summary for these methods:
> 
> mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
> 		Tested on mt6589 by Matthias.
> mt6580-smp:     Only first core is alive at boot, so need to wakeup
> 		other cores using SPM. AFAIK only for mt6580 now.
> mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
> 		trustzone firmware. Suitable for mt8127, mt8135.


Hi Matthias, Arnd,

Any suggestion on the naming? Is it ok if I just rename mt65xx-smp to
mt6589-smp since that's the only one we tested?

Joe.C



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

* Re: [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-07-11 10:38         ` Yingjoe Chen
  0 siblings, 0 replies; 75+ messages in thread
From: Yingjoe Chen @ 2015-07-11 10:38 UTC (permalink / raw)
  Cc: Matthias Brugger, Arnd Bergmann, ibanezchen, lorenzo.pieralisi,
	linux, heiko, catalin.marinas, linux-kernel, srv_wsdupstream,
	marc.ceeeee, robh+dt, linux-mediatek, galak, rchintakuntla,
	linux-arm-kernel

On Mon, 2015-06-29 at 11:03 +0800, Yingjoe Chen wrote:
> On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> > For MT6580 SoC platform, the secondary cores are in powered off state
> > as default, so compared with MT65xx series SoC, one new enable method
> > is needed. This method using the SPM (System Power Manager) inside
> > the SCYSYS to control the CPU power.
> > ---
> >  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> > index ac2903d..fb80b2e 100644
> > --- a/Documentation/devicetree/bindings/arm/cpus.txt
> > +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> > @@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
> >  			    "marvell,armada-380-smp"
> >  			    "marvell,armada-390-smp"
> >  			    "marvell,armada-xp-smp"
> > +			    "mediatek,mt6580-smp"
> >  			    "mediatek,mt65xx-smp"
> >  			    "mediatek,mt81xx-tz-smp"
> >  			    "qcom,gcc-msm8660"
> 
> Hi
> 
> It seems we have 3 different kinds of cpu enable method now, and
> mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
> change naming before it got merged.
> 
> Short summary for these methods:
> 
> mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
> 		Tested on mt6589 by Matthias.
> mt6580-smp:     Only first core is alive at boot, so need to wakeup
> 		other cores using SPM. AFAIK only for mt6580 now.
> mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
> 		trustzone firmware. Suitable for mt8127, mt8135.


Hi Matthias, Arnd,

Any suggestion on the naming? Is it ok if I just rename mt65xx-smp to
mt6589-smp since that's the only one we tested?

Joe.C

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

* [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-07-11 10:38         ` Yingjoe Chen
  0 siblings, 0 replies; 75+ messages in thread
From: Yingjoe Chen @ 2015-07-11 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, 2015-06-29 at 11:03 +0800, Yingjoe Chen wrote:
> On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> > For MT6580 SoC platform, the secondary cores are in powered off state
> > as default, so compared with MT65xx series SoC, one new enable method
> > is needed. This method using the SPM (System Power Manager) inside
> > the SCYSYS to control the CPU power.
> > ---
> >  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt b/Documentation/devicetree/bindings/arm/cpus.txt
> > index ac2903d..fb80b2e 100644
> > --- a/Documentation/devicetree/bindings/arm/cpus.txt
> > +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> > @@ -194,6 +194,7 @@ nodes to be present and contain the properties described below.
> >  			    "marvell,armada-380-smp"
> >  			    "marvell,armada-390-smp"
> >  			    "marvell,armada-xp-smp"
> > +			    "mediatek,mt6580-smp"
> >  			    "mediatek,mt65xx-smp"
> >  			    "mediatek,mt81xx-tz-smp"
> >  			    "qcom,gcc-msm8660"
> 
> Hi
> 
> It seems we have 3 different kinds of cpu enable method now, and
> mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
> change naming before it got merged.
> 
> Short summary for these methods:
> 
> mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
> 		Tested on mt6589 by Matthias.
> mt6580-smp:     Only first core is alive at boot, so need to wakeup
> 		other cores using SPM. AFAIK only for mt6580 now.
> mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
> 		trustzone firmware. Suitable for mt8127, mt8135.


Hi Matthias, Arnd,

Any suggestion on the naming? Is it ok if I just rename mt65xx-smp to
mt6589-smp since that's the only one we tested?

Joe.C

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

* Re: [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
  2015-07-11 10:38         ` Yingjoe Chen
@ 2015-07-17 22:04           ` Matthias Brugger
  -1 siblings, 0 replies; 75+ messages in thread
From: Matthias Brugger @ 2015-07-17 22:04 UTC (permalink / raw)
  To: Yingjoe Chen
  Cc: Arnd Bergmann, ibanezchen, lorenzo.pieralisi, linux, heiko,
	catalin.marinas, linux-kernel, srv_wsdupstream, marc.ceeeee,
	robh+dt, linux-mediatek, galak, rchintakuntla, linux-arm-kernel

On Saturday, July 11, 2015 06:38:06 PM Yingjoe Chen wrote:
> On Mon, 2015-06-29 at 11:03 +0800, Yingjoe Chen wrote:
> > On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> > > For MT6580 SoC platform, the secondary cores are in powered off state
> > > as default, so compared with MT65xx series SoC, one new enable method
> > > is needed. This method using the SPM (System Power Manager) inside
> > > the SCYSYS to control the CPU power.
> > > ---
> > > 
> > >  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt
> > > b/Documentation/devicetree/bindings/arm/cpus.txt index ac2903d..fb80b2e
> > > 100644
> > > --- a/Documentation/devicetree/bindings/arm/cpus.txt
> > > +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> > > @@ -194,6 +194,7 @@ nodes to be present and contain the properties
> > > described below.> > 
> > >  			    "marvell,armada-380-smp"
> > >  			    "marvell,armada-390-smp"
> > >  			    "marvell,armada-xp-smp"
> > > 
> > > +			    "mediatek,mt6580-smp"
> > > 
> > >  			    "mediatek,mt65xx-smp"
> > >  			    "mediatek,mt81xx-tz-smp"
> > >  			    "qcom,gcc-msm8660"
> > 
> > Hi
> > 
> > It seems we have 3 different kinds of cpu enable method now, and
> > mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
> > change naming before it got merged.
> > 
> > Short summary for these methods:
> > 
> > mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
> > 
> > 		Tested on mt6589 by Matthias.
> > 
> > mt6580-smp:     Only first core is alive at boot, so need to wakeup
> > 
> > 		other cores using SPM. AFAIK only for mt6580 now.
> > 
> > mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
> > 
> > 		trustzone firmware. Suitable for mt8127, mt8135.
> 
> Hi Matthias, Arnd,
> 
> Any suggestion on the naming? Is it ok if I just rename mt65xx-smp to
> mt6589-smp since that's the only one we tested?
> 

Yes, that's fine for me.

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

* [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
@ 2015-07-17 22:04           ` Matthias Brugger
  0 siblings, 0 replies; 75+ messages in thread
From: Matthias Brugger @ 2015-07-17 22:04 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday, July 11, 2015 06:38:06 PM Yingjoe Chen wrote:
> On Mon, 2015-06-29 at 11:03 +0800, Yingjoe Chen wrote:
> > On Fri, 2015-06-19 at 02:01 +0800, Scott Shu wrote:
> > > For MT6580 SoC platform, the secondary cores are in powered off state
> > > as default, so compared with MT65xx series SoC, one new enable method
> > > is needed. This method using the SPM (System Power Manager) inside
> > > the SCYSYS to control the CPU power.
> > > ---
> > > 
> > >  Documentation/devicetree/bindings/arm/cpus.txt | 1 +
> > >  1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/Documentation/devicetree/bindings/arm/cpus.txt
> > > b/Documentation/devicetree/bindings/arm/cpus.txt index ac2903d..fb80b2e
> > > 100644
> > > --- a/Documentation/devicetree/bindings/arm/cpus.txt
> > > +++ b/Documentation/devicetree/bindings/arm/cpus.txt
> > > @@ -194,6 +194,7 @@ nodes to be present and contain the properties
> > > described below.> > 
> > >  			    "marvell,armada-380-smp"
> > >  			    "marvell,armada-390-smp"
> > >  			    "marvell,armada-xp-smp"
> > > 
> > > +			    "mediatek,mt6580-smp"
> > > 
> > >  			    "mediatek,mt65xx-smp"
> > >  			    "mediatek,mt81xx-tz-smp"
> > >  			    "qcom,gcc-msm8660"
> > 
> > Hi
> > 
> > It seems we have 3 different kinds of cpu enable method now, and
> > mt65xx-smp doesn't cover all mt65xx series. So maybe it make sense to
> > change naming before it got merged.
> > 
> > Short summary for these methods:
> > 
> > mt65xx-smp:    	For mt65xx socs which wakeup all cores at boot.
> > 
> > 		Tested on mt6589 by Matthias.
> > 
> > mt6580-smp:     Only first core is alive at boot, so need to wakeup
> > 
> > 		other cores using SPM. AFAIK only for mt6580 now.
> > 
> > mt81xx-tz-smp:  For soc which wakeup all cores at boot, and have
> > 
> > 		trustzone firmware. Suitable for mt8127, mt8135.
> 
> Hi Matthias, Arnd,
> 
> Any suggestion on the naming? Is it ok if I just rename mt65xx-smp to
> mt6589-smp since that's the only one we tested?
> 

Yes, that's fine for me.

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-06-23  5:53       ` Sascha Hauer
  (?)
@ 2015-07-24  2:02         ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-24  2:02 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel, loda.chou, jades.shih, scott.shu

On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> Hi Scott,
> 
> On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > MT6580.
> 
> This seems to be support for the very same hardware as I am posting
> here:
> 
> https://lkml.org/lkml/2015/6/22/41
> 
> We should consolidate this.
> 
> My driver is currently handles all power domains except the CPUs while
> yours handles only the CPUs.
> I currently haven't looked whether CPUs can just be part of a power
> domain aswell, but if that works this would probably be the way to go.
> 
> Sascha
> 
> 
Hi Sascga,

We had posted new patch set in following link, but still keep our
original framework.
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html

As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
will be executed before registering the scpsys_drv driver, so the CPUs power
domain is controlled on arch/arm/mach-$(MACHINE) directory. 

Please kindly provide your comments and suggestion. Thank you very much. 

Best Regards,
Scott Shu




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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-24  2:02         ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-24  2:02 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel, loda.chou, jades.shih, scott.shu

On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> Hi Scott,
> 
> On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > MT6580.
> 
> This seems to be support for the very same hardware as I am posting
> here:
> 
> https://lkml.org/lkml/2015/6/22/41
> 
> We should consolidate this.
> 
> My driver is currently handles all power domains except the CPUs while
> yours handles only the CPUs.
> I currently haven't looked whether CPUs can just be part of a power
> domain aswell, but if that works this would probably be the way to go.
> 
> Sascha
> 
> 
Hi Sascga,

We had posted new patch set in following link, but still keep our
original framework.
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html

As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
will be executed before registering the scpsys_drv driver, so the CPUs power
domain is controlled on arch/arm/mach-$(MACHINE) directory. 

Please kindly provide your comments and suggestion. Thank you very much. 

Best Regards,
Scott Shu

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-24  2:02         ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-24  2:02 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> Hi Scott,
> 
> On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > MT6580.
> 
> This seems to be support for the very same hardware as I am posting
> here:
> 
> https://lkml.org/lkml/2015/6/22/41
> 
> We should consolidate this.
> 
> My driver is currently handles all power domains except the CPUs while
> yours handles only the CPUs.
> I currently haven't looked whether CPUs can just be part of a power
> domain aswell, but if that works this would probably be the way to go.
> 
> Sascha
> 
> 
Hi Sascga,

We had posted new patch set in following link, but still keep our
original framework.
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html

As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
will be executed before registering the scpsys_drv driver, so the CPUs power
domain is controlled on arch/arm/mach-$(MACHINE) directory. 

Please kindly provide your comments and suggestion. Thank you very much. 

Best Regards,
Scott Shu

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-07-24  2:02         ` Scott Shu
@ 2015-07-24  5:50           ` Sascha Hauer
  -1 siblings, 0 replies; 75+ messages in thread
From: Sascha Hauer @ 2015-07-24  5:50 UTC (permalink / raw)
  To: Scott Shu
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel, loda.chou, jades.shih, scott.shu

On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > Hi Scott,
> > 
> > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > MT6580.
> > 
> > This seems to be support for the very same hardware as I am posting
> > here:
> > 
> > https://lkml.org/lkml/2015/6/22/41
> > 
> > We should consolidate this.
> > 
> > My driver is currently handles all power domains except the CPUs while
> > yours handles only the CPUs.
> > I currently haven't looked whether CPUs can just be part of a power
> > domain aswell, but if that works this would probably be the way to go.
> > 
> > Sascha
> > 
> > 
> Hi Sascga,
> 
> We had posted new patch set in following link, but still keep our
> original framework.
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html
> 
> As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
> will be executed before registering the scpsys_drv driver, so the CPUs power
> domain is controlled on arch/arm/mach-$(MACHINE) directory. 
> 
> Please kindly provide your comments and suggestion. Thank you very much.

I think that instead of explaining why have to duplicate the code you
should rather search for ways how the code can be shared. Yes, we'll
need a second (early) entry point to the driver. Maybe we even have to
create the shared code which is then called from the driver and your
early architecture code.
You'll probably have to do this separation between early code and
regular driver code in your driver anyway, since I bet the MT6580 also
has some power domains which shall be controlled by the regular Linux
power domain code later. Also we probably could control the CPU power
domains for the MT8173 in the SCPSYS driver aswell, we just don't have
to because we use PSCI there. You see we are approaching the same
problem from two different corners. Let's find a way to share the code.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-24  5:50           ` Sascha Hauer
  0 siblings, 0 replies; 75+ messages in thread
From: Sascha Hauer @ 2015-07-24  5:50 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > Hi Scott,
> > 
> > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > MT6580.
> > 
> > This seems to be support for the very same hardware as I am posting
> > here:
> > 
> > https://lkml.org/lkml/2015/6/22/41
> > 
> > We should consolidate this.
> > 
> > My driver is currently handles all power domains except the CPUs while
> > yours handles only the CPUs.
> > I currently haven't looked whether CPUs can just be part of a power
> > domain aswell, but if that works this would probably be the way to go.
> > 
> > Sascha
> > 
> > 
> Hi Sascga,
> 
> We had posted new patch set in following link, but still keep our
> original framework.
> http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html
> 
> As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
> will be executed before registering the scpsys_drv driver, so the CPUs power
> domain is controlled on arch/arm/mach-$(MACHINE) directory. 
> 
> Please kindly provide your comments and suggestion. Thank you very much.

I think that instead of explaining why have to duplicate the code you
should rather search for ways how the code can be shared. Yes, we'll
need a second (early) entry point to the driver. Maybe we even have to
create the shared code which is then called from the driver and your
early architecture code.
You'll probably have to do this separation between early code and
regular driver code in your driver anyway, since I bet the MT6580 also
has some power domains which shall be controlled by the regular Linux
power domain code later. Also we probably could control the CPU power
domains for the MT8173 in the SCPSYS driver aswell, we just don't have
to because we use PSCI there. You see we are approaching the same
problem from two different corners. Let's find a way to share the code.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
  2015-06-18 18:01   ` Scott Shu
@ 2015-07-24 12:59     ` Matthias Brugger
  -1 siblings, 0 replies; 75+ messages in thread
From: Matthias Brugger @ 2015-07-24 12:59 UTC (permalink / raw)
  To: Scott Shu
  Cc: yingjoe.chen, robh+dt, linux, rchintakuntla, lorenzo.pieralisi,
	marc.ceeeee, heiko, catalin.marinas, arnd, galak, srv_wsdupstream,
	linux-arm-kernel, linux-kernel, linux-mediatek

On Friday, June 19, 2015 02:01:15 AM Scott Shu wrote:
> This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.
> 
> This is based on v4.1-rc1 and following patch series:
> (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
> 
> The secondary cores are power off as default on MT6580, this change adds
> a new enable-method to turn on power to the cores during booting process.
> 
> The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> power domain control. Please check [3] for more information about SCPSYS.
> 
> [1] https://lkml.org/lkml/2015/5/16/33
> [2] https://lkml.org/lkml/2015/6/3/113
> [3] https://lkml.org/lkml/2015/6/9/172
> 
> 
> Scott Shu (6):
>   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
>   soc: Mediatek: Add SCPSYS CPU power domain driver
>   ARM: mediatek: add smp bringup code
>   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for
> MT6580 ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
>   ARM: dts: mt6580: enable basic SMP bringup for MT6580
> 
>  Documentation/devicetree/bindings/arm/cpus.txt |   1 +
>  arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
>  arch/arm/mach-mediatek/Makefile                |   2 +-
>  arch/arm/mach-mediatek/generic.h               |  24 +++
>  arch/arm/mach-mediatek/hotplug.c               | 229
> +++++++++++++++++++++++++ arch/arm/mach-mediatek/mediatek.c              | 
>  4 +-
>  arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
>  7 files changed, 395 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm/mach-mediatek/generic.h
>  create mode 100644 arch/arm/mach-mediatek/hotplug.c


The whole series is missing a Signed-off-by tag, please add them to the next 
version. The Signed-off-by is mandatory for any patch to get accepted.

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

* [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-07-24 12:59     ` Matthias Brugger
  0 siblings, 0 replies; 75+ messages in thread
From: Matthias Brugger @ 2015-07-24 12:59 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday, June 19, 2015 02:01:15 AM Scott Shu wrote:
> This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.
> 
> This is based on v4.1-rc1 and following patch series:
> (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
> 
> The secondary cores are power off as default on MT6580, this change adds
> a new enable-method to turn on power to the cores during booting process.
> 
> The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> power domain control. Please check [3] for more information about SCPSYS.
> 
> [1] https://lkml.org/lkml/2015/5/16/33
> [2] https://lkml.org/lkml/2015/6/3/113
> [3] https://lkml.org/lkml/2015/6/9/172
> 
> 
> Scott Shu (6):
>   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
>   soc: Mediatek: Add SCPSYS CPU power domain driver
>   ARM: mediatek: add smp bringup code
>   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for
> MT6580 ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
>   ARM: dts: mt6580: enable basic SMP bringup for MT6580
> 
>  Documentation/devicetree/bindings/arm/cpus.txt |   1 +
>  arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
>  arch/arm/mach-mediatek/Makefile                |   2 +-
>  arch/arm/mach-mediatek/generic.h               |  24 +++
>  arch/arm/mach-mediatek/hotplug.c               | 229
> +++++++++++++++++++++++++ arch/arm/mach-mediatek/mediatek.c              | 
>  4 +-
>  arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
>  7 files changed, 395 insertions(+), 3 deletions(-)
>  create mode 100644 arch/arm/mach-mediatek/generic.h
>  create mode 100644 arch/arm/mach-mediatek/hotplug.c


The whole series is missing a Signed-off-by tag, please add them to the next 
version. The Signed-off-by is mandatory for any patch to get accepted.

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

* Re: [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
  2015-07-24 12:59     ` Matthias Brugger
  (?)
@ 2015-07-24 13:10       ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-24 13:10 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: yingjoe.chen, robh+dt, linux, rchintakuntla, lorenzo.pieralisi,
	marc.ceeeee, heiko, catalin.marinas, arnd, galak, srv_wsdupstream,
	linux-arm-kernel, linux-kernel, linux-mediatek

On Fri, 2015-07-24 at 14:59 +0200, Matthias Brugger wrote:
> On Friday, June 19, 2015 02:01:15 AM Scott Shu wrote:
> > This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.
> > 
> > This is based on v4.1-rc1 and following patch series:
> > (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> > (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> > (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
> > 
> > The secondary cores are power off as default on MT6580, this change adds
> > a new enable-method to turn on power to the cores during booting process.
> > 
> > The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> > power domain control. Please check [3] for more information about SCPSYS.
> > 
> > [1] https://lkml.org/lkml/2015/5/16/33
> > [2] https://lkml.org/lkml/2015/6/3/113
> > [3] https://lkml.org/lkml/2015/6/9/172
> > 
> > 
> > Scott Shu (6):
> >   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
> >   soc: Mediatek: Add SCPSYS CPU power domain driver
> >   ARM: mediatek: add smp bringup code
> >   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for
> > MT6580 ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
> >   ARM: dts: mt6580: enable basic SMP bringup for MT6580
> > 
> >  Documentation/devicetree/bindings/arm/cpus.txt |   1 +
> >  arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
> >  arch/arm/mach-mediatek/Makefile                |   2 +-
> >  arch/arm/mach-mediatek/generic.h               |  24 +++
> >  arch/arm/mach-mediatek/hotplug.c               | 229
> > +++++++++++++++++++++++++ arch/arm/mach-mediatek/mediatek.c              | 
> >  4 +-
> >  arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
> >  7 files changed, 395 insertions(+), 3 deletions(-)
> >  create mode 100644 arch/arm/mach-mediatek/generic.h
> >  create mode 100644 arch/arm/mach-mediatek/hotplug.c
> 
> 
> The whole series is missing a Signed-off-by tag, please add them to the next 
> version. The Signed-off-by is mandatory for any patch to get accepted.

Hi Matthias,
   Thanks for reminding me. The new version is in
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html

Thanks,
Scott Shu 



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

* Re: [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-07-24 13:10       ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-24 13:10 UTC (permalink / raw)
  To: Matthias Brugger
  Cc: yingjoe.chen, robh+dt, linux, rchintakuntla, lorenzo.pieralisi,
	marc.ceeeee, heiko, catalin.marinas, arnd, galak, srv_wsdupstream,
	linux-arm-kernel, linux-kernel, linux-mediatek

On Fri, 2015-07-24 at 14:59 +0200, Matthias Brugger wrote:
> On Friday, June 19, 2015 02:01:15 AM Scott Shu wrote:
> > This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.
> > 
> > This is based on v4.1-rc1 and following patch series:
> > (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> > (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> > (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
> > 
> > The secondary cores are power off as default on MT6580, this change adds
> > a new enable-method to turn on power to the cores during booting process.
> > 
> > The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> > power domain control. Please check [3] for more information about SCPSYS.
> > 
> > [1] https://lkml.org/lkml/2015/5/16/33
> > [2] https://lkml.org/lkml/2015/6/3/113
> > [3] https://lkml.org/lkml/2015/6/9/172
> > 
> > 
> > Scott Shu (6):
> >   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
> >   soc: Mediatek: Add SCPSYS CPU power domain driver
> >   ARM: mediatek: add smp bringup code
> >   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for
> > MT6580 ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
> >   ARM: dts: mt6580: enable basic SMP bringup for MT6580
> > 
> >  Documentation/devicetree/bindings/arm/cpus.txt |   1 +
> >  arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
> >  arch/arm/mach-mediatek/Makefile                |   2 +-
> >  arch/arm/mach-mediatek/generic.h               |  24 +++
> >  arch/arm/mach-mediatek/hotplug.c               | 229
> > +++++++++++++++++++++++++ arch/arm/mach-mediatek/mediatek.c              | 
> >  4 +-
> >  arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
> >  7 files changed, 395 insertions(+), 3 deletions(-)
> >  create mode 100644 arch/arm/mach-mediatek/generic.h
> >  create mode 100644 arch/arm/mach-mediatek/hotplug.c
> 
> 
> The whole series is missing a Signed-off-by tag, please add them to the next 
> version. The Signed-off-by is mandatory for any patch to get accepted.

Hi Matthias,
   Thanks for reminding me. The new version is in
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html

Thanks,
Scott Shu 

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

* [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580.
@ 2015-07-24 13:10       ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-24 13:10 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 2015-07-24 at 14:59 +0200, Matthias Brugger wrote:
> On Friday, June 19, 2015 02:01:15 AM Scott Shu wrote:
> > This patchset adds support SMP on MediaTek MT6580 Cortex-A7 qual core SoC.
> > 
> > This is based on v4.1-rc1 and following patch series:
> > (1) Yingjoe Chen's "Add SMP bringup support for mt65xx socs" [1]
> > (2) Mars Cheng's "Add mt6580 basic chip support" [2]
> > (3) Sascha Hauer's "Mediatek SCPSYS power domain support" [3]
> > 
> > The secondary cores are power off as default on MT6580, this change adds
> > a new enable-method to turn on power to the cores during booting process.
> > 
> > The System Power Manager (SPM) inside the SCPSYS is for the CPU MTCMOS
> > power domain control. Please check [3] for more information about SCPSYS.
> > 
> > [1] https://lkml.org/lkml/2015/5/16/33
> > [2] https://lkml.org/lkml/2015/6/3/113
> > [3] https://lkml.org/lkml/2015/6/9/172
> > 
> > 
> > Scott Shu (6):
> >   Document: bindings: DT: Add SMP enable method for MT6580 SoC platform
> >   soc: Mediatek: Add SCPSYS CPU power domain driver
> >   ARM: mediatek: add smp bringup code
> >   ARM: Mediatek: enable GPT6 on boot up to make arch timer working for
> > MT6580 ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file.
> >   ARM: dts: mt6580: enable basic SMP bringup for MT6580
> > 
> >  Documentation/devicetree/bindings/arm/cpus.txt |   1 +
> >  arch/arm/boot/dts/mt6580.dtsi                  |  25 +++
> >  arch/arm/mach-mediatek/Makefile                |   2 +-
> >  arch/arm/mach-mediatek/generic.h               |  24 +++
> >  arch/arm/mach-mediatek/hotplug.c               | 229
> > +++++++++++++++++++++++++ arch/arm/mach-mediatek/mediatek.c              | 
> >  4 +-
> >  arch/arm/mach-mediatek/platsmp.c               | 113 +++++++++++-
> >  7 files changed, 395 insertions(+), 3 deletions(-)
> >  create mode 100644 arch/arm/mach-mediatek/generic.h
> >  create mode 100644 arch/arm/mach-mediatek/hotplug.c
> 
> 
> The whole series is missing a Signed-off-by tag, please add them to the next 
> version. The Signed-off-by is mandatory for any patch to get accepted.

Hi Matthias,
   Thanks for reminding me. The new version is in
http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html

Thanks,
Scott Shu 

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-07-24  5:50           ` Sascha Hauer
  (?)
@ 2015-07-25  9:13             ` Scott Shu
  -1 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-25  9:13 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel, loda.chou, jades.shih, scott.shu

On Fri, 2015-07-24 at 07:50 +0200, Sascha Hauer wrote:
> On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> > On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > > Hi Scott,
> > > 
> > > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > > MT6580.
> > > 
> > > This seems to be support for the very same hardware as I am posting
> > > here:
> > > 
> > > https://lkml.org/lkml/2015/6/22/41
> > > 
> > > We should consolidate this.
> > > 
> > > My driver is currently handles all power domains except the CPUs while
> > > yours handles only the CPUs.
> > > I currently haven't looked whether CPUs can just be part of a power
> > > domain aswell, but if that works this would probably be the way to go.
> > > 
> > > Sascha
> > > 
> > > 
> > Hi Sascga,
> > 
> > We had posted new patch set in following link, but still keep our
> > original framework.
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html
> > 
> > As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
> > will be executed before registering the scpsys_drv driver, so the CPUs power
> > domain is controlled on arch/arm/mach-$(MACHINE) directory. 
> > 
> > Please kindly provide your comments and suggestion. Thank you very much.
> 
> I think that instead of explaining why have to duplicate the code you
> should rather search for ways how the code can be shared. Yes, we'll
> need a second (early) entry point to the driver. Maybe we even have to
> create the shared code which is then called from the driver and your
> early architecture code.
> You'll probably have to do this separation between early code and
> regular driver code in your driver anyway, since I bet the MT6580 also
> has some power domains which shall be controlled by the regular Linux
> power domain code later. Also we probably could control the CPU power
> domains for the MT8173 in the SCPSYS driver aswell, we just don't have
> to because we use PSCI there. You see we are approaching the same
> problem from two different corners. Let's find a way to share the code.
> 
> Sascha
> 
Hi Sascha,
   Thanks. OK, we move all CPU MTCMOS driver from hotplug.c to
mtk-scpsys.c and the test is passed. Next, we need spend some time to
integrate the code better.

Scott


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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-25  9:13             ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-25  9:13 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: yingjoe.chen, robh+dt, matthias.bgg, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel, loda.chou, jades.shih, scott.shu

On Fri, 2015-07-24 at 07:50 +0200, Sascha Hauer wrote:
> On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> > On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > > Hi Scott,
> > > 
> > > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > > MT6580.
> > > 
> > > This seems to be support for the very same hardware as I am posting
> > > here:
> > > 
> > > https://lkml.org/lkml/2015/6/22/41
> > > 
> > > We should consolidate this.
> > > 
> > > My driver is currently handles all power domains except the CPUs while
> > > yours handles only the CPUs.
> > > I currently haven't looked whether CPUs can just be part of a power
> > > domain aswell, but if that works this would probably be the way to go.
> > > 
> > > Sascha
> > > 
> > > 
> > Hi Sascga,
> > 
> > We had posted new patch set in following link, but still keep our
> > original framework.
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html
> > 
> > As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
> > will be executed before registering the scpsys_drv driver, so the CPUs power
> > domain is controlled on arch/arm/mach-$(MACHINE) directory. 
> > 
> > Please kindly provide your comments and suggestion. Thank you very much.
> 
> I think that instead of explaining why have to duplicate the code you
> should rather search for ways how the code can be shared. Yes, we'll
> need a second (early) entry point to the driver. Maybe we even have to
> create the shared code which is then called from the driver and your
> early architecture code.
> You'll probably have to do this separation between early code and
> regular driver code in your driver anyway, since I bet the MT6580 also
> has some power domains which shall be controlled by the regular Linux
> power domain code later. Also we probably could control the CPU power
> domains for the MT8173 in the SCPSYS driver aswell, we just don't have
> to because we use PSCI there. You see we are approaching the same
> problem from two different corners. Let's find a way to share the code.
> 
> Sascha
> 
Hi Sascha,
   Thanks. OK, we move all CPU MTCMOS driver from hotplug.c to
mtk-scpsys.c and the test is passed. Next, we need spend some time to
integrate the code better.

Scott

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-25  9:13             ` Scott Shu
  0 siblings, 0 replies; 75+ messages in thread
From: Scott Shu @ 2015-07-25  9:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, 2015-07-24 at 07:50 +0200, Sascha Hauer wrote:
> On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> > On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > > Hi Scott,
> > > 
> > > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > > MT6580.
> > > 
> > > This seems to be support for the very same hardware as I am posting
> > > here:
> > > 
> > > https://lkml.org/lkml/2015/6/22/41
> > > 
> > > We should consolidate this.
> > > 
> > > My driver is currently handles all power domains except the CPUs while
> > > yours handles only the CPUs.
> > > I currently haven't looked whether CPUs can just be part of a power
> > > domain aswell, but if that works this would probably be the way to go.
> > > 
> > > Sascha
> > > 
> > > 
> > Hi Sascga,
> > 
> > We had posted new patch set in following link, but still keep our
> > original framework.
> > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.html
> > 
> > As we mentioned in the new email thread, the SMP operations (smp_boot_secondary)
> > will be executed before registering the scpsys_drv driver, so the CPUs power
> > domain is controlled on arch/arm/mach-$(MACHINE) directory. 
> > 
> > Please kindly provide your comments and suggestion. Thank you very much.
> 
> I think that instead of explaining why have to duplicate the code you
> should rather search for ways how the code can be shared. Yes, we'll
> need a second (early) entry point to the driver. Maybe we even have to
> create the shared code which is then called from the driver and your
> early architecture code.
> You'll probably have to do this separation between early code and
> regular driver code in your driver anyway, since I bet the MT6580 also
> has some power domains which shall be controlled by the regular Linux
> power domain code later. Also we probably could control the CPU power
> domains for the MT8173 in the SCPSYS driver aswell, we just don't have
> to because we use PSCI there. You see we are approaching the same
> problem from two different corners. Let's find a way to share the code.
> 
> Sascha
> 
Hi Sascha,
   Thanks. OK, we move all CPU MTCMOS driver from hotplug.c to
mtk-scpsys.c and the test is passed. Next, we need spend some time to
integrate the code better.

Scott

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

* Re: [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
  2015-07-25  9:13             ` Scott Shu
@ 2015-07-27 10:22               ` Matthias Brugger
  -1 siblings, 0 replies; 75+ messages in thread
From: Matthias Brugger @ 2015-07-27 10:22 UTC (permalink / raw)
  To: Scott Shu
  Cc: Sascha Hauer, yingjoe.chen, robh+dt, linux, rchintakuntla,
	lorenzo.pieralisi, marc.ceeeee, heiko, catalin.marinas, arnd,
	galak, srv_wsdupstream, linux-mediatek, linux-kernel,
	linux-arm-kernel, loda.chou, jades.shih, scott.shu

On Saturday, July 25, 2015 05:13:00 PM Scott Shu wrote:
> On Fri, 2015-07-24 at 07:50 +0200, Sascha Hauer wrote:
> > On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> > > On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > > > Hi Scott,
> > > > 
> > > > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > > > MT6580.
> > > > 
> > > > This seems to be support for the very same hardware as I am posting
> > > > here:
> > > > 
> > > > https://lkml.org/lkml/2015/6/22/41
> > > > 
> > > > We should consolidate this.
> > > > 
> > > > My driver is currently handles all power domains except the CPUs while
> > > > yours handles only the CPUs.
> > > > I currently haven't looked whether CPUs can just be part of a power
> > > > domain aswell, but if that works this would probably be the way to go.
> > > > 
> > > > Sascha
> > > 
> > > Hi Sascga,
> > > 
> > > We had posted new patch set in following link, but still keep our
> > > original framework.
> > > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.htm
> > > l
> > > 
> > > As we mentioned in the new email thread, the SMP operations
> > > (smp_boot_secondary) will be executed before registering the scpsys_drv
> > > driver, so the CPUs power domain is controlled on
> > > arch/arm/mach-$(MACHINE) directory.
> > > 
> > > Please kindly provide your comments and suggestion. Thank you very much.
> > 
> > I think that instead of explaining why have to duplicate the code you
> > should rather search for ways how the code can be shared. Yes, we'll
> > need a second (early) entry point to the driver. Maybe we even have to
> > create the shared code which is then called from the driver and your
> > early architecture code.
> > You'll probably have to do this separation between early code and
> > regular driver code in your driver anyway, since I bet the MT6580 also
> > has some power domains which shall be controlled by the regular Linux
> > power domain code later. Also we probably could control the CPU power
> > domains for the MT8173 in the SCPSYS driver aswell, we just don't have
> > to because we use PSCI there. You see we are approaching the same
> > problem from two different corners. Let's find a way to share the code.
> > 
> > Sascha
> 
> Hi Sascha,
>    Thanks. OK, we move all CPU MTCMOS driver from hotplug.c to
> mtk-scpsys.c and the test is passed. Next, we need spend some time to
> integrate the code better.
> 

Good to hear that. We should try to keep mach-mediatek code a little as 
possible.

Cheers,
Matthias

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

* [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver
@ 2015-07-27 10:22               ` Matthias Brugger
  0 siblings, 0 replies; 75+ messages in thread
From: Matthias Brugger @ 2015-07-27 10:22 UTC (permalink / raw)
  To: linux-arm-kernel

On Saturday, July 25, 2015 05:13:00 PM Scott Shu wrote:
> On Fri, 2015-07-24 at 07:50 +0200, Sascha Hauer wrote:
> > On Fri, Jul 24, 2015 at 10:02:03AM +0800, Scott Shu wrote:
> > > On Tue, 2015-06-23 at 07:53 +0200, Sascha Hauer wrote:
> > > > Hi Scott,
> > > > 
> > > > On Fri, Jun 19, 2015 at 02:01:17AM +0800, Scott Shu wrote:
> > > > > This adds a CPU power domain driver for the Mediatek SCPSYS unit on
> > > > > MT6580.
> > > > 
> > > > This seems to be support for the very same hardware as I am posting
> > > > here:
> > > > 
> > > > https://lkml.org/lkml/2015/6/22/41
> > > > 
> > > > We should consolidate this.
> > > > 
> > > > My driver is currently handles all power domains except the CPUs while
> > > > yours handles only the CPUs.
> > > > I currently haven't looked whether CPUs can just be part of a power
> > > > domain aswell, but if that works this would probably be the way to go.
> > > > 
> > > > Sascha
> > > 
> > > Hi Sascga,
> > > 
> > > We had posted new patch set in following link, but still keep our
> > > original framework.
> > > http://lists.infradead.org/pipermail/linux-mediatek/2015-July/001498.htm
> > > l
> > > 
> > > As we mentioned in the new email thread, the SMP operations
> > > (smp_boot_secondary) will be executed before registering the scpsys_drv
> > > driver, so the CPUs power domain is controlled on
> > > arch/arm/mach-$(MACHINE) directory.
> > > 
> > > Please kindly provide your comments and suggestion. Thank you very much.
> > 
> > I think that instead of explaining why have to duplicate the code you
> > should rather search for ways how the code can be shared. Yes, we'll
> > need a second (early) entry point to the driver. Maybe we even have to
> > create the shared code which is then called from the driver and your
> > early architecture code.
> > You'll probably have to do this separation between early code and
> > regular driver code in your driver anyway, since I bet the MT6580 also
> > has some power domains which shall be controlled by the regular Linux
> > power domain code later. Also we probably could control the CPU power
> > domains for the MT8173 in the SCPSYS driver aswell, we just don't have
> > to because we use PSCI there. You see we are approaching the same
> > problem from two different corners. Let's find a way to share the code.
> > 
> > Sascha
> 
> Hi Sascha,
>    Thanks. OK, we move all CPU MTCMOS driver from hotplug.c to
> mtk-scpsys.c and the test is passed. Next, we need spend some time to
> integrate the code better.
> 

Good to hear that. We should try to keep mach-mediatek code a little as 
possible.

Cheers,
Matthias

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

end of thread, other threads:[~2015-07-27 10:22 UTC | newest]

Thread overview: 75+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <Scott Shu <srv_scott.shu@mediatek.com>
     [not found] ` <Scott Shu <srv_scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-06-18  2:46   ` [PATCH 0/6] This series adds SMP support for the MediaTek MT6580 Scott Shu
     [not found]     ` <1434595587-25466-1-git-send-email-scott.shu-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org>
2015-06-18  2:46       ` [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform Scott Shu
2015-06-18  2:46       ` [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver Scott Shu
2015-06-18  2:46       ` [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580 Scott Shu
2015-06-18  2:46       ` [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working " Scott Shu
2015-06-18  2:46       ` [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file Scott Shu
2015-06-18  2:46       ` [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580 Scott Shu
2015-06-18 16:12       ` [PATCH 0/6] This series adds SMP support for the MediaTek MT6580 Matthias Brugger
     [not found]         ` <CABuKBeK-WLFnrOnPYmGR1cTfecHhq+_QyAqQjJpYfuA_MNW1aw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-06-24  5:56           ` Scott Shu (舒祖襄)
2015-06-18  3:35 ` Scott Shu
2015-06-18  3:35   ` Scott Shu
2015-06-18  3:35   ` [PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform Scott Shu
2015-06-18  3:35     ` Scott Shu
2015-06-18  3:35   ` [PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver Scott Shu
2015-06-18  3:35     ` Scott Shu
2015-06-18  3:35   ` [PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580 Scott Shu
2015-06-18  3:35     ` Scott Shu
2015-06-18  3:35   ` [PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working " Scott Shu
2015-06-18  3:35     ` Scott Shu
2015-06-18  3:35   ` [PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file Scott Shu
2015-06-18  3:35     ` Scott Shu
2015-06-18  3:35   ` [PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580 Scott Shu
2015-06-18  3:35     ` Scott Shu
2015-06-18 18:01 ` [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580 Scott Shu
2015-06-18 18:01   ` Scott Shu
2015-06-18 18:01   ` Scott Shu
2015-06-18 18:01   ` [RESEND PATCH 1/6] Document: bindings: DT: Add SMP enable method for MT6580 SoC platform Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-29  3:03     ` Yingjoe Chen
2015-06-29  3:03       ` Yingjoe Chen
2015-06-29  3:03       ` Yingjoe Chen
2015-07-11 10:38       ` Yingjoe Chen
2015-07-11 10:38         ` Yingjoe Chen
2015-07-11 10:38         ` Yingjoe Chen
2015-07-17 22:04         ` Matthias Brugger
2015-07-17 22:04           ` Matthias Brugger
2015-06-18 18:01   ` [RESEND PATCH 2/6] soc: Mediatek: Add SCPSYS CPU power domain driver Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-23  5:53     ` Sascha Hauer
2015-06-23  5:53       ` Sascha Hauer
2015-06-23  5:53       ` Sascha Hauer
2015-07-03  5:58       ` Scott Shu
2015-07-03  5:58         ` Scott Shu
2015-07-03  5:58         ` Scott Shu
2015-07-24  2:02       ` Scott Shu
2015-07-24  2:02         ` Scott Shu
2015-07-24  2:02         ` Scott Shu
2015-07-24  5:50         ` Sascha Hauer
2015-07-24  5:50           ` Sascha Hauer
2015-07-25  9:13           ` Scott Shu
2015-07-25  9:13             ` Scott Shu
2015-07-25  9:13             ` Scott Shu
2015-07-27 10:22             ` Matthias Brugger
2015-07-27 10:22               ` Matthias Brugger
2015-06-18 18:01   ` [RESEND PATCH 3/6] ARM: mediatek: add smp bringup code for MT6580 Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01   ` [RESEND PATCH 4/6] ARM: Mediatek: enable GPT6 on boot up to make arch timer working " Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01   ` [RESEND PATCH 5/6] ARM: dts: mt6580: Add device nodes to the MT6580 dtsi file Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01   ` [RESEND PATCH 6/6] ARM: dts: mt6580: enable basic SMP bringup for mt6580 Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:01     ` Scott Shu
2015-06-18 18:23   ` [RESEND PATCH 0/6] This series adds SMP support for the MediaTek MT6580 Alexey Klimov
2015-06-18 18:23     ` Alexey Klimov
2015-07-24 12:59   ` Matthias Brugger
2015-07-24 12:59     ` Matthias Brugger
2015-07-24 13:10     ` Scott Shu
2015-07-24 13:10       ` Scott Shu
2015-07-24 13:10       ` Scott Shu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.