aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
authorGrant Likely <grant.likely@secretlab.ca>2012-02-14 16:06:57 -0500
committerGrant Likely <grant.likely@secretlab.ca>2012-02-16 08:11:23 -0500
commit75294957be1dee7d22dd7d90bd31334ba410e836 (patch)
treeafa8e2905af88ceeba2dccb50b56c42568e18ab9 /include/linux
parent5769089ac72569d024817270ab79fdf0b9046dde (diff)
irq_domain: Remove 'new' irq_domain in favour of the ppc one
This patch removes the simplistic implementation of irq_domains and enables the powerpc infrastructure for all irq_domain users. The powerpc infrastructure includes support for complex mappings between Linux and hardware irq numbers, and can manage allocation of irq_descs. This patch also converts the few users of irq_domain_add()/irq_domain_del() to call irq_domain_add_legacy() instead. v3: Fix bug that set up too many irqs in translation range. v2: Fix removal of irq_alloc_descs() call in gic driver Signed-off-by: Grant Likely <grant.likely@secretlab.ca> Cc: Rob Herring <rob.herring@calxeda.com> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Milton Miller <miltonm@bga.com> Tested-by: Olof Johansson <olof@lixom.net>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/irqdomain.h45
1 files changed, 4 insertions, 41 deletions
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 7fef39ed5523..624e9ac89e79 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -55,9 +55,6 @@ typedef unsigned long irq_hw_number_t;
55 * @map: Create or update a mapping between a virtual irq number and a hw 55 * @map: Create or update a mapping between a virtual irq number and a hw
56 * irq number. This is called only once for a given mapping. 56 * irq number. This is called only once for a given mapping.
57 * @unmap: Dispose of such a mapping 57 * @unmap: Dispose of such a mapping
58 * @to_irq: (optional) given a local hardware irq number, return the linux
59 * irq number. If to_irq is not implemented, then the irq_domain
60 * will use this translation: irq = (domain->irq_base + hwirq)
61 * @xlate: Given a device tree node and interrupt specifier, decode 58 * @xlate: Given a device tree node and interrupt specifier, decode
62 * the hardware irq number and linux irq type value. 59 * the hardware irq number and linux irq type value.
63 * 60 *
@@ -70,7 +67,6 @@ struct irq_domain_ops {
70 int (*match)(struct irq_domain *d, struct device_node *node); 67 int (*match)(struct irq_domain *d, struct device_node *node);
71 int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw); 68 int (*map)(struct irq_domain *d, unsigned int virq, irq_hw_number_t hw);
72 void (*unmap)(struct irq_domain *d, unsigned int virq); 69 void (*unmap)(struct irq_domain *d, unsigned int virq);
73 unsigned int (*to_irq)(struct irq_domain *d, unsigned long hwirq);
74 int (*xlate)(struct irq_domain *d, struct device_node *node, 70 int (*xlate)(struct irq_domain *d, struct device_node *node,
75 const u32 *intspec, unsigned int intsize, 71 const u32 *intspec, unsigned int intsize,
76 unsigned long *out_hwirq, unsigned int *out_type); 72 unsigned long *out_hwirq, unsigned int *out_type);
@@ -114,16 +110,11 @@ struct irq_domain {
114 void *host_data; 110 void *host_data;
115 irq_hw_number_t inval_irq; 111 irq_hw_number_t inval_irq;
116 112
117 unsigned int irq_base;
118 unsigned int nr_irq;
119 unsigned int hwirq_base;
120
121 /* Optional device node pointer */ 113 /* Optional device node pointer */
122 struct device_node *of_node; 114 struct device_node *of_node;
123}; 115};
124 116
125#ifdef CONFIG_IRQ_DOMAIN 117#ifdef CONFIG_IRQ_DOMAIN
126#ifdef CONFIG_PPC
127struct irq_domain *irq_domain_add_legacy(struct device_node *of_node, 118struct irq_domain *irq_domain_add_legacy(struct device_node *of_node,
128 unsigned int size, 119 unsigned int size,
129 unsigned int first_irq, 120 unsigned int first_irq,
@@ -153,6 +144,10 @@ static inline struct irq_domain *irq_domain_add_legacy_isa(
153 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops, 144 return irq_domain_add_legacy(of_node, NUM_ISA_INTERRUPTS, 0, 0, ops,
154 host_data); 145 host_data);
155} 146}
147extern struct irq_domain *irq_find_host(struct device_node *node);
148extern void irq_set_default_host(struct irq_domain *host);
149extern void irq_set_virq_count(unsigned int count);
150
156 151
157extern unsigned int irq_create_mapping(struct irq_domain *host, 152extern unsigned int irq_create_mapping(struct irq_domain *host,
158 irq_hw_number_t hwirq); 153 irq_hw_number_t hwirq);
@@ -167,38 +162,7 @@ extern unsigned int irq_radix_revmap_lookup(struct irq_domain *host,
167extern unsigned int irq_linear_revmap(struct irq_domain *host, 162extern unsigned int irq_linear_revmap(struct irq_domain *host,
168 irq_hw_number_t hwirq); 163 irq_hw_number_t hwirq);
169 164
170#else /* CONFIG_PPC */
171
172/**
173 * irq_domain_to_irq() - Translate from a hardware irq to a linux irq number
174 *
175 * Returns the linux irq number associated with a hardware irq. By default,
176 * the mapping is irq == domain->irq_base + hwirq, but this mapping can
177 * be overridden if the irq_domain implements a .to_irq() hook.
178 */
179static inline unsigned int irq_domain_to_irq(struct irq_domain *d,
180 unsigned long hwirq)
181{
182 if (d->ops->to_irq)
183 return d->ops->to_irq(d, hwirq);
184 if (WARN_ON(hwirq < d->hwirq_base))
185 return 0;
186 return d->irq_base + hwirq - d->hwirq_base;
187}
188
189#define irq_domain_for_each_hwirq(d, hw) \
190 for (hw = d->hwirq_base; hw < d->hwirq_base + d->nr_irq; hw++)
191
192#define irq_domain_for_each_irq(d, hw, irq) \
193 for (hw = d->hwirq_base, irq = irq_domain_to_irq(d, hw); \
194 hw < d->hwirq_base + d->nr_irq; \
195 hw++, irq = irq_domain_to_irq(d, hw))
196
197extern void irq_domain_add(struct irq_domain *domain);
198extern void irq_domain_del(struct irq_domain *domain);
199
200extern struct irq_domain_ops irq_domain_simple_ops; 165extern struct irq_domain_ops irq_domain_simple_ops;
201
202#if defined(CONFIG_OF_IRQ) 166#if defined(CONFIG_OF_IRQ)
203extern void irq_domain_add_simple(struct device_node *controller, int irq_base); 167extern void irq_domain_add_simple(struct device_node *controller, int irq_base);
204extern void irq_domain_generate_simple(const struct of_device_id *match, 168extern void irq_domain_generate_simple(const struct of_device_id *match,
@@ -207,7 +171,6 @@ extern void irq_domain_generate_simple(const struct of_device_id *match,
207static inline void irq_domain_generate_simple(const struct of_device_id *match, 171static inline void irq_domain_generate_simple(const struct of_device_id *match,
208 u64 phys_base, unsigned int irq_start) { } 172 u64 phys_base, unsigned int irq_start) { }
209#endif /* !CONFIG_OF_IRQ */ 173#endif /* !CONFIG_OF_IRQ */
210#endif /* !CONFIG_PPC */
211#endif /* CONFIG_IRQ_DOMAIN */ 174#endif /* CONFIG_IRQ_DOMAIN */
212 175
213#endif /* _LINUX_IRQDOMAIN_H */ 176#endif /* _LINUX_IRQDOMAIN_H */