aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonas Gorski <jogo@openwrt.org>2014-07-12 06:49:36 -0400
committerRalf Baechle <ralf@linux-mips.org>2014-07-30 09:28:11 -0400
commitcc81d7f37273ccb34db99a1f7ce688953a04289d (patch)
treeefd00f3eaa630a5504aa71bc3a2b247362a19295
parent86ee4333ba991654f21b7a9e7a7bff0b319f0800 (diff)
MIPS: BCM63xx: Append irq line to irq_{stat,mask}*
The SMP capable irq controllers have two interrupt output pins which are controlled through separate registers, so make the variables arrays. Signed-off-by: Jonas Gorski <jogo@openwrt.org> Cc: linux-mips@linux-mips.org Cc: John Crispin <blogic@openwrt.org> Cc: Maxime Bizon <mbizon@freebox.fr> Cc: Florian Fainelli <florian@openwrt.org> Cc: Kevin Cernekee <cernekee@gmail.com> Cc: Gregory Fong <gregory.0xf0@gmail.com> Patchwork: https://patchwork.linux-mips.org/patch/7318/ Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/bcm63xx/irq.c51
-rw-r--r--arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h16
2 files changed, 34 insertions, 33 deletions
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index db9f2ef76ebe..91d1765561b5 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -19,7 +19,8 @@
19#include <bcm63xx_io.h> 19#include <bcm63xx_io.h>
20#include <bcm63xx_irq.h> 20#include <bcm63xx_irq.h>
21 21
22static u32 irq_stat_addr, irq_mask_addr; 22static u32 irq_stat_addr[2];
23static u32 irq_mask_addr[2];
23static void (*dispatch_internal)(void); 24static void (*dispatch_internal)(void);
24static int is_ext_irq_cascaded; 25static int is_ext_irq_cascaded;
25static unsigned int ext_irq_count; 26static unsigned int ext_irq_count;
@@ -64,8 +65,8 @@ void __dispatch_internal_##width(void) \
64 for (src = 0, tgt = (width / 32); src < (width / 32); src++) { \ 65 for (src = 0, tgt = (width / 32); src < (width / 32); src++) { \
65 u32 val; \ 66 u32 val; \
66 \ 67 \
67 val = bcm_readl(irq_stat_addr + src * sizeof(u32)); \ 68 val = bcm_readl(irq_stat_addr[0] + src * sizeof(u32)); \
68 val &= bcm_readl(irq_mask_addr + src * sizeof(u32)); \ 69 val &= bcm_readl(irq_mask_addr[0] + src * sizeof(u32)); \
69 pending[--tgt] = val; \ 70 pending[--tgt] = val; \
70 \ 71 \
71 if (val) \ 72 if (val) \
@@ -92,9 +93,9 @@ static void __internal_irq_mask_##width(unsigned int irq) \
92 unsigned reg = (irq / 32) ^ (width/32 - 1); \ 93 unsigned reg = (irq / 32) ^ (width/32 - 1); \
93 unsigned bit = irq & 0x1f; \ 94 unsigned bit = irq & 0x1f; \
94 \ 95 \
95 val = bcm_readl(irq_mask_addr + reg * sizeof(u32)); \ 96 val = bcm_readl(irq_mask_addr[0] + reg * sizeof(u32)); \
96 val &= ~(1 << bit); \ 97 val &= ~(1 << bit); \
97 bcm_writel(val, irq_mask_addr + reg * sizeof(u32)); \ 98 bcm_writel(val, irq_mask_addr[0] + reg * sizeof(u32)); \
98} \ 99} \
99 \ 100 \
100static void __internal_irq_unmask_##width(unsigned int irq) \ 101static void __internal_irq_unmask_##width(unsigned int irq) \
@@ -103,9 +104,9 @@ static void __internal_irq_unmask_##width(unsigned int irq) \
103 unsigned reg = (irq / 32) ^ (width/32 - 1); \ 104 unsigned reg = (irq / 32) ^ (width/32 - 1); \
104 unsigned bit = irq & 0x1f; \ 105 unsigned bit = irq & 0x1f; \
105 \ 106 \
106 val = bcm_readl(irq_mask_addr + reg * sizeof(u32)); \ 107 val = bcm_readl(irq_mask_addr[0] + reg * sizeof(u32)); \
107 val |= (1 << bit); \ 108 val |= (1 << bit); \
108 bcm_writel(val, irq_mask_addr + reg * sizeof(u32)); \ 109 bcm_writel(val, irq_mask_addr[0] + reg * sizeof(u32)); \
109} 110}
110 111
111BUILD_IPIC_INTERNAL(32); 112BUILD_IPIC_INTERNAL(32);
@@ -339,20 +340,20 @@ static void bcm63xx_init_irq(void)
339{ 340{
340 int irq_bits; 341 int irq_bits;
341 342
342 irq_stat_addr = bcm63xx_regset_address(RSET_PERF); 343 irq_stat_addr[0] = bcm63xx_regset_address(RSET_PERF);
343 irq_mask_addr = bcm63xx_regset_address(RSET_PERF); 344 irq_mask_addr[0] = bcm63xx_regset_address(RSET_PERF);
344 345
345 switch (bcm63xx_get_cpu_id()) { 346 switch (bcm63xx_get_cpu_id()) {
346 case BCM3368_CPU_ID: 347 case BCM3368_CPU_ID:
347 irq_stat_addr += PERF_IRQSTAT_3368_REG; 348 irq_stat_addr[0] += PERF_IRQSTAT_3368_REG;
348 irq_mask_addr += PERF_IRQMASK_3368_REG; 349 irq_mask_addr[0] += PERF_IRQMASK_3368_REG;
349 irq_bits = 32; 350 irq_bits = 32;
350 ext_irq_count = 4; 351 ext_irq_count = 4;
351 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368; 352 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_3368;
352 break; 353 break;
353 case BCM6328_CPU_ID: 354 case BCM6328_CPU_ID:
354 irq_stat_addr += PERF_IRQSTAT_6328_REG; 355 irq_stat_addr[0] += PERF_IRQSTAT_6328_REG(0);
355 irq_mask_addr += PERF_IRQMASK_6328_REG; 356 irq_mask_addr[0] += PERF_IRQMASK_6328_REG(0);
356 irq_bits = 64; 357 irq_bits = 64;
357 ext_irq_count = 4; 358 ext_irq_count = 4;
358 is_ext_irq_cascaded = 1; 359 is_ext_irq_cascaded = 1;
@@ -361,29 +362,29 @@ static void bcm63xx_init_irq(void)
361 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328; 362 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6328;
362 break; 363 break;
363 case BCM6338_CPU_ID: 364 case BCM6338_CPU_ID:
364 irq_stat_addr += PERF_IRQSTAT_6338_REG; 365 irq_stat_addr[0] += PERF_IRQSTAT_6338_REG;
365 irq_mask_addr += PERF_IRQMASK_6338_REG; 366 irq_mask_addr[0] += PERF_IRQMASK_6338_REG;
366 irq_bits = 32; 367 irq_bits = 32;
367 ext_irq_count = 4; 368 ext_irq_count = 4;
368 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338; 369 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6338;
369 break; 370 break;
370 case BCM6345_CPU_ID: 371 case BCM6345_CPU_ID:
371 irq_stat_addr += PERF_IRQSTAT_6345_REG; 372 irq_stat_addr[0] += PERF_IRQSTAT_6345_REG;
372 irq_mask_addr += PERF_IRQMASK_6345_REG; 373 irq_mask_addr[0] += PERF_IRQMASK_6345_REG;
373 irq_bits = 32; 374 irq_bits = 32;
374 ext_irq_count = 4; 375 ext_irq_count = 4;
375 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345; 376 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6345;
376 break; 377 break;
377 case BCM6348_CPU_ID: 378 case BCM6348_CPU_ID:
378 irq_stat_addr += PERF_IRQSTAT_6348_REG; 379 irq_stat_addr[0] += PERF_IRQSTAT_6348_REG;
379 irq_mask_addr += PERF_IRQMASK_6348_REG; 380 irq_mask_addr[0] += PERF_IRQMASK_6348_REG;
380 irq_bits = 32; 381 irq_bits = 32;
381 ext_irq_count = 4; 382 ext_irq_count = 4;
382 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348; 383 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6348;
383 break; 384 break;
384 case BCM6358_CPU_ID: 385 case BCM6358_CPU_ID:
385 irq_stat_addr += PERF_IRQSTAT_6358_REG; 386 irq_stat_addr[0] += PERF_IRQSTAT_6358_REG(0);
386 irq_mask_addr += PERF_IRQMASK_6358_REG; 387 irq_mask_addr[0] += PERF_IRQMASK_6358_REG(0);
387 irq_bits = 32; 388 irq_bits = 32;
388 ext_irq_count = 4; 389 ext_irq_count = 4;
389 is_ext_irq_cascaded = 1; 390 is_ext_irq_cascaded = 1;
@@ -392,8 +393,8 @@ static void bcm63xx_init_irq(void)
392 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358; 393 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6358;
393 break; 394 break;
394 case BCM6362_CPU_ID: 395 case BCM6362_CPU_ID:
395 irq_stat_addr += PERF_IRQSTAT_6362_REG; 396 irq_stat_addr[0] += PERF_IRQSTAT_6362_REG(0);
396 irq_mask_addr += PERF_IRQMASK_6362_REG; 397 irq_mask_addr[0] += PERF_IRQMASK_6362_REG(0);
397 irq_bits = 64; 398 irq_bits = 64;
398 ext_irq_count = 4; 399 ext_irq_count = 4;
399 is_ext_irq_cascaded = 1; 400 is_ext_irq_cascaded = 1;
@@ -402,8 +403,8 @@ static void bcm63xx_init_irq(void)
402 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362; 403 ext_irq_cfg_reg1 = PERF_EXTIRQ_CFG_REG_6362;
403 break; 404 break;
404 case BCM6368_CPU_ID: 405 case BCM6368_CPU_ID:
405 irq_stat_addr += PERF_IRQSTAT_6368_REG; 406 irq_stat_addr[0] += PERF_IRQSTAT_6368_REG(0);
406 irq_mask_addr += PERF_IRQMASK_6368_REG; 407 irq_mask_addr[0] += PERF_IRQMASK_6368_REG(0);
407 irq_bits = 64; 408 irq_bits = 64;
408 ext_irq_count = 6; 409 ext_irq_count = 6;
409 is_ext_irq_cascaded = 1; 410 is_ext_irq_cascaded = 1;
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
index ab427f8814e6..4794067cb5a7 100644
--- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
+++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_regs.h
@@ -215,23 +215,23 @@
215 215
216/* Interrupt Mask register */ 216/* Interrupt Mask register */
217#define PERF_IRQMASK_3368_REG 0xc 217#define PERF_IRQMASK_3368_REG 0xc
218#define PERF_IRQMASK_6328_REG 0x20 218#define PERF_IRQMASK_6328_REG(x) (0x20 + (x) * 0x10)
219#define PERF_IRQMASK_6338_REG 0xc 219#define PERF_IRQMASK_6338_REG 0xc
220#define PERF_IRQMASK_6345_REG 0xc 220#define PERF_IRQMASK_6345_REG 0xc
221#define PERF_IRQMASK_6348_REG 0xc 221#define PERF_IRQMASK_6348_REG 0xc
222#define PERF_IRQMASK_6358_REG 0xc 222#define PERF_IRQMASK_6358_REG(x) (0xc + (x) * 0x2c)
223#define PERF_IRQMASK_6362_REG 0x20 223#define PERF_IRQMASK_6362_REG(x) (0x20 + (x) * 0x10)
224#define PERF_IRQMASK_6368_REG 0x20 224#define PERF_IRQMASK_6368_REG(x) (0x20 + (x) * 0x10)
225 225
226/* Interrupt Status register */ 226/* Interrupt Status register */
227#define PERF_IRQSTAT_3368_REG 0x10 227#define PERF_IRQSTAT_3368_REG 0x10
228#define PERF_IRQSTAT_6328_REG 0x28 228#define PERF_IRQSTAT_6328_REG(x) (0x28 + (x) * 0x10)
229#define PERF_IRQSTAT_6338_REG 0x10 229#define PERF_IRQSTAT_6338_REG 0x10
230#define PERF_IRQSTAT_6345_REG 0x10 230#define PERF_IRQSTAT_6345_REG 0x10
231#define PERF_IRQSTAT_6348_REG 0x10 231#define PERF_IRQSTAT_6348_REG 0x10
232#define PERF_IRQSTAT_6358_REG 0x10 232#define PERF_IRQSTAT_6358_REG(x) (0x10 + (x) * 0x2c)
233#define PERF_IRQSTAT_6362_REG 0x28 233#define PERF_IRQSTAT_6362_REG(x) (0x28 + (x) * 0x10)
234#define PERF_IRQSTAT_6368_REG 0x28 234#define PERF_IRQSTAT_6368_REG(x) (0x28 + (x) * 0x10)
235 235
236/* External Interrupt Configuration register */ 236/* External Interrupt Configuration register */
237#define PERF_EXTIRQ_CFG_REG_3368 0x14 237#define PERF_EXTIRQ_CFG_REG_3368 0x14