From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Arseniy Krasnov <avkrasnov@sberdevices.ru>,
Liang Yang <liang.yang@amlogic.com>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Neil Armstrong <neil.armstrong@linaro.org>,
Kevin Hilman <khilman@baylibre.com>,
Jerome Brunet <jbrunet@baylibre.com>,
Martin Blumenstingl <martin.blumenstingl@googlemail.com>,
Jianxin Pan <jianxin.pan@amlogic.com>,
Yixun Lan <yixun.lan@amlogic.com>
Cc: linux-mtd@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
linux-amlogic@lists.infradead.org, linux-kernel@vger.kernel.org,
kernel@sberdevices.ru, oxffffaa@gmail.com
Subject: Re: [PATCH v2] mtd: rawnand: meson: fix bitmask for length in command word
Date: Wed, 29 Mar 2023 09:09:20 +0100 [thread overview]
Message-ID: <447abc1b-b4a3-5848-c99a-ecbff11486fe@linaro.org> (raw)
In-Reply-To: <3794ffbf-dfea-e96f-1f97-fe235b005e19@sberdevices.ru>
On 3/29/23 08:47, Arseniy Krasnov wrote:
> Valid mask is 0x3FFF, without this patch the following problems were
> found:
>
> 1) [ 0.938914] Could not find a valid ONFI parameter page, trying
> bit-wise majority to recover it
> [ 0.947384] ONFI parameter recovery failed, aborting
>
> 2) Read with disabled ECC mode was broken.
>
> Fixes: 8fae856c5350 ("mtd: rawnand: meson: add support for Amlogic NAND flash controller")
> Cc: <Stable@vger.kernel.org>
> Signed-off-by: Arseniy Krasnov <AVKrasnov@sberdevices.ru>
> ---
> drivers/mtd/nand/raw/meson_nand.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index a28574c00900..074e14225c06 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -280,7 +280,7 @@ static void meson_nfc_cmd_access(struct nand_chip *nand, int raw, bool dir,
>
> if (raw) {
> len = mtd->writesize + mtd->oobsize;
> - cmd = (len & GENMASK(5, 0)) | scrambler | DMA_DIR(dir);
> + cmd = (len & GENMASK(13, 0)) | scrambler | DMA_DIR(dir);
What happens when len > GENMASK(13, 0)? Do you check this somewhere?
Please introduce a macro/field for GENMASK(13, 0), having such mask
scattered along the code looks hackish and doesn't help readability.
You'll get to use FIELD_PREP as well.
> writel(cmd, nfc->reg_base + NFC_REG_CMD);
> return;
> }
> @@ -544,7 +544,7 @@ static int meson_nfc_read_buf(struct nand_chip *nand, u8 *buf, int len)
> if (ret)
> goto out;
>
> - cmd = NFC_CMD_N2M | (len & GENMASK(5, 0));
> + cmd = NFC_CMD_N2M | (len & GENMASK(13, 0));
> writel(cmd, nfc->reg_base + NFC_REG_CMD);
>
> meson_nfc_drain_cmd(nfc);
> @@ -568,7 +568,7 @@ static int meson_nfc_write_buf(struct nand_chip *nand, u8 *buf, int len)
> if (ret)
> return ret;
>
> - cmd = NFC_CMD_M2N | (len & GENMASK(5, 0));
> + cmd = NFC_CMD_M2N | (len & GENMASK(13, 0));
> writel(cmd, nfc->reg_base + NFC_REG_CMD);
>
> meson_nfc_drain_cmd(nfc);
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2023-03-29 8:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-29 7:47 [PATCH v2] mtd: rawnand: meson: fix bitmask for length in command word Arseniy Krasnov
2023-03-29 8:09 ` Tudor Ambarus [this message]
2023-03-29 8:33 ` Arseniy Krasnov
2023-03-29 9:00 ` Miquel Raynal
2023-03-29 10:55 ` Arseniy Krasnov
2023-04-03 15:59 ` Miquel Raynal
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=447abc1b-b4a3-5848-c99a-ecbff11486fe@linaro.org \
--to=tudor.ambarus@linaro.org \
--cc=avkrasnov@sberdevices.ru \
--cc=jbrunet@baylibre.com \
--cc=jianxin.pan@amlogic.com \
--cc=kernel@sberdevices.ru \
--cc=khilman@baylibre.com \
--cc=liang.yang@amlogic.com \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=martin.blumenstingl@googlemail.com \
--cc=miquel.raynal@bootlin.com \
--cc=neil.armstrong@linaro.org \
--cc=oxffffaa@gmail.com \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=yixun.lan@amlogic.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