1
2#ifndef __OF_IRQ_H
3#define __OF_IRQ_H
4
5#include <linux/types.h>
6#include <linux/errno.h>
7#include <linux/irq.h>
8#include <linux/irqdomain.h>
9#include <linux/ioport.h>
10#include <linux/of.h>
11
12typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
13#ifdef CONFIG_IRQCHIP_XILINX_INTC_MODULE_SUPPORT_EXPERIMENTAL
14typedef int (*of_irq_remove_cb_t)(struct device_node *, struct device_node *);
15#endif
16
17
18
19#define OF_IMAP_OLDWORLD_MAC 0x00000001
20#define OF_IMAP_NO_PHANDLE 0x00000002
21
22#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
23extern unsigned int of_irq_workarounds;
24extern struct device_node *of_irq_dflt_pic;
25extern int of_irq_parse_oldworld(struct device_node *device, int index,
26 struct of_phandle_args *out_irq);
27#else
28#define of_irq_workarounds (0)
29#define of_irq_dflt_pic (NULL)
30static inline int of_irq_parse_oldworld(struct device_node *device, int index,
31 struct of_phandle_args *out_irq)
32{
33 return -EINVAL;
34}
35#endif
36
37extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
38extern int of_irq_parse_one(struct device_node *device, int index,
39 struct of_phandle_args *out_irq);
40extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
41extern int of_irq_to_resource(struct device_node *dev, int index,
42 struct resource *r);
43
44extern void of_irq_init(const struct of_device_id *matches);
45
46#ifdef CONFIG_OF_IRQ
47extern int of_irq_count(struct device_node *dev);
48extern int of_irq_get(struct device_node *dev, int index);
49extern int of_irq_get_byname(struct device_node *dev, const char *name);
50extern int of_irq_to_resource_table(struct device_node *dev,
51 struct resource *res, int nr_irqs);
52extern struct device_node *of_irq_find_parent(struct device_node *child);
53extern struct irq_domain *of_msi_get_domain(struct device *dev,
54 struct device_node *np,
55 enum irq_domain_bus_token token);
56extern struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
57 u32 id,
58 u32 bus_token);
59extern void of_msi_configure(struct device *dev, struct device_node *np);
60u32 of_msi_map_id(struct device *dev, struct device_node *msi_np, u32 id_in);
61#else
62static inline int of_irq_count(struct device_node *dev)
63{
64 return 0;
65}
66static inline int of_irq_get(struct device_node *dev, int index)
67{
68 return 0;
69}
70static inline int of_irq_get_byname(struct device_node *dev, const char *name)
71{
72 return 0;
73}
74static inline int of_irq_to_resource_table(struct device_node *dev,
75 struct resource *res, int nr_irqs)
76{
77 return 0;
78}
79static inline void *of_irq_find_parent(struct device_node *child)
80{
81 return NULL;
82}
83
84static inline struct irq_domain *of_msi_get_domain(struct device *dev,
85 struct device_node *np,
86 enum irq_domain_bus_token token)
87{
88 return NULL;
89}
90static inline struct irq_domain *of_msi_map_get_device_domain(struct device *dev,
91 u32 id, u32 bus_token)
92{
93 return NULL;
94}
95static inline void of_msi_configure(struct device *dev, struct device_node *np)
96{
97}
98static inline u32 of_msi_map_id(struct device *dev,
99 struct device_node *msi_np, u32 id_in)
100{
101 return id_in;
102}
103#endif
104
105#if defined(CONFIG_OF_IRQ) || defined(CONFIG_SPARC)
106
107
108
109
110
111extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
112
113#else
114static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
115 int index)
116{
117 return 0;
118}
119#endif
120
121#endif
122