From: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
To: "\"Qi Wang 王起 (qiwang)\"" <qiwang@micron.com>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Cc: "Brian Norris" <computersforpeace@gmail.com>,
"James Hartley" <james.hartley@imgtec.com>,
"arnaud.mouiche@invoxia.com" <arnaud.mouiche@invoxia.com>,
"\"Peter Pan 潘栋 (peterpandong)\"" <peterpandong@micron.com>
Subject: Re: [PATCH 4/6] mtd: Introduce SPI NAND framework
Date: Mon, 22 Dec 2014 12:44:23 -0300 [thread overview]
Message-ID: <54983C57.6070403@imgtec.com> (raw)
In-Reply-To: <71CF8D7F32C5C24C9CD1D0E02D52498A7713CD34@NTXXIAMBX02.xacn.micron.com>
Dear Qi Wang,
Thanks for the review,
On 12/22/2014 01:34 AM, Qi Wang 王起 (qiwang) wrote:
> Hi Ezequiel,
>
>> +/*
>> + * Wait until the status register busy bit is cleared.
>> + * Returns a negatie errno on error or time out, and a non-negative
>> +status
>> + * value if the device is ready.
>> + */
>> +static int spi_nand_wait_till_ready(struct spi_nand *snand) {
>> + unsigned long deadline = jiffies + msecs_to_jiffies(100);
>
> 100ms will be applied to all operation, but I think it would be more
> make sense to use different timeout value for different operation,
> just like Parallel NAND as below:
> "
Yes, indeed. You are right. Now we need to find out the appropriate
value in each case. Any suggestions?
> static int nand_wait(struct mtd_info *mtd, struct nand_chip *chip)
> {
>
> int status, state = chip->state;
> unsigned long timeo = (state == FL_ERASING ? 400 : 20);
> "
>
>
>> +static int spi_nand_write(struct spi_nand *snand) {
>> + int ret;
>> +
>> + /* Store the page to cache */
>> + ret = snand->store_cache(snand, 0, snand->buf_size, snand-
>>> data_buf);
>> + if (ret < 0) {
>> + dev_err(snand->dev, "error %d storing page 0x%x to cache\n",
>> + ret, snand->page_addr);
>> + return ret;
>> + }
>> +
>> + ret = spi_nand_wait_till_ready(snand);
>> + if (ret)
>> + return ret;
>> +
>> + ret = snand->write_enable(snand);
>> + if (ret < 0) {
>> + dev_err(snand->dev, "write enable command failed\n");
>> + return ret;
>> + }
>> +
>> + /* Get page from the device cache into our internal buffer */
>> + ret = snand->write_page(snand, snand->page_addr);
>
>
> The page program sequence in datasheet is write_enable->program_load->
> program_execute->read_status. Seems different with the procedure in
> your code.
>
Right. I thought calling write_enable() before actually programming the
page would be enough. Do you think we should do it before the cache
programming instead?
And what happens if it fails, will we need to call write_disable explicitly?
--
Ezequiel
next prev parent reply other threads:[~2014-12-22 15:46 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-02 12:58 [PATCH 0/6] SPI NAND for everyone Ezequiel Garcia
2014-12-02 12:58 ` [PATCH 1/6] mtd: nand: Check length of ID before reading bits per cell Ezequiel Garcia
2014-12-13 0:51 ` Daniel Ehrenberg
2015-01-05 20:38 ` Brian Norris
2014-12-02 12:58 ` [PATCH 2/6] mtd: nand: Add JEDEC manufacturer ID for Gigadevice Ezequiel Garcia
2014-12-13 0:49 ` Daniel Ehrenberg
2015-04-21 23:04 ` Ezequiel Garcia
2015-04-22 17:47 ` Brian Norris
2014-12-02 12:58 ` [PATCH 3/6] mtd: nand: Allow to set a per-device ECC layout Ezequiel Garcia
2014-12-13 0:34 ` Daniel Ehrenberg
2014-12-02 12:58 ` [PATCH 4/6] mtd: Introduce SPI NAND framework Ezequiel Garcia
2014-12-15 21:18 ` Daniel Ehrenberg
2014-12-16 0:08 ` Ezequiel Garcia
[not found] ` <87F60714EC601C4C83DFF1D2E3D390A049EE77@NTXXIAMBX02.xacn.micron.com>
2014-12-22 4:34 ` Qi Wang 王起 (qiwang)
2014-12-22 15:44 ` Ezequiel Garcia [this message]
2015-01-05 20:47 ` Brian Norris
2014-12-02 12:58 ` [PATCH 5/6] mtd: spi-nand: Add devicetree binding Ezequiel Garcia
2014-12-13 1:27 ` Daniel Ehrenberg
2014-12-02 12:58 ` [PATCH 6/6] mtd: spi-nand: Support common SPI NAND devices Ezequiel Garcia
2014-12-13 1:27 ` Daniel Ehrenberg
2014-12-15 19:36 ` Ezequiel Garcia
2014-12-15 20:17 ` Daniel Ehrenberg
[not found] ` <87F60714EC601C4C83DFF1D2E3D390A049EE65@NTXXIAMBX02.xacn.micron.com>
2014-12-22 4:34 ` Qi Wang 王起 (qiwang)
2014-12-22 16:16 ` Ezequiel Garcia
2014-12-10 17:41 ` [PATCH 0/6] SPI NAND for everyone Ezequiel Garcia
2015-01-06 3:30 ` Brian Norris
2015-01-06 21:03 ` Ezequiel Garcia
2015-01-07 0:55 ` Qi Wang 王起 (qiwang)
2015-01-07 12:13 ` Ezequiel Garcia
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=54983C57.6070403@imgtec.com \
--to=ezequiel.garcia@imgtec.com \
--cc=arnaud.mouiche@invoxia.com \
--cc=computersforpeace@gmail.com \
--cc=james.hartley@imgtec.com \
--cc=linux-mtd@lists.infradead.org \
--cc=peterpandong@micron.com \
--cc=qiwang@micron.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.