blob: 23aec8fef092b1de92b2a9d218eb3d367a1867f8 [file] [log] [blame]
Nicholas Flintham1e3d3112013-04-10 10:48:38 +01001#ifndef __OF_IRQ_H
2#define __OF_IRQ_H
3
4#if defined(CONFIG_OF)
5struct of_irq;
6#include <linux/types.h>
7#include <linux/errno.h>
8#include <linux/irq.h>
9#include <linux/irqdomain.h>
10#include <linux/ioport.h>
11#include <linux/of.h>
12
13extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
14
15#if defined(CONFIG_OF_IRQ)
16#define OF_MAX_IRQ_SPEC 4
17struct of_irq {
18 struct device_node *controller;
19 u32 size;
20 u32 specifier[OF_MAX_IRQ_SPEC];
21};
22
23typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
24
25#define OF_IMAP_OLDWORLD_MAC 0x00000001
26#define OF_IMAP_NO_PHANDLE 0x00000002
27
28#if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
29extern unsigned int of_irq_workarounds;
30extern struct device_node *of_irq_dflt_pic;
31extern int of_irq_map_oldworld(struct device_node *device, int index,
32 struct of_irq *out_irq);
33#else
34#define of_irq_workarounds (0)
35#define of_irq_dflt_pic (NULL)
36static inline int of_irq_map_oldworld(struct device_node *device, int index,
37 struct of_irq *out_irq)
38{
39 return -EINVAL;
40}
41#endif
42
43
44extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
45 u32 ointsize, const u32 *addr,
46 struct of_irq *out_irq);
47extern int of_irq_map_one(struct device_node *device, int index,
48 struct of_irq *out_irq);
49extern unsigned int irq_create_of_mapping(struct device_node *controller,
50 const u32 *intspec,
51 unsigned int intsize);
52extern int of_irq_to_resource(struct device_node *dev, int index,
53 struct resource *r);
54extern int of_irq_count(struct device_node *dev);
55extern int of_irq_to_resource_table(struct device_node *dev,
56 struct resource *res, int nr_irqs);
57extern struct device_node *of_irq_find_parent(struct device_node *child);
58
59extern void of_irq_init(const struct of_device_id *matches);
60
61#endif
62#endif
63#endif