Skip to content

Commit 58e380a

Browse files
mbizonfreeboxJohn Crispin
authored andcommitted
MIPS: BCM63XX: use a switch for external irq config
Makes the code a bit more readable and easier to add support for new chips. Signed-off-by: Maxime Bizon <mbizon@freebox.fr> Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com> Patchwork: http://patchwork.linux-mips.org/patch/4093/ Signed-off-by: John Crispin <blogic@openwrt.org>
1 parent 6d59180 commit 58e380a

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

‎arch/mips/bcm63xx/irq.c‎

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,8 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
438438
reg = bcm_perf_readl(regaddr);
439439
irq %= 4;
440440

441-
if (BCMCPU_IS_6348()) {
441+
switch (bcm63xx_get_cpu_id()) {
442+
case BCM6348_CPU_ID:
442443
if (levelsense)
443444
reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq);
444445
else
@@ -451,9 +452,13 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
451452
reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq);
452453
else
453454
reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq);
454-
}
455+
break;
455456

456-
if (BCMCPU_IS_6338() || BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
457+
case BCM6328_CPU_ID:
458+
case BCM6338_CPU_ID:
459+
case BCM6345_CPU_ID:
460+
case BCM6358_CPU_ID:
461+
case BCM6368_CPU_ID:
457462
if (levelsense)
458463
reg |= EXTIRQ_CFG_LEVELSENSE(irq);
459464
else
@@ -466,6 +471,9 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
466471
reg |= EXTIRQ_CFG_BOTHEDGE(irq);
467472
else
468473
reg &= ~EXTIRQ_CFG_BOTHEDGE(irq);
474+
break;
475+
default:
476+
BUG();
469477
}
470478

471479
bcm_perf_writel(reg, regaddr);

0 commit comments

Comments
 (0)