diff options
author | Kevin Cernekee <cernekee@gmail.com> | 2014-11-07 01:44:17 -0500 |
---|---|---|
committer | Jason Cooper <jason@lakedaemon.net> | 2014-11-08 23:01:22 -0500 |
commit | 332fd7c4fef5f3b166e93decb07fd69eb24f7998 (patch) | |
tree | 73f4056f73629eecffaa5d3140fbb2e88c609ff5 | |
parent | 1dacf194b1468546a5715db58cbb65d50b598482 (diff) |
genirq: Generic chip: Change irq_reg_{readl,writel} arguments
Pass in the irq_chip_generic struct so we can use different readl/writel
settings for each irqchip driver, when appropriate. Compute
(gc->reg_base + reg_offset) in the helper function because this is pretty
much what all callers want to do anyway.
Compile-tested using the following configurations:
at91_dt_defconfig (CONFIG_ATMEL_AIC_IRQ=y)
sama5_defconfig (CONFIG_ATMEL_AIC5_IRQ=y)
sunxi_defconfig (CONFIG_ARCH_SUNXI=y)
tb10x (ARC) is untested.
Signed-off-by: Kevin Cernekee <cernekee@gmail.com>
Acked-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Acked-by: Arnd Bergmann <arnd@arndb.de>
Link: https://lkml.kernel.org/r/1415342669-30640-3-git-send-email-cernekee@gmail.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
-rw-r--r-- | drivers/irqchip/irq-atmel-aic.c | 40 | ||||
-rw-r--r-- | drivers/irqchip/irq-atmel-aic5.c | 65 | ||||
-rw-r--r-- | drivers/irqchip/irq-sunxi-nmi.c | 4 | ||||
-rw-r--r-- | drivers/irqchip/irq-tb10x.c | 4 | ||||
-rw-r--r-- | include/linux/irq.h | 20 | ||||
-rw-r--r-- | kernel/irq/generic-chip.c | 20 |
6 files changed, 78 insertions, 75 deletions
diff --git a/drivers/irqchip/irq-atmel-aic.c b/drivers/irqchip/irq-atmel-aic.c index 9a2cf3c1a3a5..27fdd8c3e7b4 100644 --- a/drivers/irqchip/irq-atmel-aic.c +++ b/drivers/irqchip/irq-atmel-aic.c | |||
@@ -65,11 +65,11 @@ aic_handle(struct pt_regs *regs) | |||
65 | u32 irqnr; | 65 | u32 irqnr; |
66 | u32 irqstat; | 66 | u32 irqstat; |
67 | 67 | ||
68 | irqnr = irq_reg_readl(gc->reg_base + AT91_AIC_IVR); | 68 | irqnr = irq_reg_readl(gc, AT91_AIC_IVR); |
69 | irqstat = irq_reg_readl(gc->reg_base + AT91_AIC_ISR); | 69 | irqstat = irq_reg_readl(gc, AT91_AIC_ISR); |
70 | 70 | ||
71 | if (!irqstat) | 71 | if (!irqstat) |
72 | irq_reg_writel(0, gc->reg_base + AT91_AIC_EOICR); | 72 | irq_reg_writel(gc, 0, AT91_AIC_EOICR); |
73 | else | 73 | else |
74 | handle_domain_irq(aic_domain, irqnr, regs); | 74 | handle_domain_irq(aic_domain, irqnr, regs); |
75 | } | 75 | } |
@@ -80,7 +80,7 @@ static int aic_retrigger(struct irq_data *d) | |||
80 | 80 | ||
81 | /* Enable interrupt on AIC5 */ | 81 | /* Enable interrupt on AIC5 */ |
82 | irq_gc_lock(gc); | 82 | irq_gc_lock(gc); |
83 | irq_reg_writel(d->mask, gc->reg_base + AT91_AIC_ISCR); | 83 | irq_reg_writel(gc, d->mask, AT91_AIC_ISCR); |
84 | irq_gc_unlock(gc); | 84 | irq_gc_unlock(gc); |
85 | 85 | ||
86 | return 0; | 86 | return 0; |
@@ -92,12 +92,12 @@ static int aic_set_type(struct irq_data *d, unsigned type) | |||
92 | unsigned int smr; | 92 | unsigned int smr; |
93 | int ret; | 93 | int ret; |
94 | 94 | ||
95 | smr = irq_reg_readl(gc->reg_base + AT91_AIC_SMR(d->hwirq)); | 95 | smr = irq_reg_readl(gc, AT91_AIC_SMR(d->hwirq)); |
96 | ret = aic_common_set_type(d, type, &smr); | 96 | ret = aic_common_set_type(d, type, &smr); |
97 | if (ret) | 97 | if (ret) |
98 | return ret; | 98 | return ret; |
99 | 99 | ||
100 | irq_reg_writel(smr, gc->reg_base + AT91_AIC_SMR(d->hwirq)); | 100 | irq_reg_writel(gc, smr, AT91_AIC_SMR(d->hwirq)); |
101 | 101 | ||
102 | return 0; | 102 | return 0; |
103 | } | 103 | } |
@@ -108,8 +108,8 @@ static void aic_suspend(struct irq_data *d) | |||
108 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 108 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
109 | 109 | ||
110 | irq_gc_lock(gc); | 110 | irq_gc_lock(gc); |
111 | irq_reg_writel(gc->mask_cache, gc->reg_base + AT91_AIC_IDCR); | 111 | irq_reg_writel(gc, gc->mask_cache, AT91_AIC_IDCR); |
112 | irq_reg_writel(gc->wake_active, gc->reg_base + AT91_AIC_IECR); | 112 | irq_reg_writel(gc, gc->wake_active, AT91_AIC_IECR); |
113 | irq_gc_unlock(gc); | 113 | irq_gc_unlock(gc); |
114 | } | 114 | } |
115 | 115 | ||
@@ -118,8 +118,8 @@ static void aic_resume(struct irq_data *d) | |||
118 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 118 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
119 | 119 | ||
120 | irq_gc_lock(gc); | 120 | irq_gc_lock(gc); |
121 | irq_reg_writel(gc->wake_active, gc->reg_base + AT91_AIC_IDCR); | 121 | irq_reg_writel(gc, gc->wake_active, AT91_AIC_IDCR); |
122 | irq_reg_writel(gc->mask_cache, gc->reg_base + AT91_AIC_IECR); | 122 | irq_reg_writel(gc, gc->mask_cache, AT91_AIC_IECR); |
123 | irq_gc_unlock(gc); | 123 | irq_gc_unlock(gc); |
124 | } | 124 | } |
125 | 125 | ||
@@ -128,8 +128,8 @@ static void aic_pm_shutdown(struct irq_data *d) | |||
128 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); | 128 | struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d); |
129 | 129 | ||
130 | irq_gc_lock(gc); | 130 | irq_gc_lock(gc); |
131 | irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC_IDCR); | 131 | irq_reg_writel(gc, 0xffffffff, AT91_AIC_IDCR); |
132 | irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC_ICCR); | 132 | irq_reg_writel(gc, 0xffffffff, AT91_AIC_ICCR); |
133 | irq_gc_unlock(gc); | 133 | irq_gc_unlock(gc); |
134 | } | 134 | } |
135 | #else | 135 | #else |
@@ -148,24 +148,24 @@ static void __init aic_hw_init(struct irq_domain *domain) | |||
148 | * will not Lock out nIRQ | 148 | * will not Lock out nIRQ |
149 | */ | 149 | */ |
150 | for (i = 0; i < 8; i++) | 150 | for (i = 0; i < 8; i++) |
151 | irq_reg_writel(0, gc->reg_base + AT91_AIC_EOICR); | 151 | irq_reg_writel(gc, 0, AT91_AIC_EOICR); |
152 | 152 | ||
153 | /* | 153 | /* |
154 | * Spurious Interrupt ID in Spurious Vector Register. | 154 | * Spurious Interrupt ID in Spurious Vector Register. |
155 | * When there is no current interrupt, the IRQ Vector Register | 155 | * When there is no current interrupt, the IRQ Vector Register |
156 | * reads the value stored in AIC_SPU | 156 | * reads the value stored in AIC_SPU |
157 | */ | 157 | */ |
158 | irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC_SPU); | 158 | irq_reg_writel(gc, 0xffffffff, AT91_AIC_SPU); |
159 | 159 | ||
160 | /* No debugging in AIC: Debug (Protect) Control Register */ | 160 | /* No debugging in AIC: Debug (Protect) Control Register */ |
161 | irq_reg_writel(0, gc->reg_base + AT91_AIC_DCR); | 161 | irq_reg_writel(gc, 0, AT91_AIC_DCR); |
162 | 162 | ||
163 | /* Disable and clear all interrupts initially */ | 163 | /* Disable and clear all interrupts initially */ |
164 | irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC_IDCR); | 164 | irq_reg_writel(gc, 0xffffffff, AT91_AIC_IDCR); |
165 | irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC_ICCR); | 165 | irq_reg_writel(gc, 0xffffffff, AT91_AIC_ICCR); |
166 | 166 | ||
167 | for (i = 0; i < 32; i++) | 167 | for (i = 0; i < 32; i++) |
168 | irq_reg_writel(i, gc->reg_base + AT91_AIC_SVR(i)); | 168 | irq_reg_writel(gc, i, AT91_AIC_SVR(i)); |
169 | } | 169 | } |
170 | 170 | ||
171 | static int aic_irq_domain_xlate(struct irq_domain *d, | 171 | static int aic_irq_domain_xlate(struct irq_domain *d, |
@@ -195,10 +195,10 @@ static int aic_irq_domain_xlate(struct irq_domain *d, | |||
195 | gc = dgc->gc[idx]; | 195 | gc = dgc->gc[idx]; |
196 | 196 | ||
197 | irq_gc_lock(gc); | 197 | irq_gc_lock(gc); |
198 | smr = irq_reg_readl(gc->reg_base + AT91_AIC_SMR(*out_hwirq)); | 198 | smr = irq_reg_readl(gc, AT91_AIC_SMR(*out_hwirq)); |
199 | ret = aic_common_set_priority(intspec[2], &smr); | 199 | ret = aic_common_set_priority(intspec[2], &smr); |
200 | if (!ret) | 200 | if (!ret) |
201 | irq_reg_writel(smr, gc->reg_base + AT91_AIC_SMR(*out_hwirq)); | 201 | irq_reg_writel(gc, smr, AT91_AIC_SMR(*out_hwirq)); |
202 | irq_gc_unlock(gc); | 202 | irq_gc_unlock(gc); |
203 | 203 | ||
204 | return ret; | 204 | return ret; |
diff --git a/drivers/irqchip/irq-atmel-aic5.c b/drivers/irqchip/irq-atmel-aic5.c index a11aae8fb006..a2e8c3f876cb 100644 --- a/drivers/irqchip/irq-atmel-aic5.c +++ b/drivers/irqchip/irq-atmel-aic5.c | |||
@@ -75,11 +75,11 @@ aic5_handle(struct pt_regs *regs) | |||
75 | u32 irqnr; | 75 | u32 irqnr; |
76 | u32 irqstat; | 76 | u32 irqstat; |
77 | 77 | ||
78 | irqnr = irq_reg_readl(gc->reg_base + AT91_AIC5_IVR); | 78 | irqnr = irq_reg_readl(gc, AT91_AIC5_IVR); |
79 | irqstat = irq_reg_readl(gc->reg_base + AT91_AIC5_ISR); | 79 | irqstat = irq_reg_readl(gc, AT91_AIC5_ISR); |
80 | 80 | ||
81 | if (!irqstat) | 81 | if (!irqstat) |
82 | irq_reg_writel(0, gc->reg_base + AT91_AIC5_EOICR); | 82 | irq_reg_writel(gc, 0, AT91_AIC5_EOICR); |
83 | else | 83 | else |
84 | handle_domain_irq(aic5_domain, irqnr, regs); | 84 | handle_domain_irq(aic5_domain, irqnr, regs); |
85 | } | 85 | } |
@@ -92,8 +92,8 @@ static void aic5_mask(struct irq_data *d) | |||
92 | 92 | ||
93 | /* Disable interrupt on AIC5 */ | 93 | /* Disable interrupt on AIC5 */ |
94 | irq_gc_lock(gc); | 94 | irq_gc_lock(gc); |
95 | irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); | 95 | irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); |
96 | irq_reg_writel(1, gc->reg_base + AT91_AIC5_IDCR); | 96 | irq_reg_writel(gc, 1, AT91_AIC5_IDCR); |
97 | gc->mask_cache &= ~d->mask; | 97 | gc->mask_cache &= ~d->mask; |
98 | irq_gc_unlock(gc); | 98 | irq_gc_unlock(gc); |
99 | } | 99 | } |
@@ -106,8 +106,8 @@ static void aic5_unmask(struct irq_data *d) | |||
106 | 106 | ||
107 | /* Enable interrupt on AIC5 */ | 107 | /* Enable interrupt on AIC5 */ |
108 | irq_gc_lock(gc); | 108 | irq_gc_lock(gc); |
109 | irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); | 109 | irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); |
110 | irq_reg_writel(1, gc->reg_base + AT91_AIC5_IECR); | 110 | irq_reg_writel(gc, 1, AT91_AIC5_IECR); |
111 | gc->mask_cache |= d->mask; | 111 | gc->mask_cache |= d->mask; |
112 | irq_gc_unlock(gc); | 112 | irq_gc_unlock(gc); |
113 | } | 113 | } |
@@ -120,8 +120,8 @@ static int aic5_retrigger(struct irq_data *d) | |||
120 | 120 | ||
121 | /* Enable interrupt on AIC5 */ | 121 | /* Enable interrupt on AIC5 */ |
122 | irq_gc_lock(gc); | 122 | irq_gc_lock(gc); |
123 | irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); | 123 | irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); |
124 | irq_reg_writel(1, gc->reg_base + AT91_AIC5_ISCR); | 124 | irq_reg_writel(gc, 1, AT91_AIC5_ISCR); |
125 | irq_gc_unlock(gc); | 125 | irq_gc_unlock(gc); |
126 | 126 | ||
127 | return 0; | 127 | return 0; |
@@ -136,11 +136,11 @@ static int aic5_set_type(struct irq_data *d, unsigned type) | |||
136 | int ret; | 136 | int ret; |
137 | 137 | ||
138 | irq_gc_lock(gc); | 138 | irq_gc_lock(gc); |
139 | irq_reg_writel(d->hwirq, gc->reg_base + AT91_AIC5_SSR); | 139 | irq_reg_writel(gc, d->hwirq, AT91_AIC5_SSR); |
140 | smr = irq_reg_readl(gc->reg_base + AT91_AIC5_SMR); | 140 | smr = irq_reg_readl(gc, AT91_AIC5_SMR); |
141 | ret = aic_common_set_type(d, type, &smr); | 141 | ret = aic_common_set_type(d, type, &smr); |
142 | if (!ret) | 142 | if (!ret) |
143 | irq_reg_writel(smr, gc->reg_base + AT91_AIC5_SMR); | 143 | irq_reg_writel(gc, smr, AT91_AIC5_SMR); |
144 | irq_gc_unlock(gc); | 144 | irq_gc_unlock(gc); |
145 | 145 | ||
146 | return ret; | 146 | return ret; |
@@ -162,12 +162,11 @@ static void aic5_suspend(struct irq_data *d) | |||
162 | if ((mask & gc->mask_cache) == (mask & gc->wake_active)) | 162 | if ((mask & gc->mask_cache) == (mask & gc->wake_active)) |
163 | continue; | 163 | continue; |
164 | 164 | ||
165 | irq_reg_writel(i + gc->irq_base, | 165 | irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); |
166 | bgc->reg_base + AT91_AIC5_SSR); | ||
167 | if (mask & gc->wake_active) | 166 | if (mask & gc->wake_active) |
168 | irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IECR); | 167 | irq_reg_writel(bgc, 1, AT91_AIC5_IECR); |
169 | else | 168 | else |
170 | irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IDCR); | 169 | irq_reg_writel(bgc, 1, AT91_AIC5_IDCR); |
171 | } | 170 | } |
172 | irq_gc_unlock(bgc); | 171 | irq_gc_unlock(bgc); |
173 | } | 172 | } |
@@ -187,12 +186,11 @@ static void aic5_resume(struct irq_data *d) | |||
187 | if ((mask & gc->mask_cache) == (mask & gc->wake_active)) | 186 | if ((mask & gc->mask_cache) == (mask & gc->wake_active)) |
188 | continue; | 187 | continue; |
189 | 188 | ||
190 | irq_reg_writel(i + gc->irq_base, | 189 | irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); |
191 | bgc->reg_base + AT91_AIC5_SSR); | ||
192 | if (mask & gc->mask_cache) | 190 | if (mask & gc->mask_cache) |
193 | irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IECR); | 191 | irq_reg_writel(bgc, 1, AT91_AIC5_IECR); |
194 | else | 192 | else |
195 | irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IDCR); | 193 | irq_reg_writel(bgc, 1, AT91_AIC5_IDCR); |
196 | } | 194 | } |
197 | irq_gc_unlock(bgc); | 195 | irq_gc_unlock(bgc); |
198 | } | 196 | } |
@@ -207,10 +205,9 @@ static void aic5_pm_shutdown(struct irq_data *d) | |||
207 | 205 | ||
208 | irq_gc_lock(bgc); | 206 | irq_gc_lock(bgc); |
209 | for (i = 0; i < dgc->irqs_per_chip; i++) { | 207 | for (i = 0; i < dgc->irqs_per_chip; i++) { |
210 | irq_reg_writel(i + gc->irq_base, | 208 | irq_reg_writel(bgc, i + gc->irq_base, AT91_AIC5_SSR); |
211 | bgc->reg_base + AT91_AIC5_SSR); | 209 | irq_reg_writel(bgc, 1, AT91_AIC5_IDCR); |
212 | irq_reg_writel(1, bgc->reg_base + AT91_AIC5_IDCR); | 210 | irq_reg_writel(bgc, 1, AT91_AIC5_ICCR); |
213 | irq_reg_writel(1, bgc->reg_base + AT91_AIC5_ICCR); | ||
214 | } | 211 | } |
215 | irq_gc_unlock(bgc); | 212 | irq_gc_unlock(bgc); |
216 | } | 213 | } |
@@ -230,24 +227,24 @@ static void __init aic5_hw_init(struct irq_domain *domain) | |||
230 | * will not Lock out nIRQ | 227 | * will not Lock out nIRQ |
231 | */ | 228 | */ |
232 | for (i = 0; i < 8; i++) | 229 | for (i = 0; i < 8; i++) |
233 | irq_reg_writel(0, gc->reg_base + AT91_AIC5_EOICR); | 230 | irq_reg_writel(gc, 0, AT91_AIC5_EOICR); |
234 | 231 | ||
235 | /* | 232 | /* |
236 | * Spurious Interrupt ID in Spurious Vector Register. | 233 | * Spurious Interrupt ID in Spurious Vector Register. |
237 | * When there is no current interrupt, the IRQ Vector Register | 234 | * When there is no current interrupt, the IRQ Vector Register |
238 | * reads the value stored in AIC_SPU | 235 | * reads the value stored in AIC_SPU |
239 | */ | 236 | */ |
240 | irq_reg_writel(0xffffffff, gc->reg_base + AT91_AIC5_SPU); | 237 | irq_reg_writel(gc, 0xffffffff, AT91_AIC5_SPU); |
241 | 238 | ||
242 | /* No debugging in AIC: Debug (Protect) Control Register */ | 239 | /* No debugging in AIC: Debug (Protect) Control Register */ |
243 | irq_reg_writel(0, gc->reg_base + AT91_AIC5_DCR); | 240 | irq_reg_writel(gc, 0, AT91_AIC5_DCR); |
244 | 241 | ||
245 | /* Disable and clear all interrupts initially */ | 242 | /* Disable and clear all interrupts initially */ |
246 | for (i = 0; i < domain->revmap_size; i++) { | 243 | for (i = 0; i < domain->revmap_size; i++) { |
247 | irq_reg_writel(i, gc->reg_base + AT91_AIC5_SSR); | 244 | irq_reg_writel(gc, i, AT91_AIC5_SSR); |
248 | irq_reg_writel(i, gc->reg_base + AT91_AIC5_SVR); | 245 | irq_reg_writel(gc, i, AT91_AIC5_SVR); |
249 | irq_reg_writel(1, gc->reg_base + AT91_AIC5_IDCR); | 246 | irq_reg_writel(gc, 1, AT91_AIC5_IDCR); |
250 | irq_reg_writel(1, gc->reg_base + AT91_AIC5_ICCR); | 247 | irq_reg_writel(gc, 1, AT91_AIC5_ICCR); |
251 | } | 248 | } |
252 | } | 249 | } |
253 | 250 | ||
@@ -273,11 +270,11 @@ static int aic5_irq_domain_xlate(struct irq_domain *d, | |||
273 | gc = dgc->gc[0]; | 270 | gc = dgc->gc[0]; |
274 | 271 | ||
275 | irq_gc_lock(gc); | 272 | irq_gc_lock(gc); |
276 | irq_reg_writel(*out_hwirq, gc->reg_base + AT91_AIC5_SSR); | 273 | irq_reg_writel(gc, *out_hwirq, AT91_AIC5_SSR); |
277 | smr = irq_reg_readl(gc->reg_base + AT91_AIC5_SMR); | 274 | smr = irq_reg_readl(gc, AT91_AIC5_SMR); |
278 | ret = aic_common_set_priority(intspec[2], &smr); | 275 | ret = aic_common_set_priority(intspec[2], &smr); |
279 | if (!ret) | 276 | if (!ret) |
280 | irq_reg_writel(intspec[2] | smr, gc->reg_base + AT91_AIC5_SMR); | 277 | irq_reg_writel(gc, intspec[2] | smr, AT91_AIC5_SMR); |
281 | irq_gc_unlock(gc); | 278 | irq_gc_unlock(gc); |
282 | 279 | ||
283 | return ret; | 280 | return ret; |
diff --git a/drivers/irqchip/irq-sunxi-nmi.c b/drivers/irqchip/irq-sunxi-nmi.c index 12f547a44ae4..4a9ce5b50c5b 100644 --- a/drivers/irqchip/irq-sunxi-nmi.c +++ b/drivers/irqchip/irq-sunxi-nmi.c | |||
@@ -50,12 +50,12 @@ static struct sunxi_sc_nmi_reg_offs sun6i_reg_offs = { | |||
50 | static inline void sunxi_sc_nmi_write(struct irq_chip_generic *gc, u32 off, | 50 | static inline void sunxi_sc_nmi_write(struct irq_chip_generic *gc, u32 off, |
51 | u32 val) | 51 | u32 val) |
52 | { | 52 | { |
53 | irq_reg_writel(val, gc->reg_base + off); | 53 | irq_reg_writel(gc, val, off); |
54 | } | 54 | } |
55 | 55 | ||
56 | static inline u32 sunxi_sc_nmi_read(struct irq_chip_generic *gc, u32 off) | 56 | static inline u32 sunxi_sc_nmi_read(struct irq_chip_generic *gc, u32 off) |
57 | { | 57 | { |
58 | return irq_reg_readl(gc->reg_base + off); | 58 | return irq_reg_readl(gc, off); |
59 | } | 59 | } |
60 | 60 | ||
61 | static void sunxi_sc_nmi_handle_irq(unsigned int irq, struct irq_desc *desc) | 61 | static void sunxi_sc_nmi_handle_irq(unsigned int irq, struct irq_desc *desc) |
diff --git a/drivers/irqchip/irq-tb10x.c b/drivers/irqchip/irq-tb10x.c index 7c44c99bf1f2..accc20036a3c 100644 --- a/drivers/irqchip/irq-tb10x.c +++ b/drivers/irqchip/irq-tb10x.c | |||
@@ -43,12 +43,12 @@ | |||
43 | static inline void ab_irqctl_writereg(struct irq_chip_generic *gc, u32 reg, | 43 | static inline void ab_irqctl_writereg(struct irq_chip_generic *gc, u32 reg, |
44 | u32 val) | 44 | u32 val) |
45 | { | 45 | { |
46 | irq_reg_writel(val, gc->reg_base + reg); | 46 | irq_reg_writel(gc, val, reg); |
47 | } | 47 | } |
48 | 48 | ||
49 | static inline u32 ab_irqctl_readreg(struct irq_chip_generic *gc, u32 reg) | 49 | static inline u32 ab_irqctl_readreg(struct irq_chip_generic *gc, u32 reg) |
50 | { | 50 | { |
51 | return irq_reg_readl(gc->reg_base + reg); | 51 | return irq_reg_readl(gc, reg); |
52 | } | 52 | } |
53 | 53 | ||
54 | static int tb10x_irq_set_type(struct irq_data *data, unsigned int flow_type) | 54 | static int tb10x_irq_set_type(struct irq_data *data, unsigned int flow_type) |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 03f48d936f66..ed1135d32d80 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -20,6 +20,7 @@ | |||
20 | #include <linux/errno.h> | 20 | #include <linux/errno.h> |
21 | #include <linux/topology.h> | 21 | #include <linux/topology.h> |
22 | #include <linux/wait.h> | 22 | #include <linux/wait.h> |
23 | #include <linux/io.h> | ||
23 | 24 | ||
24 | #include <asm/irq.h> | 25 | #include <asm/irq.h> |
25 | #include <asm/ptrace.h> | 26 | #include <asm/ptrace.h> |
@@ -639,13 +640,6 @@ void arch_teardown_hwirq(unsigned int irq); | |||
639 | void irq_init_desc(unsigned int irq); | 640 | void irq_init_desc(unsigned int irq); |
640 | #endif | 641 | #endif |
641 | 642 | ||
642 | #ifndef irq_reg_writel | ||
643 | # define irq_reg_writel(val, addr) writel(val, addr) | ||
644 | #endif | ||
645 | #ifndef irq_reg_readl | ||
646 | # define irq_reg_readl(addr) readl(addr) | ||
647 | #endif | ||
648 | |||
649 | /** | 643 | /** |
650 | * struct irq_chip_regs - register offsets for struct irq_gci | 644 | * struct irq_chip_regs - register offsets for struct irq_gci |
651 | * @enable: Enable register offset to reg_base | 645 | * @enable: Enable register offset to reg_base |
@@ -821,4 +815,16 @@ static inline void irq_gc_lock(struct irq_chip_generic *gc) { } | |||
821 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } | 815 | static inline void irq_gc_unlock(struct irq_chip_generic *gc) { } |
822 | #endif | 816 | #endif |
823 | 817 | ||
818 | static inline void irq_reg_writel(struct irq_chip_generic *gc, | ||
819 | u32 val, int reg_offset) | ||
820 | { | ||
821 | writel(val, gc->reg_base + reg_offset); | ||
822 | } | ||
823 | |||
824 | static inline u32 irq_reg_readl(struct irq_chip_generic *gc, | ||
825 | int reg_offset) | ||
826 | { | ||
827 | return readl(gc->reg_base + reg_offset); | ||
828 | } | ||
829 | |||
824 | #endif /* _LINUX_IRQ_H */ | 830 | #endif /* _LINUX_IRQ_H */ |
diff --git a/kernel/irq/generic-chip.c b/kernel/irq/generic-chip.c index cf80e7b0ddab..db458c68e392 100644 --- a/kernel/irq/generic-chip.c +++ b/kernel/irq/generic-chip.c | |||
@@ -39,7 +39,7 @@ void irq_gc_mask_disable_reg(struct irq_data *d) | |||
39 | u32 mask = d->mask; | 39 | u32 mask = d->mask; |
40 | 40 | ||
41 | irq_gc_lock(gc); | 41 | irq_gc_lock(gc); |
42 | irq_reg_writel(mask, gc->reg_base + ct->regs.disable); | 42 | irq_reg_writel(gc, mask, ct->regs.disable); |
43 | *ct->mask_cache &= ~mask; | 43 | *ct->mask_cache &= ~mask; |
44 | irq_gc_unlock(gc); | 44 | irq_gc_unlock(gc); |
45 | } | 45 | } |
@@ -59,7 +59,7 @@ void irq_gc_mask_set_bit(struct irq_data *d) | |||
59 | 59 | ||
60 | irq_gc_lock(gc); | 60 | irq_gc_lock(gc); |
61 | *ct->mask_cache |= mask; | 61 | *ct->mask_cache |= mask; |
62 | irq_reg_writel(*ct->mask_cache, gc->reg_base + ct->regs.mask); | 62 | irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask); |
63 | irq_gc_unlock(gc); | 63 | irq_gc_unlock(gc); |
64 | } | 64 | } |
65 | EXPORT_SYMBOL_GPL(irq_gc_mask_set_bit); | 65 | EXPORT_SYMBOL_GPL(irq_gc_mask_set_bit); |
@@ -79,7 +79,7 @@ void irq_gc_mask_clr_bit(struct irq_data *d) | |||
79 | 79 | ||
80 | irq_gc_lock(gc); | 80 | irq_gc_lock(gc); |
81 | *ct->mask_cache &= ~mask; | 81 | *ct->mask_cache &= ~mask; |
82 | irq_reg_writel(*ct->mask_cache, gc->reg_base + ct->regs.mask); | 82 | irq_reg_writel(gc, *ct->mask_cache, ct->regs.mask); |
83 | irq_gc_unlock(gc); | 83 | irq_gc_unlock(gc); |
84 | } | 84 | } |
85 | EXPORT_SYMBOL_GPL(irq_gc_mask_clr_bit); | 85 | EXPORT_SYMBOL_GPL(irq_gc_mask_clr_bit); |
@@ -98,7 +98,7 @@ void irq_gc_unmask_enable_reg(struct irq_data *d) | |||
98 | u32 mask = d->mask; | 98 | u32 mask = d->mask; |
99 | 99 | ||
100 | irq_gc_lock(gc); | 100 | irq_gc_lock(gc); |
101 | irq_reg_writel(mask, gc->reg_base + ct->regs.enable); | 101 | irq_reg_writel(gc, mask, ct->regs.enable); |
102 | *ct->mask_cache |= mask; | 102 | *ct->mask_cache |= mask; |
103 | irq_gc_unlock(gc); | 103 | irq_gc_unlock(gc); |
104 | } | 104 | } |
@@ -114,7 +114,7 @@ void irq_gc_ack_set_bit(struct irq_data *d) | |||
114 | u32 mask = d->mask; | 114 | u32 mask = d->mask; |
115 | 115 | ||
116 | irq_gc_lock(gc); | 116 | irq_gc_lock(gc); |
117 | irq_reg_writel(mask, gc->reg_base + ct->regs.ack); | 117 | irq_reg_writel(gc, mask, ct->regs.ack); |
118 | irq_gc_unlock(gc); | 118 | irq_gc_unlock(gc); |
119 | } | 119 | } |
120 | EXPORT_SYMBOL_GPL(irq_gc_ack_set_bit); | 120 | EXPORT_SYMBOL_GPL(irq_gc_ack_set_bit); |
@@ -130,7 +130,7 @@ void irq_gc_ack_clr_bit(struct irq_data *d) | |||
130 | u32 mask = ~d->mask; | 130 | u32 mask = ~d->mask; |
131 | 131 | ||
132 | irq_gc_lock(gc); | 132 | irq_gc_lock(gc); |
133 | irq_reg_writel(mask, gc->reg_base + ct->regs.ack); | 133 | irq_reg_writel(gc, mask, ct->regs.ack); |
134 | irq_gc_unlock(gc); | 134 | irq_gc_unlock(gc); |
135 | } | 135 | } |
136 | 136 | ||
@@ -145,8 +145,8 @@ void irq_gc_mask_disable_reg_and_ack(struct irq_data *d) | |||
145 | u32 mask = d->mask; | 145 | u32 mask = d->mask; |
146 | 146 | ||
147 | irq_gc_lock(gc); | 147 | irq_gc_lock(gc); |
148 | irq_reg_writel(mask, gc->reg_base + ct->regs.mask); | 148 | irq_reg_writel(gc, mask, ct->regs.mask); |
149 | irq_reg_writel(mask, gc->reg_base + ct->regs.ack); | 149 | irq_reg_writel(gc, mask, ct->regs.ack); |
150 | irq_gc_unlock(gc); | 150 | irq_gc_unlock(gc); |
151 | } | 151 | } |
152 | 152 | ||
@@ -161,7 +161,7 @@ void irq_gc_eoi(struct irq_data *d) | |||
161 | u32 mask = d->mask; | 161 | u32 mask = d->mask; |
162 | 162 | ||
163 | irq_gc_lock(gc); | 163 | irq_gc_lock(gc); |
164 | irq_reg_writel(mask, gc->reg_base + ct->regs.eoi); | 164 | irq_reg_writel(gc, mask, ct->regs.eoi); |
165 | irq_gc_unlock(gc); | 165 | irq_gc_unlock(gc); |
166 | } | 166 | } |
167 | 167 | ||
@@ -245,7 +245,7 @@ irq_gc_init_mask_cache(struct irq_chip_generic *gc, enum irq_gc_flags flags) | |||
245 | } | 245 | } |
246 | ct[i].mask_cache = mskptr; | 246 | ct[i].mask_cache = mskptr; |
247 | if (flags & IRQ_GC_INIT_MASK_CACHE) | 247 | if (flags & IRQ_GC_INIT_MASK_CACHE) |
248 | *mskptr = irq_reg_readl(gc->reg_base + mskreg); | 248 | *mskptr = irq_reg_readl(gc, mskreg); |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||