From: Boris Brezillon <boris.brezillon-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
To: Jorge Ramirez-Ortiz
<jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
Cc: robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
erin.lo-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org,
computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org
Subject: Re: [PATCH v3 2/2] mtd: mediatek: driver for MTK Smart Device Gen1 NAND
Date: Tue, 19 Apr 2016 22:24:46 +0200 [thread overview]
Message-ID: <20160419222446.052cfa63@bbrezillon> (raw)
In-Reply-To: <1460393772-26910-3-git-send-email-jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
On Mon, 11 Apr 2016 12:56:12 -0400
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org> wrote:
> +static int mtk_nfc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
> + int page)
> +{
> + u8 *buf = chip->buffers->databuf;
You're touching ->databuf here, and the core uses this buffer for its
internal cache. If want to use this buffer you have to invalidate the
cache by setting chip->pagebuf to -1 first.
> + struct mtd_ecc_stats stats;
> + int ret;
> +
> + stats = mtd->ecc_stats;
> +
> + memset(buf, 0xff, mtd->writesize);
> + chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
> +
> + ret = mtk_nfc_read_page_hwecc(mtd, chip, buf, 1, page);
> +
> + /* mark as invalid data 0x00 if UECC happens */
> + if ((mtd->ecc_stats.failed - stats.failed) > 0)
> + memset(chip->oob_poi, 0, mtd->oobsize);
> +
> + if (ret < mtd->bitflip_threshold)
> + mtd->ecc_stats.corrected = stats.corrected;
> +
> + return ret;
> +}
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org>
Cc: dwmw2@infradead.org, computersforpeace@gmail.com,
matthias.bgg@gmail.com, robh@kernel.org,
linux-mtd@lists.infradead.org, xiaolei.li@mediatek.com,
daniel.thompson@linaro.org, erin.lo@mediatek.com,
linux-mediatek@lists.infradead.org
Subject: Re: [PATCH v3 2/2] mtd: mediatek: driver for MTK Smart Device Gen1 NAND
Date: Tue, 19 Apr 2016 22:24:46 +0200 [thread overview]
Message-ID: <20160419222446.052cfa63@bbrezillon> (raw)
In-Reply-To: <1460393772-26910-3-git-send-email-jorge.ramirez-ortiz@linaro.org>
On Mon, 11 Apr 2016 12:56:12 -0400
Jorge Ramirez-Ortiz <jorge.ramirez-ortiz@linaro.org> wrote:
> +static int mtk_nfc_read_oob(struct mtd_info *mtd, struct nand_chip *chip,
> + int page)
> +{
> + u8 *buf = chip->buffers->databuf;
You're touching ->databuf here, and the core uses this buffer for its
internal cache. If want to use this buffer you have to invalidate the
cache by setting chip->pagebuf to -1 first.
> + struct mtd_ecc_stats stats;
> + int ret;
> +
> + stats = mtd->ecc_stats;
> +
> + memset(buf, 0xff, mtd->writesize);
> + chip->cmdfunc(mtd, NAND_CMD_READ0, 0, page);
> +
> + ret = mtk_nfc_read_page_hwecc(mtd, chip, buf, 1, page);
> +
> + /* mark as invalid data 0x00 if UECC happens */
> + if ((mtd->ecc_stats.failed - stats.failed) > 0)
> + memset(chip->oob_poi, 0, mtd->oobsize);
> +
> + if (ret < mtd->bitflip_threshold)
> + mtd->ecc_stats.corrected = stats.corrected;
> +
> + return ret;
> +}
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2016-04-19 20:24 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-11 16:56 [PATCH v3 0/2] MTK Smart Device Gen1 NAND Driver Jorge Ramirez-Ortiz
2016-04-11 16:56 ` Jorge Ramirez-Ortiz
[not found] ` <1460393772-26910-1-git-send-email-jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-11 16:56 ` [PATCH v3 1/2] mtd: mediatek: device tree docs for MTK Smart Device Gen1 NAND Jorge Ramirez-Ortiz
2016-04-11 16:56 ` Jorge Ramirez-Ortiz
[not found] ` <1460393772-26910-2-git-send-email-jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-11 23:15 ` Boris Brezillon
2016-04-11 23:15 ` Boris Brezillon
2016-04-12 1:17 ` Jorge Ramirez-Ortiz
2016-04-12 1:17 ` Jorge Ramirez-Ortiz
2016-04-11 16:56 ` [PATCH v3 2/2] mtd: mediatek: driver " Jorge Ramirez-Ortiz
2016-04-11 16:56 ` Jorge Ramirez-Ortiz
[not found] ` <1460393772-26910-3-git-send-email-jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-17 22:17 ` Boris Brezillon
2016-04-17 22:17 ` Boris Brezillon
2016-04-19 14:26 ` Jorge Ramirez-Ortiz
2016-04-19 14:26 ` Jorge Ramirez-Ortiz
[not found] ` <5716402F.8060908-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>
2016-04-19 16:42 ` Boris Brezillon
2016-04-19 16:42 ` Boris Brezillon
2016-04-19 22:39 ` Jorge Ramirez-Ortiz
2016-04-19 22:39 ` Jorge Ramirez-Ortiz
2016-04-18 8:01 ` Boris Brezillon
2016-04-18 8:01 ` Boris Brezillon
2016-04-19 20:24 ` Boris Brezillon [this message]
2016-04-19 20:24 ` Boris Brezillon
2016-04-19 21:16 ` Jorge Ramirez-Ortiz
2016-04-19 21:16 ` Jorge Ramirez-Ortiz
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=20160419222446.052cfa63@bbrezillon \
--to=boris.brezillon-wi1+55scjutkeb57/3fjtnbpr1lh4cv8@public.gmane.org \
--cc=computersforpeace-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=daniel.thompson-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=dwmw2-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
--cc=erin.lo-NuS5LvNUpcJWk0Htik3J/w@public.gmane.org \
--cc=jorge.ramirez-ortiz-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
--cc=linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=matthias.bgg-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=robh-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=xiaolei.li-NuS5LvNUpcJWk0Htik3J/w@public.gmane.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.