Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Tue, 13 Jan 2009
 06:39:35 -0800
Received: from dalesmta2-1.messageone.com ([129.41.169.249]) by
 mail.onstor.com with Microsoft SMTPSVC(6.0.3790.3959);	 Tue, 13 Jan 2009
 06:39:35 -0800
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])	by
 dalesmta2-1.messageone.com (8.13.8/8.13.8) with ESMTP id n0DEdXeY011838	for
 <andy.sharp@onstor.com>; Tue, 13 Jan 2009 08:39:34 -0600
Received: from localhost.localdomain ([127.0.0.1]:53686 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP	id S21103612AbZAMOjN
 (ORCPT <rfc822;andy.sharp@onstor.com>);	Tue, 13 Jan 2009 14:39:13 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Tue, 13 Jan 2009 14:38:56
 +0000 (GMT)
Received: from fnoeppeil36.netpark.at ([217.175.205.164]:10624 "EHLO
	roarinelk.homelinux.net") by ftp.linux-mips.org with ESMTP	id
 S21103512AbZAMOiy (ORCPT <rfc822;linux-mips@linux-mips.org>);	Tue, 13 Jan
 2009 14:38:54 +0000
Received: (qmail 18794 invoked by uid 1000); 13 Jan 2009 15:35:52 +0100
From: Manuel Lauss <mano@roarinelk.homelinux.net>
To: Linux-MIPS <linux-mips@linux-mips.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Tue, 13 Jan 2009 06:35:52 -0800
Subject: [RFC PATCH] Alchemy: detect Au1300
Thread-Topic: [RFC PATCH] Alchemy: detect Au1300
Thread-Index: Acl1jMGsHqq67qfXRsK9K0fMuKZ3Qg==
Message-ID: <20090113143552.GA18721@roarinelk.homelinux.net>
References: <20090113135302.GA18442@roarinelk.homelinux.net>
In-Reply-To: <20090113135302.GA18442@roarinelk.homelinux.net>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 13 Jan 2009 14:39:35.0300 (UTC)
 FILETIME=[C123F440:01C9758C]
user-agent: Mutt/1.5.16 (2007-06-09)
errors-to: linux-mips-bounce@linux-mips.org
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: lLKR4IOxXRr5hhLBGIJeAg==
x-messageone-virus-version: vendor=fsecure
 engine=4.65.7400:2.4.4,1.2.40,4.0.164
 definitions=2009-01-13_08:2009-01-08,2009-01-13,2009-01-13 signatures=0
x-messageone-virus-scanned: Clean
x-messageone-envelope-sender: linux-mips-bounce@linux-mips.org
x-messageone-spam-details: rule=m773emszm_notspam policy=m773emszm score=0
 spamscore=0 ipscore=0 phishscore=0 bulkscore=0 adultscore=0 classifier=spam
 adjust=0 reason=mlx engine=3.1.0-0810130000 definitions=main-0901130080
x-messageone-spam-score: 0
x-messageone-spam-bar:
x-list: linux-mips
x-archive-position: 21721
x-ecartis-version: Ecartis v1.0.0
x-original-sender: mano@roarinelk.homelinux.net
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

Add code to detect Au1300 and its variants.  c0_prid uses a layout
different from previous Alchemy chips and company ID switched to RMI.

Core and cache-wise it is compatible with previous Alchemy chips.

Signed-off-by: Manuel Lauss <mano@roarinelk.homelinux.net>
---
This patch depends on "Alchemy: remove superfluous cpu-model constants."
Information was pieced together from the Au1300 databook, and obviously
only compile tested. (Also, the irq controller looks completely different
so this patch alone is insufficient to get linux working on it).

 arch/mips/include/asm/cpu.h  |    1 +
 arch/mips/kernel/cpu-probe.c |   39 ++++++++++++++++++++++++++++++++++++++=
+
 2 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index 3bdc0e3..8dd3038 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -33,6 +33,7 @@
 #define PRID_COMP_TOSHIBA	0x070000
 #define PRID_COMP_LSI		0x080000
 #define PRID_COMP_LEXRA		0x0b0000
+#define PRID_COMP_RMI		0x0c0000
 #define PRID_COMP_CAVIUM	0x0d0000
=20
=20
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 0f33858..9499610 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -19,6 +19,7 @@
 #include <asm/bugs.h>
 #include <asm/cpu.h>
 #include <asm/fpu.h>
+#include <asm/io.h>
 #include <asm/mipsregs.h>
 #include <asm/system.h>
 #include <asm/watch.h>
@@ -886,6 +887,41 @@ static inline void cpu_probe_cavium(struct cpuinfo_mip=
s *c, unsigned int cpu)
 	}
 }
=20
+static inline void cpu_probe_rmi(struct cpuinfo_mips *c, unsigned int cpu)
+{
+	decode_configs(c);
+	switch (c->processor_id & 0xff000000) {
+	case 0x80000000:		/* Au1300 */
+		c->cputype =3D CPU_ALCHEMY;
+
+		/* OTP-ROM Config0 register indicates the presence
+		 * of various peripherals.  Combinations of those
+		 * bits are marketed unter different names.
+		 */
+		switch (__raw_readl((void *)0xb0002000)) {
+		case 0x00000000:
+			__cpu_name[cpu] =3D "Au1380";
+			break;
+		case 0x0000000d:
+			__cpu_name[cpu] =3D "Au1370";
+			break;
+		case 0x00000010:
+			__cpu_name[cpu] =3D "Au1350";
+			break;
+		case 0x0000001d:
+			__cpu_name[cpu] =3D "Au1340";
+			break;
+		default:
+			__cpu_name[cpu] =3D "Au1300";
+			break;
+		}
+	default:
+		printk(KERN_INFO "Unknown RMI chip!\n");
+		c->cputype =3D CPU_UNKNOWN;
+		break;
+	}
+}
+
 const char *__cpu_name[NR_CPUS];
=20
 __cpuinit void cpu_probe(void)
@@ -920,6 +956,9 @@ __cpuinit void cpu_probe(void)
 	case PRID_COMP_NXP:
 		cpu_probe_nxp(c, cpu);
 		break;
+	case PRID_COMP_RMI:
+		cpu_probe_rmi(c, cpu);
+		break;
 	case PRID_COMP_CAVIUM:
 		cpu_probe_cavium(c, cpu);
 		break;
--=20
1.6.1


