public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: William J Beksi <wjbeksi@setabox.com>
To: tglx@linutronix.de
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH] command function for nand flash through IDE
Date: Sat, 01 Jan 2005 23:08:39 +0800	[thread overview]
Message-ID: <41D6BCF7.4090809@setabox.com> (raw)
In-Reply-To: <1104577162.4258.23.camel@tglx.tec.linutronix.de>

[-- Attachment #1: Type: text/plain, Size: 462 bytes --]

Thomas Gleixner wrote:

>On Sat, 2005-01-01 at 18:50 +0800, William J Beksi wrote:
>
>  
>
>>>I still have a question. Did you modify nand_base.c ? 
>>>
>>>      
>>>
>>No, I only add a compile time switch as you recommended because I want 
>>to use outb/inb.
>>    
>>
>
>Can you please provide a patch for this too ?
>  
>
Hi Thomas,
This patch allows you to select the i/o instruction you want to use 
(writeb/readb or outb/inb) at compile time.

-- 
William

[-- Attachment #2: nand_base.c.patch --]
[-- Type: text/x-patch, Size: 2139 bytes --]

--- /opt/mtd/drivers/mtd/nand/nand_base.c	2004-12-14 07:00:18.000000000 +0800
+++ nand_base.c	2005-01-01 21:58:19.000000000 +0800
@@ -66,6 +66,8 @@
 #include <linux/mtd/partitions.h>
 #endif
 
+#define NAND_USE_IO_INSTR	1
+
 /* Define default oob placement schemes for large and small page devices */
 static struct nand_oobinfo nand_oob_8 = {
 	.useecc = MTD_NANDECC_AUTOPLACE,
@@ -171,7 +173,13 @@
 static u_char nand_read_byte(struct mtd_info *mtd)
 {
 	struct nand_chip *this = mtd->priv;
-	return readb(this->IO_ADDR_R);
+
+	switch(NAND_USE_IO_INSTR) {
+	case 0:
+		return readb(this->IO_ADDR_R);
+	case 1:
+		return inb((unsigned int) this->IO_ADDR_R);
+	}
 }
 
 /**
@@ -184,7 +192,15 @@
 static void nand_write_byte(struct mtd_info *mtd, u_char byte)
 {
 	struct nand_chip *this = mtd->priv;
-	writeb(byte, this->IO_ADDR_W);
+
+	switch(NAND_USE_IO_INSTR) {
+	case 0:
+		writeb(byte, this->IO_ADDR_W);
+		break;
+	case 1:
+		outb(byte, (unsigned int) this->IO_ADDR_W);
+		break;
+	}
 }
 
 /**
@@ -277,8 +293,16 @@
 	int i;
 	struct nand_chip *this = mtd->priv;
 
-	for (i=0; i<len; i++)
-		writeb(buf[i], this->IO_ADDR_W);
+	switch(NAND_USE_IO_INSTR) {
+	case 0:
+		for (i=0; i<len; i++)
+			writeb(buf[i], this->IO_ADDR_W);
+		break;
+	case 1:
+		for (i=0; i<len; i++)
+			outb(buf[i], (unsigned int) this->IO_ADDR_W);
+		break;
+	}
 }
 
 /**
@@ -294,8 +318,16 @@
 	int i;
 	struct nand_chip *this = mtd->priv;
 
-	for (i=0; i<len; i++)
-		buf[i] = readb(this->IO_ADDR_R);
+	switch(NAND_USE_IO_INSTR) {
+	case 0:
+		for (i=0; i<len; i++)
+			buf[i] = readb(this->IO_ADDR_R);
+		break;
+	case 1:
+		for (i=0; i<len; i++)
+			buf[i] = inb((unsigned int) this->IO_ADDR_R);
+		break;
+	}
 }
 
 /**
@@ -311,10 +343,18 @@
 	int i;
 	struct nand_chip *this = mtd->priv;
 
-	for (i=0; i<len; i++)
-		if (buf[i] != readb(this->IO_ADDR_R))
-			return -EFAULT;
-
+	switch(NAND_USE_IO_INSTR) {
+	case 0:
+		for (i=0; i<len; i++)
+			if (buf[i] != readb(this->IO_ADDR_R))
+				return -EFAULT;
+		break;
+	case 1:
+		for (i=0; i<len; i++)
+			if (buf[i] != inb((unsigned int) this->IO_ADDR_R))
+				return -EFAULT;
+		break;
+	}
 	return 0;
 }
 

      reply	other threads:[~2005-01-01 15:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-16 13:11 [PATCH] command function for nand flash through IDE William J Beksi
2004-12-20  8:09 ` Thomas Gleixner
     [not found]   ` <41C7F8C7.8050607@setabox.com>
2004-12-21 15:27     ` Thomas Gleixner
2004-12-31  4:14       ` William J Beksi
2004-12-31  9:18         ` Thomas Gleixner
2005-01-01 10:50           ` William J Beksi
2005-01-01 10:59             ` Thomas Gleixner
2005-01-01 15:08               ` William J Beksi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D6BCF7.4090809@setabox.com \
    --to=wjbeksi@setabox.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox