All of lore.kernel.org
 help / color / mirror / Atom feed
From: 张忠山 <zzs213@126.com>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox <barebox@lists.infradead.org>
Subject: Re: [PATCH 4/4] Revert "mtd: atmel_nand: optimize read/write buffer functions"
Date: Sun, 25 Nov 2012 16:11:49 +0800	[thread overview]
Message-ID: <20121125081149.GB19824@greatfirst.com> (raw)
In-Reply-To: <20121124084544.GY8327@game.jcrosoft.org>

> >
> > This patch resolves my problem
> I'm expecting to see your patches
>

My first patch very simple:

------------------
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 0477178..a111463 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -155,23 +155,6 @@ static int atmel_nand_device_ready(struct mtd_info *mtd)
 }

 /*
- * Minimal-overhead PIO for data access.
- */
-static void atmel_read_buf(struct mtd_info *mtd, u8 *buf, int len)
-{
-       struct nand_chip *chip = mtd->priv;
-
-       memcpy_fromio(buf, chip->IO_ADDR_R, len);
-}
-
-static void atmel_write_buf(struct mtd_info *mtd, const u8 *buf, int len)
-{
-       struct nand_chip *chip = mtd->priv;
-
-       memcpy_toio(chip->IO_ADDR_W, buf, len);
-}
-
-/*
  * Return number of ecc bytes per sector according to sector size and
  * correction capability
  *
@@ -1115,8 +1098,9 @@ static int __init atmel_nand_probe(struct device_d *dev)
        if (host->board->bus_width_16)          /* 16-bit bus width */
                nand_chip->options |= NAND_BUSWIDTH_16;

-       nand_chip->read_buf = atmel_read_buf;
-       nand_chip->write_buf = atmel_write_buf;
+       /* use default */
+       nand_chip->read_buf = NULL;
+       nand_chip->write_buf = NULL;

        atmel_nand_enable(host);
------------------

After seeing your patch, I suppose the flowing patch may be works.
The idea is use optimized read/write function when 2**ale >= pagesize
and 2**cle >= pagesize.

I can't test it because the ale = a7, cle = a6 on my board, but
pagesize is 2048

------------------
diff --git a/drivers/mtd/nand/atmel_nand.c b/drivers/mtd/nand/atmel_nand.c
index 0477178..66cf5db 100644
--- a/drivers/mtd/nand/atmel_nand.c
+++ b/drivers/mtd/nand/atmel_nand.c
@@ -1115,8 +1115,8 @@ static int __init atmel_nand_probe(struct device_d *dev)
        if (host->board->bus_width_16)          /* 16-bit bus width */
                nand_chip->options |= NAND_BUSWIDTH_16;

-       nand_chip->read_buf = atmel_read_buf;
-       nand_chip->write_buf = atmel_write_buf;
+       nand_chip->read_buf = NULL;
+       nand_chip->write_buf = NULL;

        atmel_nand_enable(host);

@@ -1151,6 +1151,11 @@ static int __init atmel_nand_probe(struct device_d *dev)
                        goto err_hw_ecc;
        }

+       if((1 << pdata->ale) >= mtd->writesize && (1 << pdata->cle) >= mtd->writesize) {
+               nand_chip->read_buf = atmel_read_buf;
+               nand_chip->write_buf = atmel_write_buf;
+       }
+
        /* second phase scan */
        if (nand_scan_tail(mtd)) {
                res = -ENXIO;
------------------

-- 
Best Regards,
zzs



_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-25  8:14 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-23 15:52 [PATCH 0/4] at91: some fixes Jean-Christophe PLAGNIOL-VILLARD
2012-11-23 15:55 ` [PATCH 1/4] at91: fix timer rate Jean-Christophe PLAGNIOL-VILLARD
2012-11-23 15:55   ` [PATCH 2/4] atmel_nand: fix pmecc timeout Jean-Christophe PLAGNIOL-VILLARD
2012-11-23 15:55   ` [PATCH 3/4] at91: clock: check overclock for sam9260/9261/9263/9rl Jean-Christophe PLAGNIOL-VILLARD
2012-11-23 15:55   ` [PATCH 4/4] Revert "mtd: atmel_nand: optimize read/write buffer functions" Jean-Christophe PLAGNIOL-VILLARD
2012-11-24  3:42     ` 张忠山
2012-11-24  8:45       ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-25  8:11         ` 张忠山 [this message]
2012-11-25 19:32           ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-26  2:17             ` 张忠山
2012-11-26  7:31 ` [PATCH 0/4] at91: some fixes Sascha Hauer

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=20121125081149.GB19824@greatfirst.com \
    --to=zzs213@126.com \
    --cc=barebox@lists.infradead.org \
    --cc=plagnioj@jcrosoft.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.