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; Sat, 1 Nov 2008
 01:40:00 -0700
Received: from ausesmta2-1.messageone.com ([64.20.241.45]) by mail.onstor.com
 with Microsoft SMTPSVC(6.0.3790.3959);	 Sat, 1 Nov 2008 01:39:59 -0700
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])	by
 ausesmta2-1.messageone.com (8.13.8/8.13.8) with ESMTP id mA18dwqK032126	for
 <andy.sharp@onstor.com>; Sat, 1 Nov 2008 03:39:58 -0500
Received: from localhost.localdomain ([127.0.0.1]:11697 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP	id S22893433AbYKAIjd
 (ORCPT <rfc822;andy.sharp@onstor.com>);	Sat, 1 Nov 2008 08:39:33 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Sat, 01 Nov 2008 08:39:16
 +0000 (GMT)
Received: from orbit.nwl.cc ([81.169.176.177]:18081 "EHLO
	mail.ifyouseekate.net") by ftp.linux-mips.org with ESMTP	id S22828128AbYJaNYo
 (ORCPT <rfc822;linux-mips@linux-mips.org>);	Fri, 31 Oct 2008 13:24:44 +0000
Received: from base (localhost [127.0.0.1])	by mail.ifyouseekate.net (Postfix)
 with ESMTP id 7C5DF38CE86F;	Fri, 31 Oct 2008 14:24:33 +0100 (CET)
From: Phil Sutter <n0-1@freewrt.org>
To: Ralf Baechle <ralf@linux-mips.org>
CC: "linux-mips@linux-mips.org" <linux-mips@linux-mips.org>, Florian Fainelli
	<florian@openwrt.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Fri, 31 Oct 2008 06:24:29 -0700
Subject: [PATCH] rb532: gpio register offsets are relatives to GPIOBASE
Thread-Topic: [PATCH] rb532: gpio register offsets are relatives to GPIOBASE
Thread-Index: Ack7/W2wgrrq4R1ISfG8oQ7zR5R15Q==
Message-ID: <1225459469-12279-1-git-send-email-n0-1@freewrt.org>
References: <200810261112.37008.florian@openwrt.org>
In-Reply-To: <200810261112.37008.florian@openwrt.org>
Accept-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: 01 Nov 2008 08:39:59.0871 (UTC)
 FILETIME=[6D0700F0:01C93BFD]
errors-to: linux-mips-bounce@linux-mips.org
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: THT6tqmT9A3Q97tVkW8S5g==
x-messageone-virus-version: vendor=fsecure
 engine=4.65.7400:2.4.4,1.2.40,4.0.164
 definitions=2008-10-31_11:2008-10-10,2008-10-31,2008-10-31 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=1 classifier=spam
 adjust=0 reason=mlx engine=3.1.0-0810130000 definitions=main-0811010013
x-messageone-spam-score: 0
x-messageone-spam-bar:
x-list: linux-mips
x-archive-position: 21147
x-ecartis-version: Ecartis v1.0.0
x-original-sender: n0-1@freewrt.org
Content-Type: text/plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

From: Florian Fainelli <florian@openwrt.org>

This patch fixes the wrong use of GPIO register offsets
in devices.c. To avoid further problems, use gpio_get_value
to return the NAND status instead of our own expanded code.

Also define the zero offset of the alternate function register to allow
consistent access.

Signef-off-by: Phil Sutter <n0-1@freewrt.org>
Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
 arch/mips/include/asm/mach-rc32434/rb.h |   14 ++++++++------
 arch/mips/rb532/devices.c               |    2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/arch/mips/include/asm/mach-rc32434/rb.h b/arch/mips/include/as=
m/mach-rc32434/rb.h
index 79e8ef6..f25a849 100644
--- a/arch/mips/include/asm/mach-rc32434/rb.h
+++ b/arch/mips/include/asm/mach-rc32434/rb.h
@@ -40,12 +40,14 @@
 #define BTCS		0x010040
 #define BTCOMPARE	0x010044
 #define GPIOBASE	0x050000
-#define GPIOCFG		0x050004
-#define GPIOD		0x050008
-#define GPIOILEVEL	0x05000C
-#define GPIOISTAT	0x050010
-#define GPIONMIEN	0x050014
-#define IMASK6		0x038038
+/* Offsets relative to GPIOBASE */
+#define GPIOFUNC	0x00
+#define GPIOCFG		0x04
+#define GPIOD		0x08
+#define GPIOILEVEL	0x0C
+#define GPIOISTAT	0x10
+#define GPIONMIEN	0x14
+#define IMASK6		0x38
 #define LO_WPX		(1 << 0)
 #define LO_ALE		(1 << 1)
 #define LO_CLE		(1 << 2)
diff --git a/arch/mips/rb532/devices.c b/arch/mips/rb532/devices.c
index 31619c6..c40be04 100644
--- a/arch/mips/rb532/devices.c
+++ b/arch/mips/rb532/devices.c
@@ -118,7 +118,7 @@ static struct platform_device cf_slot0 =3D {
 /* Resources and device for NAND */
 static int rb532_dev_ready(struct mtd_info *mtd)
 {
-	return readl(IDT434_REG_BASE + GPIOD) & GPIO_RDY;
+	return gpio_get_value(GPIO_RDY);
 }
=20
 static void rb532_cmd_ctrl(struct mtd_info *mtd, int cmd, unsigned int ctr=
l)
--=20
1.5.6.4


