| Nicholas Flintham | 1e3d311 | 2013-04-10 10:48:38 +0100 | [diff] [blame^] | 1 | #ifndef __OF_IRQ_H |
| 2 | #define __OF_IRQ_H |
| 3 | |
| 4 | #if defined(CONFIG_OF) |
| 5 | struct 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 | |
| 13 | extern 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 |
| 17 | struct of_irq { |
| 18 | struct device_node *controller; |
| 19 | u32 size; |
| 20 | u32 specifier[OF_MAX_IRQ_SPEC]; |
| 21 | }; |
| 22 | |
| 23 | typedef 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) |
| 29 | extern unsigned int of_irq_workarounds; |
| 30 | extern struct device_node *of_irq_dflt_pic; |
| 31 | extern 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) |
| 36 | static 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 | |
| 44 | extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec, |
| 45 | u32 ointsize, const u32 *addr, |
| 46 | struct of_irq *out_irq); |
| 47 | extern int of_irq_map_one(struct device_node *device, int index, |
| 48 | struct of_irq *out_irq); |
| 49 | extern unsigned int irq_create_of_mapping(struct device_node *controller, |
| 50 | const u32 *intspec, |
| 51 | unsigned int intsize); |
| 52 | extern int of_irq_to_resource(struct device_node *dev, int index, |
| 53 | struct resource *r); |
| 54 | extern int of_irq_count(struct device_node *dev); |
| 55 | extern int of_irq_to_resource_table(struct device_node *dev, |
| 56 | struct resource *res, int nr_irqs); |
| 57 | extern struct device_node *of_irq_find_parent(struct device_node *child); |
| 58 | |
| 59 | extern void of_irq_init(const struct of_device_id *matches); |
| 60 | |
| 61 | #endif |
| 62 | #endif |
| 63 | #endif |