Skip to contentSkip to conversation

sh: INTC IRQ domain and DT support prototype

PATCH New Magnus Damm 1 participant 1 message Mar 28, 2012 SuperH

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: INTC IRQ domain and DT support prototype

From: Magnus Damm <[email protected]>

This prototype patch hacks up IRQ Domain support for INTC.

Tested with DT on sh7372. Another incremental DT patch for sh7372 is needed to make use of this feature.

Probably needs to be reworked into something better looking.

Not-yet-signed-off-by Magnus Damm <[email protected]>

---

 drivers/sh/intc/chip.c      |    6 -
 drivers/sh/intc/core.c      |  149 ++++++++++++++++++++++++++++++++++++-------
 drivers/sh/intc/internals.h |    4 +
 include/linux/sh_intc.h     |    6 +
 4 files changed, 139 insertions(+), 26 deletions(-)
drivers/sh/intc/chip.c +3 -3
@@ -86,7 +86,7 @@ static void intc_mask_ack(struct irq_dat
 {
 	unsigned int irq = data->irq;
 	struct intc_desc_int *d = get_intc_desc(irq);
-	unsigned long handle = intc_get_ack_handle(irq);
+	unsigned long handle = intc_get_ack_handle(data->hwirq);
 	unsigned long addr;
 
 	intc_disable(data);
@@ -152,7 +152,7 @@ int intc_set_priority(unsigned int irq,
 	struct irq_data *data = irq_get_irq_data(irq);
 	struct intc_handle_int *ihp;
 
-	if (!intc_get_prio_level(irq) || prio <= 1)
+	if (!intc_get_prio_level(data->hwirq) || prio <= 1)
 		return -EINVAL;
 
 	ihp = intc_find_irq(d->prio, d->nr_prio, irq);
@@ -160,7 +160,7 @@ int intc_set_priority(unsigned int irq,
 		if (prio >= (1 << _INTC_WIDTH(ihp->handle)))
 			return -EINVAL;
 
-		intc_set_prio_level(irq, prio);
+		intc_set_prio_level(data->hwirq, prio);
 
 		/*
 		 * only set secondary masking method directly
drivers/sh/intc/core.c +126 -23

235 lines not on this page · raw message

drivers/sh/intc/internals.h +4 -0
@@ -5,6 +5,7 @@
 #include <linux/types.h>
 #include <linux/radix-tree.h>
 #include <linux/device.h>
+#include <linux/irqdomain.h>
 
 #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \
 	((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \
@@ -67,6 +68,9 @@ struct intc_desc_int {
 	struct intc_window *window;
 	unsigned int nr_windows;
 	struct irq_chip chip;
+#ifdef CONFIG_IRQ_DOMAIN
+	struct irq_domain domain;
+#endif
 	bool skip_suspend;
 };
 
include/linux/sh_intc.h +6 -0
@@ -116,6 +116,12 @@ struct intc_desc symbol __initdata = {
 }
 
 int register_intc_controller(struct intc_desc *desc);
+struct device_node;
+struct irq_domain_ops;
+int register_intc_controller_dt(struct intc_desc *desc,
+				struct device_node *node,
+				struct device_node *parent,
+				const struct irq_domain_ops *ops);
 void reserve_intc_vectors(struct intc_vect *vectors, unsigned int nr_vecs);
 int intc_set_priority(unsigned int irq, unsigned int prio);
 int intc_irq_lookup(const char *chipname, intc_enum enum_id);