All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v6 2/2] irqchip: add J-Core AIC driver
  2016-08-03  1:08 ` Rich Felker
  (?)
@ 2016-03-17 23:12     ` Rich Felker
  -1 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-03-17 23:12 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sh-u79uwXL29TY76Z2rM5mHXA
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

There are two versions of the J-Core interrupt controller in use, aic1
which generates interrupts with programmable priorities, but only
supports 8 irq lines and maps them to cpu traps in the range 17 to 24,
and aic2 which uses traps in the range 64-127 and supports up to 128
irqs, with priorities dependent on the interrupt number. The Linux
driver does not make use of priorities anyway.

For simplicity, there is no aic1-specific logic in the driver beyond
setting the priority register, which is necessary for interrupts to
work at all. Eventually aic1 will likely be phased out, but it's
currently in use in deployments and all released bitstream binaries.

Signed-off-by: Rich Felker <dalias@libc.org>
---
 drivers/irqchip/Kconfig         |  7 +++
 drivers/irqchip/Makefile        |  1 +
 drivers/irqchip/irq-jcore-aic.c | 94 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 5495a5b..ab84ce3 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -156,6 +156,13 @@ config PIC32_EVIC
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN
 
+config JCORE_AIC
+	bool "J-Core integrated AIC"
+	depends on OF && (SUPERH || COMPILE_TEST)
+	select IRQ_DOMAIN
+	help
+	  Support for the J-Core integrated AIC.
+
 config RENESAS_INTC_IRQPIN
 	bool
 	select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 4c203b6..ee7e3ca 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_I8259)			+= irq-i8259.o
 obj-$(CONFIG_IMGPDC_IRQ)		+= irq-imgpdc.o
 obj-$(CONFIG_IRQ_MIPS_CPU)		+= irq-mips-cpu.o
 obj-$(CONFIG_SIRF_IRQ)			+= irq-sirfsoc.o
+obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
diff --git a/drivers/irqchip/irq-jcore-aic.c b/drivers/irqchip/irq-jcore-aic.c
new file mode 100644
index 0000000..5e5e3bb
--- /dev/null
+++ b/drivers/irqchip/irq-jcore-aic.c
@@ -0,0 +1,94 @@
+/*
+ * J-Core SoC AIC driver
+ *
+ * Copyright (C) 2015-2016 Smart Energy Instruments, Inc.
+ *
+ * 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
+ * for more details.
+ */
+
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
+#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define JCORE_AIC_MAX_HWIRQ	127
+#define JCORE_AIC1_MIN_HWIRQ	16
+#define JCORE_AIC2_MIN_HWIRQ	64
+
+#define JCORE_AIC1_INTPRI_REG	8
+
+static struct irq_chip jcore_aic;
+
+static int jcore_aic_irqdomain_map(struct irq_domain *d, unsigned int irq,
+				   irq_hw_number_t hwirq)
+{
+	struct irq_chip *aic = d->host_data;
+
+	irq_set_chip_and_handler(irq, aic, handle_simple_irq);
+
+	return 0;
+}
+
+static const struct irq_domain_ops jcore_aic_irqdomain_ops = {
+	.map = jcore_aic_irqdomain_map,
+	.xlate = irq_domain_xlate_onecell,
+};
+
+static void noop(struct irq_data *data)
+{
+}
+
+int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
+{
+	unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
+	unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
+	struct irq_domain *domain;
+
+	pr_info("Initializing J-Core AIC\n");
+
+	/* AIC1 needs priority initialization to receive interrupts. */
+	if (of_device_is_compatible(node, "jcore,aic1")) {
+		unsigned cpu;
+
+		for_each_present_cpu(cpu) {
+			void __iomem *base = of_iomap(node, cpu);
+
+			if (!base) {
+				pr_err("Unable to map AIC for cpu %u\n", cpu);
+				return -ENOMEM;
+			}
+			__raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
+			iounmap(base);
+		}
+		min_irq = JCORE_AIC1_MIN_HWIRQ;
+	}
+
+	/*
+	 * The irq chip framework requires either mask/unmask or enable/disable
+	 * function pointers to be provided, but the hardware does not have any
+	 * such mechanism; the only interrupt masking is at the cpu level and
+	 * it affects all interrupts. We provide dummy mask/unmask. The hardware
+	 * handles all interrupt control and clears pending status when the cpu
+	 * accepts the interrupt.
+	 */
+	jcore_aic.irq_mask = noop;
+	jcore_aic.irq_unmask = noop;
+	jcore_aic.name = "AIC";
+
+	domain = irq_domain_add_linear(node, dom_sz, &jcore_aic_irqdomain_ops,
+				       &jcore_aic);
+	if (!domain)
+		return -ENOMEM;
+	irq_create_strict_mappings(domain, min_irq, min_irq, dom_sz - min_irq);
+
+	return 0;
+}
+
+IRQCHIP_DECLARE(jcore_aic2, "jcore,aic2", aic_irq_of_init);
+IRQCHIP_DECLARE(jcore_aic1, "jcore,aic1", aic_irq_of_init);
-- 
2.8.1


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

* [PATCH v6 2/2] irqchip: add J-Core AIC driver
@ 2016-03-17 23:12     ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-03-17 23:12 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

There are two versions of the J-Core interrupt controller in use, aic1
which generates interrupts with programmable priorities, but only
supports 8 irq lines and maps them to cpu traps in the range 17 to 24,
and aic2 which uses traps in the range 64-127 and supports up to 128
irqs, with priorities dependent on the interrupt number. The Linux
driver does not make use of priorities anyway.

For simplicity, there is no aic1-specific logic in the driver beyond
setting the priority register, which is necessary for interrupts to
work at all. Eventually aic1 will likely be phased out, but it's
currently in use in deployments and all released bitstream binaries.

Signed-off-by: Rich Felker <dalias@libc.org>
---
 drivers/irqchip/Kconfig         |  7 +++
 drivers/irqchip/Makefile        |  1 +
 drivers/irqchip/irq-jcore-aic.c | 94 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 5495a5b..ab84ce3 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -156,6 +156,13 @@ config PIC32_EVIC
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN
 
+config JCORE_AIC
+	bool "J-Core integrated AIC"
+	depends on OF && (SUPERH || COMPILE_TEST)
+	select IRQ_DOMAIN
+	help
+	  Support for the J-Core integrated AIC.
+
 config RENESAS_INTC_IRQPIN
 	bool
 	select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 4c203b6..ee7e3ca 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_I8259)			+= irq-i8259.o
 obj-$(CONFIG_IMGPDC_IRQ)		+= irq-imgpdc.o
 obj-$(CONFIG_IRQ_MIPS_CPU)		+= irq-mips-cpu.o
 obj-$(CONFIG_SIRF_IRQ)			+= irq-sirfsoc.o
+obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
diff --git a/drivers/irqchip/irq-jcore-aic.c b/drivers/irqchip/irq-jcore-aic.c
new file mode 100644
index 0000000..5e5e3bb
--- /dev/null
+++ b/drivers/irqchip/irq-jcore-aic.c
@@ -0,0 +1,94 @@
+/*
+ * J-Core SoC AIC driver
+ *
+ * Copyright (C) 2015-2016 Smart Energy Instruments, Inc.
+ *
+ * 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
+ * for more details.
+ */
+
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
+#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define JCORE_AIC_MAX_HWIRQ	127
+#define JCORE_AIC1_MIN_HWIRQ	16
+#define JCORE_AIC2_MIN_HWIRQ	64
+
+#define JCORE_AIC1_INTPRI_REG	8
+
+static struct irq_chip jcore_aic;
+
+static int jcore_aic_irqdomain_map(struct irq_domain *d, unsigned int irq,
+				   irq_hw_number_t hwirq)
+{
+	struct irq_chip *aic = d->host_data;
+
+	irq_set_chip_and_handler(irq, aic, handle_simple_irq);
+
+	return 0;
+}
+
+static const struct irq_domain_ops jcore_aic_irqdomain_ops = {
+	.map = jcore_aic_irqdomain_map,
+	.xlate = irq_domain_xlate_onecell,
+};
+
+static void noop(struct irq_data *data)
+{
+}
+
+int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
+{
+	unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
+	unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
+	struct irq_domain *domain;
+
+	pr_info("Initializing J-Core AIC\n");
+
+	/* AIC1 needs priority initialization to receive interrupts. */
+	if (of_device_is_compatible(node, "jcore,aic1")) {
+		unsigned cpu;
+
+		for_each_present_cpu(cpu) {
+			void __iomem *base = of_iomap(node, cpu);
+
+			if (!base) {
+				pr_err("Unable to map AIC for cpu %u\n", cpu);
+				return -ENOMEM;
+			}
+			__raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
+			iounmap(base);
+		}
+		min_irq = JCORE_AIC1_MIN_HWIRQ;
+	}
+
+	/*
+	 * The irq chip framework requires either mask/unmask or enable/disable
+	 * function pointers to be provided, but the hardware does not have any
+	 * such mechanism; the only interrupt masking is at the cpu level and
+	 * it affects all interrupts. We provide dummy mask/unmask. The hardware
+	 * handles all interrupt control and clears pending status when the cpu
+	 * accepts the interrupt.
+	 */
+	jcore_aic.irq_mask = noop;
+	jcore_aic.irq_unmask = noop;
+	jcore_aic.name = "AIC";
+
+	domain = irq_domain_add_linear(node, dom_sz, &jcore_aic_irqdomain_ops,
+				       &jcore_aic);
+	if (!domain)
+		return -ENOMEM;
+	irq_create_strict_mappings(domain, min_irq, min_irq, dom_sz - min_irq);
+
+	return 0;
+}
+
+IRQCHIP_DECLARE(jcore_aic2, "jcore,aic2", aic_irq_of_init);
+IRQCHIP_DECLARE(jcore_aic1, "jcore,aic1", aic_irq_of_init);
-- 
2.8.1

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

* [PATCH v6 2/2] irqchip: add J-Core AIC driver
@ 2016-03-17 23:12     ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-03-17 23:12 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sh-u79uwXL29TY76Z2rM5mHXA
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

There are two versions of the J-Core interrupt controller in use, aic1
which generates interrupts with programmable priorities, but only
supports 8 irq lines and maps them to cpu traps in the range 17 to 24,
and aic2 which uses traps in the range 64-127 and supports up to 128
irqs, with priorities dependent on the interrupt number. The Linux
driver does not make use of priorities anyway.

For simplicity, there is no aic1-specific logic in the driver beyond
setting the priority register, which is necessary for interrupts to
work at all. Eventually aic1 will likely be phased out, but it's
currently in use in deployments and all released bitstream binaries.

Signed-off-by: Rich Felker <dalias-8zAoT0mYgF4@public.gmane.org>
---
 drivers/irqchip/Kconfig         |  7 +++
 drivers/irqchip/Makefile        |  1 +
 drivers/irqchip/irq-jcore-aic.c | 94 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 5495a5b..ab84ce3 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -156,6 +156,13 @@ config PIC32_EVIC
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN
 
+config JCORE_AIC
+	bool "J-Core integrated AIC"
+	depends on OF && (SUPERH || COMPILE_TEST)
+	select IRQ_DOMAIN
+	help
+	  Support for the J-Core integrated AIC.
+
 config RENESAS_INTC_IRQPIN
 	bool
 	select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 4c203b6..ee7e3ca 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_I8259)			+= irq-i8259.o
 obj-$(CONFIG_IMGPDC_IRQ)		+= irq-imgpdc.o
 obj-$(CONFIG_IRQ_MIPS_CPU)		+= irq-mips-cpu.o
 obj-$(CONFIG_SIRF_IRQ)			+= irq-sirfsoc.o
+obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
diff --git a/drivers/irqchip/irq-jcore-aic.c b/drivers/irqchip/irq-jcore-aic.c
new file mode 100644
index 0000000..5e5e3bb
--- /dev/null
+++ b/drivers/irqchip/irq-jcore-aic.c
@@ -0,0 +1,94 @@
+/*
+ * J-Core SoC AIC driver
+ *
+ * Copyright (C) 2015-2016 Smart Energy Instruments, Inc.
+ *
+ * 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
+ * for more details.
+ */
+
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
+#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define JCORE_AIC_MAX_HWIRQ	127
+#define JCORE_AIC1_MIN_HWIRQ	16
+#define JCORE_AIC2_MIN_HWIRQ	64
+
+#define JCORE_AIC1_INTPRI_REG	8
+
+static struct irq_chip jcore_aic;
+
+static int jcore_aic_irqdomain_map(struct irq_domain *d, unsigned int irq,
+				   irq_hw_number_t hwirq)
+{
+	struct irq_chip *aic = d->host_data;
+
+	irq_set_chip_and_handler(irq, aic, handle_simple_irq);
+
+	return 0;
+}
+
+static const struct irq_domain_ops jcore_aic_irqdomain_ops = {
+	.map = jcore_aic_irqdomain_map,
+	.xlate = irq_domain_xlate_onecell,
+};
+
+static void noop(struct irq_data *data)
+{
+}
+
+int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
+{
+	unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
+	unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
+	struct irq_domain *domain;
+
+	pr_info("Initializing J-Core AIC\n");
+
+	/* AIC1 needs priority initialization to receive interrupts. */
+	if (of_device_is_compatible(node, "jcore,aic1")) {
+		unsigned cpu;
+
+		for_each_present_cpu(cpu) {
+			void __iomem *base = of_iomap(node, cpu);
+
+			if (!base) {
+				pr_err("Unable to map AIC for cpu %u\n", cpu);
+				return -ENOMEM;
+			}
+			__raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
+			iounmap(base);
+		}
+		min_irq = JCORE_AIC1_MIN_HWIRQ;
+	}
+
+	/*
+	 * The irq chip framework requires either mask/unmask or enable/disable
+	 * function pointers to be provided, but the hardware does not have any
+	 * such mechanism; the only interrupt masking is at the cpu level and
+	 * it affects all interrupts. We provide dummy mask/unmask. The hardware
+	 * handles all interrupt control and clears pending status when the cpu
+	 * accepts the interrupt.
+	 */
+	jcore_aic.irq_mask = noop;
+	jcore_aic.irq_unmask = noop;
+	jcore_aic.name = "AIC";
+
+	domain = irq_domain_add_linear(node, dom_sz, &jcore_aic_irqdomain_ops,
+				       &jcore_aic);
+	if (!domain)
+		return -ENOMEM;
+	irq_create_strict_mappings(domain, min_irq, min_irq, dom_sz - min_irq);
+
+	return 0;
+}
+
+IRQCHIP_DECLARE(jcore_aic2, "jcore,aic2", aic_irq_of_init);
+IRQCHIP_DECLARE(jcore_aic1, "jcore,aic1", aic_irq_of_init);
-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 1/2] of: add J-Core interrupt controller bindings
  2016-08-03  1:08 ` Rich Felker
                   ` (2 preceding siblings ...)
  (?)
@ 2016-05-17 23:18 ` Rich Felker
  -1 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-05-17 23:18 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Signed-off-by: Rich Felker <dalias@libc.org>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt

diff --git a/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
new file mode 100644
index 0000000..ee2ad36
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
@@ -0,0 +1,26 @@
+J-Core Advanced Interrupt Controller
+
+Required properties:
+
+- compatible: Should be "jcore,aic1" for the (obsolete) first-generation aic
+  with 8 interrupt lines with programmable priorities, or "jcore,aic2" for
+  the "aic2" core with 64 interrupts.
+
+- reg: Memory region(s) for configuration. For SMP, there should be one
+  region per cpu, indexed by the sequential, zero-based hardware cpu
+  number.
+
+- interrupt-controller: Identifies the node as an interrupt controller
+
+- #interrupt-cells: Specifies the number of cells needed to encode an
+  interrupt source. The value shall be 1.
+
+
+Example:
+
+aic: interrupt-controller@200 {
+	compatible = "jcore,aic2";
+	reg = < 0x200 0x30 0x500 0x30 >;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+};
-- 
2.8.1



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

* [PATCH v6 0/2] J-Core interrupt controller support
@ 2016-08-03  1:08 ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-03  1:08 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sh-u79uwXL29TY76Z2rM5mHXA
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Updated based on feedback from Thomas Gleixner. Removal of unnecessary
data allowed some simplification. Magic numbers have been replaced
with meaningful (I hope) macro constants, comments added, and minor
style issues fixed.

Also, driver was made conditional in Kconfig to avoid it showing up in
configurations where it's not relevant.

Rich


Rich Felker (2):
  of: add J-Core interrupt controller bindings
  irqchip: add J-Core AIC driver

 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
 drivers/irqchip/Kconfig                            |  7 ++
 drivers/irqchip/Makefile                           |  1 +
 drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

-- 
2.8.1


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

* [PATCH v6 0/2] J-Core interrupt controller support
@ 2016-08-03  1:08 ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-03  1:08 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Updated based on feedback from Thomas Gleixner. Removal of unnecessary
data allowed some simplification. Magic numbers have been replaced
with meaningful (I hope) macro constants, comments added, and minor
style issues fixed.

Also, driver was made conditional in Kconfig to avoid it showing up in
configurations where it's not relevant.

Rich


Rich Felker (2):
  of: add J-Core interrupt controller bindings
  irqchip: add J-Core AIC driver

 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
 drivers/irqchip/Kconfig                            |  7 ++
 drivers/irqchip/Makefile                           |  1 +
 drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

-- 
2.8.1

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

* [PATCH v6 0/2] J-Core interrupt controller support
@ 2016-08-03  1:08 ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-03  1:08 UTC (permalink / raw)
  To: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	devicetree-u79uwXL29TY76Z2rM5mHXA,
	linux-sh-u79uwXL29TY76Z2rM5mHXA
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Updated based on feedback from Thomas Gleixner. Removal of unnecessary
data allowed some simplification. Magic numbers have been replaced
with meaningful (I hope) macro constants, comments added, and minor
style issues fixed.

Also, driver was made conditional in Kconfig to avoid it showing up in
configurations where it's not relevant.

Rich


Rich Felker (2):
  of: add J-Core interrupt controller bindings
  irqchip: add J-Core AIC driver

 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
 drivers/irqchip/Kconfig                            |  7 ++
 drivers/irqchip/Makefile                           |  1 +
 drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

-- 
2.8.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* [PATCH v6 0/2] J-Core interrupt controller support
@ 2016-08-04  4:30   ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-04  4:30 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Updated based on feedback from Thomas Gleixner. Removal of unnecessary
data allowed some simplification. Magic numbers have been replaced
with meaningful (I hope) macro constants, comments added, and minor
style issues fixed.

Also, driver was made conditional in Kconfig to avoid it showing up in
configurations where it's not relevant.

Rich


Rich Felker (2):
  of: add J-Core interrupt controller bindings
  irqchip: add J-Core AIC driver

 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
 drivers/irqchip/Kconfig                            |  7 ++
 drivers/irqchip/Makefile                           |  1 +
 drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

-- 
2.8.1


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

* [PATCH v6 0/2] J-Core interrupt controller support
@ 2016-08-04  4:30   ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-04  4:30 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Updated based on feedback from Thomas Gleixner. Removal of unnecessary
data allowed some simplification. Magic numbers have been replaced
with meaningful (I hope) macro constants, comments added, and minor
style issues fixed.

Also, driver was made conditional in Kconfig to avoid it showing up in
configurations where it's not relevant.

Rich


Rich Felker (2):
  of: add J-Core interrupt controller bindings
  irqchip: add J-Core AIC driver

 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
 drivers/irqchip/Kconfig                            |  7 ++
 drivers/irqchip/Makefile                           |  1 +
 drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
 4 files changed, 128 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

-- 
2.8.1

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

* [PATCH v6 2/2] irqchip: add J-Core AIC driver
  2016-08-04  4:30   ` Rich Felker
  (?)
@ 2016-08-04  4:30   ` Rich Felker
  2016-08-04 14:32       ` Geert Uytterhoeven
  -1 siblings, 1 reply; 18+ messages in thread
From: Rich Felker @ 2016-08-04  4:30 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

There are two versions of the J-Core interrupt controller in use, aic1
which generates interrupts with programmable priorities, but only
supports 8 irq lines and maps them to cpu traps in the range 17 to 24,
and aic2 which uses traps in the range 64-127 and supports up to 128
irqs, with priorities dependent on the interrupt number. The Linux
driver does not make use of priorities anyway.

For simplicity, there is no aic1-specific logic in the driver beyond
setting the priority register, which is necessary for interrupts to
work at all. Eventually aic1 will likely be phased out, but it's
currently in use in deployments and all released bitstream binaries.

Signed-off-by: Rich Felker <dalias@libc.org>
---
 drivers/irqchip/Kconfig         |  7 +++
 drivers/irqchip/Makefile        |  1 +
 drivers/irqchip/irq-jcore-aic.c | 94 +++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+)
 create mode 100644 drivers/irqchip/irq-jcore-aic.c

diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig
index 5495a5b..ab84ce3 100644
--- a/drivers/irqchip/Kconfig
+++ b/drivers/irqchip/Kconfig
@@ -156,6 +156,13 @@ config PIC32_EVIC
 	select GENERIC_IRQ_CHIP
 	select IRQ_DOMAIN
 
+config JCORE_AIC
+	bool "J-Core integrated AIC"
+	depends on OF && (SUPERH || COMPILE_TEST)
+	select IRQ_DOMAIN
+	help
+	  Support for the J-Core integrated AIC.
+
 config RENESAS_INTC_IRQPIN
 	bool
 	select IRQ_DOMAIN
diff --git a/drivers/irqchip/Makefile b/drivers/irqchip/Makefile
index 4c203b6..ee7e3ca 100644
--- a/drivers/irqchip/Makefile
+++ b/drivers/irqchip/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_I8259)			+= irq-i8259.o
 obj-$(CONFIG_IMGPDC_IRQ)		+= irq-imgpdc.o
 obj-$(CONFIG_IRQ_MIPS_CPU)		+= irq-mips-cpu.o
 obj-$(CONFIG_SIRF_IRQ)			+= irq-sirfsoc.o
+obj-$(CONFIG_JCORE_AIC)			+= irq-jcore-aic.o
 obj-$(CONFIG_RENESAS_INTC_IRQPIN)	+= irq-renesas-intc-irqpin.o
 obj-$(CONFIG_RENESAS_IRQC)		+= irq-renesas-irqc.o
 obj-$(CONFIG_VERSATILE_FPGA_IRQ)	+= irq-versatile-fpga.o
diff --git a/drivers/irqchip/irq-jcore-aic.c b/drivers/irqchip/irq-jcore-aic.c
new file mode 100644
index 0000000..5e5e3bb
--- /dev/null
+++ b/drivers/irqchip/irq-jcore-aic.c
@@ -0,0 +1,94 @@
+/*
+ * J-Core SoC AIC driver
+ *
+ * Copyright (C) 2015-2016 Smart Energy Instruments, Inc.
+ *
+ * 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
+ * for more details.
+ */
+
+#include <linux/irq.h>
+#include <linux/io.h>
+#include <linux/irqchip.h>
+#include <linux/irqdomain.h>
+#include <linux/cpu.h>
+#include <linux/of.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+
+#define JCORE_AIC_MAX_HWIRQ	127
+#define JCORE_AIC1_MIN_HWIRQ	16
+#define JCORE_AIC2_MIN_HWIRQ	64
+
+#define JCORE_AIC1_INTPRI_REG	8
+
+static struct irq_chip jcore_aic;
+
+static int jcore_aic_irqdomain_map(struct irq_domain *d, unsigned int irq,
+				   irq_hw_number_t hwirq)
+{
+	struct irq_chip *aic = d->host_data;
+
+	irq_set_chip_and_handler(irq, aic, handle_simple_irq);
+
+	return 0;
+}
+
+static const struct irq_domain_ops jcore_aic_irqdomain_ops = {
+	.map = jcore_aic_irqdomain_map,
+	.xlate = irq_domain_xlate_onecell,
+};
+
+static void noop(struct irq_data *data)
+{
+}
+
+int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
+{
+	unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
+	unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
+	struct irq_domain *domain;
+
+	pr_info("Initializing J-Core AIC\n");
+
+	/* AIC1 needs priority initialization to receive interrupts. */
+	if (of_device_is_compatible(node, "jcore,aic1")) {
+		unsigned cpu;
+
+		for_each_present_cpu(cpu) {
+			void __iomem *base = of_iomap(node, cpu);
+
+			if (!base) {
+				pr_err("Unable to map AIC for cpu %u\n", cpu);
+				return -ENOMEM;
+			}
+			__raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
+			iounmap(base);
+		}
+		min_irq = JCORE_AIC1_MIN_HWIRQ;
+	}
+
+	/*
+	 * The irq chip framework requires either mask/unmask or enable/disable
+	 * function pointers to be provided, but the hardware does not have any
+	 * such mechanism; the only interrupt masking is at the cpu level and
+	 * it affects all interrupts. We provide dummy mask/unmask. The hardware
+	 * handles all interrupt control and clears pending status when the cpu
+	 * accepts the interrupt.
+	 */
+	jcore_aic.irq_mask = noop;
+	jcore_aic.irq_unmask = noop;
+	jcore_aic.name = "AIC";
+
+	domain = irq_domain_add_linear(node, dom_sz, &jcore_aic_irqdomain_ops,
+				       &jcore_aic);
+	if (!domain)
+		return -ENOMEM;
+	irq_create_strict_mappings(domain, min_irq, min_irq, dom_sz - min_irq);
+
+	return 0;
+}
+
+IRQCHIP_DECLARE(jcore_aic2, "jcore,aic2", aic_irq_of_init);
+IRQCHIP_DECLARE(jcore_aic1, "jcore,aic1", aic_irq_of_init);
-- 
2.8.1


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

* [PATCH v6 1/2] of: add J-Core interrupt controller bindings
  2016-08-04  4:30   ` Rich Felker
  (?)
  (?)
@ 2016-08-04  4:30   ` Rich Felker
  -1 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-04  4:30 UTC (permalink / raw)
  To: linux-kernel, devicetree, linux-sh
  Cc: Thomas Gleixner, Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Signed-off-by: Rich Felker <dalias@libc.org>
Acked-by: Rob Herring <robh@kernel.org>
---
 .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++++++++++++++++++
 1 file changed, 26 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt

diff --git a/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
new file mode 100644
index 0000000..ee2ad36
--- /dev/null
+++ b/Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
@@ -0,0 +1,26 @@
+J-Core Advanced Interrupt Controller
+
+Required properties:
+
+- compatible: Should be "jcore,aic1" for the (obsolete) first-generation aic
+  with 8 interrupt lines with programmable priorities, or "jcore,aic2" for
+  the "aic2" core with 64 interrupts.
+
+- reg: Memory region(s) for configuration. For SMP, there should be one
+  region per cpu, indexed by the sequential, zero-based hardware cpu
+  number.
+
+- interrupt-controller: Identifies the node as an interrupt controller
+
+- #interrupt-cells: Specifies the number of cells needed to encode an
+  interrupt source. The value shall be 1.
+
+
+Example:
+
+aic: interrupt-controller@200 {
+	compatible = "jcore,aic2";
+	reg = < 0x200 0x30 0x500 0x30 >;
+	interrupt-controller;
+	#interrupt-cells = <1>;
+};
-- 
2.8.1



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

* Re: [PATCH v6 0/2] J-Core interrupt controller support
  2016-08-04  4:30   ` Rich Felker
@ 2016-08-04 14:31     ` Jason Cooper
  -1 siblings, 0 replies; 18+ messages in thread
From: Jason Cooper @ 2016-08-04 14:31 UTC (permalink / raw)
  To: Rich Felker
  Cc: linux-kernel, devicetree, linux-sh, Thomas Gleixner,
	Marc Zyngier, Rob Herring, Mark Rutland

Hi Rich,

On Thu, Aug 04, 2016 at 04:30:36AM +0000, Rich Felker wrote:
> Updated based on feedback from Thomas Gleixner. Removal of unnecessary
> data allowed some simplification. Magic numbers have been replaced
> with meaningful (I hope) macro constants, comments added, and minor
> style issues fixed.
> 
> Also, driver was made conditional in Kconfig to avoid it showing up in
> configurations where it's not relevant.
> 
> Rich
> 
> 
> Rich Felker (2):
>   of: add J-Core interrupt controller bindings
>   irqchip: add J-Core AIC driver
> 
>  .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
>  drivers/irqchip/Kconfig                            |  7 ++
>  drivers/irqchip/Makefile                           |  1 +
>  drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
>  4 files changed, 128 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
>  create mode 100644 drivers/irqchip/irq-jcore-aic.c

Once -rc1 drops, I'll put this in a branch, irqchip/jcore.  You can then
include it as a dep for other branches as needed.

thx,

Jason.

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

* Re: [PATCH v6 0/2] J-Core interrupt controller support
@ 2016-08-04 14:31     ` Jason Cooper
  0 siblings, 0 replies; 18+ messages in thread
From: Jason Cooper @ 2016-08-04 14:31 UTC (permalink / raw)
  To: Rich Felker
  Cc: linux-kernel, devicetree, linux-sh, Thomas Gleixner,
	Marc Zyngier, Rob Herring, Mark Rutland

Hi Rich,

On Thu, Aug 04, 2016 at 04:30:36AM +0000, Rich Felker wrote:
> Updated based on feedback from Thomas Gleixner. Removal of unnecessary
> data allowed some simplification. Magic numbers have been replaced
> with meaningful (I hope) macro constants, comments added, and minor
> style issues fixed.
> 
> Also, driver was made conditional in Kconfig to avoid it showing up in
> configurations where it's not relevant.
> 
> Rich
> 
> 
> Rich Felker (2):
>   of: add J-Core interrupt controller bindings
>   irqchip: add J-Core AIC driver
> 
>  .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
>  drivers/irqchip/Kconfig                            |  7 ++
>  drivers/irqchip/Makefile                           |  1 +
>  drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
>  4 files changed, 128 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
>  create mode 100644 drivers/irqchip/irq-jcore-aic.c

Once -rc1 drops, I'll put this in a branch, irqchip/jcore.  You can then
include it as a dep for other branches as needed.

thx,

Jason.

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

* Re: [PATCH v6 2/2] irqchip: add J-Core AIC driver
  2016-08-04  4:30   ` [PATCH v6 2/2] irqchip: add J-Core AIC driver Rich Felker
@ 2016-08-04 14:32       ` Geert Uytterhoeven
  0 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2016-08-04 14:32 UTC (permalink / raw)
  To: Rich Felker
  Cc: linux-kernel, devicetree, Linux-sh list, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Hi Rich,

On Thu, Aug 4, 2016 at 6:30 AM, Rich Felker <dalias@libc.org> wrote:
> --- /dev/null
> +++ b/drivers/irqchip/irq-jcore-aic.c

> +int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
> +{
> +       unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
> +       unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
> +       struct irq_domain *domain;
> +
> +       pr_info("Initializing J-Core AIC\n");
> +
> +       /* AIC1 needs priority initialization to receive interrupts. */
> +       if (of_device_is_compatible(node, "jcore,aic1")) {
> +               unsigned cpu;
> +
> +               for_each_present_cpu(cpu) {
> +                       void __iomem *base = of_iomap(node, cpu);

Just double checking, these regions are per-cpu hardware registers,
and not related to other functionality at all?

I.e. when booting on an SMP-capable system a kernel compiled with
CONFIG_SMP=n, or using the kernel command line option maxcpusto reduce the number of CPUs, no ill effects happen by not mapping the
region and not writing to the register below?

> +
> +                       if (!base) {
> +                               pr_err("Unable to map AIC for cpu %u\n", cpu);
> +                               return -ENOMEM;
> +                       }
> +                       __raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
> +                       iounmap(base);
> +               }
> +               min_irq = JCORE_AIC1_MIN_HWIRQ;
> +       }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v6 2/2] irqchip: add J-Core AIC driver
@ 2016-08-04 14:32       ` Geert Uytterhoeven
  0 siblings, 0 replies; 18+ messages in thread
From: Geert Uytterhoeven @ 2016-08-04 14:32 UTC (permalink / raw)
  To: Rich Felker
  Cc: linux-kernel, devicetree, Linux-sh list, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

Hi Rich,

On Thu, Aug 4, 2016 at 6:30 AM, Rich Felker <dalias@libc.org> wrote:
> --- /dev/null
> +++ b/drivers/irqchip/irq-jcore-aic.c

> +int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
> +{
> +       unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
> +       unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
> +       struct irq_domain *domain;
> +
> +       pr_info("Initializing J-Core AIC\n");
> +
> +       /* AIC1 needs priority initialization to receive interrupts. */
> +       if (of_device_is_compatible(node, "jcore,aic1")) {
> +               unsigned cpu;
> +
> +               for_each_present_cpu(cpu) {
> +                       void __iomem *base = of_iomap(node, cpu);

Just double checking, these regions are per-cpu hardware registers,
and not related to other functionality at all?

I.e. when booting on an SMP-capable system a kernel compiled with
CONFIG_SMP=n, or using the kernel command line option maxcpus=
to reduce the number of CPUs, no ill effects happen by not mapping the
region and not writing to the register below?

> +
> +                       if (!base) {
> +                               pr_err("Unable to map AIC for cpu %u\n", cpu);
> +                               return -ENOMEM;
> +                       }
> +                       __raw_writel(0xffffffff, base + JCORE_AIC1_INTPRI_REG);
> +                       iounmap(base);
> +               }
> +               min_irq = JCORE_AIC1_MIN_HWIRQ;
> +       }

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH v6 2/2] irqchip: add J-Core AIC driver
  2016-08-04 14:32       ` Geert Uytterhoeven
@ 2016-08-04 16:42         ` Rich Felker
  -1 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-04 16:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kernel, devicetree, Linux-sh list, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

On Thu, Aug 04, 2016 at 04:32:57PM +0200, Geert Uytterhoeven wrote:
> Hi Rich,
> 
> On Thu, Aug 4, 2016 at 6:30 AM, Rich Felker <dalias@libc.org> wrote:
> > --- /dev/null
> > +++ b/drivers/irqchip/irq-jcore-aic.c
> 
> > +int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
> > +{
> > +       unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
> > +       unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
> > +       struct irq_domain *domain;
> > +
> > +       pr_info("Initializing J-Core AIC\n");
> > +
> > +       /* AIC1 needs priority initialization to receive interrupts. */
> > +       if (of_device_is_compatible(node, "jcore,aic1")) {
> > +               unsigned cpu;
> > +
> > +               for_each_present_cpu(cpu) {
> > +                       void __iomem *base = of_iomap(node, cpu);
> 
> Just double checking, these regions are per-cpu hardware registers,
> and not related to other functionality at all?
> 
> I.e. when booting on an SMP-capable system a kernel compiled with
> CONFIG_SMP=n, or using the kernel command line option maxcpus> to reduce the number of CPUs, no ill effects happen by not mapping the
> region and not writing to the register below?

If you're not using a secondary cpu, there's no harm in ignoring its
aic completely.

Rich

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

* Re: [PATCH v6 2/2] irqchip: add J-Core AIC driver
@ 2016-08-04 16:42         ` Rich Felker
  0 siblings, 0 replies; 18+ messages in thread
From: Rich Felker @ 2016-08-04 16:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: linux-kernel, devicetree, Linux-sh list, Thomas Gleixner,
	Jason Cooper, Marc Zyngier, Rob Herring, Mark Rutland

On Thu, Aug 04, 2016 at 04:32:57PM +0200, Geert Uytterhoeven wrote:
> Hi Rich,
> 
> On Thu, Aug 4, 2016 at 6:30 AM, Rich Felker <dalias@libc.org> wrote:
> > --- /dev/null
> > +++ b/drivers/irqchip/irq-jcore-aic.c
> 
> > +int __init aic_irq_of_init(struct device_node *node, struct device_node *parent)
> > +{
> > +       unsigned min_irq = JCORE_AIC2_MIN_HWIRQ;
> > +       unsigned dom_sz = JCORE_AIC_MAX_HWIRQ+1;
> > +       struct irq_domain *domain;
> > +
> > +       pr_info("Initializing J-Core AIC\n");
> > +
> > +       /* AIC1 needs priority initialization to receive interrupts. */
> > +       if (of_device_is_compatible(node, "jcore,aic1")) {
> > +               unsigned cpu;
> > +
> > +               for_each_present_cpu(cpu) {
> > +                       void __iomem *base = of_iomap(node, cpu);
> 
> Just double checking, these regions are per-cpu hardware registers,
> and not related to other functionality at all?
> 
> I.e. when booting on an SMP-capable system a kernel compiled with
> CONFIG_SMP=n, or using the kernel command line option maxcpus=
> to reduce the number of CPUs, no ill effects happen by not mapping the
> region and not writing to the register below?

If you're not using a secondary cpu, there's no harm in ignoring its
aic completely.

Rich

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

* Re: [PATCH v6 0/2] J-Core interrupt controller support
  2016-08-04 14:31     ` Jason Cooper
  (?)
@ 2016-08-16 13:53     ` Jason Cooper
  -1 siblings, 0 replies; 18+ messages in thread
From: Jason Cooper @ 2016-08-16 13:53 UTC (permalink / raw)
  To: Rich Felker
  Cc: linux-kernel, devicetree, linux-sh, Thomas Gleixner,
	Marc Zyngier, Rob Herring, Mark Rutland

Hi Rich,

On Thu, Aug 04, 2016 at 02:31:18PM +0000, Jason Cooper wrote:
> On Thu, Aug 04, 2016 at 04:30:36AM +0000, Rich Felker wrote:
> > Updated based on feedback from Thomas Gleixner. Removal of unnecessary
> > data allowed some simplification. Magic numbers have been replaced
> > with meaningful (I hope) macro constants, comments added, and minor
> > style issues fixed.
> > 
> > Also, driver was made conditional in Kconfig to avoid it showing up in
> > configurations where it's not relevant.
> > 
> > Rich
> > 
> > 
> > Rich Felker (2):
> >   of: add J-Core interrupt controller bindings
> >   irqchip: add J-Core AIC driver
> > 
> >  .../bindings/interrupt-controller/jcore,aic.txt    | 26 ++++++
> >  drivers/irqchip/Kconfig                            |  7 ++
> >  drivers/irqchip/Makefile                           |  1 +
> >  drivers/irqchip/irq-jcore-aic.c                    | 94 ++++++++++++++++++++++
> >  4 files changed, 128 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/interrupt-controller/jcore,aic.txt
> >  create mode 100644 drivers/irqchip/irq-jcore-aic.c
> 
> Once -rc1 drops, I'll put this in a branch, irqchip/jcore.  You can then
> include it as a dep for other branches as needed.

This is now up and should appear in -next.

thx,

Jason.

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

end of thread, other threads:[~2016-08-16 13:53 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-03  1:08 [PATCH v6 0/2] J-Core interrupt controller support Rich Felker
2016-08-03  1:08 ` Rich Felker
2016-08-03  1:08 ` Rich Felker
     [not found] ` <cover.1470186529.git.dalias-8zAoT0mYgF4@public.gmane.org>
2016-03-17 23:12   ` [PATCH v6 2/2] irqchip: add J-Core AIC driver Rich Felker
2016-03-17 23:12     ` Rich Felker
2016-03-17 23:12     ` Rich Felker
2016-05-17 23:18 ` [PATCH v6 1/2] of: add J-Core interrupt controller bindings Rich Felker
2016-08-04  4:30 ` [PATCH v6 0/2] J-Core interrupt controller support Rich Felker
2016-08-04  4:30   ` Rich Felker
2016-08-04  4:30   ` [PATCH v6 2/2] irqchip: add J-Core AIC driver Rich Felker
2016-08-04 14:32     ` Geert Uytterhoeven
2016-08-04 14:32       ` Geert Uytterhoeven
2016-08-04 16:42       ` Rich Felker
2016-08-04 16:42         ` Rich Felker
2016-08-04  4:30   ` [PATCH v6 1/2] of: add J-Core interrupt controller bindings Rich Felker
2016-08-04 14:31   ` [PATCH v6 0/2] J-Core interrupt controller support Jason Cooper
2016-08-04 14:31     ` Jason Cooper
2016-08-16 13:53     ` Jason Cooper

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.