aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/irq.h47
-rw-r--r--include/linux/irqdomain.h12
2 files changed, 58 insertions, 1 deletions
diff --git a/include/linux/irq.h b/include/linux/irq.h
index bc4e06611958..298a9b9ce675 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -119,6 +119,7 @@ struct irq_domain;
119 119
120/** 120/**
121 * struct irq_data - per irq and irq chip data passed down to chip functions 121 * struct irq_data - per irq and irq chip data passed down to chip functions
122 * @mask: precomputed bitmask for accessing the chip registers
122 * @irq: interrupt number 123 * @irq: interrupt number
123 * @hwirq: hardware interrupt number, local to the interrupt domain 124 * @hwirq: hardware interrupt number, local to the interrupt domain
124 * @node: node index useful for balancing 125 * @node: node index useful for balancing
@@ -138,6 +139,7 @@ struct irq_domain;
138 * irq_data. 139 * irq_data.
139 */ 140 */
140struct irq_data { 141struct irq_data {
142 u32 mask;
141 unsigned int irq; 143 unsigned int irq;
142 unsigned long hwirq; 144 unsigned long hwirq;
143 unsigned int node; 145 unsigned int node;
@@ -294,6 +296,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
294 * @irq_suspend: function called from core code on suspend once per chip 296 * @irq_suspend: function called from core code on suspend once per chip
295 * @irq_resume: function called from core code on resume once per chip 297 * @irq_resume: function called from core code on resume once per chip
296 * @irq_pm_shutdown: function called from core code on shutdown once per chip 298 * @irq_pm_shutdown: function called from core code on shutdown once per chip
299 * @irq_calc_mask: Optional function to set irq_data.mask for special cases
297 * @irq_print_chip: optional to print special chip info in show_interrupts 300 * @irq_print_chip: optional to print special chip info in show_interrupts
298 * @flags: chip specific flags 301 * @flags: chip specific flags
299 */ 302 */
@@ -325,6 +328,8 @@ struct irq_chip {
325 void (*irq_resume)(struct irq_data *data); 328 void (*irq_resume)(struct irq_data *data);
326 void (*irq_pm_shutdown)(struct irq_data *data); 329 void (*irq_pm_shutdown)(struct irq_data *data);
327 330
331 void (*irq_calc_mask)(struct irq_data *data);
332
328 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); 333 void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
329 334
330 unsigned long flags; 335 unsigned long flags;
@@ -644,6 +649,8 @@ struct irq_chip_regs {
644 * @regs: Register offsets for this chip 649 * @regs: Register offsets for this chip
645 * @handler: Flow handler associated with this chip 650 * @handler: Flow handler associated with this chip
646 * @type: Chip can handle these flow types 651 * @type: Chip can handle these flow types
652 * @mask_cache_priv: Cached mask register private to the chip type
653 * @mask_cache: Pointer to cached mask register
647 * 654 *
648 * A irq_generic_chip can have several instances of irq_chip_type when 655 * A irq_generic_chip can have several instances of irq_chip_type when
649 * it requires different functions and register offsets for different 656 * it requires different functions and register offsets for different
@@ -654,6 +661,8 @@ struct irq_chip_type {
654 struct irq_chip_regs regs; 661 struct irq_chip_regs regs;
655 irq_flow_handler_t handler; 662 irq_flow_handler_t handler;
656 u32 type; 663 u32 type;
664 u32 mask_cache_priv;
665 u32 *mask_cache;
657}; 666};
658 667
659/** 668/**
@@ -662,13 +671,16 @@ struct irq_chip_type {
662 * @reg_base: Register base address (virtual) 671 * @reg_base: Register base address (virtual)
663 * @irq_base: Interrupt base nr for this chip 672 * @irq_base: Interrupt base nr for this chip
664 * @irq_cnt: Number of interrupts handled by this chip 673 * @irq_cnt: Number of interrupts handled by this chip
665 * @mask_cache: Cached mask register 674 * @mask_cache: Cached mask register shared between all chip types
666 * @type_cache: Cached type register 675 * @type_cache: Cached type register
667 * @polarity_cache: Cached polarity register 676 * @polarity_cache: Cached polarity register
668 * @wake_enabled: Interrupt can wakeup from suspend 677 * @wake_enabled: Interrupt can wakeup from suspend
669 * @wake_active: Interrupt is marked as an wakeup from suspend source 678 * @wake_active: Interrupt is marked as an wakeup from suspend source
670 * @num_ct: Number of available irq_chip_type instances (usually 1) 679 * @num_ct: Number of available irq_chip_type instances (usually 1)
671 * @private: Private data for non generic chip callbacks 680 * @private: Private data for non generic chip callbacks
681 * @installed: bitfield to denote installed interrupts
682 * @unused: bitfield to denote unused interrupts
683 * @domain: irq domain pointer
672 * @list: List head for keeping track of instances 684 * @list: List head for keeping track of instances
673 * @chip_types: Array of interrupt irq_chip_types 685 * @chip_types: Array of interrupt irq_chip_types
674 * 686 *
@@ -690,6 +702,9 @@ struct irq_chip_generic {
690 u32 wake_active; 702 u32 wake_active;
691 unsigned int num_ct; 703 unsigned int num_ct;
692 void *private; 704 void *private;
705 unsigned long installed;
706 unsigned long unused;
707 struct irq_domain *domain;
693 struct list_head list; 708 struct list_head list;
694 struct irq_chip_type chip_types[0]; 709 struct irq_chip_type chip_types[0];
695}; 710};
@@ -700,10 +715,32 @@ struct irq_chip_generic {
700 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for 715 * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for
701 * irq chips which need to call irq_set_wake() on 716 * irq chips which need to call irq_set_wake() on
702 * the parent irq. Usually GPIO implementations 717 * the parent irq. Usually GPIO implementations
718 * @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private
719 * @IRQ_GC_NO_MASK: Do not calculate irq_data->mask
703 */ 720 */
704enum irq_gc_flags { 721enum irq_gc_flags {
705 IRQ_GC_INIT_MASK_CACHE = 1 << 0, 722 IRQ_GC_INIT_MASK_CACHE = 1 << 0,
706 IRQ_GC_INIT_NESTED_LOCK = 1 << 1, 723 IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
724 IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2,
725 IRQ_GC_NO_MASK = 1 << 3,
726};
727
728/*
729 * struct irq_domain_chip_generic - Generic irq chip data structure for irq domains
730 * @irqs_per_chip: Number of interrupts per chip
731 * @num_chips: Number of chips
732 * @irq_flags_to_set: IRQ* flags to set on irq setup
733 * @irq_flags_to_clear: IRQ* flags to clear on irq setup
734 * @gc_flags: Generic chip specific setup flags
735 * @gc: Array of pointers to generic interrupt chips
736 */
737struct irq_domain_chip_generic {
738 unsigned int irqs_per_chip;
739 unsigned int num_chips;
740 unsigned int irq_flags_to_clear;
741 unsigned int irq_flags_to_set;
742 enum irq_gc_flags gc_flags;
743 struct irq_chip_generic *gc[0];
707}; 744};
708 745
709/* Generic chip callback functions */ 746/* Generic chip callback functions */
@@ -729,6 +766,14 @@ int irq_setup_alt_chip(struct irq_data *d, unsigned int type);
729void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, 766void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
730 unsigned int clr, unsigned int set); 767 unsigned int clr, unsigned int set);
731 768
769struct irq_chip_generic *irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq);
770int irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,
771 int num_ct, const char *name,
772 irq_flow_handler_t handler,
773 unsigned int clr, unsigned int set,
774 enum irq_gc_flags flags);
775
776
732static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d) 777static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d)
733{ 778{
734 return container_of(d->chip, struct irq_chip_type, chip); 779 return container_of(d->chip, struct irq_chip_type, chip);
diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 0d5b17bf5e51..ba2c708adcff 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -66,6 +66,10 @@ struct irq_domain_ops {
66 unsigned long *out_hwirq, unsigned int *out_type); 66 unsigned long *out_hwirq, unsigned int *out_type);
67}; 67};
68 68
69extern struct irq_domain_ops irq_generic_chip_ops;
70
71struct irq_domain_chip_generic;
72
69/** 73/**
70 * struct irq_domain - Hardware interrupt number translation object 74 * struct irq_domain - Hardware interrupt number translation object
71 * @link: Element in global irq_domain list. 75 * @link: Element in global irq_domain list.
@@ -109,8 +113,16 @@ struct irq_domain {
109 113
110 /* Optional device node pointer */ 114 /* Optional device node pointer */
111 struct device_node *of_node; 115 struct device_node *of_node;
116 /* Optional pointer to generic interrupt chips */
117 struct irq_domain_chip_generic *gc;
112}; 118};
113 119
120#define IRQ_DOMAIN_MAP_LEGACY 0 /* driver allocated fixed range of irqs.
121 * ie. legacy 8259, gets irqs 1..15 */
122#define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */
123#define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */
124#define IRQ_DOMAIN_MAP_TREE 3 /* radix tree */
125
114#ifdef CONFIG_IRQ_DOMAIN 126#ifdef CONFIG_IRQ_DOMAIN
115struct irq_domain *irq_domain_add_simple(struct device_node *of_node, 127struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
116 unsigned int size, 128 unsigned int size,