From: Ezequiel Garcia <ezequiel.garcia@imgtec.com>
To: Daniel Ehrenberg <dehrenberg@google.com>
Cc: bpqw@micron.com, Ionela Voinescu <ionela.voinescu@imgtec.com>,
frankliu@micron.com, Andrew Bresticker <abrestic@chromium.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
arnaud.mouiche@invoxia.com,
Brian Norris <computersforpeace@gmail.com>,
James Hartley <james.hartley@imgtec.com>
Subject: Re: [PATCH 4/6] mtd: Introduce SPI NAND framework
Date: Mon, 15 Dec 2014 21:08:37 -0300 [thread overview]
Message-ID: <548F7805.3020708@imgtec.com> (raw)
In-Reply-To: <CAAK6Zt0q=uFMzYtdu-G1mk8Ao4KTaBuYU74hy3x8bBy39BD1TA@mail.gmail.com>
On 12/15/2014 06:18 PM, Daniel Ehrenberg wrote:
> On Tue, Dec 2, 2014 at 4:58 AM, Ezequiel Garcia
> <ezequiel.garcia@imgtec.com> wrote:
>> +static int spi_nand_read_page(struct spi_nand *snand, unsigned int page_addr,
>> + unsigned int page_offset, size_t length)
>> +{
>> + unsigned int corrected = 0, ecc_error = 0;
>> + int ret;
>> +
>> + /* Load a page into the cache register */
>> + ret = snand->load_page(snand, page_addr);
>> + if (ret < 0) {
>> + dev_err(snand->dev, "error %d loading page 0x%x to cache\n",
>> + ret, page_addr);
>> + return ret;
>> + }
>> +
>> + ret = spi_nand_wait_till_ready(snand);
>> + if (ret < 0)
>> + return ret;
>> +
>> + if (snand->ecc) {
>> + snand->get_ecc_status(ret, &corrected, &ecc_error);
>> + snand->bitflips = corrected;
>> +
>> + /*
>> + * If there's an ECC error, print a message and notify MTD
>> + * about it. Then complete the read, to load actual data on
>> + * the buffer (instead of the status result).
>> + */
>> + if (ecc_error) {
>> + dev_err(snand->dev,
>> + "internal ECC error reading page 0x%x\n",
>> + page_addr);
>> + snand->mtd.ecc_stats.failed++;
>> + }
>> + }
>> +
>> + /* Get page from the device cache into our internal buffer */
>> + ret = snand->read_cache(snand, page_offset, length, snand->data_buf);
>> + if (ret < 0) {
>> + dev_err(snand->dev, "error %d reading page 0x%x from cache\n",
>> + ret, page_addr);
>> + return ret;
>> + }
>> + return 0;
>> +}
>
> Should you increment snand->mtd.corrected by corrected in this function?
>
Yes, it looks like I missed that.
Thanks for the feedback,
--
Ezequiel
next prev parent reply other threads:[~2014-12-16 0:10 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 [this message]
[not found] ` <87F60714EC601C4C83DFF1D2E3D390A049EE77@NTXXIAMBX02.xacn.micron.com>
2014-12-22 4:34 ` Qi Wang 王起 (qiwang)
2014-12-22 15:44 ` Ezequiel Garcia
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=548F7805.3020708@imgtec.com \
--to=ezequiel.garcia@imgtec.com \
--cc=abrestic@chromium.org \
--cc=arnaud.mouiche@invoxia.com \
--cc=bpqw@micron.com \
--cc=computersforpeace@gmail.com \
--cc=dehrenberg@google.com \
--cc=frankliu@micron.com \
--cc=ionela.voinescu@imgtec.com \
--cc=james.hartley@imgtec.com \
--cc=linux-mtd@lists.infradead.org \
/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.