All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lubomir Rintel <lkundrak@v3.sk>
To: Olof Johansson <olof@lixom.net>
Cc: Rob Herring <robh+dt@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>,
	Marc Zyngier <maz@kernel.org>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Russell King <linux@armlinux.org.uk>,
	Michael Turquette <mturquette@baylibre.com>,
	Stephen Boyd <sboyd@kernel.org>,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	Andres Salomon <dilinger@queued.net>,
	Lubomir Rintel <lkundrak@v3.sk>
Subject: [PATCH v2 08/20] irqchip/mmp: mask off interrupts from other cores
Date: Thu, 22 Aug 2019 11:26:31 +0200	[thread overview]
Message-ID: <20190822092643.593488-9-lkundrak@v3.sk> (raw)
In-Reply-To: <20190822092643.593488-1-lkundrak@v3.sk>

From: Andres Salomon <dilinger@queued.net>

On mmp3, there's an extra set of ICU registers (ICU2) that handle
interrupts on the extra cores.  When masking off interrupts on MP1,
these should be masked as well.

We add a new interrupt controller via device tree to identify when we're
looking at an mmp3 machine via compatible field of "marvell,mmp3-intc".

[lkundrak@v3.sk: Changed "mrvl,mmp3-intc" compatible strings to
"marvell,mmp3-intc". Tidied up the subject line a bit.]

Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

--
Changes since v1:
- Moved mmp3-specific mmp_icu2_base initialization from mmp_init_bases() to
  mmp3_of_init() so that we don't have to check for marvell,mmp3-intc
  compatibility twice.
- Drop an superfluous call to irq_set_default_host()

 arch/arm/mach-mmp/regs-icu.h |  3 +++
 drivers/irqchip/irq-mmp.c    | 48 ++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/arch/arm/mach-mmp/regs-icu.h b/arch/arm/mach-mmp/regs-icu.h
index 0375d5a7fcb2b..410743d2b4020 100644
--- a/arch/arm/mach-mmp/regs-icu.h
+++ b/arch/arm/mach-mmp/regs-icu.h
@@ -11,6 +11,9 @@
 #define ICU_VIRT_BASE	(AXI_VIRT_BASE + 0x82000)
 #define ICU_REG(x)	(ICU_VIRT_BASE + (x))
 
+#define ICU2_VIRT_BASE	(AXI_VIRT_BASE + 0x84000)
+#define ICU2_REG(x)	(ICU2_VIRT_BASE + (x))
+
 #define ICU_INT_CONF(n)		ICU_REG((n) << 2)
 #define ICU_INT_CONF_MASK	(0xf)
 
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c
index 126ffdbffdddf..25848d73f6792 100644
--- a/drivers/irqchip/irq-mmp.c
+++ b/drivers/irqchip/irq-mmp.c
@@ -44,6 +44,7 @@ struct icu_chip_data {
 	unsigned int		conf_enable;
 	unsigned int		conf_disable;
 	unsigned int		conf_mask;
+	unsigned int		conf2_mask;
 	unsigned int		clr_mfp_irq_base;
 	unsigned int		clr_mfp_hwirq;
 	struct irq_domain	*domain;
@@ -53,9 +54,11 @@ struct mmp_intc_conf {
 	unsigned int	conf_enable;
 	unsigned int	conf_disable;
 	unsigned int	conf_mask;
+	unsigned int	conf2_mask;
 };
 
 static void __iomem *mmp_icu_base;
+static void __iomem *mmp_icu2_base;
 static struct icu_chip_data icu_data[MAX_ICU_NR];
 static int max_icu_nr;
 
@@ -98,6 +101,16 @@ static void icu_mask_irq(struct irq_data *d)
 		r &= ~data->conf_mask;
 		r |= data->conf_disable;
 		writel_relaxed(r, mmp_icu_base + (hwirq << 2));
+
+		if (data->conf2_mask) {
+			/*
+			 * ICU1 (above) only controls PJ4 MP1; if using SMP,
+			 * we need to also mask the MP2 and MM cores via ICU2.
+			 */
+			r = readl_relaxed(mmp_icu2_base + (hwirq << 2));
+			r &= ~data->conf2_mask;
+			writel_relaxed(r, mmp_icu2_base + (hwirq << 2));
+		}
 	} else {
 		r = readl_relaxed(data->reg_mask) | (1 << hwirq);
 		writel_relaxed(r, data->reg_mask);
@@ -201,6 +214,14 @@ static const struct mmp_intc_conf mmp2_conf = {
 			  MMP2_ICU_INT_ROUTE_PJ4_FIQ,
 };
 
+static struct mmp_intc_conf mmp3_conf = {
+	.conf_enable	= 0x20,
+	.conf_disable	= 0x0,
+	.conf_mask	= MMP2_ICU_INT_ROUTE_PJ4_IRQ |
+			  MMP2_ICU_INT_ROUTE_PJ4_FIQ,
+	.conf2_mask	= 0xf0,
+};
+
 static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs)
 {
 	int hwirq;
@@ -428,6 +449,33 @@ static int __init mmp2_of_init(struct device_node *node,
 }
 IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init);
 
+static int __init mmp3_of_init(struct device_node *node,
+			       struct device_node *parent)
+{
+	int ret;
+
+	mmp_icu2_base = of_iomap(node, 1);
+	if (!mmp_icu2_base) {
+		pr_err("Failed to get interrupt controller register #2\n");
+		return -ENODEV;
+	}
+
+	ret = mmp_init_bases(node);
+	if (ret < 0) {
+		iounmap(mmp_icu2_base);
+		return ret;
+	}
+
+	icu_data[0].conf_enable = mmp3_conf.conf_enable;
+	icu_data[0].conf_disable = mmp3_conf.conf_disable;
+	icu_data[0].conf_mask = mmp3_conf.conf_mask;
+	icu_data[0].conf2_mask = mmp3_conf.conf2_mask;
+	set_handle_irq(mmp2_handle_irq);
+	max_icu_nr = 1;
+	return 0;
+}
+IRQCHIP_DECLARE(mmp3_intc, "marvell,mmp3-intc", mmp3_of_init);
+
 static int __init mmp2_mux_of_init(struct device_node *node,
 				   struct device_node *parent)
 {
-- 
2.21.0


WARNING: multiple messages have this Message-ID (diff)
From: Lubomir Rintel <lkundrak@v3.sk>
To: Olof Johansson <olof@lixom.net>
Cc: Mark Rutland <mark.rutland@arm.com>,
	devicetree@vger.kernel.org, Jason Cooper <jason@lakedaemon.net>,
	Stephen Boyd <sboyd@kernel.org>, Marc Zyngier <maz@kernel.org>,
	Michael Turquette <mturquette@baylibre.com>,
	Russell King <linux@armlinux.org.uk>,
	Kishon Vijay Abraham I <kishon@ti.com>,
	Lubomir Rintel <lkundrak@v3.sk>, Rob Herring <robh+dt@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	Andres Salomon <dilinger@queued.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 08/20] irqchip/mmp: mask off interrupts from other cores
Date: Thu, 22 Aug 2019 11:26:31 +0200	[thread overview]
Message-ID: <20190822092643.593488-9-lkundrak@v3.sk> (raw)
In-Reply-To: <20190822092643.593488-1-lkundrak@v3.sk>

From: Andres Salomon <dilinger@queued.net>

On mmp3, there's an extra set of ICU registers (ICU2) that handle
interrupts on the extra cores.  When masking off interrupts on MP1,
these should be masked as well.

We add a new interrupt controller via device tree to identify when we're
looking at an mmp3 machine via compatible field of "marvell,mmp3-intc".

[lkundrak@v3.sk: Changed "mrvl,mmp3-intc" compatible strings to
"marvell,mmp3-intc". Tidied up the subject line a bit.]

Signed-off-by: Andres Salomon <dilinger@queued.net>
Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

--
Changes since v1:
- Moved mmp3-specific mmp_icu2_base initialization from mmp_init_bases() to
  mmp3_of_init() so that we don't have to check for marvell,mmp3-intc
  compatibility twice.
- Drop an superfluous call to irq_set_default_host()

 arch/arm/mach-mmp/regs-icu.h |  3 +++
 drivers/irqchip/irq-mmp.c    | 48 ++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+)

diff --git a/arch/arm/mach-mmp/regs-icu.h b/arch/arm/mach-mmp/regs-icu.h
index 0375d5a7fcb2b..410743d2b4020 100644
--- a/arch/arm/mach-mmp/regs-icu.h
+++ b/arch/arm/mach-mmp/regs-icu.h
@@ -11,6 +11,9 @@
 #define ICU_VIRT_BASE	(AXI_VIRT_BASE + 0x82000)
 #define ICU_REG(x)	(ICU_VIRT_BASE + (x))
 
+#define ICU2_VIRT_BASE	(AXI_VIRT_BASE + 0x84000)
+#define ICU2_REG(x)	(ICU2_VIRT_BASE + (x))
+
 #define ICU_INT_CONF(n)		ICU_REG((n) << 2)
 #define ICU_INT_CONF_MASK	(0xf)
 
diff --git a/drivers/irqchip/irq-mmp.c b/drivers/irqchip/irq-mmp.c
index 126ffdbffdddf..25848d73f6792 100644
--- a/drivers/irqchip/irq-mmp.c
+++ b/drivers/irqchip/irq-mmp.c
@@ -44,6 +44,7 @@ struct icu_chip_data {
 	unsigned int		conf_enable;
 	unsigned int		conf_disable;
 	unsigned int		conf_mask;
+	unsigned int		conf2_mask;
 	unsigned int		clr_mfp_irq_base;
 	unsigned int		clr_mfp_hwirq;
 	struct irq_domain	*domain;
@@ -53,9 +54,11 @@ struct mmp_intc_conf {
 	unsigned int	conf_enable;
 	unsigned int	conf_disable;
 	unsigned int	conf_mask;
+	unsigned int	conf2_mask;
 };
 
 static void __iomem *mmp_icu_base;
+static void __iomem *mmp_icu2_base;
 static struct icu_chip_data icu_data[MAX_ICU_NR];
 static int max_icu_nr;
 
@@ -98,6 +101,16 @@ static void icu_mask_irq(struct irq_data *d)
 		r &= ~data->conf_mask;
 		r |= data->conf_disable;
 		writel_relaxed(r, mmp_icu_base + (hwirq << 2));
+
+		if (data->conf2_mask) {
+			/*
+			 * ICU1 (above) only controls PJ4 MP1; if using SMP,
+			 * we need to also mask the MP2 and MM cores via ICU2.
+			 */
+			r = readl_relaxed(mmp_icu2_base + (hwirq << 2));
+			r &= ~data->conf2_mask;
+			writel_relaxed(r, mmp_icu2_base + (hwirq << 2));
+		}
 	} else {
 		r = readl_relaxed(data->reg_mask) | (1 << hwirq);
 		writel_relaxed(r, data->reg_mask);
@@ -201,6 +214,14 @@ static const struct mmp_intc_conf mmp2_conf = {
 			  MMP2_ICU_INT_ROUTE_PJ4_FIQ,
 };
 
+static struct mmp_intc_conf mmp3_conf = {
+	.conf_enable	= 0x20,
+	.conf_disable	= 0x0,
+	.conf_mask	= MMP2_ICU_INT_ROUTE_PJ4_IRQ |
+			  MMP2_ICU_INT_ROUTE_PJ4_FIQ,
+	.conf2_mask	= 0xf0,
+};
+
 static void __exception_irq_entry mmp_handle_irq(struct pt_regs *regs)
 {
 	int hwirq;
@@ -428,6 +449,33 @@ static int __init mmp2_of_init(struct device_node *node,
 }
 IRQCHIP_DECLARE(mmp2_intc, "mrvl,mmp2-intc", mmp2_of_init);
 
+static int __init mmp3_of_init(struct device_node *node,
+			       struct device_node *parent)
+{
+	int ret;
+
+	mmp_icu2_base = of_iomap(node, 1);
+	if (!mmp_icu2_base) {
+		pr_err("Failed to get interrupt controller register #2\n");
+		return -ENODEV;
+	}
+
+	ret = mmp_init_bases(node);
+	if (ret < 0) {
+		iounmap(mmp_icu2_base);
+		return ret;
+	}
+
+	icu_data[0].conf_enable = mmp3_conf.conf_enable;
+	icu_data[0].conf_disable = mmp3_conf.conf_disable;
+	icu_data[0].conf_mask = mmp3_conf.conf_mask;
+	icu_data[0].conf2_mask = mmp3_conf.conf2_mask;
+	set_handle_irq(mmp2_handle_irq);
+	max_icu_nr = 1;
+	return 0;
+}
+IRQCHIP_DECLARE(mmp3_intc, "marvell,mmp3-intc", mmp3_of_init);
+
 static int __init mmp2_mux_of_init(struct device_node *node,
 				   struct device_node *parent)
 {
-- 
2.21.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2019-08-22  9:34 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  9:26 [PATCH v2 00/20] Initial support for Marvell MMP3 SoC Lubomir Rintel
2019-08-22  9:26 ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 01/20] dt-bindings: arm: cpu: Add Marvell MMP3 SMP enable method Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 02/20] dt-bindings: arm: Convert Marvell MMP board/soc bindings to json-schema Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-27 11:59   ` Rob Herring
2019-08-27 11:59     ` Rob Herring
2019-08-27 11:59     ` Rob Herring
2019-08-27 13:23     ` Lubomir Rintel
2019-08-27 13:23       ` Lubomir Rintel
2019-08-27 13:23       ` Lubomir Rintel
2019-08-27 13:36       ` Rob Herring
2019-08-27 13:36         ` Rob Herring
2019-08-27 13:36         ` Rob Herring
2019-08-22  9:26 ` [PATCH v2 03/20] dt-bindings: arm: mrvl: Document MMP3 compatible string Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-27 12:00   ` Rob Herring
2019-08-27 12:00     ` Rob Herring
2019-08-27 12:00     ` Rob Herring
2019-08-22  9:26 ` [PATCH v2 04/20] dt-bindings: mrvl,intc: Add a MMP3 interrupt controller Lubomir Rintel
2019-08-22  9:26   ` [PATCH v2 04/20] dt-bindings: mrvl, intc: " Lubomir Rintel
2019-08-27 22:23   ` [PATCH v2 04/20] dt-bindings: mrvl,intc: " Rob Herring
2019-08-27 22:23     ` Rob Herring
2019-08-27 22:23     ` Rob Herring
2019-08-22  9:26 ` [PATCH v2 05/20] dt-bindings: phy-mmp3-usb: Add bindings Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-27 22:24   ` Rob Herring
2019-08-27 22:24     ` Rob Herring
2019-08-27 22:24     ` Rob Herring
2019-08-22  9:26 ` [PATCH v2 06/20] irqchip/mmp: do not use of_address_to_resource() to get mux regs Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-09-06 11:08   ` [tip: irq/core] irqchip/mmp: Do " tip-bot2 for Lubomir Rintel
2020-03-09 16:25   ` [PATCH v2 06/20] irqchip/mmp: do " Rob Herring
2020-03-09 16:25     ` Rob Herring
2020-03-09 16:28     ` Rob Herring
2020-03-09 16:28       ` Rob Herring
2019-08-22  9:26 ` [PATCH v2 07/20] irqchip/mmp: add missing chained_irq_{enter,exit}() Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-09-06 11:08   ` [tip: irq/core] irqchip/mmp: Add " tip-bot2 for Lubomir Rintel
2019-08-22  9:26 ` Lubomir Rintel [this message]
2019-08-22  9:26   ` [PATCH v2 08/20] irqchip/mmp: mask off interrupts from other cores Lubomir Rintel
2019-09-06 11:08   ` [tip: irq/core] irqchip/mmp: Mask " tip-bot2 for Andres Salomon
2019-08-22  9:26 ` [PATCH v2 09/20] irqchip/mmp: coexist with GIC root IRQ controller Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-09-06 11:08   ` [tip: irq/core] irqchip/mmp: Coexist " tip-bot2 for Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 10/20] ARM: l2c: add definition for FWA in PL310 aux register Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 11/20] ARM: mmp: don't select CACHE_TAUROS2 on all ARCH_MMP Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 12/20] ARM: mmp: map the PGU as well Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 13/20] ARM: mmp: DT: convert timer driver to use TIMER_OF_DECLARE Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 14/20] ARM: mmp: define MMP_CHIPID by the means of CIU_REG() Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 15/20] ARM: mmp: add support for MMP3 SoC Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 16/20] ARM: mmp: add SMP support Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22 16:36   ` Florian Fainelli
2019-08-22 16:36     ` Florian Fainelli
2019-08-23  7:13     ` Lubomir Rintel
2019-08-23  7:13       ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 17/20] ARM: mmp: move cputype.h to include/linux/soc/ Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 18/20] ARM: mmp: remove MMP3 USB PHY registers from regs-usb.h Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 19/20] phy: phy-mmp3-usb: add a new driver Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22  9:26 ` [PATCH v2 20/20] ARM: dts: mmp3: Add MMP3 SoC dts file Lubomir Rintel
2019-08-22  9:26   ` Lubomir Rintel
2019-08-22 10:31 ` [PATCH v2 00/20] Initial support for Marvell MMP3 SoC Marc Zyngier
2019-08-22 10:31   ` Marc Zyngier
2019-08-22 16:23   ` Olof Johansson
2019-08-22 16:23     ` Olof Johansson
2019-08-23  7:21   ` Lubomir Rintel
2019-08-23  7:21     ` Lubomir Rintel
2019-08-23  9:42     ` Marc Zyngier
2019-08-23  9:42       ` Marc Zyngier
2019-08-26 11:59       ` Lubomir Rintel
2019-08-26 11:59         ` Lubomir Rintel
2019-08-30 14:26         ` Marc Zyngier
2019-08-30 14:26           ` Marc Zyngier
2019-08-30 14:26           ` Marc Zyngier

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20190822092643.593488-9-lkundrak@v3.sk \
    --to=lkundrak@v3.sk \
    --cc=devicetree@vger.kernel.org \
    --cc=dilinger@queued.net \
    --cc=jason@lakedaemon.net \
    --cc=kishon@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=olof@lixom.net \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

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

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is 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.