* [PATCH v3 1/5] irqchip/irq-bcm7038-l1: Add PM support
2019-10-24 20:14 [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Florian Fainelli
@ 2019-10-24 20:14 ` Florian Fainelli
2019-11-20 13:21 ` [tip: irq/core] " tip-bot2 for Justin Chen
2019-10-24 20:14 ` [PATCH v3 2/5] dt-bindings: Document brcm,irq-can-wake for brcm,bcm7038-l1-intc.txt Florian Fainelli
` (4 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2019-10-24 20:14 UTC (permalink / raw)
To: linux-kernel
Cc: Justin Chen, Florian Fainelli, Thomas Gleixner, Jason Cooper,
Marc Zyngier, Rob Herring, Mark Rutland,
maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
From: Justin Chen <justinpopo6@gmail.com>
The current L1 controller does not mask any interrupts when dropping
into suspend. This mean we can receive unexpected wake up sources.
Modified the BCM7038 L1 controller to mask the all non-wake interrupts
before dropping into suspend.
Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 89 ++++++++++++++++++++++++++++++++
1 file changed, 89 insertions(+)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index fc75c61233aa..689e487be80c 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -27,6 +27,7 @@
#include <linux/types.h>
#include <linux/irqchip.h>
#include <linux/irqchip/chained_irq.h>
+#include <linux/syscore_ops.h>
#define IRQS_PER_WORD 32
#define REG_BYTES_PER_IRQ_WORD (sizeof(u32) * 4)
@@ -39,6 +40,10 @@ struct bcm7038_l1_chip {
unsigned int n_words;
struct irq_domain *domain;
struct bcm7038_l1_cpu *cpus[NR_CPUS];
+#ifdef CONFIG_PM_SLEEP
+ struct list_head list;
+ u32 wake_mask[MAX_WORDS];
+#endif
u8 affinity[MAX_WORDS * IRQS_PER_WORD];
};
@@ -287,6 +292,77 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+/*
+ * We keep a list of bcm7038_l1_chip used for suspend/resume. This hack is
+ * used because the struct chip_type suspend/resume hooks are not called
+ * unless chip_type is hooked onto a generic_chip. Since this driver does
+ * not use generic_chip, we need to manually hook our resume/suspend to
+ * syscore_ops.
+ */
+static LIST_HEAD(bcm7038_l1_intcs_list);
+static DEFINE_RAW_SPINLOCK(bcm7038_l1_intcs_lock);
+
+static int bcm7038_l1_suspend(void)
+{
+ struct bcm7038_l1_chip *intc;
+ int boot_cpu, word;
+
+ /* Wakeup interrupt should only come from the boot cpu */
+ boot_cpu = cpu_logical_map(0);
+
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
+ for (word = 0; word < intc->n_words; word++) {
+ l1_writel(~intc->wake_mask[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_set(intc, word));
+ l1_writel(intc->wake_mask[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_clr(intc, word));
+ }
+ }
+
+ return 0;
+}
+
+static void bcm7038_l1_resume(void)
+{
+ struct bcm7038_l1_chip *intc;
+ int boot_cpu, word;
+
+ boot_cpu = cpu_logical_map(0);
+
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
+ for (word = 0; word < intc->n_words; word++) {
+ l1_writel(intc->cpus[boot_cpu]->mask_cache[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_set(intc, word));
+ l1_writel(~intc->cpus[boot_cpu]->mask_cache[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_clr(intc, word));
+ }
+ }
+}
+
+static struct syscore_ops bcm7038_l1_syscore_ops = {
+ .suspend = bcm7038_l1_suspend,
+ .resume = bcm7038_l1_resume,
+};
+
+static int bcm7038_l1_set_wake(struct irq_data *d, unsigned int on)
+{
+ struct bcm7038_l1_chip *intc = irq_data_get_irq_chip_data(d);
+ unsigned long flags;
+ u32 word = d->hwirq / IRQS_PER_WORD;
+ u32 mask = BIT(d->hwirq % IRQS_PER_WORD);
+
+ raw_spin_lock_irqsave(&intc->lock, flags);
+ if (on)
+ intc->wake_mask[word] |= mask;
+ else
+ intc->wake_mask[word] &= ~mask;
+ raw_spin_unlock_irqrestore(&intc->lock, flags);
+
+ return 0;
+}
+#endif
+
static struct irq_chip bcm7038_l1_irq_chip = {
.name = "bcm7038-l1",
.irq_mask = bcm7038_l1_mask,
@@ -295,6 +371,9 @@ static struct irq_chip bcm7038_l1_irq_chip = {
#ifdef CONFIG_SMP
.irq_cpu_offline = bcm7038_l1_cpu_offline,
#endif
+#ifdef CONFIG_PM_SLEEP
+ .irq_set_wake = bcm7038_l1_set_wake,
+#endif
};
static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
@@ -340,6 +419,16 @@ int __init bcm7038_l1_of_init(struct device_node *dn,
goto out_unmap;
}
+#ifdef CONFIG_PM_SLEEP
+ /* Add bcm7038_l1_chip into a list */
+ raw_spin_lock(&bcm7038_l1_intcs_lock);
+ list_add_tail(&intc->list, &bcm7038_l1_intcs_list);
+ raw_spin_unlock(&bcm7038_l1_intcs_lock);
+
+ if (list_is_singular(&bcm7038_l1_intcs_list))
+ register_syscore_ops(&bcm7038_l1_syscore_ops);
+#endif
+
pr_info("registered BCM7038 L1 intc (%pOF, IRQs: %d)\n",
dn, IRQS_PER_WORD * intc->n_words);
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [tip: irq/core] irqchip/irq-bcm7038-l1: Add PM support
2019-10-24 20:14 ` [PATCH v3 1/5] irqchip/irq-bcm7038-l1: Add PM support Florian Fainelli
@ 2019-11-20 13:21 ` tip-bot2 for Justin Chen
0 siblings, 0 replies; 12+ messages in thread
From: tip-bot2 for Justin Chen @ 2019-11-20 13:21 UTC (permalink / raw)
To: linux-tip-commits
Cc: Justin Chen, Florian Fainelli, Marc Zyngier, Ingo Molnar,
Borislav Petkov, linux-kernel
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 6468fc18b00685c82408f40e9569c0d3527862b8
Gitweb: https://git.kernel.org/tip/6468fc18b00685c82408f40e9569c0d3527862b8
Author: Justin Chen <justinpopo6@gmail.com>
AuthorDate: Thu, 24 Oct 2019 13:14:11 -07:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 10 Nov 2019 18:47:46
irqchip/irq-bcm7038-l1: Add PM support
The current L1 controller does not mask any interrupts when dropping
into suspend. This mean we can receive unexpected wake up sources.
Modified the BCM7038 L1 controller to mask the all non-wake interrupts
before dropping into suspend.
Signed-off-by: Justin Chen <justinpopo6@gmail.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20191024201415.23454-2-f.fainelli@gmail.com
---
drivers/irqchip/irq-bcm7038-l1.c | 89 +++++++++++++++++++++++++++++++-
1 file changed, 89 insertions(+)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index fc75c61..689e487 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -27,6 +27,7 @@
#include <linux/types.h>
#include <linux/irqchip.h>
#include <linux/irqchip/chained_irq.h>
+#include <linux/syscore_ops.h>
#define IRQS_PER_WORD 32
#define REG_BYTES_PER_IRQ_WORD (sizeof(u32) * 4)
@@ -39,6 +40,10 @@ struct bcm7038_l1_chip {
unsigned int n_words;
struct irq_domain *domain;
struct bcm7038_l1_cpu *cpus[NR_CPUS];
+#ifdef CONFIG_PM_SLEEP
+ struct list_head list;
+ u32 wake_mask[MAX_WORDS];
+#endif
u8 affinity[MAX_WORDS * IRQS_PER_WORD];
};
@@ -287,6 +292,77 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
return 0;
}
+#ifdef CONFIG_PM_SLEEP
+/*
+ * We keep a list of bcm7038_l1_chip used for suspend/resume. This hack is
+ * used because the struct chip_type suspend/resume hooks are not called
+ * unless chip_type is hooked onto a generic_chip. Since this driver does
+ * not use generic_chip, we need to manually hook our resume/suspend to
+ * syscore_ops.
+ */
+static LIST_HEAD(bcm7038_l1_intcs_list);
+static DEFINE_RAW_SPINLOCK(bcm7038_l1_intcs_lock);
+
+static int bcm7038_l1_suspend(void)
+{
+ struct bcm7038_l1_chip *intc;
+ int boot_cpu, word;
+
+ /* Wakeup interrupt should only come from the boot cpu */
+ boot_cpu = cpu_logical_map(0);
+
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
+ for (word = 0; word < intc->n_words; word++) {
+ l1_writel(~intc->wake_mask[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_set(intc, word));
+ l1_writel(intc->wake_mask[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_clr(intc, word));
+ }
+ }
+
+ return 0;
+}
+
+static void bcm7038_l1_resume(void)
+{
+ struct bcm7038_l1_chip *intc;
+ int boot_cpu, word;
+
+ boot_cpu = cpu_logical_map(0);
+
+ list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
+ for (word = 0; word < intc->n_words; word++) {
+ l1_writel(intc->cpus[boot_cpu]->mask_cache[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_set(intc, word));
+ l1_writel(~intc->cpus[boot_cpu]->mask_cache[word],
+ intc->cpus[boot_cpu]->map_base + reg_mask_clr(intc, word));
+ }
+ }
+}
+
+static struct syscore_ops bcm7038_l1_syscore_ops = {
+ .suspend = bcm7038_l1_suspend,
+ .resume = bcm7038_l1_resume,
+};
+
+static int bcm7038_l1_set_wake(struct irq_data *d, unsigned int on)
+{
+ struct bcm7038_l1_chip *intc = irq_data_get_irq_chip_data(d);
+ unsigned long flags;
+ u32 word = d->hwirq / IRQS_PER_WORD;
+ u32 mask = BIT(d->hwirq % IRQS_PER_WORD);
+
+ raw_spin_lock_irqsave(&intc->lock, flags);
+ if (on)
+ intc->wake_mask[word] |= mask;
+ else
+ intc->wake_mask[word] &= ~mask;
+ raw_spin_unlock_irqrestore(&intc->lock, flags);
+
+ return 0;
+}
+#endif
+
static struct irq_chip bcm7038_l1_irq_chip = {
.name = "bcm7038-l1",
.irq_mask = bcm7038_l1_mask,
@@ -295,6 +371,9 @@ static struct irq_chip bcm7038_l1_irq_chip = {
#ifdef CONFIG_SMP
.irq_cpu_offline = bcm7038_l1_cpu_offline,
#endif
+#ifdef CONFIG_PM_SLEEP
+ .irq_set_wake = bcm7038_l1_set_wake,
+#endif
};
static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
@@ -340,6 +419,16 @@ int __init bcm7038_l1_of_init(struct device_node *dn,
goto out_unmap;
}
+#ifdef CONFIG_PM_SLEEP
+ /* Add bcm7038_l1_chip into a list */
+ raw_spin_lock(&bcm7038_l1_intcs_lock);
+ list_add_tail(&intc->list, &bcm7038_l1_intcs_list);
+ raw_spin_unlock(&bcm7038_l1_intcs_lock);
+
+ if (list_is_singular(&bcm7038_l1_intcs_list))
+ register_syscore_ops(&bcm7038_l1_syscore_ops);
+#endif
+
pr_info("registered BCM7038 L1 intc (%pOF, IRQs: %d)\n",
dn, IRQS_PER_WORD * intc->n_words);
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 2/5] dt-bindings: Document brcm,irq-can-wake for brcm,bcm7038-l1-intc.txt
2019-10-24 20:14 [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Florian Fainelli
2019-10-24 20:14 ` [PATCH v3 1/5] irqchip/irq-bcm7038-l1: Add PM support Florian Fainelli
@ 2019-10-24 20:14 ` Florian Fainelli
2019-11-20 13:21 ` [tip: irq/core] dt-bindings: Document brcm, irq-can-wake for brcm, bcm7038-l1-intc.txt tip-bot2 for Florian Fainelli
2019-10-24 20:14 ` [PATCH v3 3/5] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary Florian Fainelli
` (3 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2019-10-24 20:14 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Thomas Gleixner, Jason Cooper, Marc Zyngier,
Rob Herring, Mark Rutland,
maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
The BCM7038 L1 interrupt controller can be used as a wake-up interrupt
controller on MIPS and ARM-based systems, document the brcm,irq-can-wake
which has been "standardized" across Broadcom interrupt controllers.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
index 2117d4ac1ae5..4eb043270f5b 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
@@ -31,6 +31,11 @@ Required properties:
- interrupts: specifies the interrupt line(s) in the interrupt-parent controller
node; valid values depend on the type of parent interrupt controller
+Optional properties:
+
+- brcm,irq-can-wake: If present, this means the L1 controller can be used as a
+ wakeup source for system suspend/resume.
+
If multiple reg ranges and interrupt-parent entries are present on an SMP
system, the driver will allow IRQ SMP affinity to be set up through the
/proc/irq/ interface. In the simplest possible configuration, only one
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [tip: irq/core] dt-bindings: Document brcm, irq-can-wake for brcm, bcm7038-l1-intc.txt
2019-10-24 20:14 ` [PATCH v3 2/5] dt-bindings: Document brcm,irq-can-wake for brcm,bcm7038-l1-intc.txt Florian Fainelli
@ 2019-11-20 13:21 ` tip-bot2 for Florian Fainelli
0 siblings, 0 replies; 12+ messages in thread
From: tip-bot2 for Florian Fainelli @ 2019-11-20 13:21 UTC (permalink / raw)
To: linux-tip-commits
Cc: Florian Fainelli, Marc Zyngier, Rob Herring, Ingo Molnar,
Borislav Petkov, linux-kernel
The following commit has been merged into the irq/core branch of tip:
Commit-ID: b94f9008f2ad551f4d6a9537b10238847cb81e5d
Gitweb: https://git.kernel.org/tip/b94f9008f2ad551f4d6a9537b10238847cb81e5d
Author: Florian Fainelli <f.fainelli@gmail.com>
AuthorDate: Thu, 24 Oct 2019 13:14:12 -07:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 10 Nov 2019 18:47:46
dt-bindings: Document brcm, irq-can-wake for brcm, bcm7038-l1-intc.txt
The BCM7038 L1 interrupt controller can be used as a wake-up interrupt
controller on MIPS and ARM-based systems, document the brcm,irq-can-wake
which has been "standardized" across Broadcom interrupt controllers.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20191024201415.23454-3-f.fainelli@gmail.com
---
Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
index 2117d4a..4eb0432 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
@@ -31,6 +31,11 @@ Required properties:
- interrupts: specifies the interrupt line(s) in the interrupt-parent controller
node; valid values depend on the type of parent interrupt controller
+Optional properties:
+
+- brcm,irq-can-wake: If present, this means the L1 controller can be used as a
+ wakeup source for system suspend/resume.
+
If multiple reg ranges and interrupt-parent entries are present on an SMP
system, the driver will allow IRQ SMP affinity to be set up through the
/proc/irq/ interface. In the simplest possible configuration, only one
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/5] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary
2019-10-24 20:14 [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Florian Fainelli
2019-10-24 20:14 ` [PATCH v3 1/5] irqchip/irq-bcm7038-l1: Add PM support Florian Fainelli
2019-10-24 20:14 ` [PATCH v3 2/5] dt-bindings: Document brcm,irq-can-wake for brcm,bcm7038-l1-intc.txt Florian Fainelli
@ 2019-10-24 20:14 ` Florian Fainelli
2019-11-20 13:21 ` [tip: irq/core] " tip-bot2 for Florian Fainelli
2019-10-24 20:14 ` [PATCH v3 4/5] dt-bindings: Document brcm,int-fwd-mask property for bcm7038-l1-intc Florian Fainelli
` (2 subsequent siblings)
5 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2019-10-24 20:14 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Thomas Gleixner, Jason Cooper, Marc Zyngier,
Rob Herring, Mark Rutland,
maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
If the 'brcm,irq-can-wake' property is specified, make sure we also
enable the corresponding parent interrupt we are attached to.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index 689e487be80c..45879e59e58b 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -286,6 +286,10 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
pr_err("failed to map parent interrupt %d\n", parent_irq);
return -EINVAL;
}
+
+ if (of_property_read_bool(dn, "brcm,irq-can-wake"))
+ enable_irq_wake(parent_irq);
+
irq_set_chained_handler_and_data(parent_irq, bcm7038_l1_irq_handle,
intc);
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [tip: irq/core] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary
2019-10-24 20:14 ` [PATCH v3 3/5] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary Florian Fainelli
@ 2019-11-20 13:21 ` tip-bot2 for Florian Fainelli
0 siblings, 0 replies; 12+ messages in thread
From: tip-bot2 for Florian Fainelli @ 2019-11-20 13:21 UTC (permalink / raw)
To: linux-tip-commits
Cc: Florian Fainelli, Marc Zyngier, Ingo Molnar, Borislav Petkov,
linux-kernel
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 27eebb60357ed5aa6659442f92907c0f7368d6ae
Gitweb: https://git.kernel.org/tip/27eebb60357ed5aa6659442f92907c0f7368d6ae
Author: Florian Fainelli <f.fainelli@gmail.com>
AuthorDate: Thu, 24 Oct 2019 13:14:13 -07:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 10 Nov 2019 18:47:47
irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary
If the 'brcm,irq-can-wake' property is specified, make sure we also
enable the corresponding parent interrupt we are attached to.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20191024201415.23454-4-f.fainelli@gmail.com
---
drivers/irqchip/irq-bcm7038-l1.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index 689e487..45879e5 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -286,6 +286,10 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
pr_err("failed to map parent interrupt %d\n", parent_irq);
return -EINVAL;
}
+
+ if (of_property_read_bool(dn, "brcm,irq-can-wake"))
+ enable_irq_wake(parent_irq);
+
irq_set_chained_handler_and_data(parent_irq, bcm7038_l1_irq_handle,
intc);
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 4/5] dt-bindings: Document brcm,int-fwd-mask property for bcm7038-l1-intc
2019-10-24 20:14 [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Florian Fainelli
` (2 preceding siblings ...)
2019-10-24 20:14 ` [PATCH v3 3/5] irqchip/irq-bcm7038-l1: Enable parent IRQ if necessary Florian Fainelli
@ 2019-10-24 20:14 ` Florian Fainelli
2019-11-20 13:21 ` [tip: irq/core] dt-bindings: Document brcm, int-fwd-mask " tip-bot2 for Florian Fainelli
2019-10-24 20:14 ` [PATCH v3 5/5] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask Florian Fainelli
2019-11-11 10:52 ` [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Marc Zyngier
5 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2019-10-24 20:14 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Thomas Gleixner, Jason Cooper, Marc Zyngier,
Rob Herring, Mark Rutland,
maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
Indicate that the brcm,int-fwd-mask property is optional and can be set
on platforms which require to leave specific interrupts unmanaged by
Linux and need to retain the firmware configuration.
Acked-by: Rob Herring <robh@kernel.org>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
.../bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
index 4eb043270f5b..5ddef1dc0c1a 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
@@ -36,6 +36,12 @@ Optional properties:
- brcm,irq-can-wake: If present, this means the L1 controller can be used as a
wakeup source for system suspend/resume.
+Optional properties:
+
+- brcm,int-fwd-mask: if present, a bit mask to indicate which interrupts
+ have already been configured by the firmware and should be left unmanaged.
+ This should have one 32-bit word per status/set/clear/mask group.
+
If multiple reg ranges and interrupt-parent entries are present on an SMP
system, the driver will allow IRQ SMP affinity to be set up through the
/proc/irq/ interface. In the simplest possible configuration, only one
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [tip: irq/core] dt-bindings: Document brcm, int-fwd-mask property for bcm7038-l1-intc
2019-10-24 20:14 ` [PATCH v3 4/5] dt-bindings: Document brcm,int-fwd-mask property for bcm7038-l1-intc Florian Fainelli
@ 2019-11-20 13:21 ` tip-bot2 for Florian Fainelli
0 siblings, 0 replies; 12+ messages in thread
From: tip-bot2 for Florian Fainelli @ 2019-11-20 13:21 UTC (permalink / raw)
To: linux-tip-commits
Cc: Florian Fainelli, Marc Zyngier, Rob Herring, Ingo Molnar,
Borislav Petkov, linux-kernel
The following commit has been merged into the irq/core branch of tip:
Commit-ID: e14b5e5ff0841270e6262e3e5fd69ad764a80aee
Gitweb: https://git.kernel.org/tip/e14b5e5ff0841270e6262e3e5fd69ad764a80aee
Author: Florian Fainelli <f.fainelli@gmail.com>
AuthorDate: Thu, 24 Oct 2019 13:14:14 -07:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 10 Nov 2019 18:47:47
dt-bindings: Document brcm, int-fwd-mask property for bcm7038-l1-intc
Indicate that the brcm,int-fwd-mask property is optional and can be set
on platforms which require to leave specific interrupts unmanaged by
Linux and need to retain the firmware configuration.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Acked-by: Rob Herring <robh@kernel.org>
Link: https://lore.kernel.org/r/20191024201415.23454-5-f.fainelli@gmail.com
---
Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
index 4eb0432..5ddef1d 100644
--- a/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm7038-l1-intc.txt
@@ -36,6 +36,12 @@ Optional properties:
- brcm,irq-can-wake: If present, this means the L1 controller can be used as a
wakeup source for system suspend/resume.
+Optional properties:
+
+- brcm,int-fwd-mask: if present, a bit mask to indicate which interrupts
+ have already been configured by the firmware and should be left unmanaged.
+ This should have one 32-bit word per status/set/clear/mask group.
+
If multiple reg ranges and interrupt-parent entries are present on an SMP
system, the driver will allow IRQ SMP affinity to be set up through the
/proc/irq/ interface. In the simplest possible configuration, only one
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 5/5] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask
2019-10-24 20:14 [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Florian Fainelli
` (3 preceding siblings ...)
2019-10-24 20:14 ` [PATCH v3 4/5] dt-bindings: Document brcm,int-fwd-mask property for bcm7038-l1-intc Florian Fainelli
@ 2019-10-24 20:14 ` Florian Fainelli
2019-11-20 13:21 ` [tip: irq/core] " tip-bot2 for Florian Fainelli
2019-11-11 10:52 ` [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Marc Zyngier
5 siblings, 1 reply; 12+ messages in thread
From: Florian Fainelli @ 2019-10-24 20:14 UTC (permalink / raw)
To: linux-kernel
Cc: Florian Fainelli, Thomas Gleixner, Jason Cooper, Marc Zyngier,
Rob Herring, Mark Rutland,
maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE...,
open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS,
moderated list:BROADCOM BCM2835 ARM ARCHITECTURE
On some specific chips like 7211 we need to leave some interrupts
untouched/forwarded to the VPU which is another agent in the system
making use of that interrupt controller hardware (goes to both ARM GIC
and VPU L1 interrupt controller). Make that possible by using the
existing brcm,int-fwd-mask property and take necessary actions to avoid
masking that interrupt as well as not allowing Linux to map them.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
drivers/irqchip/irq-bcm7038-l1.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index 45879e59e58b..cbf01afcd2a6 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -44,6 +44,7 @@ struct bcm7038_l1_chip {
struct list_head list;
u32 wake_mask[MAX_WORDS];
#endif
+ u32 irq_fwd_mask[MAX_WORDS];
u8 affinity[MAX_WORDS * IRQS_PER_WORD];
};
@@ -254,6 +255,7 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
resource_size_t sz;
struct bcm7038_l1_cpu *cpu;
unsigned int i, n_words, parent_irq;
+ int ret;
if (of_address_to_resource(dn, idx, &res))
return -EINVAL;
@@ -267,6 +269,14 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
else if (intc->n_words != n_words)
return -EINVAL;
+ ret = of_property_read_u32_array(dn , "brcm,int-fwd-mask",
+ intc->irq_fwd_mask, n_words);
+ if (ret != 0 && ret != -EINVAL) {
+ /* property exists but has the wrong number of words */
+ pr_err("invalid brcm,int-fwd-mask property\n");
+ return -EINVAL;
+ }
+
cpu = intc->cpus[idx] = kzalloc(sizeof(*cpu) + n_words * sizeof(u32),
GFP_KERNEL);
if (!cpu)
@@ -277,8 +287,11 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
return -ENOMEM;
for (i = 0; i < n_words; i++) {
- l1_writel(0xffffffff, cpu->map_base + reg_mask_set(intc, i));
- cpu->mask_cache[i] = 0xffffffff;
+ l1_writel(~intc->irq_fwd_mask[i],
+ cpu->map_base + reg_mask_set(intc, i));
+ l1_writel(intc->irq_fwd_mask[i],
+ cpu->map_base + reg_mask_clr(intc, i));
+ cpu->mask_cache[i] = ~intc->irq_fwd_mask[i];
}
parent_irq = irq_of_parse_and_map(dn, idx);
@@ -311,15 +324,17 @@ static int bcm7038_l1_suspend(void)
{
struct bcm7038_l1_chip *intc;
int boot_cpu, word;
+ u32 val;
/* Wakeup interrupt should only come from the boot cpu */
boot_cpu = cpu_logical_map(0);
list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
for (word = 0; word < intc->n_words; word++) {
- l1_writel(~intc->wake_mask[word],
+ val = intc->wake_mask[word] | intc->irq_fwd_mask[word];
+ l1_writel(~val,
intc->cpus[boot_cpu]->map_base + reg_mask_set(intc, word));
- l1_writel(intc->wake_mask[word],
+ l1_writel(val,
intc->cpus[boot_cpu]->map_base + reg_mask_clr(intc, word));
}
}
@@ -383,6 +398,13 @@ static struct irq_chip bcm7038_l1_irq_chip = {
static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
irq_hw_number_t hw_irq)
{
+ struct bcm7038_l1_chip *intc = d->host_data;
+ u32 mask = BIT(hw_irq % IRQS_PER_WORD);
+ u32 word = hw_irq / IRQS_PER_WORD;
+
+ if (intc->irq_fwd_mask[word] & mask)
+ return -EPERM;
+
irq_set_chip_and_handler(virq, &bcm7038_l1_irq_chip, handle_level_irq);
irq_set_chip_data(virq, d->host_data);
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
--
2.17.1
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [tip: irq/core] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask
2019-10-24 20:14 ` [PATCH v3 5/5] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask Florian Fainelli
@ 2019-11-20 13:21 ` tip-bot2 for Florian Fainelli
0 siblings, 0 replies; 12+ messages in thread
From: tip-bot2 for Florian Fainelli @ 2019-11-20 13:21 UTC (permalink / raw)
To: linux-tip-commits
Cc: Florian Fainelli, Marc Zyngier, Ingo Molnar, Borislav Petkov,
linux-kernel
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 96de80c14bc6b43b797299270e31b8924f89fa52
Gitweb: https://git.kernel.org/tip/96de80c14bc6b43b797299270e31b8924f89fa52
Author: Florian Fainelli <f.fainelli@gmail.com>
AuthorDate: Thu, 24 Oct 2019 13:14:15 -07:00
Committer: Marc Zyngier <maz@kernel.org>
CommitterDate: Sun, 10 Nov 2019 18:47:48
irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask
On some specific chips like 7211 we need to leave some interrupts
untouched/forwarded to the VPU which is another agent in the system
making use of that interrupt controller hardware (goes to both ARM GIC
and VPU L1 interrupt controller). Make that possible by using the
existing brcm,int-fwd-mask property and take necessary actions to avoid
masking that interrupt as well as not allowing Linux to map them.
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Marc Zyngier <maz@kernel.org>
Link: https://lore.kernel.org/r/20191024201415.23454-6-f.fainelli@gmail.com
---
drivers/irqchip/irq-bcm7038-l1.c | 30 ++++++++++++++++++++++++++----
1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/drivers/irqchip/irq-bcm7038-l1.c b/drivers/irqchip/irq-bcm7038-l1.c
index 45879e5..cbf01af 100644
--- a/drivers/irqchip/irq-bcm7038-l1.c
+++ b/drivers/irqchip/irq-bcm7038-l1.c
@@ -44,6 +44,7 @@ struct bcm7038_l1_chip {
struct list_head list;
u32 wake_mask[MAX_WORDS];
#endif
+ u32 irq_fwd_mask[MAX_WORDS];
u8 affinity[MAX_WORDS * IRQS_PER_WORD];
};
@@ -254,6 +255,7 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
resource_size_t sz;
struct bcm7038_l1_cpu *cpu;
unsigned int i, n_words, parent_irq;
+ int ret;
if (of_address_to_resource(dn, idx, &res))
return -EINVAL;
@@ -267,6 +269,14 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
else if (intc->n_words != n_words)
return -EINVAL;
+ ret = of_property_read_u32_array(dn , "brcm,int-fwd-mask",
+ intc->irq_fwd_mask, n_words);
+ if (ret != 0 && ret != -EINVAL) {
+ /* property exists but has the wrong number of words */
+ pr_err("invalid brcm,int-fwd-mask property\n");
+ return -EINVAL;
+ }
+
cpu = intc->cpus[idx] = kzalloc(sizeof(*cpu) + n_words * sizeof(u32),
GFP_KERNEL);
if (!cpu)
@@ -277,8 +287,11 @@ static int __init bcm7038_l1_init_one(struct device_node *dn,
return -ENOMEM;
for (i = 0; i < n_words; i++) {
- l1_writel(0xffffffff, cpu->map_base + reg_mask_set(intc, i));
- cpu->mask_cache[i] = 0xffffffff;
+ l1_writel(~intc->irq_fwd_mask[i],
+ cpu->map_base + reg_mask_set(intc, i));
+ l1_writel(intc->irq_fwd_mask[i],
+ cpu->map_base + reg_mask_clr(intc, i));
+ cpu->mask_cache[i] = ~intc->irq_fwd_mask[i];
}
parent_irq = irq_of_parse_and_map(dn, idx);
@@ -311,15 +324,17 @@ static int bcm7038_l1_suspend(void)
{
struct bcm7038_l1_chip *intc;
int boot_cpu, word;
+ u32 val;
/* Wakeup interrupt should only come from the boot cpu */
boot_cpu = cpu_logical_map(0);
list_for_each_entry(intc, &bcm7038_l1_intcs_list, list) {
for (word = 0; word < intc->n_words; word++) {
- l1_writel(~intc->wake_mask[word],
+ val = intc->wake_mask[word] | intc->irq_fwd_mask[word];
+ l1_writel(~val,
intc->cpus[boot_cpu]->map_base + reg_mask_set(intc, word));
- l1_writel(intc->wake_mask[word],
+ l1_writel(val,
intc->cpus[boot_cpu]->map_base + reg_mask_clr(intc, word));
}
}
@@ -383,6 +398,13 @@ static struct irq_chip bcm7038_l1_irq_chip = {
static int bcm7038_l1_map(struct irq_domain *d, unsigned int virq,
irq_hw_number_t hw_irq)
{
+ struct bcm7038_l1_chip *intc = d->host_data;
+ u32 mask = BIT(hw_irq % IRQS_PER_WORD);
+ u32 word = hw_irq / IRQS_PER_WORD;
+
+ if (intc->irq_fwd_mask[word] & mask)
+ return -EPERM;
+
irq_set_chip_and_handler(virq, &bcm7038_l1_irq_chip, handle_level_irq);
irq_set_chip_data(virq, d->host_data);
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates
2019-10-24 20:14 [PATCH v3 0/5] irqchip/irq-bcm7038-l1 updates Florian Fainelli
` (4 preceding siblings ...)
2019-10-24 20:14 ` [PATCH v3 5/5] irqchip/irq-bcm7038-l1: Support brcm,int-fwd-mask Florian Fainelli
@ 2019-11-11 10:52 ` Marc Zyngier
5 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2019-11-11 10:52 UTC (permalink / raw)
To: Florian Fainelli
Cc: linux-kernel, Thomas Gleixner, Jason Cooper, Rob Herring,
Mark Rutland, bcm-kernel-feedback-list, devicetree,
linux-arm-kernel
On 2019-10-24 21:23, Florian Fainelli wrote:
> Hi Marc, Jason, Thomas,
>
> This patch series contains some updates from our internal tree to
> support power management and allow configuring specific instances of
> the
> brcm,bcm7038-l1-intc to leave some interrupts untouched and how the
> firmware might have configured them.
Applied to irqchip-next.
M.
--
Jazz is not dead. It just smells funny...
^ permalink raw reply [flat|nested] 12+ messages in thread