From: Miquel Raynal <miquel.raynal@bootlin.com>
To: "Álvaro Fernández Rojas" <noltari@gmail.com>
Cc: vigneshr@ti.com, kdasu.kdev@gmail.com, richard@nod.at,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
linaro-mm-sig@lists.linaro.org, linux-mtd@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
computersforpeace@gmail.com, sumit.semwal@linaro.org,
linux-media@vger.kernel.org
Subject: Re: [PATCH v2 1/2] nand: brcmnand: improve hamming oob layout
Date: Mon, 11 May 2020 18:34:01 +0200 [thread overview]
Message-ID: <20200511183401.2ef8b037@xps13> (raw)
In-Reply-To: <20200504185945.2776148-1-noltari@gmail.com>
Hi Álvaro,
Álvaro Fernández Rojas <noltari@gmail.com> wrote on Mon, 4 May 2020
20:59:44 +0200:
> The current code generates 8 oob sections:
> S1 1-5
> ECC 6-8
> S2 9-15
> S3 16-21
> ECC 22-24
> S4 25-31
> S5 32-37
> ECC 38-40
> S6 41-47
> S7 48-53
> ECC 54-56
> S8 57-63
>
> Change it by merging continuous sections:
> S1 1-5
> ECC 6-8
> S2 9-21
> ECC 22-24
> S3 25-37
> ECC 38-40
> S4 41-53
> ECC 54-56
> S5 57-63
>
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
> v2: keep original comment and fix correctly skip byte 6 for small-page nand
>
> drivers/mtd/nand/raw/brcmnand/brcmnand.c | 34 +++++++++++++-----------
> 1 file changed, 18 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/brcmnand/brcmnand.c b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> index e4e3ceeac38f..767343e0e6e7 100644
> --- a/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> +++ b/drivers/mtd/nand/raw/brcmnand/brcmnand.c
> @@ -1100,30 +1100,32 @@ static int brcmnand_hamming_ooblayout_free(struct mtd_info *mtd, int section,
> struct brcmnand_cfg *cfg = &host->hwcfg;
> int sas = cfg->spare_area_size << cfg->sector_size_1k;
> int sectors = cfg->page_size / (512 << cfg->sector_size_1k);
> + u32 next;
>
> - if (section >= sectors * 2)
> + if (section > sectors)
> return -ERANGE;
>
> - oobregion->offset = (section / 2) * sas;
> + next = (section * sas);
> + if (section < sectors)
> + next += 6;
>
> - if (section & 1) {
> - oobregion->offset += 9;
> - oobregion->length = 7;
> + if (section) {
> + oobregion->offset = ((section - 1) * sas) + 9;
> } else {
> - oobregion->length = 6;
> -
> - /* First sector of each page may have BBI */
> - if (!section) {
> - /*
> - * Small-page NAND use byte 6 for BBI while large-page
> - * NAND use byte 0.
> - */
> - if (cfg->page_size > 512)
> - oobregion->offset++;
> - oobregion->length--;
> + /*
> + * Small-page NAND use byte 6 for BBI while large-page
> + * NAND use byte 0.
> + */
> + if (cfg->page_size > 512) {
> + oobregion->offset = 1;
> + } else {
> + oobregion->offset = 0;
> + next--;
> }
> }
>
> + oobregion->length = next - oobregion->offset;
> +
> return 0;
> }
>
I'm fine with the two patches but could you please invert the order and
add Fixes: + Cc: stable tags on both? on "fix hamming oob layout"
please? This way the fix is valid on older versions of the driver an
can be backported easily.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
next prev parent reply other threads:[~2020-05-11 16:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-04 9:30 [PATCH 1/2] nand: brcmnand: improve hamming oob layout Álvaro Fernández Rojas
2020-05-04 9:30 ` [PATCH 2/2] nand: brcmnand: fix BBI in " Álvaro Fernández Rojas
2020-05-04 18:59 ` [PATCH v2 1/2] nand: brcmnand: improve " Álvaro Fernández Rojas
2020-05-04 18:59 ` [PATCH v2 2/2] nand: brcmnand: fix " Álvaro Fernández Rojas
2020-05-11 16:34 ` Miquel Raynal [this message]
2020-05-12 6:00 ` [PATCH v3 0/2] mtd: rawnand: brcmnand: improve " Álvaro Fernández Rojas
2020-05-12 6:00 ` [PATCH v3 1/2] mtd: rawnand: brcmnand: fix " Álvaro Fernández Rojas
2020-05-12 6:00 ` [PATCH v3 2/2] mtd: rawnand: brcmnand: improve " Álvaro Fernández Rojas
2020-05-12 7:08 ` Miquel Raynal
2020-05-12 7:12 ` Álvaro Fernández Rojas
2020-05-12 7:19 ` Miquel Raynal
2020-05-12 7:26 ` Álvaro Fernández Rojas
2020-05-12 7:41 ` Miquel Raynal
2020-05-12 7:57 ` [PATCH v4 0/2] " Álvaro Fernández Rojas
2020-05-12 7:57 ` [PATCH v4 1/2] mtd: rawnand: brcmnand: fix " Álvaro Fernández Rojas
2020-05-24 19:17 ` Miquel Raynal
2020-05-12 7:57 ` [PATCH v4 2/2] mtd: rawnand: brcmnand: improve " Álvaro Fernández Rojas
2020-05-24 19:17 ` 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=20200511183401.2ef8b037@xps13 \
--to=miquel.raynal@bootlin.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=computersforpeace@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kdasu.kdev@gmail.com \
--cc=linaro-mm-sig@lists.linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=noltari@gmail.com \
--cc=richard@nod.at \
--cc=sumit.semwal@linaro.org \
--cc=vigneshr@ti.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;
as well as URLs for NNTP newsgroup(s).