Commit 5e8bd41a authored by Grant Likely's avatar Grant Likely

Merge remote-tracking branch 'tip/irq/for-arm' into irqdomain/next

parents 317ddd25 e8bd834f
...@@ -119,6 +119,7 @@ struct irq_domain; ...@@ -119,6 +119,7 @@ struct irq_domain;
/** /**
* struct irq_data - per irq and irq chip data passed down to chip functions * struct irq_data - per irq and irq chip data passed down to chip functions
* @mask: precomputed bitmask for accessing the chip registers
* @irq: interrupt number * @irq: interrupt number
* @hwirq: hardware interrupt number, local to the interrupt domain * @hwirq: hardware interrupt number, local to the interrupt domain
* @node: node index useful for balancing * @node: node index useful for balancing
...@@ -138,6 +139,7 @@ struct irq_domain; ...@@ -138,6 +139,7 @@ struct irq_domain;
* irq_data. * irq_data.
*/ */
struct irq_data { struct irq_data {
u32 mask;
unsigned int irq; unsigned int irq;
unsigned long hwirq; unsigned long hwirq;
unsigned int node; unsigned int node;
...@@ -294,6 +296,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d) ...@@ -294,6 +296,7 @@ static inline irq_hw_number_t irqd_to_hwirq(struct irq_data *d)
* @irq_suspend: function called from core code on suspend once per chip * @irq_suspend: function called from core code on suspend once per chip
* @irq_resume: function called from core code on resume once per chip * @irq_resume: function called from core code on resume once per chip
* @irq_pm_shutdown: function called from core code on shutdown once per chip * @irq_pm_shutdown: function called from core code on shutdown once per chip
* @irq_calc_mask: Optional function to set irq_data.mask for special cases
* @irq_print_chip: optional to print special chip info in show_interrupts * @irq_print_chip: optional to print special chip info in show_interrupts
* @flags: chip specific flags * @flags: chip specific flags
*/ */
...@@ -325,6 +328,8 @@ struct irq_chip { ...@@ -325,6 +328,8 @@ struct irq_chip {
void (*irq_resume)(struct irq_data *data); void (*irq_resume)(struct irq_data *data);
void (*irq_pm_shutdown)(struct irq_data *data); void (*irq_pm_shutdown)(struct irq_data *data);
void (*irq_calc_mask)(struct irq_data *data);
void (*irq_print_chip)(struct irq_data *data, struct seq_file *p); void (*irq_print_chip)(struct irq_data *data, struct seq_file *p);
unsigned long flags; unsigned long flags;
...@@ -644,6 +649,8 @@ struct irq_chip_regs { ...@@ -644,6 +649,8 @@ struct irq_chip_regs {
* @regs: Register offsets for this chip * @regs: Register offsets for this chip
* @handler: Flow handler associated with this chip * @handler: Flow handler associated with this chip
* @type: Chip can handle these flow types * @type: Chip can handle these flow types
* @mask_cache_priv: Cached mask register private to the chip type
* @mask_cache: Pointer to cached mask register
* *
* A irq_generic_chip can have several instances of irq_chip_type when * A irq_generic_chip can have several instances of irq_chip_type when
* it requires different functions and register offsets for different * it requires different functions and register offsets for different
...@@ -654,6 +661,8 @@ struct irq_chip_type { ...@@ -654,6 +661,8 @@ struct irq_chip_type {
struct irq_chip_regs regs; struct irq_chip_regs regs;
irq_flow_handler_t handler; irq_flow_handler_t handler;
u32 type; u32 type;
u32 mask_cache_priv;
u32 *mask_cache;
}; };
/** /**
...@@ -662,13 +671,16 @@ struct irq_chip_type { ...@@ -662,13 +671,16 @@ struct irq_chip_type {
* @reg_base: Register base address (virtual) * @reg_base: Register base address (virtual)
* @irq_base: Interrupt base nr for this chip * @irq_base: Interrupt base nr for this chip
* @irq_cnt: Number of interrupts handled by this chip * @irq_cnt: Number of interrupts handled by this chip
* @mask_cache: Cached mask register * @mask_cache: Cached mask register shared between all chip types
* @type_cache: Cached type register * @type_cache: Cached type register
* @polarity_cache: Cached polarity register * @polarity_cache: Cached polarity register
* @wake_enabled: Interrupt can wakeup from suspend * @wake_enabled: Interrupt can wakeup from suspend
* @wake_active: Interrupt is marked as an wakeup from suspend source * @wake_active: Interrupt is marked as an wakeup from suspend source
* @num_ct: Number of available irq_chip_type instances (usually 1) * @num_ct: Number of available irq_chip_type instances (usually 1)
* @private: Private data for non generic chip callbacks * @private: Private data for non generic chip callbacks
* @installed: bitfield to denote installed interrupts
* @unused: bitfield to denote unused interrupts
* @domain: irq domain pointer
* @list: List head for keeping track of instances * @list: List head for keeping track of instances
* @chip_types: Array of interrupt irq_chip_types * @chip_types: Array of interrupt irq_chip_types
* *
...@@ -690,6 +702,9 @@ struct irq_chip_generic { ...@@ -690,6 +702,9 @@ struct irq_chip_generic {
u32 wake_active; u32 wake_active;
unsigned int num_ct; unsigned int num_ct;
void *private; void *private;
unsigned long installed;
unsigned long unused;
struct irq_domain *domain;
struct list_head list; struct list_head list;
struct irq_chip_type chip_types[0]; struct irq_chip_type chip_types[0];
}; };
...@@ -700,10 +715,32 @@ struct irq_chip_generic { ...@@ -700,10 +715,32 @@ struct irq_chip_generic {
* @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for * @IRQ_GC_INIT_NESTED_LOCK: Set the lock class of the irqs to nested for
* irq chips which need to call irq_set_wake() on * irq chips which need to call irq_set_wake() on
* the parent irq. Usually GPIO implementations * the parent irq. Usually GPIO implementations
* @IRQ_GC_MASK_CACHE_PER_TYPE: Mask cache is chip type private
* @IRQ_GC_NO_MASK: Do not calculate irq_data->mask
*/ */
enum irq_gc_flags { enum irq_gc_flags {
IRQ_GC_INIT_MASK_CACHE = 1 << 0, IRQ_GC_INIT_MASK_CACHE = 1 << 0,
IRQ_GC_INIT_NESTED_LOCK = 1 << 1, IRQ_GC_INIT_NESTED_LOCK = 1 << 1,
IRQ_GC_MASK_CACHE_PER_TYPE = 1 << 2,
IRQ_GC_NO_MASK = 1 << 3,
};
/*
* struct irq_domain_chip_generic - Generic irq chip data structure for irq domains
* @irqs_per_chip: Number of interrupts per chip
* @num_chips: Number of chips
* @irq_flags_to_set: IRQ* flags to set on irq setup
* @irq_flags_to_clear: IRQ* flags to clear on irq setup
* @gc_flags: Generic chip specific setup flags
* @gc: Array of pointers to generic interrupt chips
*/
struct irq_domain_chip_generic {
unsigned int irqs_per_chip;
unsigned int num_chips;
unsigned int irq_flags_to_clear;
unsigned int irq_flags_to_set;
enum irq_gc_flags gc_flags;
struct irq_chip_generic *gc[0];
}; };
/* Generic chip callback functions */ /* Generic chip callback functions */
...@@ -729,6 +766,14 @@ int irq_setup_alt_chip(struct irq_data *d, unsigned int type); ...@@ -729,6 +766,14 @@ int irq_setup_alt_chip(struct irq_data *d, unsigned int type);
void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk, void irq_remove_generic_chip(struct irq_chip_generic *gc, u32 msk,
unsigned int clr, unsigned int set); unsigned int clr, unsigned int set);
struct irq_chip_generic *irq_get_domain_generic_chip(struct irq_domain *d, unsigned int hw_irq);
int irq_alloc_domain_generic_chips(struct irq_domain *d, int irqs_per_chip,
int num_ct, const char *name,
irq_flow_handler_t handler,
unsigned int clr, unsigned int set,
enum irq_gc_flags flags);
static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d) static inline struct irq_chip_type *irq_data_get_chip_type(struct irq_data *d)
{ {
return container_of(d->chip, struct irq_chip_type, chip); return container_of(d->chip, struct irq_chip_type, chip);
......
...@@ -66,6 +66,10 @@ struct irq_domain_ops { ...@@ -66,6 +66,10 @@ struct irq_domain_ops {
unsigned long *out_hwirq, unsigned int *out_type); unsigned long *out_hwirq, unsigned int *out_type);
}; };
extern struct irq_domain_ops irq_generic_chip_ops;
struct irq_domain_chip_generic;
/** /**
* struct irq_domain - Hardware interrupt number translation object * struct irq_domain - Hardware interrupt number translation object
* @link: Element in global irq_domain list. * @link: Element in global irq_domain list.
...@@ -109,8 +113,16 @@ struct irq_domain { ...@@ -109,8 +113,16 @@ struct irq_domain {
/* Optional device node pointer */ /* Optional device node pointer */
struct device_node *of_node; struct device_node *of_node;
/* Optional pointer to generic interrupt chips */
struct irq_domain_chip_generic *gc;
}; };
#define IRQ_DOMAIN_MAP_LEGACY 0 /* driver allocated fixed range of irqs.
* ie. legacy 8259, gets irqs 1..15 */
#define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */
#define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */
#define IRQ_DOMAIN_MAP_TREE 3 /* radix tree */
#ifdef CONFIG_IRQ_DOMAIN #ifdef CONFIG_IRQ_DOMAIN
struct irq_domain *irq_domain_add_simple(struct device_node *of_node, struct irq_domain *irq_domain_add_simple(struct device_node *of_node,
unsigned int size, unsigned int size,
......
This diff is collapsed.
...@@ -16,12 +16,6 @@ ...@@ -16,12 +16,6 @@
#include <linux/smp.h> #include <linux/smp.h>
#include <linux/fs.h> #include <linux/fs.h>
#define IRQ_DOMAIN_MAP_LEGACY 0 /* driver allocated fixed range of irqs.
* ie. legacy 8259, gets irqs 1..15 */
#define IRQ_DOMAIN_MAP_NOMAP 1 /* no fast reverse mapping */
#define IRQ_DOMAIN_MAP_LINEAR 2 /* linear map of interrupts */
#define IRQ_DOMAIN_MAP_TREE 3 /* radix tree */
static LIST_HEAD(irq_domain_list); static LIST_HEAD(irq_domain_list);
static DEFINE_MUTEX(irq_domain_mutex); static DEFINE_MUTEX(irq_domain_mutex);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment