Received: from mail.onstor.com ([66.201.51.107]) by onstor-exch02.onstor.net with Microsoft SMTPSVC(6.0.3790.1830);
	 Thu, 21 Aug 2008 15:16:19 -0700
Received: from ausesmta2-2.messageone.com ([64.20.241.45]) by mail.onstor.com with Microsoft SMTPSVC(6.0.3790.1830);
	 Thu, 21 Aug 2008 15:16:18 -0700
Received: from ftp.linux-mips.org (ftp.linux-mips.org [213.58.128.207])
	by ausesmta2-2.messageone.com (8.13.8/8.13.8) with ESMTP id m7LMGHEs002679
	for <andy.sharp@onstor.com>; Thu, 21 Aug 2008 17:16:17 -0500
Received: from localhost.localdomain ([127.0.0.1]:40625 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP
	id S28586986AbYHUWPh (ORCPT <rfc822;andy.sharp@onstor.com>);
	Thu, 21 Aug 2008 23:15:37 +0100
Received: with ECARTIS (v1.0.0; list linux-mips); Thu, 21 Aug 2008 23:15:20 +0100 (BST)
Received: from smtp4.int-evry.fr ([157.159.10.71]:30115 "EHLO
	smtp4.int-evry.fr") by ftp.linux-mips.org with ESMTP
	id S28586956AbYHUWO5 (ORCPT <rfc822;linux-mips@linux-mips.org>);
	Thu, 21 Aug 2008 23:14:57 +0100
Received: from smtp2.int-evry.fr (smtp2.int-evry.fr [157.159.10.45])
	by smtp4.int-evry.fr (Postfix) with ESMTP id D5DC7FE2E23;
	Fri, 22 Aug 2008 00:14:51 +0200 (CEST)
Received: from smtp-ext.int-evry.fr (smtp-ext.int-evry.fr [157.159.11.17])
	by smtp2.int-evry.fr (Postfix) with ESMTP id BACE13F008A;
	Fri, 22 Aug 2008 00:14:28 +0200 (CEST)
Received: from lenovo.mimichou.home (florian.mimichou.net [82.241.112.26])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp-ext.int-evry.fr (Postfix) with ESMTP id 8CB4C90004;
	Fri, 22 Aug 2008 00:14:28 +0200 (CEST)
From: Florian Fainelli <florian@openwrt.org>
Date: 	Fri, 22 Aug 2008 00:14:27 +0200
Subject: [PATCH 2/6] rb532: use physical addresses for gpio and device controller registers
MIME-Version: 1.0
X-UID: 	1118
X-Length: 2606
To: "linux-mips" <linux-mips@linux-mips.org>
Cc: ralf@linux-mips.org
Content-Type: text/plain;
  charset="utf-8"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline
Message-Id: <200808220014.27497.florian@openwrt.org>
X-INT-MailScanner-Information: Please contact the ISP for more information
X-MailScanner-ID: BACE13F008A.E0055
X-INT-MailScanner: Found to be clean
X-INT-MailScanner-SpamCheck: 
X-INT-MailScanner-From: 	florian@openwrt.org
X-archive-position: 20311
X-ecartis-version: Ecartis v1.0.0
Sender: linux-mips-bounce@linux-mips.org
Errors-to: linux-mips-bounce@linux-mips.org
X-original-sender: florian@openwrt.org
Precedence: bulk
X-list: 	linux-mips
X-MessageOne-Virus-Version: vendor=fsecure engine=4.65.7161:2.4.4,1.2.40,4.0.164 definitions=2008-08-21_08:2008-08-21,2008-08-21,2008-08-21 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-0805090000 definitions=main-0808210180
X-MessageOne-Spam-Score: 0
X-MessageOne-Spam-Bar: 
Return-Path: linux-mips-bounce@linux-mips.org
X-OriginalArrivalTime: 21 Aug 2008 22:16:19.0080 (UTC) FILETIME=[892B3080:01C903DB]

This patch fixes the misuse of virtual address which would lead to
serious problems while accessing ioremap'd registers in the GPIO
code.

Signed-off-by: Florian Fainelli <florian@openwrt.org>
---
diff --git a/arch/mips/rb532/gpio.c b/arch/mips/rb532/gpio.c
index 00a1c78..3d1632c 100644
--- a/arch/mips/rb532/gpio.c
+++ b/arch/mips/rb532/gpio.c
@@ -47,8 +47,8 @@ struct mpmc_device dev3;
 static struct resource rb532_gpio_reg0_res[] = {
 	{
 		.name 	= "gpio_reg0",
-		.start 	= (u32)(IDT434_REG_BASE + GPIOBASE),
-		.end 	= (u32)(IDT434_REG_BASE + GPIOBASE + sizeof(struct rb532_gpio_reg)),
+		.start 	= (REG_BASE + GPIOBASE),
+		.end 	= (REG_BASE + GPIOBASE + sizeof(struct rb532_gpio_reg)),
 		.flags 	= IORESOURCE_MEM,
 	}
 };
@@ -56,8 +56,8 @@ static struct resource rb532_gpio_reg0_res[] = {
 static struct resource rb532_dev3_ctl_res[] = {
 	{
 		.name	= "dev3_ctl",
-		.start	= (u32)(IDT434_REG_BASE + DEV3BASE),
-		.end	= (u32)(IDT434_REG_BASE + DEV3BASE + sizeof(struct dev_reg)),
+		.start	= (REG_BASE + DEV3BASE),
+		.end	= (REG_BASE + DEV3BASE + sizeof(struct dev_reg)),
 		.flags	= IORESOURCE_MEM,
 	}
 };
diff --git a/include/asm-mips/mach-rc32434/rb.h b/include/asm-mips/mach-rc32434/rb.h
index e0a76e3..f229da4 100644
--- a/include/asm-mips/mach-rc32434/rb.h
+++ b/include/asm-mips/mach-rc32434/rb.h
@@ -18,6 +18,7 @@
 #include <linux/genhd.h>
 
 #define IDT434_REG_BASE	((volatile void *) KSEG1ADDR(0x18000000))
+#define REG_BASE	0x18000000
 #define DEV0BASE	0x010000
 #define DEV0MASK	0x010004
 #define DEV0C		0x010008
@@ -43,6 +44,7 @@
 #define GPIOISTAT	0x050010
 #define GPIONMIEN	0x050014
 #define IMASK6		0x038038
+
 #define LO_WPX		(1 << 0)
 #define LO_ALE		(1 << 1)
 #define LO_CLE		(1 << 2)

