linux-mips
[Top] [All Lists]

[PATCH 3/8] MIPS: BCM63XX: use the Chip ID register for identifying the

To: Ralf Baechle <ralf@linux-mips.org>
Subject: [PATCH 3/8] MIPS: BCM63XX: use the Chip ID register for identifying the SoC
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Tue, 12 Jun 2012 10:23:40 +0200
Cc: linux-mips@linux-mips.org, Maxime Bizon <mbizon@freebox.fr>, Florian Fainelli <florian@openwrt.org>, 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=vupu2FZxLDm4rhVdSmp5mi/PDBSRcOe/7O25ZCPMV2I=; b=mUCpSCROt1ulkyYcmIpktKRldmpkkQW0igL9yxJLkFSOob6vy4TTSH7UXgctxKj/U3 NFReT0ZQSsFGcRMTKi1KuPBjoAeV6ANSAYIj/1d0QFPuAxDHSUiOYu6PuknQQ+pxHPtc 7EUcfLEEDs0EFjaJx5PdKrqjQ5McWQnJ8AP4xKyWaiWpbQzV1GWJiHLr8tKCUrRLZmaJ jTJzgZAXkAvrui/iff7jZBh/+67SyH9c442bOal6gUcyhgzqRa6W+FyWoP3X/WiMS/xu a9mAJkCxEOPW5975tRNN3fPMROlsxWqun7vHXnGXbEQ++4nPTXgm5YXl1hNcicAnqcoK 6p6Q==
In-reply-to: <1339489425-19037-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: <1339489425-19037-1-git-send-email-jonas.gorski@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
Newer BCM63XX SoCs use virtually the same CPU ID, differing only in the
revision bits. But since they all have the Chip ID register at the same
location, we can use that to identify the SoC we are running on.

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---
 arch/mips/bcm63xx/cpu.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/mips/bcm63xx/cpu.c b/arch/mips/bcm63xx/cpu.c
index 8f0d6c7..e3c1da5 100644
--- a/arch/mips/bcm63xx/cpu.c
+++ b/arch/mips/bcm63xx/cpu.c
@@ -228,17 +228,21 @@ void __init bcm63xx_cpu_init(void)
                bcm63xx_irqs = bcm6345_irqs;
                break;
        case CPU_BMIPS4350:
-               switch (read_c0_prid() & 0xf0) {
-               case 0x10:
+               if ((read_c0_prid() & 0xf0) == 0x10) {
                        expected_cpu_id = BCM6358_CPU_ID;
                        bcm63xx_regs_base = bcm6358_regs_base;
                        bcm63xx_irqs = bcm6358_irqs;
-                       break;
-               case 0x30:
-                       expected_cpu_id = BCM6368_CPU_ID;
-                       bcm63xx_regs_base = bcm6368_regs_base;
-                       bcm63xx_irqs = bcm6368_irqs;
-                       break;
+               } else {
+                       /* all newer chips have the same chip id location */
+                       u16 chip_id = bcm_readw(BCM_6368_PERF_BASE);
+
+                       switch (chip_id) {
+                       case BCM6368_CPU_ID:
+                               expected_cpu_id = BCM6368_CPU_ID;
+                               bcm63xx_regs_base = bcm6368_regs_base;
+                               bcm63xx_irqs = bcm6368_irqs;
+                               break;
+                       }
                }
                break;
        }
-- 
1.7.2.5


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