From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Johan Jonker <jbx6244@gmail.com>
Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com
Subject: Re: [PATCH v2 3/5] mtd: nand: raw: rockchip-nand-controller: fix oobfree offset and description
Date: Mon, 12 Jun 2023 19:26:40 +0200 [thread overview]
Message-ID: <20230612192640.63baf3e8@xps-13> (raw)
In-Reply-To: <f2cebf54-a16c-c849-a988-bfd98c502748@gmail.com>
Hi Johan,
jbx6244@gmail.com wrote on Mon, 12 Jun 2023 17:03:18 +0200:
> The MTD framework reserves 1 or 2 bytes for the bad block marker
> depending on the bus size. The rockchip-nand-controller driver
> currently only supports a 8 bit bus, but reserves standard 2 bytes
> for the BBM.
We always reserve 2 bytes, no?
> The first free OOB byte is therefore OOB2 at offset 2.
> Page address(PA) bytes are moved to the last 4 positions before
> ECC. Update the description for Linux.
The description should just be:
Move Page Address (PA) bytes to the last 4 positions before ECC.
And then you should justify why this is needed. Also, this would break
all existing jffs2 users, right?
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
> drivers/mtd/nand/raw/rockchip-nand-controller.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> index 31d8c7a87..fcda4c760 100644
> --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
> +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> @@ -566,9 +566,10 @@ static int rk_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
> * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3
> *
> * The rk_nfc_ooblayout_free() function already has reserved
> - * these 4 bytes with:
> + * these 4 bytes together with 2 bytes for BBM
> + * by reducing it's length:
> *
> - * oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + * oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> */
> if (!i)
> memcpy(rk_nfc_oob_ptr(chip, i),
> @@ -945,12 +946,8 @@ static int rk_nfc_ooblayout_free(struct mtd_info *mtd, int section,
> if (section)
> return -ERANGE;
>
> - /*
> - * The beginning of the OOB area stores the reserved data for the NFC,
> - * the size of the reserved data is NFC_SYS_DATA_SIZE bytes.
> - */
> oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> - oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + oob_region->offset = 2;
>
> return 0;
> }
> --
> 2.30.2
>
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Johan Jonker <jbx6244@gmail.com>
Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com
Subject: Re: [PATCH v2 3/5] mtd: nand: raw: rockchip-nand-controller: fix oobfree offset and description
Date: Mon, 12 Jun 2023 19:26:40 +0200 [thread overview]
Message-ID: <20230612192640.63baf3e8@xps-13> (raw)
In-Reply-To: <f2cebf54-a16c-c849-a988-bfd98c502748@gmail.com>
Hi Johan,
jbx6244@gmail.com wrote on Mon, 12 Jun 2023 17:03:18 +0200:
> The MTD framework reserves 1 or 2 bytes for the bad block marker
> depending on the bus size. The rockchip-nand-controller driver
> currently only supports a 8 bit bus, but reserves standard 2 bytes
> for the BBM.
We always reserve 2 bytes, no?
> The first free OOB byte is therefore OOB2 at offset 2.
> Page address(PA) bytes are moved to the last 4 positions before
> ECC. Update the description for Linux.
The description should just be:
Move Page Address (PA) bytes to the last 4 positions before ECC.
And then you should justify why this is needed. Also, this would break
all existing jffs2 users, right?
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
> drivers/mtd/nand/raw/rockchip-nand-controller.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> index 31d8c7a87..fcda4c760 100644
> --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
> +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> @@ -566,9 +566,10 @@ static int rk_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
> * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3
> *
> * The rk_nfc_ooblayout_free() function already has reserved
> - * these 4 bytes with:
> + * these 4 bytes together with 2 bytes for BBM
> + * by reducing it's length:
> *
> - * oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + * oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> */
> if (!i)
> memcpy(rk_nfc_oob_ptr(chip, i),
> @@ -945,12 +946,8 @@ static int rk_nfc_ooblayout_free(struct mtd_info *mtd, int section,
> if (section)
> return -ERANGE;
>
> - /*
> - * The beginning of the OOB area stores the reserved data for the NFC,
> - * the size of the reserved data is NFC_SYS_DATA_SIZE bytes.
> - */
> oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> - oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + oob_region->offset = 2;
>
> return 0;
> }
> --
> 2.30.2
>
Thanks,
Miquèl
_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Johan Jonker <jbx6244@gmail.com>
Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com
Subject: Re: [PATCH v2 3/5] mtd: nand: raw: rockchip-nand-controller: fix oobfree offset and description
Date: Mon, 12 Jun 2023 19:26:40 +0200 [thread overview]
Message-ID: <20230612192640.63baf3e8@xps-13> (raw)
In-Reply-To: <f2cebf54-a16c-c849-a988-bfd98c502748@gmail.com>
Hi Johan,
jbx6244@gmail.com wrote on Mon, 12 Jun 2023 17:03:18 +0200:
> The MTD framework reserves 1 or 2 bytes for the bad block marker
> depending on the bus size. The rockchip-nand-controller driver
> currently only supports a 8 bit bus, but reserves standard 2 bytes
> for the BBM.
We always reserve 2 bytes, no?
> The first free OOB byte is therefore OOB2 at offset 2.
> Page address(PA) bytes are moved to the last 4 positions before
> ECC. Update the description for Linux.
The description should just be:
Move Page Address (PA) bytes to the last 4 positions before ECC.
And then you should justify why this is needed. Also, this would break
all existing jffs2 users, right?
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
> drivers/mtd/nand/raw/rockchip-nand-controller.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> index 31d8c7a87..fcda4c760 100644
> --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
> +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> @@ -566,9 +566,10 @@ static int rk_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
> * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3
> *
> * The rk_nfc_ooblayout_free() function already has reserved
> - * these 4 bytes with:
> + * these 4 bytes together with 2 bytes for BBM
> + * by reducing it's length:
> *
> - * oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + * oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> */
> if (!i)
> memcpy(rk_nfc_oob_ptr(chip, i),
> @@ -945,12 +946,8 @@ static int rk_nfc_ooblayout_free(struct mtd_info *mtd, int section,
> if (section)
> return -ERANGE;
>
> - /*
> - * The beginning of the OOB area stores the reserved data for the NFC,
> - * the size of the reserved data is NFC_SYS_DATA_SIZE bytes.
> - */
> oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> - oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + oob_region->offset = 2;
>
> return 0;
> }
> --
> 2.30.2
>
Thanks,
Miquèl
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Johan Jonker <jbx6244@gmail.com>
Cc: richard@nod.at, vigneshr@ti.com, heiko@sntech.de,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org, yifeng.zhao@rock-chips.com
Subject: Re: [PATCH v2 3/5] mtd: nand: raw: rockchip-nand-controller: fix oobfree offset and description
Date: Mon, 12 Jun 2023 19:26:40 +0200 [thread overview]
Message-ID: <20230612192640.63baf3e8@xps-13> (raw)
In-Reply-To: <f2cebf54-a16c-c849-a988-bfd98c502748@gmail.com>
Hi Johan,
jbx6244@gmail.com wrote on Mon, 12 Jun 2023 17:03:18 +0200:
> The MTD framework reserves 1 or 2 bytes for the bad block marker
> depending on the bus size. The rockchip-nand-controller driver
> currently only supports a 8 bit bus, but reserves standard 2 bytes
> for the BBM.
We always reserve 2 bytes, no?
> The first free OOB byte is therefore OOB2 at offset 2.
> Page address(PA) bytes are moved to the last 4 positions before
> ECC. Update the description for Linux.
The description should just be:
Move Page Address (PA) bytes to the last 4 positions before ECC.
And then you should justify why this is needed. Also, this would break
all existing jffs2 users, right?
>
> Signed-off-by: Johan Jonker <jbx6244@gmail.com>
> ---
> drivers/mtd/nand/raw/rockchip-nand-controller.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/rockchip-nand-controller.c b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> index 31d8c7a87..fcda4c760 100644
> --- a/drivers/mtd/nand/raw/rockchip-nand-controller.c
> +++ b/drivers/mtd/nand/raw/rockchip-nand-controller.c
> @@ -566,9 +566,10 @@ static int rk_nfc_write_page_raw(struct nand_chip *chip, const u8 *buf,
> * BBM OOB1 OOB2 OOB3 |......| PA0 PA1 PA2 PA3
> *
> * The rk_nfc_ooblayout_free() function already has reserved
> - * these 4 bytes with:
> + * these 4 bytes together with 2 bytes for BBM
> + * by reducing it's length:
> *
> - * oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + * oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> */
> if (!i)
> memcpy(rk_nfc_oob_ptr(chip, i),
> @@ -945,12 +946,8 @@ static int rk_nfc_ooblayout_free(struct mtd_info *mtd, int section,
> if (section)
> return -ERANGE;
>
> - /*
> - * The beginning of the OOB area stores the reserved data for the NFC,
> - * the size of the reserved data is NFC_SYS_DATA_SIZE bytes.
> - */
> oob_region->length = rknand->metadata_size - NFC_SYS_DATA_SIZE - 2;
> - oob_region->offset = NFC_SYS_DATA_SIZE + 2;
> + oob_region->offset = 2;
>
> return 0;
> }
> --
> 2.30.2
>
Thanks,
Miquèl
next prev parent reply other threads:[~2023-06-12 17:27 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 15:00 [PATCH v2 0/5] Fixes for Rockchip NAND controller driver Johan Jonker
2023-06-12 15:00 ` Johan Jonker
2023-06-12 15:00 ` Johan Jonker
2023-06-12 15:00 ` Johan Jonker
2023-06-12 15:02 ` [PATCH v2 1/5] mtd: nand: raw: rockchip-nand-controller: copy hwecc PA data to oob_poi buffer Johan Jonker
2023-06-12 15:02 ` Johan Jonker
2023-06-12 15:02 ` Johan Jonker
2023-06-12 15:02 ` Johan Jonker
2023-06-12 17:40 ` Miquel Raynal
2023-06-12 17:40 ` Miquel Raynal
2023-06-12 17:40 ` Miquel Raynal
2023-06-12 17:40 ` Miquel Raynal
2023-06-12 15:02 ` [PATCH v2 2/5] mtd: nand: raw: rockchip-nand-controller: add skipbbt option Johan Jonker
2023-06-12 15:02 ` Johan Jonker
2023-06-12 15:02 ` Johan Jonker
2023-06-12 15:02 ` Johan Jonker
2023-06-12 15:03 ` [PATCH v2 3/5] mtd: nand: raw: rockchip-nand-controller: fix oobfree offset and description Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 17:26 ` Miquel Raynal [this message]
2023-06-12 17:26 ` Miquel Raynal
2023-06-12 17:26 ` Miquel Raynal
2023-06-12 17:26 ` Miquel Raynal
2023-06-14 9:23 ` Johan Jonker
2023-06-14 9:23 ` Johan Jonker
2023-06-14 9:23 ` Johan Jonker
2023-06-14 9:23 ` Johan Jonker
2023-06-14 16:01 ` Miquel Raynal
2023-06-14 16:01 ` Miquel Raynal
2023-06-14 16:01 ` Miquel Raynal
2023-06-14 16:01 ` Miquel Raynal
2023-06-12 15:03 ` [PATCH v2 4/5] mtd: nand: raw: add basic sandisk manufacturer ops Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 17:41 ` Miquel Raynal
2023-06-12 17:41 ` Miquel Raynal
2023-06-12 17:41 ` Miquel Raynal
2023-06-12 17:41 ` Miquel Raynal
2023-06-12 15:03 ` [PATCH v2 5/5] mtd: nand: add support for the Sandisk SDTNQGAMA chip Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 15:03 ` Johan Jonker
2023-06-12 15:03 ` Johan Jonker
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=20230612192640.63baf3e8@xps-13 \
--to=miquel.raynal@bootlin.com \
--cc=heiko@sntech.de \
--cc=jbx6244@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=richard@nod.at \
--cc=vigneshr@ti.com \
--cc=yifeng.zhao@rock-chips.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.