17 #include <linux/kernel.h>
19 #include <linux/errno.h>
20 #include <linux/reboot.h>
21 #include <linux/slab.h>
22 #include <linux/stddef.h>
23 #include <linux/sched.h>
24 #include <linux/signal.h>
25 #include <linux/device.h>
180 return in_be32(base + (reg >> 2));
183 static inline void qe_ic_write(
volatile __be32 __iomem * base,
unsigned int reg,
189 static inline struct qe_ic *qe_ic_from_irq(
unsigned int virq)
191 return irq_get_chip_data(virq);
194 static inline struct qe_ic *qe_ic_from_irq_data(
struct irq_data *
d)
196 return irq_data_get_irq_chip_data(d);
199 static void qe_ic_unmask_irq(
struct irq_data *
d)
202 unsigned int src = irqd_to_hwirq(d);
208 temp = qe_ic_read(qe_ic->
regs, qe_ic_info[src].
mask_reg);
210 temp | qe_ic_info[src].
mask);
215 static void qe_ic_mask_irq(
struct irq_data *
d)
218 unsigned int src = irqd_to_hwirq(d);
224 temp = qe_ic_read(qe_ic->
regs, qe_ic_info[src].
mask_reg);
226 temp & ~qe_ic_info[src].
mask);
241 static struct irq_chip qe_ic_irq_chip = {
243 .irq_unmask = qe_ic_unmask_irq,
244 .irq_mask = qe_ic_mask_irq,
245 .irq_mask_ack = qe_ic_mask_irq,
254 static int qe_ic_host_map(
struct irq_domain *
h,
unsigned int virq,
260 if (qe_ic_info[hw].
mask == 0) {
276 .match = qe_ic_host_match,
277 .map = qe_ic_host_map,
314 void (*low_handler)(
unsigned int irq,
struct irq_desc *
desc),
315 void (*high_handler)(
unsigned int irq,
struct irq_desc *desc))
330 &qe_ic_host_ops, qe_ic);
338 qe_ic->
hc_irq = qe_ic_irq_chip;
373 irq_set_chained_handler(qe_ic->
virq_low, low_handler);
378 irq_set_chained_handler(qe_ic->
virq_high, high_handler);
384 struct qe_ic *qe_ic = qe_ic_from_irq(virq);
402 struct qe_ic *qe_ic = qe_ic_from_irq(virq);
406 if (priority > 8 || priority == 0)
410 if (qe_ic_info[src].pri_reg == 0)
413 temp = qe_ic_read(qe_ic->
regs, qe_ic_info[src].
pri_reg);
416 temp &= ~(0x7 << (32 - priority * 3));
417 temp |= qe_ic_info[
src].
pri_code << (32 - priority * 3);
419 temp &= ~(0x7 << (24 - priority * 3));
420 temp |= qe_ic_info[
src].
pri_code << (24 - priority * 3);
423 qe_ic_write(qe_ic->
regs, qe_ic_info[src].
pri_reg, temp);
431 struct qe_ic *qe_ic = qe_ic_from_irq(virq);
435 if (priority > 2 || priority == 0)
438 switch (qe_ic_info[src].pri_reg) {
464 temp = qe_ic_read(qe_ic->
regs, control_reg);
467 qe_ic_write(qe_ic->
regs, control_reg, temp);
472 static struct bus_type qe_ic_subsys = {
477 static struct device device_qe_ic = {
479 .bus = &qe_ic_subsys,
482 static int __init init_qe_ic_sysfs(
void)