of_irq.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #ifndef __OF_IRQ_H
  2. #define __OF_IRQ_H
  3. #include <linux/types.h>
  4. #include <linux/errno.h>
  5. #include <linux/irq.h>
  6. #include <linux/irqdomain.h>
  7. #include <linux/ioport.h>
  8. #include <linux/of.h>
  9. typedef int (*of_irq_init_cb_t)(struct device_node *, struct device_node *);
  10. /*
  11. * Workarounds only applied to 32bit powermac machines
  12. */
  13. #define OF_IMAP_OLDWORLD_MAC 0x00000001
  14. #define OF_IMAP_NO_PHANDLE 0x00000002
  15. #if defined(CONFIG_PPC32) && defined(CONFIG_PPC_PMAC)
  16. extern unsigned int of_irq_workarounds;
  17. extern struct device_node *of_irq_dflt_pic;
  18. extern int of_irq_parse_oldworld(struct device_node *device, int index,
  19. struct of_phandle_args *out_irq);
  20. #else /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
  21. #define of_irq_workarounds (0)
  22. #define of_irq_dflt_pic (NULL)
  23. static inline int of_irq_parse_oldworld(struct device_node *device, int index,
  24. struct of_phandle_args *out_irq)
  25. {
  26. return -EINVAL;
  27. }
  28. #endif /* CONFIG_PPC32 && CONFIG_PPC_PMAC */
  29. extern int of_irq_parse_raw(const __be32 *addr, struct of_phandle_args *out_irq);
  30. extern int of_irq_parse_one(struct device_node *device, int index,
  31. struct of_phandle_args *out_irq);
  32. extern unsigned int irq_create_of_mapping(struct of_phandle_args *irq_data);
  33. extern int of_irq_to_resource(struct device_node *dev, int index,
  34. struct resource *r);
  35. extern int of_irq_count(struct device_node *dev);
  36. extern int of_irq_to_resource_table(struct device_node *dev,
  37. struct resource *res, int nr_irqs);
  38. extern void of_irq_init(const struct of_device_id *matches);
  39. #if defined(CONFIG_OF)
  40. /*
  41. * irq_of_parse_and_map() is used by all OF enabled platforms; but SPARC
  42. * implements it differently. However, the prototype is the same for all,
  43. * so declare it here regardless of the CONFIG_OF_IRQ setting.
  44. */
  45. extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
  46. extern struct device_node *of_irq_find_parent(struct device_node *child);
  47. #else /* !CONFIG_OF */
  48. static inline unsigned int irq_of_parse_and_map(struct device_node *dev,
  49. int index)
  50. {
  51. return 0;
  52. }
  53. static inline void *of_irq_find_parent(struct device_node *child)
  54. {
  55. return NULL;
  56. }
  57. #endif /* !CONFIG_OF */
  58. #endif /* __OF_IRQ_H */