diff options
author | Andrew Bresticker <abrestic@chromium.org> | 2014-10-20 15:03:54 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-11-24 01:45:13 -0500 |
commit | 824f3f7fa2b441416e3d9aaf1f19feab7db44747 (patch) | |
tree | 4a3f96dfb428482bc15d97586bf998b544875c08 /include/linux/irqchip | |
parent | 7110e227c86b83446b3b157df2ebb662c9fcb033 (diff) |
irqchip: mips-gic: Clean up header file
Remove duplicate #defines and unnecessary #includes, fix parenthesization,
and re-order register definitions in ascending order.
Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Cc: Daniel Lezcano <daniel.lezcano@linaro.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Paul Burton <paul.burton@imgtec.com>
Cc: Qais Yousef <qais.yousef@imgtec.com>
Cc: John Crispin <blogic@openwrt.org>
Cc: linux-mips@linux-mips.org
Cc: linux-kernel@vger.kernel.org
Patchwork: https://patchwork.linux-mips.org/patch/8128/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'include/linux/irqchip')
-rw-r--r-- | include/linux/irqchip/mips-gic.h | 129 |
1 files changed, 27 insertions, 102 deletions
diff --git a/include/linux/irqchip/mips-gic.h b/include/linux/irqchip/mips-gic.h index 285944ca9f6c..0350effb7ccc 100644 --- a/include/linux/irqchip/mips-gic.h +++ b/include/linux/irqchip/mips-gic.h | |||
@@ -4,17 +4,11 @@ | |||
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 2000, 07 MIPS Technologies, Inc. | 6 | * Copyright (C) 2000, 07 MIPS Technologies, Inc. |
7 | * | ||
8 | * GIC Register Definitions | ||
9 | * | ||
10 | */ | 7 | */ |
11 | #ifndef _ASM_GICREGS_H | 8 | #ifndef __LINUX_IRQCHIP_MIPS_GIC_H |
12 | #define _ASM_GICREGS_H | 9 | #define __LINUX_IRQCHIP_MIPS_GIC_H |
13 | |||
14 | #include <linux/bitmap.h> | ||
15 | #include <linux/threads.h> | ||
16 | 10 | ||
17 | #include <irq.h> | 11 | #include <linux/clocksource.h> |
18 | 12 | ||
19 | #define GIC_MAX_INTRS 256 | 13 | #define GIC_MAX_INTRS 256 |
20 | 14 | ||
@@ -50,108 +44,42 @@ | |||
50 | #define GIC_SH_COUNTER_63_32_OFS 0x0014 | 44 | #define GIC_SH_COUNTER_63_32_OFS 0x0014 |
51 | #define GIC_SH_REVISIONID_OFS 0x0020 | 45 | #define GIC_SH_REVISIONID_OFS 0x0020 |
52 | 46 | ||
53 | /* Interrupt Polarity */ | 47 | /* Convert an interrupt number to a byte offset/bit for multi-word registers */ |
54 | #define GIC_SH_POL_31_0_OFS 0x0100 | 48 | #define GIC_INTR_OFS(intr) (((intr) / 32) * 4) |
55 | #define GIC_SH_POL_63_32_OFS 0x0104 | 49 | #define GIC_INTR_BIT(intr) ((intr) % 32) |
56 | #define GIC_SH_POL_95_64_OFS 0x0108 | 50 | |
57 | #define GIC_SH_POL_127_96_OFS 0x010c | 51 | /* Polarity : Reset Value is always 0 */ |
58 | #define GIC_SH_POL_159_128_OFS 0x0110 | 52 | #define GIC_SH_SET_POLARITY_OFS 0x0100 |
59 | #define GIC_SH_POL_191_160_OFS 0x0114 | 53 | |
60 | #define GIC_SH_POL_223_192_OFS 0x0118 | 54 | /* Triggering : Reset Value is always 0 */ |
61 | #define GIC_SH_POL_255_224_OFS 0x011c | 55 | #define GIC_SH_SET_TRIGGER_OFS 0x0180 |
62 | 56 | ||
63 | /* Edge/Level Triggering */ | 57 | /* Dual edge triggering : Reset Value is always 0 */ |
64 | #define GIC_SH_TRIG_31_0_OFS 0x0180 | 58 | #define GIC_SH_SET_DUAL_OFS 0x0200 |
65 | #define GIC_SH_TRIG_63_32_OFS 0x0184 | ||
66 | #define GIC_SH_TRIG_95_64_OFS 0x0188 | ||
67 | #define GIC_SH_TRIG_127_96_OFS 0x018c | ||
68 | #define GIC_SH_TRIG_159_128_OFS 0x0190 | ||
69 | #define GIC_SH_TRIG_191_160_OFS 0x0194 | ||
70 | #define GIC_SH_TRIG_223_192_OFS 0x0198 | ||
71 | #define GIC_SH_TRIG_255_224_OFS 0x019c | ||
72 | |||
73 | /* Dual Edge Triggering */ | ||
74 | #define GIC_SH_DUAL_31_0_OFS 0x0200 | ||
75 | #define GIC_SH_DUAL_63_32_OFS 0x0204 | ||
76 | #define GIC_SH_DUAL_95_64_OFS 0x0208 | ||
77 | #define GIC_SH_DUAL_127_96_OFS 0x020c | ||
78 | #define GIC_SH_DUAL_159_128_OFS 0x0210 | ||
79 | #define GIC_SH_DUAL_191_160_OFS 0x0214 | ||
80 | #define GIC_SH_DUAL_223_192_OFS 0x0218 | ||
81 | #define GIC_SH_DUAL_255_224_OFS 0x021c | ||
82 | 59 | ||
83 | /* Set/Clear corresponding bit in Edge Detect Register */ | 60 | /* Set/Clear corresponding bit in Edge Detect Register */ |
84 | #define GIC_SH_WEDGE_OFS 0x0280 | 61 | #define GIC_SH_WEDGE_OFS 0x0280 |
85 | 62 | ||
86 | /* Reset Mask - Disables Interrupt */ | 63 | /* Mask manipulation */ |
87 | #define GIC_SH_RMASK_31_0_OFS 0x0300 | 64 | #define GIC_SH_RMASK_OFS 0x0300 |
88 | #define GIC_SH_RMASK_63_32_OFS 0x0304 | 65 | #define GIC_SH_SMASK_OFS 0x0380 |
89 | #define GIC_SH_RMASK_95_64_OFS 0x0308 | ||
90 | #define GIC_SH_RMASK_127_96_OFS 0x030c | ||
91 | #define GIC_SH_RMASK_159_128_OFS 0x0310 | ||
92 | #define GIC_SH_RMASK_191_160_OFS 0x0314 | ||
93 | #define GIC_SH_RMASK_223_192_OFS 0x0318 | ||
94 | #define GIC_SH_RMASK_255_224_OFS 0x031c | ||
95 | |||
96 | /* Set Mask (WO) - Enables Interrupt */ | ||
97 | #define GIC_SH_SMASK_31_0_OFS 0x0380 | ||
98 | #define GIC_SH_SMASK_63_32_OFS 0x0384 | ||
99 | #define GIC_SH_SMASK_95_64_OFS 0x0388 | ||
100 | #define GIC_SH_SMASK_127_96_OFS 0x038c | ||
101 | #define GIC_SH_SMASK_159_128_OFS 0x0390 | ||
102 | #define GIC_SH_SMASK_191_160_OFS 0x0394 | ||
103 | #define GIC_SH_SMASK_223_192_OFS 0x0398 | ||
104 | #define GIC_SH_SMASK_255_224_OFS 0x039c | ||
105 | 66 | ||
106 | /* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */ | 67 | /* Global Interrupt Mask Register (RO) - Bit Set == Interrupt enabled */ |
107 | #define GIC_SH_MASK_31_0_OFS 0x0400 | 68 | #define GIC_SH_MASK_OFS 0x0400 |
108 | #define GIC_SH_MASK_63_32_OFS 0x0404 | ||
109 | #define GIC_SH_MASK_95_64_OFS 0x0408 | ||
110 | #define GIC_SH_MASK_127_96_OFS 0x040c | ||
111 | #define GIC_SH_MASK_159_128_OFS 0x0410 | ||
112 | #define GIC_SH_MASK_191_160_OFS 0x0414 | ||
113 | #define GIC_SH_MASK_223_192_OFS 0x0418 | ||
114 | #define GIC_SH_MASK_255_224_OFS 0x041c | ||
115 | 69 | ||
116 | /* Pending Global Interrupts (RO) */ | 70 | /* Pending Global Interrupts (RO) */ |
117 | #define GIC_SH_PEND_31_0_OFS 0x0480 | 71 | #define GIC_SH_PEND_OFS 0x0480 |
118 | #define GIC_SH_PEND_63_32_OFS 0x0484 | ||
119 | #define GIC_SH_PEND_95_64_OFS 0x0488 | ||
120 | #define GIC_SH_PEND_127_96_OFS 0x048c | ||
121 | #define GIC_SH_PEND_159_128_OFS 0x0490 | ||
122 | #define GIC_SH_PEND_191_160_OFS 0x0494 | ||
123 | #define GIC_SH_PEND_223_192_OFS 0x0498 | ||
124 | #define GIC_SH_PEND_255_224_OFS 0x049c | ||
125 | |||
126 | #define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500 | ||
127 | 72 | ||
128 | /* Maps Interrupt X to a Pin */ | 73 | /* Maps Interrupt X to a Pin */ |
74 | #define GIC_SH_INTR_MAP_TO_PIN_BASE_OFS 0x0500 | ||
129 | #define GIC_SH_MAP_TO_PIN(intr) (4 * (intr)) | 75 | #define GIC_SH_MAP_TO_PIN(intr) (4 * (intr)) |
130 | 76 | ||
131 | #define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2000 | ||
132 | |||
133 | /* Maps Interrupt X to a VPE */ | 77 | /* Maps Interrupt X to a VPE */ |
78 | #define GIC_SH_INTR_MAP_TO_VPE_BASE_OFS 0x2000 | ||
134 | #define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \ | 79 | #define GIC_SH_MAP_TO_VPE_REG_OFF(intr, vpe) \ |
135 | ((32 * (intr)) + (((vpe) / 32) * 4)) | 80 | ((32 * (intr)) + (((vpe) / 32) * 4)) |
136 | #define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32)) | 81 | #define GIC_SH_MAP_TO_VPE_REG_BIT(vpe) (1 << ((vpe) % 32)) |
137 | 82 | ||
138 | /* Convert an interrupt number to a byte offset/bit for multi-word registers */ | ||
139 | #define GIC_INTR_OFS(intr) (((intr) / 32)*4) | ||
140 | #define GIC_INTR_BIT(intr) ((intr) % 32) | ||
141 | |||
142 | /* Polarity : Reset Value is always 0 */ | ||
143 | #define GIC_SH_SET_POLARITY_OFS 0x0100 | ||
144 | |||
145 | /* Triggering : Reset Value is always 0 */ | ||
146 | #define GIC_SH_SET_TRIGGER_OFS 0x0180 | ||
147 | |||
148 | /* Dual edge triggering : Reset Value is always 0 */ | ||
149 | #define GIC_SH_SET_DUAL_OFS 0x0200 | ||
150 | |||
151 | /* Mask manipulation */ | ||
152 | #define GIC_SH_SMASK_OFS 0x0380 | ||
153 | #define GIC_SH_RMASK_OFS 0x0300 | ||
154 | |||
155 | /* Register Map for Local Section */ | 83 | /* Register Map for Local Section */ |
156 | #define GIC_VPE_CTL_OFS 0x0000 | 84 | #define GIC_VPE_CTL_OFS 0x0000 |
157 | #define GIC_VPE_PEND_OFS 0x0004 | 85 | #define GIC_VPE_PEND_OFS 0x0004 |
@@ -200,8 +128,8 @@ | |||
200 | #define GIC_SH_CONFIG_NUMVPES_SHF 0 | 128 | #define GIC_SH_CONFIG_NUMVPES_SHF 0 |
201 | #define GIC_SH_CONFIG_NUMVPES_MSK (MSK(8) << GIC_SH_CONFIG_NUMVPES_SHF) | 129 | #define GIC_SH_CONFIG_NUMVPES_MSK (MSK(8) << GIC_SH_CONFIG_NUMVPES_SHF) |
202 | 130 | ||
203 | #define GIC_SH_WEDGE_SET(intr) (intr | (0x1 << 31)) | 131 | #define GIC_SH_WEDGE_SET(intr) ((intr) | (0x1 << 31)) |
204 | #define GIC_SH_WEDGE_CLR(intr) (intr & ~(0x1 << 31)) | 132 | #define GIC_SH_WEDGE_CLR(intr) ((intr) & ~(0x1 << 31)) |
205 | 133 | ||
206 | #define GIC_MAP_TO_PIN_SHF 31 | 134 | #define GIC_MAP_TO_PIN_SHF 31 |
207 | #define GIC_MAP_TO_PIN_MSK (MSK(1) << GIC_MAP_TO_PIN_SHF) | 135 | #define GIC_MAP_TO_PIN_MSK (MSK(1) << GIC_MAP_TO_PIN_SHF) |
@@ -278,10 +206,10 @@ | |||
278 | #define GIC_CPU_PIN_OFFSET 2 | 206 | #define GIC_CPU_PIN_OFFSET 2 |
279 | 207 | ||
280 | /* Add 2 to convert non-EIC hardware interrupt to EIC vector number. */ | 208 | /* Add 2 to convert non-EIC hardware interrupt to EIC vector number. */ |
281 | #define GIC_CPU_TO_VEC_OFFSET (2) | 209 | #define GIC_CPU_TO_VEC_OFFSET 2 |
282 | 210 | ||
283 | /* Mapped interrupt to pin X, then GIC will generate the vector (X+1). */ | 211 | /* Mapped interrupt to pin X, then GIC will generate the vector (X+1). */ |
284 | #define GIC_PIN_TO_VEC_OFFSET (1) | 212 | #define GIC_PIN_TO_VEC_OFFSET 1 |
285 | 213 | ||
286 | /* Local GIC interrupts. */ | 214 | /* Local GIC interrupts. */ |
287 | #define GIC_LOCAL_INT_WD 0 /* GIC watchdog */ | 215 | #define GIC_LOCAL_INT_WD 0 /* GIC watchdog */ |
@@ -301,9 +229,6 @@ | |||
301 | #define GIC_SHARED_TO_HWIRQ(x) (GIC_SHARED_HWIRQ_BASE + (x)) | 229 | #define GIC_SHARED_TO_HWIRQ(x) (GIC_SHARED_HWIRQ_BASE + (x)) |
302 | #define GIC_HWIRQ_TO_SHARED(x) ((x) - GIC_SHARED_HWIRQ_BASE) | 230 | #define GIC_HWIRQ_TO_SHARED(x) ((x) - GIC_SHARED_HWIRQ_BASE) |
303 | 231 | ||
304 | #include <linux/clocksource.h> | ||
305 | #include <linux/irq.h> | ||
306 | |||
307 | extern unsigned int gic_present; | 232 | extern unsigned int gic_present; |
308 | extern unsigned int gic_frequency; | 233 | extern unsigned int gic_frequency; |
309 | 234 | ||
@@ -322,4 +247,4 @@ extern unsigned int plat_ipi_resched_int_xlate(unsigned int); | |||
322 | extern unsigned int gic_get_timer_pending(void); | 247 | extern unsigned int gic_get_timer_pending(void); |
323 | extern int gic_get_c0_compare_int(void); | 248 | extern int gic_get_c0_compare_int(void); |
324 | extern int gic_get_c0_perfcount_int(void); | 249 | extern int gic_get_c0_perfcount_int(void); |
325 | #endif /* _ASM_GICREGS_H */ | 250 | #endif /* __LINUX_IRQCHIP_MIPS_GIC_H */ |