From: Artem Bityutskiy <dedekind1@gmail.com>
To: Matthieu CASTET <matthieu.castet@parrot.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: [PATCH 3/6] refactor mtd wait code
Date: Tue, 28 Jun 2011 11:00:27 +0300 [thread overview]
Message-ID: <1309248031.23597.45.camel@sauron> (raw)
In-Reply-To: <1309105616-3609-3-git-send-email-matthieu.castet@parrot.com>
On Sun, 2011-06-26 at 18:26 +0200, Matthieu CASTET wrote:
> +/**
> + * This is call after sending a read command, or for autoincrement
> + * chip that need it (!NAND_NO_READRDY).
> + *
> + * We can't call NAND_CMD_STATUS here, because the read command
> + * is not finished
> + */
> +static void nand_wait_read(struct mtd_info *mtd, struct nand_chip *chip)
> +{
> + /*
> + * If we don't have access to the busy pin, we apply the given
> + * command delay
> + */
> + if (!chip->dev_ready) {
> + udelay(chip->chip_delay);
> + }
> + else {
> + /* Apply this short delay always to ensure that we do wait tWB in
> + * any case on any machine. */
> + ndelay(100);
Please, all these hard-coded numbers should be hidden in the specific
driver.
> + nand_wait_ready(mtd);
> + }
> +}
> +
> +/**
> * __nand_unlock - [REPLACEABLE] unlocks specified locked blocks
> *
> * @mtd: mtd info
> @@ -1526,10 +1540,7 @@ static int nand_do_read_ops(struct mtd_info *mtd, loff_t from,
> * increment is marked as NOAUTOINCR by the
> * board driver.
> */
> - if (!chip->dev_ready)
> - udelay(chip->chip_delay);
> - else
> - nand_wait_ready(mtd);
> + nand_wait_read(mtd, chip);
> }
> } else {
> memcpy(buf, chip->buffers->databuf + col, bytes);
> @@ -1811,10 +1822,7 @@ static int nand_do_read_oob(struct mtd_info *mtd, loff_t from,
> * chip which does auto increment is marked as
> * NOAUTOINCR by the board driver.
> */
> - if (!chip->dev_ready)
> - udelay(chip->chip_delay);
> - else
> - nand_wait_ready(mtd);
> + nand_wait_read(mtd, chip);
I think one thing which you should do as part of this series is to get
rid of all the if (!chip->dev_ready) checks. Instead, you should
introduce something like default_chip_ready and make it do the job.
Also, make sure nand_wait_ready() works in that case.
--
Best Regards,
Artem Bityutskiy
next prev parent reply other threads:[~2011-06-28 7:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-26 16:26 [PATCH 1/6] nand_wait_ready timeout fix Matthieu CASTET
2011-06-26 16:26 ` [PATCH 2/6] nand_wait : warn if the nand is busy on exit Matthieu CASTET
2011-06-28 7:57 ` Artem Bityutskiy
2011-06-28 15:03 ` Matthieu CASTET
2011-06-28 19:05 ` Artem Bityutskiy
2011-06-29 13:59 ` Ivan Djelic
2011-06-30 12:36 ` Artem Bityutskiy
2011-06-26 16:26 ` [PATCH 3/6] refactor mtd wait code Matthieu CASTET
2011-06-28 8:00 ` Artem Bityutskiy [this message]
2011-06-28 8:03 ` Artem Bityutskiy
2011-06-28 15:00 ` Matthieu CASTET
2011-06-29 6:09 ` Artem Bityutskiy
2011-06-26 16:26 ` [PATCH 4/6] nand_wait_read : add code to wait on status for LP Matthieu CASTET
2011-06-26 16:26 ` [PATCH 5/6] nand_flash_detect_onfi propagate busw info Matthieu CASTET
2011-06-29 16:38 ` Brian Norris
2011-06-30 11:47 ` Artem Bityutskiy
2011-06-26 16:26 ` [PATCH 6/6] add NAND_BUSWIDTH_AUTO Matthieu CASTET
2011-06-29 16:37 ` Brian Norris
2011-06-28 7:48 ` [PATCH 1/6] nand_wait_ready timeout fix Artem Bityutskiy
2011-06-28 15:09 ` Matthieu CASTET
2011-06-29 6:08 ` Artem Bityutskiy
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=1309248031.23597.45.camel@sauron \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=matthieu.castet@parrot.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox