13 #include <linux/kernel.h>
15 #include <linux/errno.h>
16 #include <linux/reboot.h>
17 #include <linux/slab.h>
18 #include <linux/stddef.h>
19 #include <linux/sched.h>
20 #include <linux/signal.h>
21 #include <linux/device.h>
32 #define NR_UIC_INTS 32
55 static void uic_unmask_irq(
struct irq_data *
d)
57 struct uic *
uic = irq_data_get_irq_chip_data(d);
58 unsigned int src = irqd_to_hwirq(d);
65 if (irqd_is_level_type(d))
73 static void uic_mask_irq(
struct irq_data *
d)
75 struct uic *
uic = irq_data_get_irq_chip_data(d);
76 unsigned int src = irqd_to_hwirq(d);
82 er &= ~(1 << (31 -
src));
87 static void uic_ack_irq(
struct irq_data *
d)
89 struct uic *
uic = irq_data_get_irq_chip_data(d);
90 unsigned int src = irqd_to_hwirq(d);
98 static void uic_mask_ack_irq(
struct irq_data *
d)
100 struct uic *
uic = irq_data_get_irq_chip_data(d);
101 unsigned int src = irqd_to_hwirq(d);
118 if (!irqd_is_level_type(d))
123 static int uic_set_irq_type(
struct irq_data *d,
unsigned int flow_type)
125 struct uic *uic = irq_data_get_irq_chip_data(d);
126 unsigned int src = irqd_to_hwirq(d);
137 trigger = 1; polarity = 1;
140 trigger = 1; polarity = 0;
143 trigger = 0; polarity = 1;
146 trigger = 0; polarity = 0;
152 mask = ~(1 << (31 -
src));
157 tr = (tr &
mask) | (trigger << (31-src));
158 pr = (pr &
mask) | (polarity << (31-src));
168 static struct irq_chip uic_irq_chip = {
170 .irq_unmask = uic_unmask_irq,
171 .irq_mask = uic_mask_irq,
172 .irq_mask_ack = uic_mask_ack_irq,
173 .irq_ack = uic_ack_irq,
174 .irq_set_type = uic_set_irq_type,
177 static int uic_host_map(
struct irq_domain *
h,
unsigned int virq,
201 struct irq_data *idata = irq_desc_get_irq_data(desc);
202 struct uic *uic = irq_get_handler_data(virq);
208 if (irqd_is_level_type(idata))
225 if (irqd_is_level_type(idata))
227 if (!irqd_irq_disabled(idata) && chip->
irq_unmask)
235 const u32 *indexp, *dcrreg;
246 if (!indexp || (len !=
sizeof(
u32))) {
248 "cell-index property\n", node->
full_name);
251 uic->
index = *indexp;
254 if (!dcrreg || (len != 2*
sizeof(
u32))) {
273 printk (
"UIC%d (%d IRQ sources) at DCR 0x%x\n", uic->
index,
283 const u32 *interrupts;
286 for_each_compatible_node(np,
NULL,
"ibm,uic") {
294 primary_uic = uic_init_one(np);
302 for_each_compatible_node(np,
NULL,
"ibm,uic") {
308 uic = uic_init_one(np);
310 panic(
"Unable to initialize a secondary UIC %s\n",