diff options
author | Gabor Juhos <juhosg@openwrt.org> | 2012-03-14 05:45:25 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-05-15 11:49:09 -0400 |
commit | fce5cc6e0ddc601e504063548034766c5c5a78d1 (patch) | |
tree | 7cd6498b983f4f8efb22070b22c77f9afb2388f9 /arch/mips | |
parent | 4dbcbdf8135def8f704b130305721bdd42a8078b (diff) |
MIPS: ath79: add IRQ handling code for AR934X
Signed-off-by: Gabor Juhos <juhosg@openwrt.org>
Acked-by: Luis R. Rodriguez <mcgrof@qca.qualcomm.com>
Cc: linux-mips@linux-mips.org
Cc: mcgrof@infradead.org
Patchwork: https://patchwork.linux-mips.org/patch/3510/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/ath79/irq.c | 55 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-ath79/ar71xx_regs.h | 25 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-ath79/irq.h | 6 |
3 files changed, 83 insertions, 3 deletions
diff --git a/arch/mips/ath79/irq.c b/arch/mips/ath79/irq.c index 9f87ade52956..90d09fc15398 100644 --- a/arch/mips/ath79/irq.c +++ b/arch/mips/ath79/irq.c | |||
@@ -1,10 +1,11 @@ | |||
1 | /* | 1 | /* |
2 | * Atheros AR71xx/AR724x/AR913x specific interrupt handling | 2 | * Atheros AR71xx/AR724x/AR913x specific interrupt handling |
3 | * | 3 | * |
4 | * Copyright (C) 2010-2011 Jaiganesh Narayanan <jnarayanan@atheros.com> | ||
4 | * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> | 5 | * Copyright (C) 2008-2011 Gabor Juhos <juhosg@openwrt.org> |
5 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> | 6 | * Copyright (C) 2008 Imre Kaloz <kaloz@openwrt.org> |
6 | * | 7 | * |
7 | * Parts of this file are based on Atheros' 2.6.15 BSP | 8 | * Parts of this file are based on Atheros' 2.6.15/2.6.31 BSP |
8 | * | 9 | * |
9 | * This program is free software; you can redistribute it and/or modify it | 10 | * This program is free software; you can redistribute it and/or modify it |
10 | * under the terms of the GNU General Public License version 2 as published | 11 | * under the terms of the GNU General Public License version 2 as published |
@@ -129,7 +130,7 @@ static void __init ath79_misc_irq_init(void) | |||
129 | 130 | ||
130 | if (soc_is_ar71xx() || soc_is_ar913x()) | 131 | if (soc_is_ar71xx() || soc_is_ar913x()) |
131 | ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; | 132 | ath79_misc_irq_chip.irq_mask_ack = ar71xx_misc_irq_mask; |
132 | else if (soc_is_ar724x() || soc_is_ar933x()) | 133 | else if (soc_is_ar724x() || soc_is_ar933x() || soc_is_ar934x()) |
133 | ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; | 134 | ath79_misc_irq_chip.irq_ack = ar724x_misc_irq_ack; |
134 | else | 135 | else |
135 | BUG(); | 136 | BUG(); |
@@ -143,6 +144,39 @@ static void __init ath79_misc_irq_init(void) | |||
143 | irq_set_chained_handler(ATH79_CPU_IRQ_MISC, ath79_misc_irq_handler); | 144 | irq_set_chained_handler(ATH79_CPU_IRQ_MISC, ath79_misc_irq_handler); |
144 | } | 145 | } |
145 | 146 | ||
147 | static void ar934x_ip2_irq_dispatch(unsigned int irq, struct irq_desc *desc) | ||
148 | { | ||
149 | u32 status; | ||
150 | |||
151 | disable_irq_nosync(irq); | ||
152 | |||
153 | status = ath79_reset_rr(AR934X_RESET_REG_PCIE_WMAC_INT_STATUS); | ||
154 | |||
155 | if (status & AR934X_PCIE_WMAC_INT_PCIE_ALL) { | ||
156 | ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_PCIE); | ||
157 | generic_handle_irq(ATH79_IP2_IRQ(0)); | ||
158 | } else if (status & AR934X_PCIE_WMAC_INT_WMAC_ALL) { | ||
159 | ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_WMAC); | ||
160 | generic_handle_irq(ATH79_IP2_IRQ(1)); | ||
161 | } else { | ||
162 | spurious_interrupt(); | ||
163 | } | ||
164 | |||
165 | enable_irq(irq); | ||
166 | } | ||
167 | |||
168 | static void ar934x_ip2_irq_init(void) | ||
169 | { | ||
170 | int i; | ||
171 | |||
172 | for (i = ATH79_IP2_IRQ_BASE; | ||
173 | i < ATH79_IP2_IRQ_BASE + ATH79_IP2_IRQ_COUNT; i++) | ||
174 | irq_set_chip_and_handler(i, &dummy_irq_chip, | ||
175 | handle_level_irq); | ||
176 | |||
177 | irq_set_chained_handler(ATH79_CPU_IRQ_IP2, ar934x_ip2_irq_dispatch); | ||
178 | } | ||
179 | |||
146 | asmlinkage void plat_irq_dispatch(void) | 180 | asmlinkage void plat_irq_dispatch(void) |
147 | { | 181 | { |
148 | unsigned long pending; | 182 | unsigned long pending; |
@@ -202,6 +236,11 @@ static void ar933x_ip2_handler(void) | |||
202 | do_IRQ(ATH79_CPU_IRQ_IP2); | 236 | do_IRQ(ATH79_CPU_IRQ_IP2); |
203 | } | 237 | } |
204 | 238 | ||
239 | static void ar934x_ip2_handler(void) | ||
240 | { | ||
241 | do_IRQ(ATH79_CPU_IRQ_IP2); | ||
242 | } | ||
243 | |||
205 | static void ar71xx_ip3_handler(void) | 244 | static void ar71xx_ip3_handler(void) |
206 | { | 245 | { |
207 | ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB); | 246 | ath79_ddr_wb_flush(AR71XX_DDR_REG_FLUSH_USB); |
@@ -226,6 +265,12 @@ static void ar933x_ip3_handler(void) | |||
226 | do_IRQ(ATH79_CPU_IRQ_USB); | 265 | do_IRQ(ATH79_CPU_IRQ_USB); |
227 | } | 266 | } |
228 | 267 | ||
268 | static void ar934x_ip3_handler(void) | ||
269 | { | ||
270 | ath79_ddr_wb_flush(AR934X_DDR_REG_FLUSH_USB); | ||
271 | do_IRQ(ATH79_CPU_IRQ_USB); | ||
272 | } | ||
273 | |||
229 | void __init arch_init_irq(void) | 274 | void __init arch_init_irq(void) |
230 | { | 275 | { |
231 | if (soc_is_ar71xx()) { | 276 | if (soc_is_ar71xx()) { |
@@ -240,6 +285,9 @@ void __init arch_init_irq(void) | |||
240 | } else if (soc_is_ar933x()) { | 285 | } else if (soc_is_ar933x()) { |
241 | ath79_ip2_handler = ar933x_ip2_handler; | 286 | ath79_ip2_handler = ar933x_ip2_handler; |
242 | ath79_ip3_handler = ar933x_ip3_handler; | 287 | ath79_ip3_handler = ar933x_ip3_handler; |
288 | } else if (soc_is_ar934x()) { | ||
289 | ath79_ip2_handler = ar934x_ip2_handler; | ||
290 | ath79_ip3_handler = ar934x_ip3_handler; | ||
243 | } else { | 291 | } else { |
244 | BUG(); | 292 | BUG(); |
245 | } | 293 | } |
@@ -247,4 +295,7 @@ void __init arch_init_irq(void) | |||
247 | cp0_perfcount_irq = ATH79_MISC_IRQ_PERFC; | 295 | cp0_perfcount_irq = ATH79_MISC_IRQ_PERFC; |
248 | mips_cpu_irq_init(); | 296 | mips_cpu_irq_init(); |
249 | ath79_misc_irq_init(); | 297 | ath79_misc_irq_init(); |
298 | |||
299 | if (soc_is_ar934x()) | ||
300 | ar934x_ip2_irq_init(); | ||
250 | } | 301 | } |
diff --git a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h index 1a9234b5150b..d6af4eb5d2c0 100644 --- a/arch/mips/include/asm/mach-ath79/ar71xx_regs.h +++ b/arch/mips/include/asm/mach-ath79/ar71xx_regs.h | |||
@@ -92,6 +92,12 @@ | |||
92 | #define AR933X_DDR_REG_FLUSH_USB 0x84 | 92 | #define AR933X_DDR_REG_FLUSH_USB 0x84 |
93 | #define AR933X_DDR_REG_FLUSH_WMAC 0x88 | 93 | #define AR933X_DDR_REG_FLUSH_WMAC 0x88 |
94 | 94 | ||
95 | #define AR934X_DDR_REG_FLUSH_GE0 0x9c | ||
96 | #define AR934X_DDR_REG_FLUSH_GE1 0xa0 | ||
97 | #define AR934X_DDR_REG_FLUSH_USB 0xa4 | ||
98 | #define AR934X_DDR_REG_FLUSH_PCIE 0xa8 | ||
99 | #define AR934X_DDR_REG_FLUSH_WMAC 0xac | ||
100 | |||
95 | /* | 101 | /* |
96 | * PLL block | 102 | * PLL block |
97 | */ | 103 | */ |
@@ -222,6 +228,7 @@ | |||
222 | #define AR933X_RESET_REG_BOOTSTRAP 0xac | 228 | #define AR933X_RESET_REG_BOOTSTRAP 0xac |
223 | 229 | ||
224 | #define AR934X_RESET_REG_BOOTSTRAP 0xb0 | 230 | #define AR934X_RESET_REG_BOOTSTRAP 0xb0 |
231 | #define AR934X_RESET_REG_PCIE_WMAC_INT_STATUS 0xac | ||
225 | 232 | ||
226 | #define MISC_INT_ETHSW BIT(12) | 233 | #define MISC_INT_ETHSW BIT(12) |
227 | #define MISC_INT_TIMER4 BIT(10) | 234 | #define MISC_INT_TIMER4 BIT(10) |
@@ -295,6 +302,24 @@ | |||
295 | #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1) | 302 | #define AR934X_BOOTSTRAP_SDRAM_DISABLED BIT(1) |
296 | #define AR934X_BOOTSTRAP_DDR1 BIT(0) | 303 | #define AR934X_BOOTSTRAP_DDR1 BIT(0) |
297 | 304 | ||
305 | #define AR934X_PCIE_WMAC_INT_WMAC_MISC BIT(0) | ||
306 | #define AR934X_PCIE_WMAC_INT_WMAC_TX BIT(1) | ||
307 | #define AR934X_PCIE_WMAC_INT_WMAC_RXLP BIT(2) | ||
308 | #define AR934X_PCIE_WMAC_INT_WMAC_RXHP BIT(3) | ||
309 | #define AR934X_PCIE_WMAC_INT_PCIE_RC BIT(4) | ||
310 | #define AR934X_PCIE_WMAC_INT_PCIE_RC0 BIT(5) | ||
311 | #define AR934X_PCIE_WMAC_INT_PCIE_RC1 BIT(6) | ||
312 | #define AR934X_PCIE_WMAC_INT_PCIE_RC2 BIT(7) | ||
313 | #define AR934X_PCIE_WMAC_INT_PCIE_RC3 BIT(8) | ||
314 | #define AR934X_PCIE_WMAC_INT_WMAC_ALL \ | ||
315 | (AR934X_PCIE_WMAC_INT_WMAC_MISC | AR934X_PCIE_WMAC_INT_WMAC_TX | \ | ||
316 | AR934X_PCIE_WMAC_INT_WMAC_RXLP | AR934X_PCIE_WMAC_INT_WMAC_RXHP) | ||
317 | |||
318 | #define AR934X_PCIE_WMAC_INT_PCIE_ALL \ | ||
319 | (AR934X_PCIE_WMAC_INT_PCIE_RC | AR934X_PCIE_WMAC_INT_PCIE_RC0 | \ | ||
320 | AR934X_PCIE_WMAC_INT_PCIE_RC1 | AR934X_PCIE_WMAC_INT_PCIE_RC2 | \ | ||
321 | AR934X_PCIE_WMAC_INT_PCIE_RC3) | ||
322 | |||
298 | #define REV_ID_MAJOR_MASK 0xfff0 | 323 | #define REV_ID_MAJOR_MASK 0xfff0 |
299 | #define REV_ID_MAJOR_AR71XX 0x00a0 | 324 | #define REV_ID_MAJOR_AR71XX 0x00a0 |
300 | #define REV_ID_MAJOR_AR913X 0x00b0 | 325 | #define REV_ID_MAJOR_AR913X 0x00b0 |
diff --git a/arch/mips/include/asm/mach-ath79/irq.h b/arch/mips/include/asm/mach-ath79/irq.h index 6ae2646da4f4..0968f69e2018 100644 --- a/arch/mips/include/asm/mach-ath79/irq.h +++ b/arch/mips/include/asm/mach-ath79/irq.h | |||
@@ -10,7 +10,7 @@ | |||
10 | #define __ASM_MACH_ATH79_IRQ_H | 10 | #define __ASM_MACH_ATH79_IRQ_H |
11 | 11 | ||
12 | #define MIPS_CPU_IRQ_BASE 0 | 12 | #define MIPS_CPU_IRQ_BASE 0 |
13 | #define NR_IRQS 46 | 13 | #define NR_IRQS 48 |
14 | 14 | ||
15 | #define ATH79_MISC_IRQ_BASE 8 | 15 | #define ATH79_MISC_IRQ_BASE 8 |
16 | #define ATH79_MISC_IRQ_COUNT 32 | 16 | #define ATH79_MISC_IRQ_COUNT 32 |
@@ -19,6 +19,10 @@ | |||
19 | #define ATH79_PCI_IRQ_COUNT 6 | 19 | #define ATH79_PCI_IRQ_COUNT 6 |
20 | #define ATH79_PCI_IRQ(_x) (ATH79_PCI_IRQ_BASE + (_x)) | 20 | #define ATH79_PCI_IRQ(_x) (ATH79_PCI_IRQ_BASE + (_x)) |
21 | 21 | ||
22 | #define ATH79_IP2_IRQ_BASE (ATH79_PCI_IRQ_BASE + ATH79_PCI_IRQ_COUNT) | ||
23 | #define ATH79_IP2_IRQ_COUNT 2 | ||
24 | #define ATH79_IP2_IRQ(_x) (ATH79_IP2_IRQ_BASE + (_x)) | ||
25 | |||
22 | #define ATH79_CPU_IRQ_IP2 (MIPS_CPU_IRQ_BASE + 2) | 26 | #define ATH79_CPU_IRQ_IP2 (MIPS_CPU_IRQ_BASE + 2) |
23 | #define ATH79_CPU_IRQ_USB (MIPS_CPU_IRQ_BASE + 3) | 27 | #define ATH79_CPU_IRQ_USB (MIPS_CPU_IRQ_BASE + 3) |
24 | #define ATH79_CPU_IRQ_GE0 (MIPS_CPU_IRQ_BASE + 4) | 28 | #define ATH79_CPU_IRQ_GE0 (MIPS_CPU_IRQ_BASE + 4) |