From: Mike Rapoport <mike@compulab.co.il>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>,
linux-next@vger.kernel.org,
Russell King <rmk+kernel@arm.linux.org.uk>
Subject: [PATCH] MTD: NAND: make gpio_nand use io{read,write}{8,16}_rep (was: Re: linux-next: mtd tree build failure)
Date: Sun, 16 Nov 2008 09:39:06 +0200 [thread overview]
Message-ID: <491FCE1A.6040201@compulab.co.il> (raw)
In-Reply-To: <1224492482.6770.1531.camel@macbook.infradead.org>
David Woodhouse wrote:
> On Mon, 2008-10-20 at 10:33 +0200, Mike Rapoport wrote:
>> You applied the correct version of the patch. It did depend on ARM at the
>> beginning, but after discussion it was decided to make it generic so that other
>> architecture would be able to use it. I just haven't thought that readsw/writesw
>> might be not available on all architectures.
>
> I've made it depend on ARM again for now. For 2.6.29, let's look at
> making use ioread8_rep().
The below patch makes GPIO NAND use io{read,write}{8,16}_rep to allow
architectures other than ARM use the driver.
I've build-tested it for x86_64 with allmodconfig and for powerpc with
ep8248e_defconfig and manually enabled GPIO NAND driver.
Signed-off-by: Mike Rapoport <mike@compulab.co.il>
---
drivers/mtd/nand/Kconfig | 2 +-
drivers/mtd/nand/gpio.c | 16 ++++++++--------
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/drivers/mtd/nand/Kconfig b/drivers/mtd/nand/Kconfig
index 1c2e945..b9eed99 100644
--- a/drivers/mtd/nand/Kconfig
+++ b/drivers/mtd/nand/Kconfig
@@ -58,7 +58,7 @@ config MTD_NAND_H1900
config MTD_NAND_GPIO
tristate "GPIO NAND Flash driver"
- depends on GENERIC_GPIO && ARM
+ depends on GENERIC_GPIO
help
This enables a GPIO based NAND flash driver.
diff --git a/drivers/mtd/nand/gpio.c b/drivers/mtd/nand/gpio.c
index 8f902e7..c9f26fa 100644
--- a/drivers/mtd/nand/gpio.c
+++ b/drivers/mtd/nand/gpio.c
@@ -87,14 +87,14 @@ static void gpio_nand_writebuf(struct mtd_info *mtd, const
u_char *buf, int len)
{
struct nand_chip *this = mtd->priv;
- writesb(this->IO_ADDR_W, buf, len);
+ iowrite8_rep(this->IO_ADDR_W, buf, len);
}
static void gpio_nand_readbuf(struct mtd_info *mtd, u_char *buf, int len)
{
struct nand_chip *this = mtd->priv;
- readsb(this->IO_ADDR_R, buf, len);
+ ioread8_rep(this->IO_ADDR_R, buf, len);
}
static int gpio_nand_verifybuf(struct mtd_info *mtd, const u_char *buf, int len)
@@ -104,7 +104,7 @@ static int gpio_nand_verifybuf(struct mtd_info *mtd, const
u_char *buf, int len)
int i, err = 0;
for (i = 0; i < len; i++) {
- read = readb(this->IO_ADDR_R);
+ read = ioread8(this->IO_ADDR_R);
if (read != p[i]) {
pr_debug("%s: err at %d (read %04x vs %04x)\n",
__func__, i, read, p[i]);
@@ -120,13 +120,13 @@ static void gpio_nand_writebuf16(struct mtd_info *mtd,
const u_char *buf,
struct nand_chip *this = mtd->priv;
if (IS_ALIGNED((unsigned long)buf, 2)) {
- writesw(this->IO_ADDR_W, buf, len>>1);
+ iowrite16_rep(this->IO_ADDR_W, buf, len>>1);
} else {
int i;
unsigned short *ptr = (unsigned short *)buf;
for (i = 0; i < len; i += 2, ptr++)
- writew(*ptr, this->IO_ADDR_W);
+ iowrite16(*ptr, this->IO_ADDR_W);
}
}
@@ -135,13 +135,13 @@ static void gpio_nand_readbuf16(struct mtd_info *mtd,
u_char *buf, int len)
struct nand_chip *this = mtd->priv;
if (IS_ALIGNED((unsigned long)buf, 2)) {
- readsw(this->IO_ADDR_R, buf, len>>1);
+ ioread16_rep(this->IO_ADDR_R, buf, len>>1);
} else {
int i;
unsigned short *ptr = (unsigned short *)buf;
for (i = 0; i < len; i += 2, ptr++)
- *ptr = readw(this->IO_ADDR_R);
+ *ptr = ioread16(this->IO_ADDR_R);
}
}
@@ -154,7 +154,7 @@ static int gpio_nand_verifybuf16(struct mtd_info *mtd, const
u_char *buf,
len >>= 1;
for (i = 0; i < len; i++) {
- read = readw(this->IO_ADDR_R);
+ read = ioread16(this->IO_ADDR_R);
if (read != p[i]) {
pr_debug("%s: err at %d (read %04x vs %04x)\n",
__func__, i, read, p[i]);
--
1.5.6.4
--
Sincerely yours,
Mike.
prev parent reply other threads:[~2008-11-16 7:39 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-10-20 5:35 linux-next: mtd tree build failure Stephen Rothwell
2008-10-20 7:24 ` David Woodhouse
2008-10-20 8:33 ` Mike Rapoport
2008-10-20 8:48 ` David Woodhouse
2008-11-16 7:39 ` Mike Rapoport [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=491FCE1A.6040201@compulab.co.il \
--to=mike@compulab.co.il \
--cc=dwmw2@infradead.org \
--cc=linux-next@vger.kernel.org \
--cc=rmk+kernel@arm.linux.org.uk \
--cc=sfr@canb.auug.org.au \
/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;
as well as URLs for NNTP newsgroup(s).