|
|
|
@ -1,47 +1,72 @@ |
|
|
|
|
From 4d3886359d6f6ac475e143d5f3e3b389542a0510 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From 7aaa70416d87434792b73077beb328202975e541 Mon Sep 17 00:00:00 2001
|
|
|
|
|
From: Jonas Gorski <jogo@openwrt.org>
|
|
|
|
|
Date: Sun, 30 Nov 2014 14:53:12 +0100
|
|
|
|
|
Subject: [PATCH 17/20] irqchip: add support for bcm6345-style l2 irq
|
|
|
|
|
Subject: [PATCH 1/5] irqchip: add support for bcm6345-style periphery irq
|
|
|
|
|
controller
|
|
|
|
|
|
|
|
|
|
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
|
|
|
|
|
---
|
|
|
|
|
.../interrupt-controller/brcm,bcm6345-l2-intc.txt | 25 ++
|
|
|
|
|
.../brcm,bcm6345-periph-intc.txt | 50 +++
|
|
|
|
|
drivers/irqchip/Kconfig | 4 +
|
|
|
|
|
drivers/irqchip/Makefile | 1 +
|
|
|
|
|
drivers/irqchip/irq-bcm6345-l2.c | 320 ++++++++++++++++++++
|
|
|
|
|
include/linux/irqchip/irq-bcm6345-l2-intc.h | 16 +
|
|
|
|
|
5 files changed, 366 insertions(+)
|
|
|
|
|
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-l2-intc.txt
|
|
|
|
|
create mode 100644 drivers/irqchip/irq-bcm6345-l2.c
|
|
|
|
|
create mode 100644 include/linux/irqchip/irq-bcm6345-l2-intc.h
|
|
|
|
|
drivers/irqchip/irq-bcm6345-periph.c | 325 ++++++++++++++++++++
|
|
|
|
|
include/linux/irqchip/irq-bcm6345-periph.h | 16 +
|
|
|
|
|
5 files changed, 396 insertions(+)
|
|
|
|
|
create mode 100644 Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-periph-intc.txt
|
|
|
|
|
create mode 100644 drivers/irqchip/irq-bcm6345-periph.c
|
|
|
|
|
create mode 100644 include/linux/irqchip/irq-bcm6345-periph.h
|
|
|
|
|
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-l2-intc.txt
|
|
|
|
|
@@ -0,0 +1,25 @@
|
|
|
|
|
+Broadcom BCM6345 Level 2 interrupt controller
|
|
|
|
|
+++ b/Documentation/devicetree/bindings/interrupt-controller/brcm,bcm6345-periph-intc.txt
|
|
|
|
|
@@ -0,0 +1,50 @@
|
|
|
|
|
+Broadcom BCM6345 Level 1 periphery interrupt controller
|
|
|
|
|
+
|
|
|
|
|
+This block is a interrupt controller that is typically connected directly
|
|
|
|
|
+to one of the HW INT lines on each CPU. Every BCM63XX xDSL chip since
|
|
|
|
|
+BCM6345 has contained this hardware.
|
|
|
|
|
+
|
|
|
|
|
+Key elements of the hardware design include:
|
|
|
|
|
+
|
|
|
|
|
+- 32, 64, or 128 incoming level IRQ lines
|
|
|
|
|
+
|
|
|
|
|
+- All onchip peripherals are wired directly to an L2 input
|
|
|
|
|
+
|
|
|
|
|
+- A separate instance of the register set for each CPU, allowing individual
|
|
|
|
|
+ peripheral IRQs to be routed to any CPU
|
|
|
|
|
+
|
|
|
|
|
+- No atomic mask/unmask operations
|
|
|
|
|
+
|
|
|
|
|
+- No polarity/level/edge settings
|
|
|
|
|
+
|
|
|
|
|
+- No FIFO or priority encoder logic; software is expected to read all
|
|
|
|
|
+ 1-4 status words to determine which IRQs are pending
|
|
|
|
|
+
|
|
|
|
|
+Required properties:
|
|
|
|
|
+
|
|
|
|
|
+- compatible: should be "brcm,bcm6345-l2-intc"
|
|
|
|
|
+- reg: specifies the base physical address and size of the registers;
|
|
|
|
|
+ multiple regs may be specified, and must match the amount of parent interrupts
|
|
|
|
|
+- interrupt-controller: identifies the node as an interrupt controller
|
|
|
|
|
+- #interrupt-cells: specifies the number of cells needed to encode an interrupt
|
|
|
|
|
+ source, should be 1
|
|
|
|
|
+- interrupt-parent: specifies the phandle to the parent interrupt controller
|
|
|
|
|
+ this one is cascaded from
|
|
|
|
|
+- interrupts: specifies the interrupt line(s) in the interrupt-parent controller
|
|
|
|
|
+ node, valid values depend on the type of parent interrupt controller
|
|
|
|
|
+- compatible: Should be "brcm,bcm6345-periph-intc".
|
|
|
|
|
+- reg: Specifies the base physical address and size of the registers.
|
|
|
|
|
+ Multiple register addresses may be specified, and must match the amount of
|
|
|
|
|
+ parent interrupts.
|
|
|
|
|
+- interrupt-controller: Identifies the node as an interrupt controller.
|
|
|
|
|
+- #interrupt-cells: Specifies the number of cells needed to encode an interrupt
|
|
|
|
|
+ source, should be 1.
|
|
|
|
|
+- interrupt-parent: Specifies the phandle to the parent interrupt controller
|
|
|
|
|
+ this one is cascaded from.
|
|
|
|
|
+- interrupts: Specifies the interrupt line(s) in the interrupt-parent controller
|
|
|
|
|
+ node, valid values depend on the type of parent interrupt controller.
|
|
|
|
|
+ Multiple lines are used to route interrupts to different cpus, with the first
|
|
|
|
|
+ assumed to be for the boot CPU.
|
|
|
|
|
+
|
|
|
|
|
+Example:
|
|
|
|
|
+
|
|
|
|
|
+periph_intc: interrupt-controller@f0406800 {
|
|
|
|
|
+ compatible = "brcm,bcm6345-l2-intc";
|
|
|
|
|
+ interrupt-parent = <&mips_intc>;
|
|
|
|
|
+ #interrupt-cells = <1>;
|
|
|
|
|
+ reg = <0x10000020 0x10> <0x10000030 0x10>;
|
|
|
|
|
+ compatible = "brcm,bcm6345-periph-intc";
|
|
|
|
|
+ reg = <0x10000020 0x10>, <0x10000030 0x10>;
|
|
|
|
|
+
|
|
|
|
|
+ interrupt-controller;
|
|
|
|
|
+ #interrupt-cells = <1>;
|
|
|
|
|
+
|
|
|
|
|
+ interrupt-parent = <&cpu_intc>;
|
|
|
|
|
+ interrupts = <2>, <3>;
|
|
|
|
|
+};
|
|
|
|
|
--- a/drivers/irqchip/Kconfig
|
|
|
|
@ -50,7 +75,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
The maximum number of VICs available in the system, for
|
|
|
|
|
power management.
|
|
|
|
|
|
|
|
|
|
+config BCM6345_L2_IRQ
|
|
|
|
|
+config BCM6345_PERIPH_IRQ
|
|
|
|
|
+ bool
|
|
|
|
|
+ select IRQ_DOMAIN
|
|
|
|
|
+
|
|
|
|
@ -63,13 +88,13 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
obj-$(CONFIG_ARCH_MVEBU) += irq-armada-370-xp.o
|
|
|
|
|
obj-$(CONFIG_ARCH_MXS) += irq-mxs.o
|
|
|
|
|
obj-$(CONFIG_ARCH_S3C24XX) += irq-s3c24xx.o
|
|
|
|
|
+obj-$(CONFIG_BCM6345_L2_IRQ) += irq-bcm6345-l2.o
|
|
|
|
|
+obj-$(CONFIG_BCM6345_PERIPH_IRQ) += irq-bcm6345-periph.o
|
|
|
|
|
obj-$(CONFIG_DW_APB_ICTL) += irq-dw-apb-ictl.o
|
|
|
|
|
obj-$(CONFIG_METAG) += irq-metag-ext.o
|
|
|
|
|
obj-$(CONFIG_METAG_PERFCOUNTER_IRQS) += irq-metag.o
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/drivers/irqchip/irq-bcm6345-l2.c
|
|
|
|
|
@@ -0,0 +1,320 @@
|
|
|
|
|
+++ b/drivers/irqchip/irq-bcm6345-periph.c
|
|
|
|
|
@@ -0,0 +1,340 @@
|
|
|
|
|
+/*
|
|
|
|
|
+ * This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
|
+ * License. See the file "COPYING" in the main directory of this archive
|
|
|
|
@ -81,7 +106,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+#include <linux/ioport.h>
|
|
|
|
|
+#include <linux/irq.h>
|
|
|
|
|
+#include <linux/irqchip/chained_irq.h>
|
|
|
|
|
+#include <linux/irqchip/irq-bcm6345-l2-intc.h>
|
|
|
|
|
+#include <linux/irqchip/irq-bcm6345-periph.h>
|
|
|
|
|
+#include <linux/kernel.h>
|
|
|
|
|
+#include <linux/of.h>
|
|
|
|
|
+#include <linux/of_irq.h>
|
|
|
|
@ -118,10 +143,10 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ int num_words;
|
|
|
|
|
+
|
|
|
|
|
+ struct irq_domain *domain;
|
|
|
|
|
+ spinlock_t lock;
|
|
|
|
|
+ raw_spinlock_t lock;
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+static void bcm6345_l2_intc_irq_handle(unsigned int irq, struct irq_desc *desc)
|
|
|
|
|
+static void bcm6345_periph_irq_handle(unsigned int irq, struct irq_desc *desc)
|
|
|
|
|
+{
|
|
|
|
|
+ struct intc_data *data = irq_desc_get_handler_data(desc);
|
|
|
|
|
+ struct irq_chip *chip = irq_desc_get_chip(desc);
|
|
|
|
@ -139,20 +164,36 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ unsigned long pending;
|
|
|
|
|
+ int hw_irq;
|
|
|
|
|
+
|
|
|
|
|
+ raw_spin_lock(data->lock);
|
|
|
|
|
+ raw_spin_lock(&data->lock);
|
|
|
|
|
+ pending = __raw_readl(block->en_reg[idx]) &
|
|
|
|
|
+ __raw_readl(block->status_reg[idx]);
|
|
|
|
|
+ raw_spin_unlock(data->lock);
|
|
|
|
|
+ raw_spin_unlock(&data->lock);
|
|
|
|
|
+
|
|
|
|
|
+ for_each_set_bit(hw_irq, &pending, IRQS_PER_WORD) {
|
|
|
|
|
+ generic_handle_irq(irq_find_mapping(data->domain, base + hw_irq));
|
|
|
|
|
+ int virq;
|
|
|
|
|
+
|
|
|
|
|
+ virq = irq_find_mapping(data->domain, base + hw_irq);
|
|
|
|
|
+ generic_handle_irq(virq);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ chained_irq_exit(chip, desc);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void bcm6345_l2_intc_irq_mask(struct irq_data *data)
|
|
|
|
|
+static void __bcm6345_periph_enable(struct intc_block *block, int reg, int bit,
|
|
|
|
|
+ bool enable)
|
|
|
|
|
+{
|
|
|
|
|
+ u32 val;
|
|
|
|
|
+
|
|
|
|
|
+ val = __raw_readl(block->en_reg[reg]);
|
|
|
|
|
+ if (enable)
|
|
|
|
|
+ val |= BIT(bit);
|
|
|
|
|
+ else
|
|
|
|
|
+ val &= ~BIT(bit);
|
|
|
|
|
+ __raw_writel(val, block->en_reg[reg]);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void bcm6345_periph_irq_mask(struct irq_data *data)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int i, reg, bit;
|
|
|
|
|
+ struct intc_data *priv = data->domain->host_data;
|
|
|
|
@ -161,58 +202,51 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ reg = hwirq / IRQS_PER_WORD;
|
|
|
|
|
+ bit = hwirq % IRQS_PER_WORD;
|
|
|
|
|
+
|
|
|
|
|
+ raw_spin_lock(priv->lock);
|
|
|
|
|
+ raw_spin_lock(&priv->lock);
|
|
|
|
|
+ for (i = 0; i < MAX_PARENT_IRQS; i++) {
|
|
|
|
|
+ struct intc_block *block = &priv->block[i];
|
|
|
|
|
+ u32 val;
|
|
|
|
|
+
|
|
|
|
|
+ if (!block->parent_irq)
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ val = __raw_readl(block->en_reg[reg]);
|
|
|
|
|
+ __raw_writel(val & ~BIT(bit), block->en_reg[reg]);
|
|
|
|
|
+ __bcm6345_periph_enable(block, reg, bit, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ raw_spin_unlock(priv->lock);
|
|
|
|
|
+ raw_spin_unlock(&priv->lock);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static void bcm6345_l2_intc_irq_unmask(struct irq_data *data)
|
|
|
|
|
+static void bcm6345_periph_irq_unmask(struct irq_data *data)
|
|
|
|
|
+{
|
|
|
|
|
+ unsigned int i, reg, bit;
|
|
|
|
|
+ struct intc_data *priv = data->domain->host_data;
|
|
|
|
|
+ irq_hw_number_t hwirq = irqd_to_hwirq(data);
|
|
|
|
|
+ unsigned int i, reg, bit;
|
|
|
|
|
+
|
|
|
|
|
+ reg = hwirq / IRQS_PER_WORD;
|
|
|
|
|
+ bit = hwirq % IRQS_PER_WORD;
|
|
|
|
|
+
|
|
|
|
|
+ raw_spin_lock(priv->lock);
|
|
|
|
|
+ raw_spin_lock(&priv->lock);
|
|
|
|
|
+ for (i = 0; i < MAX_PARENT_IRQS; i++) {
|
|
|
|
|
+ struct intc_block *block = &priv->block[i];
|
|
|
|
|
+ u32 val;
|
|
|
|
|
+
|
|
|
|
|
+ if (!block->parent_irq)
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ val = __raw_readl(block->en_reg[reg]);
|
|
|
|
|
+
|
|
|
|
|
+ if (block->mask_cache[reg] & BIT(bit))
|
|
|
|
|
+ val |= BIT(bit);
|
|
|
|
|
+ __bcm6345_periph_enable(block, reg, bit, true);
|
|
|
|
|
+ else
|
|
|
|
|
+ val &= ~BIT(bit);
|
|
|
|
|
+
|
|
|
|
|
+ __raw_writel(val, block->en_reg[reg]);
|
|
|
|
|
+ __bcm6345_periph_enable(block, reg, bit, false);
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+ raw_spin_unlock(priv->lock);
|
|
|
|
|
+ raw_spin_unlock(&priv->lock);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_SMP
|
|
|
|
|
+static int bcm6345_l2_intc_set_affinity(struct irq_data *data,
|
|
|
|
|
+ const struct cpumask *mask,
|
|
|
|
|
+ bool force)
|
|
|
|
|
+static int bcm6345_periph_set_affinity(struct irq_data *data,
|
|
|
|
|
+ const struct cpumask *mask, bool force)
|
|
|
|
|
+{
|
|
|
|
|
+ irq_hw_number_t hwirq = irqd_to_hwirq(data);
|
|
|
|
|
+ struct intc_data *priv = data->domain->host_data;
|
|
|
|
|
+ unsigned int i, reg, bit;
|
|
|
|
|
+ bool enabled;
|
|
|
|
|
+ int cpu;
|
|
|
|
|
+
|
|
|
|
|
+ reg = hwirq / IRQS_PER_WORD;
|
|
|
|
@ -231,21 +265,30 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ if (!priv->block[cpu].parent_irq)
|
|
|
|
|
+ return -EINVAL;
|
|
|
|
|
+
|
|
|
|
|
+ raw_spin_lock(priv->lock);
|
|
|
|
|
+ raw_spin_lock(&priv->lock);
|
|
|
|
|
+ enabled = !irqd_irq_masked(data);
|
|
|
|
|
+ for (i = 0; i < MAX_PARENT_IRQS; i++) {
|
|
|
|
|
+ if (i == cpu)
|
|
|
|
|
+ priv->block[i].mask_cache[reg] |= BIT(bit);
|
|
|
|
|
+ else
|
|
|
|
|
+ priv->block[i].mask_cache[reg] &= ~BIT(bit);
|
|
|
|
|
+ struct intc_block *block = &priv->block[i];
|
|
|
|
|
+
|
|
|
|
|
+ if (!block->parent_irq)
|
|
|
|
|
+ break;
|
|
|
|
|
+
|
|
|
|
|
+ if (i == cpu) {
|
|
|
|
|
+ block->mask_cache[reg] |= BIT(bit);
|
|
|
|
|
+ __bcm6345_periph_enable(block, reg, bit, enabled);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ block->mask_cache[reg] &= ~BIT(bit);
|
|
|
|
|
+ __bcm6345_periph_enable(block, reg, bit, false);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ raw_spin_unlock(priv->lock);
|
|
|
|
|
+ raw_spin_unlock(&priv->lock);
|
|
|
|
|
+
|
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+static int bcm6345_l2_map(struct irq_domain *d, unsigned int irq,
|
|
|
|
|
+ irq_hw_number_t hw)
|
|
|
|
|
+static int bcm6345_periph_map(struct irq_domain *d, unsigned int irq,
|
|
|
|
|
+ irq_hw_number_t hw)
|
|
|
|
|
+{
|
|
|
|
|
+ struct intc_data *priv = d->host_data;
|
|
|
|
|
+
|
|
|
|
@ -254,14 +297,14 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+static const struct irq_domain_ops bcm6345_l2_domain_ops = {
|
|
|
|
|
+static const struct irq_domain_ops bcm6345_periph_domain_ops = {
|
|
|
|
|
+ .xlate = irq_domain_xlate_onecell,
|
|
|
|
|
+ .map = bcm6345_l2_map,
|
|
|
|
|
+ .map = bcm6345_periph_map,
|
|
|
|
|
+};
|
|
|
|
|
+
|
|
|
|
|
+static int __init __bcm6345_l2_intc_init(struct device_node *node,
|
|
|
|
|
+ int num_blocks, int *irq,
|
|
|
|
|
+ void __iomem **base, int num_words)
|
|
|
|
|
+static int __init __bcm6345_periph_intc_init(struct device_node *node,
|
|
|
|
|
+ int num_blocks, int *irq,
|
|
|
|
|
+ void __iomem **base, int num_words)
|
|
|
|
|
+{
|
|
|
|
|
+ struct intc_data *data;
|
|
|
|
|
+ unsigned int i, w, status_offset;
|
|
|
|
@ -270,6 +313,8 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ if (!data)
|
|
|
|
|
+ return -ENOMEM;
|
|
|
|
|
+
|
|
|
|
|
+ raw_spin_lock_init(&data->lock);
|
|
|
|
|
+
|
|
|
|
|
+ status_offset = num_words * sizeof(u32);
|
|
|
|
|
+
|
|
|
|
|
+ for (i = 0; i < num_blocks; i++) {
|
|
|
|
@ -292,23 +337,23 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+
|
|
|
|
|
+ irq_set_handler_data(block->parent_irq, data);
|
|
|
|
|
+ irq_set_chained_handler(block->parent_irq,
|
|
|
|
|
+ bcm6345_l2_intc_irq_handle);
|
|
|
|
|
+ bcm6345_periph_irq_handle);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ data->num_words = num_words;
|
|
|
|
|
+
|
|
|
|
|
+ data->chip.name = "bcm6345-l2-intc";
|
|
|
|
|
+ data->chip.irq_mask = bcm6345_l2_intc_irq_mask;
|
|
|
|
|
+ data->chip.irq_unmask = bcm6345_l2_intc_irq_unmask;
|
|
|
|
|
+ data->chip.name = "bcm6345-periph-intc";
|
|
|
|
|
+ data->chip.irq_mask = bcm6345_periph_irq_mask;
|
|
|
|
|
+ data->chip.irq_unmask = bcm6345_periph_irq_unmask;
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_SMP
|
|
|
|
|
+ if (num_blocks > 1)
|
|
|
|
|
+ data->chip.set_affinity = bcm6345_l2_intc_set_affinity;
|
|
|
|
|
+ data->chip.irq_set_affinity = bcm6345_periph_set_affinity;
|
|
|
|
|
+#endif
|
|
|
|
|
+
|
|
|
|
|
+ data->domain = irq_domain_add_simple(node, IRQS_PER_WORD * num_words,
|
|
|
|
|
+ VIRQ_BASE, &bcm6345_l2_domain_ops,
|
|
|
|
|
+ data);
|
|
|
|
|
+ VIRQ_BASE,
|
|
|
|
|
+ &bcm6345_periph_domain_ops, data);
|
|
|
|
|
+ if (!data->domain) {
|
|
|
|
|
+ kfree(data);
|
|
|
|
|
+ return -EINVAL;
|
|
|
|
@ -317,15 +362,15 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ return 0;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+void __init bcm6345_l2_intc_init(int num_blocks, int *irq, void __iomem **base,
|
|
|
|
|
+ int num_words)
|
|
|
|
|
+void __init bcm6345_periph_intc_init(int num_blocks, int *irq,
|
|
|
|
|
+ void __iomem **base, int num_words)
|
|
|
|
|
+{
|
|
|
|
|
+ __bcm6345_l2_intc_init(NULL, num_blocks, irq, base, num_words);
|
|
|
|
|
+ __bcm6345_periph_intc_init(NULL, num_blocks, irq, base, num_words);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+#ifdef CONFIG_OF
|
|
|
|
|
+static int __init bcm6345_l2_intc_of_init(struct device_node *node,
|
|
|
|
|
+ struct device_node *parent)
|
|
|
|
|
+static int __init bcm6345_periph_of_init(struct device_node *node,
|
|
|
|
|
+ struct device_node *parent)
|
|
|
|
|
+{
|
|
|
|
|
+ struct resource res;
|
|
|
|
|
+ int num_irqs, ret = -EINVAL;
|
|
|
|
@ -374,7 +419,7 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ ret = __bcm6345_l2_intc_init(node, num_irqs, irqs, bases, words);
|
|
|
|
|
+ ret = __bcm6345_periph_intc_init(node, num_irqs, irqs, bases, words);
|
|
|
|
|
+ if (!ret)
|
|
|
|
|
+ return 0;
|
|
|
|
|
+
|
|
|
|
@ -387,11 +432,11 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ return ret;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+IRQCHIP_DECLARE(bcm6345_l2_intc, "brcm,bcm6345-l2-intc",
|
|
|
|
|
+ bcm6345_l2_intc_of_init);
|
|
|
|
|
+IRQCHIP_DECLARE(bcm6345_periph_intc, "brcm,bcm6345-periph-intc",
|
|
|
|
|
+ bcm6345_periph_of_init);
|
|
|
|
|
+#endif
|
|
|
|
|
--- /dev/null
|
|
|
|
|
+++ b/include/linux/irqchip/irq-bcm6345-l2-intc.h
|
|
|
|
|
+++ b/include/linux/irqchip/irq-bcm6345-periph.h
|
|
|
|
|
@@ -0,0 +1,16 @@
|
|
|
|
|
+/*
|
|
|
|
|
+ * This file is subject to the terms and conditions of the GNU General Public
|
|
|
|
@ -402,10 +447,40 @@ Signed-off-by: Jonas Gorski <jogo@openwrt.org> |
|
|
|
|
+ * Copyright (C) 2008 Nicolas Schichan <nschichan@freebox.fr>
|
|
|
|
|
+ */
|
|
|
|
|
+
|
|
|
|
|
+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_L2_INTC_H
|
|
|
|
|
+#define __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_L2_INTC_H
|
|
|
|
|
+
|
|
|
|
|
+void bcm6345_l2_intc_init(int num_blocks, int *irq, void __iomem **base,
|
|
|
|
|
+ int num_words);
|
|
|
|
|
+
|
|
|
|
|
+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_L2_INTC_H */
|
|
|
|
|
+#ifndef __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H
|
|
|
|
|
+#define __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H
|
|
|
|
|
+
|
|
|
|
|
+void bcm6345_periph_intc_init(int num_blocks, int *irq, void __iomem **base,
|
|
|
|
|
+ int num_words);
|
|
|
|
|
+
|
|
|
|
|
+#endif /* __INCLUDE_LINUX_IRQCHIP_IRQ_BCM6345_PERIPH_H */
|
|
|
|
|
diff --git a/drivers/irqchip/irq-bcm6345-periph.c b/drivers/irqchip/irq-bcm6345-periph.c
|
|
|
|
|
index dfab88e..b280164 100644
|
|
|
|
|
--- a/drivers/irqchip/irq-bcm6345-periph.c
|
|
|
|
|
+++ b/drivers/irqchip/irq-bcm6345-periph.c
|
|
|
|
|
@@ -149,6 +149,7 @@ static int bcm6345_periph_set_affinity(struct irq_data *data,
|
|
|
|
|
irq_hw_number_t hwirq = irqd_to_hwirq(data);
|
|
|
|
|
struct intc_data *priv = data->domain->host_data;
|
|
|
|
|
unsigned int i, reg, bit;
|
|
|
|
|
+ unsigned long flags;
|
|
|
|
|
bool enabled;
|
|
|
|
|
int cpu;
|
|
|
|
|
|
|
|
|
|
@@ -168,7 +169,7 @@ static int bcm6345_periph_set_affinity(struct irq_data *data,
|
|
|
|
|
if (!priv->block[cpu].parent_irq)
|
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
|
|
- raw_spin_lock(&priv->lock);
|
|
|
|
|
+ raw_spin_lock_irqsave(&priv->lock, flags);
|
|
|
|
|
enabled = !irqd_irq_masked(data);
|
|
|
|
|
for (i = 0; i < MAX_PARENT_IRQS; i++) {
|
|
|
|
|
struct intc_block *block = &priv->block[i];
|
|
|
|
|
@@ -184,7 +185,7 @@ static int bcm6345_periph_set_affinity(struct irq_data *data,
|
|
|
|
|
__bcm6345_periph_enable(block, reg, bit, false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
- raw_spin_unlock(&priv->lock);
|
|
|
|
|
+ raw_spin_unlock_irqrestore(&priv->lock, flags);
|
|
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
}
|