1 #ifndef __ASM_AVR32_INTC_H
2 #define __ASM_AVR32_INTC_H
4 #include <linux/sysdev.h>
5 #include <linux/interrupt.h>
11 struct platform_device
;
13 /* Information about the internal interrupt controller */
15 /* ioremapped address of configuration block */
18 /* the physical device */
19 struct platform_device
*pdev
;
21 /* Number of interrupt lines per group. */
22 unsigned int irqs_per_group
;
24 /* The highest group ID + 1 */
25 unsigned int nr_groups
;
28 * Bitfield indicating which groups are actually in use. The
29 * size of the array is
30 * ceil(group_max / (8 * sizeof(unsigned int))).
32 unsigned int group_mask
[];
35 struct irq_controller_class
{
37 * A short name identifying this kind of controller.
41 * Handle the IRQ. Must do any necessary acking and masking.
43 irqreturn_t (*handle
)(int irq
, void *dev_id
, struct pt_regs
*regs
);
45 * Register a new IRQ handler.
47 int (*setup
)(struct irq_controller
*ctrl
, unsigned int irq
,
48 struct irqaction
*action
);
50 * Unregister a IRQ handler.
52 void (*free
)(struct irq_controller
*ctrl
, unsigned int irq
,
55 * Mask the IRQ in the interrupt controller.
57 void (*mask
)(struct irq_controller
*ctrl
, unsigned int irq
);
59 * Unmask the IRQ in the interrupt controller.
61 void (*unmask
)(struct irq_controller
*ctrl
, unsigned int irq
);
63 * Set the type of the IRQ. See below for possible types.
64 * Return -EINVAL if a given type is not supported
66 int (*set_type
)(struct irq_controller
*ctrl
, unsigned int irq
,
69 * Return the IRQ type currently set
71 unsigned int (*get_type
)(struct irq_controller
*ctrl
, unsigned int irq
);
74 struct irq_controller
{
75 struct irq_controller_class
*class;
76 unsigned int irq_group
;
77 unsigned int first_irq
;
79 struct list_head list
;
82 struct intc_group_desc
{
83 struct irq_controller
*ctrl
;
84 irqreturn_t (*handle
)(int, void *, struct pt_regs
*);
91 * The internal interrupt controller. Defined in board/part-specific
93 * TODO: Should probably be defined per-cpu.
95 extern struct intc_device intc
;
97 extern int request_internal_irq(unsigned int irq
,
98 irqreturn_t (*handler
)(int, void *, struct pt_regs
*),
99 unsigned long irqflags
,
100 const char *devname
, void *dev_id
);
101 extern void free_internal_irq(unsigned int irq
);
103 /* Only used by time_init() */
104 extern int setup_internal_irq(unsigned int irq
, struct intc_group_desc
*desc
);
107 * Set interrupt priority for a given group. `group' can be found by
108 * using irq_to_group(irq). Priority can be from 0 (lowest) to 3
109 * (highest). Higher-priority interrupts will preempt lower-priority
110 * interrupts (unless interrupts are masked globally).
112 * This function does not check for conflicts within a group.
114 extern int intc_set_priority(unsigned int group
,
115 unsigned int priority
);
118 * Returns a bitmask of pending interrupts in a group.
120 extern unsigned long intc_get_pending(unsigned int group
);
123 * Register a new external interrupt controller. Returns the first
124 * external IRQ number that is assigned to the new controller.
126 extern int intc_register_controller(struct irq_controller
*ctrl
);
128 #endif /* __ASM_AVR32_INTC_H */