aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-sh/hw_irq.h
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2007-07-18 04:25:09 -0400
committerPaul Mundt <lethal@linux-sh.org>2007-07-19 23:18:20 -0400
commit02ab3f70791f7d5c9098acaa31a72dd7d0961cb0 (patch)
treeb95f0ec8cc57ed2166eb28e53bb604374e6f0f44 /include/asm-sh/hw_irq.h
parent53aba19f82045c1df838570b8484043e93c4442a (diff)
sh: intc - shared IPR and INTC2 controller
This is the second version of the shared interrupt controller patch for the sh architecture, fixing up handling of intc_reg_fns[]. The three main advantages with this controller over the existing ones are: - Both priority (ipr) and bitmap (intc2) registers are supported - External pin sense configuration is supported, ie edge vs level triggered - CPU/Board specific code maps 1:1 with datasheet for easy verification This controller can easily coexist with the current IPR and INTC2 controllers, but the idea is that CPUs/Boards should be moved over to this controller over time so we have a single code base to maintain. Signed-off-by: Magnus Damm <damm@igel.co.jp> Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'include/asm-sh/hw_irq.h')
-rw-r--r--include/asm-sh/hw_irq.h68
1 files changed, 68 insertions, 0 deletions
diff --git a/include/asm-sh/hw_irq.h b/include/asm-sh/hw_irq.h
index 4ca3f765bacc..34ff8c7cfb55 100644
--- a/include/asm-sh/hw_irq.h
+++ b/include/asm-sh/hw_irq.h
@@ -1,6 +1,7 @@
1#ifndef __ASM_SH_HW_IRQ_H 1#ifndef __ASM_SH_HW_IRQ_H
2#define __ASM_SH_HW_IRQ_H 2#define __ASM_SH_HW_IRQ_H
3 3
4#include <linux/init.h>
4#include <asm/atomic.h> 5#include <asm/atomic.h>
5 6
6extern atomic_t irq_err_count; 7extern atomic_t irq_err_count;
@@ -47,4 +48,71 @@ void init_IRQ_ipr(void);
47 */ 48 */
48void ipr_irq_enable_irlm(void); 49void ipr_irq_enable_irlm(void);
49 50
51typedef unsigned char intc_enum;
52
53struct intc_vect {
54 intc_enum enum_id;
55 unsigned short vect;
56};
57
58#define INTC_VECT(enum_id, vect) { enum_id, vect }
59
60struct intc_prio {
61 intc_enum enum_id;
62 unsigned char priority;
63};
64
65#define INTC_PRIO(enum_id, prio) { enum_id, prio }
66
67struct intc_group {
68 intc_enum enum_id;
69 intc_enum *enum_ids;
70};
71
72#define INTC_GROUP(enum_id, ids...) { enum_id, (intc_enum []) { ids, 0 } }
73
74struct intc_mask_reg {
75 unsigned long set_reg, clr_reg, reg_width;
76 intc_enum enum_ids[32];
77};
78
79struct intc_prio_reg {
80 unsigned long reg, reg_width, field_width;
81 intc_enum enum_ids[16];
82};
83
84struct intc_sense_reg {
85 unsigned long reg, reg_width, field_width;
86 intc_enum enum_ids[16];
87};
88
89struct intc_desc {
90 struct intc_vect *vectors;
91 unsigned int nr_vectors;
92 struct intc_group *groups;
93 unsigned int nr_groups;
94 struct intc_prio *priorities;
95 unsigned int nr_priorities;
96 struct intc_mask_reg *mask_regs;
97 unsigned int nr_mask_regs;
98 struct intc_prio_reg *prio_regs;
99 unsigned int nr_prio_regs;
100 struct intc_sense_reg *sense_regs;
101 unsigned int nr_sense_regs;
102 struct irq_chip chip;
103};
104
105#define _INTC_ARRAY(a) a, sizeof(a)/sizeof(*a)
106#define DECLARE_INTC_DESC(symbol, chipname, vectors, groups, \
107 priorities, mask_regs, prio_regs, sense_regs) \
108static struct intc_desc symbol = { \
109 _INTC_ARRAY(vectors), _INTC_ARRAY(groups), \
110 _INTC_ARRAY(priorities), \
111 _INTC_ARRAY(mask_regs), _INTC_ARRAY(prio_regs), \
112 _INTC_ARRAY(sense_regs), \
113 .chip.name = chipname, \
114}
115
116void __init register_intc_controller(struct intc_desc *desc);
117
50#endif /* __ASM_SH_HW_IRQ_H */ 118#endif /* __ASM_SH_HW_IRQ_H */