linux-mips
[Top] [All Lists]

[PATCH 3/3] MIPS: BCM63XX: use a switch for external irq config

To: linux-mips@linux-mips.org
Subject: [PATCH 3/3] MIPS: BCM63XX: use a switch for external irq config
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Fri, 13 Jul 2012 10:46:05 +0200
Cc: Ralf Baechle <ralf@linux-mips.org>, Florian Fainelli <florian@openwrt.org>, Maxime Bizon <mbizon@freebox.fr>, Kevin Cernekee <cernekee@gmail.com>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=7fIoExIxF/X7rOHeZHnEdPF7vheRp9RUMIDq1RTSBCE=; b=y7jmscREAE0x05/QSKOoRJnmDIRL4FA8lco3i6LZygxW2OEDkoZWb/UeAtkPpo/Izh aUXzYl59H9TJ2qHi1UxI3Pjo/mGbUoDuEo7UAxTeHCVly6GfmEPTZCc3zHDEaBz8V9zv HJXcqSoY8kmQhGvmxGFV3bVS0OKN5LdU6pMZ05H4RrBImsqEvzd228M2HrBV5WfoT346 cEbf4ShCokoGYoRfSin0Bw+t8hYOF7kaczeIjylfUoY94hy8enGnvZA+gL7OaljAxy/q GlSXSQ4YTeZT2Ym5XBRP45MyeNaqHlm+2GYmslrD/mJ5znbH3r+06uFweSySaU6OTPX/ wqWA==
In-reply-to: <1342169165-18382-1-git-send-email-jonas.gorski@gmail.com>
List-archive: <http://www.linux-mips.org/archives/linux-mips/>
List-help: <mailto:ecartis@linux-mips.org?Subject=help>
List-id: linux-mips <linux-mips.eddie.linux-mips.org>
List-owner: <mailto:ralf@linux-mips.org>
List-post: <mailto:linux-mips@linux-mips.org>
List-software: Ecartis version 1.0.0
List-subscribe: <mailto:ecartis@linux-mips.org?subject=subscribe%20linux-mips>
List-unsubscribe: <mailto:ecartis@linux-mips.org?subject=unsubscribe%20linux-mips>
References: <1342169165-18382-1-git-send-email-jonas.gorski@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
From: Maxime Bizon <mbizon@freebox.fr>

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>
---
 arch/mips/bcm63xx/irq.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index d40169f..da24c2b 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -438,7 +438,8 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
        reg = bcm_perf_readl(regaddr);
        irq %= 4;
 
-       if (BCMCPU_IS_6348()) {
+       switch (bcm63xx_get_cpu_id()) {
+       case BCM6348_CPU_ID:
                if (levelsense)
                        reg |= EXTIRQ_CFG_LEVELSENSE_6348(irq);
                else
@@ -451,9 +452,13 @@ static int bcm63xx_external_irq_set_type(struct irq_data 
*d,
                        reg |= EXTIRQ_CFG_BOTHEDGE_6348(irq);
                else
                        reg &= ~EXTIRQ_CFG_BOTHEDGE_6348(irq);
-       }
+               break;
 
-       if (BCMCPU_IS_6338() || BCMCPU_IS_6358() || BCMCPU_IS_6368()) {
+       case BCM6328_CPU_ID:
+       case BCM6338_CPU_ID:
+       case BCM6345_CPU_ID:
+       case BCM6358_CPU_ID:
+       case BCM6368_CPU_ID:
                if (levelsense)
                        reg |= EXTIRQ_CFG_LEVELSENSE(irq);
                else
@@ -466,6 +471,9 @@ static int bcm63xx_external_irq_set_type(struct irq_data *d,
                        reg |= EXTIRQ_CFG_BOTHEDGE(irq);
                else
                        reg &= ~EXTIRQ_CFG_BOTHEDGE(irq);
+               break;
+       default:
+               BUG();
        }
 
        bcm_perf_writel(reg, regaddr);
-- 
1.7.2.5


<Prev in Thread] Current Thread [Next in Thread>