0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #define pr_fmt(fmt) "intc: " fmt
0011
0012 #include <linux/irqdomain.h>
0013 #include <linux/sh_intc.h>
0014 #include <linux/export.h>
0015 #include "internals.h"
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027 static int intc_evt_xlate(struct irq_domain *d, struct device_node *ctrlr,
0028 const u32 *intspec, unsigned int intsize,
0029 unsigned long *out_hwirq, unsigned int *out_type)
0030 {
0031 if (WARN_ON(intsize < 1))
0032 return -EINVAL;
0033
0034 *out_hwirq = evt2irq(intspec[0]);
0035 *out_type = IRQ_TYPE_NONE;
0036
0037 return 0;
0038 }
0039
0040 static const struct irq_domain_ops intc_evt_ops = {
0041 .xlate = intc_evt_xlate,
0042 };
0043
0044 void __init intc_irq_domain_init(struct intc_desc_int *d,
0045 struct intc_hw_desc *hw)
0046 {
0047 unsigned int irq_base, irq_end;
0048
0049
0050
0051
0052 irq_base = evt2irq(hw->vectors[0].vect);
0053 irq_end = evt2irq(hw->vectors[hw->nr_vectors - 1].vect);
0054
0055
0056
0057
0058
0059
0060
0061 if (irq_base == 0 && irq_end == (irq_base + hw->nr_vectors - 1))
0062 d->domain = irq_domain_add_linear(NULL, hw->nr_vectors,
0063 &intc_evt_ops, NULL);
0064 else
0065 d->domain = irq_domain_add_tree(NULL, &intc_evt_ops, NULL);
0066
0067 BUG_ON(!d->domain);
0068 }