From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Ziyang Huang <hzyitc@outlook.com>
Cc: richard@nod.at, vigneshr@ti.com, cnsztl@gmail.com,
csharper2005@gmail.com, mikhail.kshevetskiy@iopsys.eu,
linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mtd: spinand: fmsh: add support for FM25G{01,02}B
Date: Tue, 28 Apr 2026 14:49:13 +0200 [thread overview]
Message-ID: <87340fdzcm.fsf@bootlin.com> (raw)
In-Reply-To: <SEYPR01MB5882D37365BB442818AEC143C9222@SEYPR01MB5882.apcprd01.prod.exchangelabs.com> (Ziyang Huang's message of "Wed, 15 Apr 2026 23:31:41 +0800")
Hello Ziyang,
On 15/04/2026 at 23:31:41 +08, Ziyang Huang <hzyitc@outlook.com> wrote:
> FM25G01B: https://www.fmsh.com/nvm/FM25G01B_ds_eng.pdf
> FM25G02B: https://www.fmsh.com/nvm/FM25G02B_ds_eng.pdf
Before giving the links, the commit could be slightly more verbose, such
as "Add support for...".
> Signed-off-by: Ziyang Huang <hzyitc@outlook.com>
> ---
> Changes since v1:
> Fix copy-paste issue. (Correct FM25G01B size.)
>
> drivers/mtd/nand/spi/fmsh.c | 101 ++++++++++++++++++++++++++++++++++++
> 1 file changed, 101 insertions(+)
>
> diff --git a/drivers/mtd/nand/spi/fmsh.c b/drivers/mtd/nand/spi/fmsh.c
> index f417955f7d1c..a9b219ae6c29 100644
> --- a/drivers/mtd/nand/spi/fmsh.c
> +++ b/drivers/mtd/nand/spi/fmsh.c
> @@ -9,6 +9,16 @@
> #include <linux/kernel.h>
> #include <linux/mtd/spinand.h>
>
> +#define FM25G01B_STATUS_ECC_MASK (7 << 4)
> + #define FM25G01B_STATUS_ECC_NO_BITFLIPS (0 << 4)
> + #define FM25G01B_STATUS_ECC_1_3_BITFLIPS (1 << 4)
> + #define FM25G01B_STATUS_ECC_4_BITFLIPS (2 << 4)
> + #define FM25G01B_STATUS_ECC_5_BITFLIPS (3 << 4)
> + #define FM25G01B_STATUS_ECC_6_BITFLIPS (4 << 4)
> + #define FM25G01B_STATUS_ECC_7_BITFLIPS (5 << 4)
> + #define FM25G01B_STATUS_ECC_8_BITFLIPS (6 << 4)
> + #define FM25G01B_STATUS_ECC_UNCOR_ERROR (7 << 4)
> +
> #define FM25S01BI3_STATUS_ECC_MASK (7 << 4)
> #define FM25S01BI3_STATUS_ECC_NO_BITFLIPS (0 << 4)
> #define FM25S01BI3_STATUS_ECC_1_3_BITFLIPS (1 << 4)
> @@ -34,6 +44,72 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
> SPINAND_PROG_LOAD_1S_1S_4S_OP(false, 0, NULL, 0),
> SPINAND_PROG_LOAD_1S_1S_1S_OP(false, 0, NULL, 0));
>
> +
> +static int fm25g01b_ooblayout_ecc(struct mtd_info *mtd, int section,
> + struct mtd_oob_region *region)
> +{
> + if (section)
> + return -ERANGE;
> +
> + region->offset = 64;
> + region->length = 64;
> +
> + return 0;
> +}
> +
> +static int fm25g01b_ooblayout_free(struct mtd_info *mtd, int section,
> + struct mtd_oob_region *region)
> +{
> + if (section > 3)
> + return -ERANGE;
> +
> + if (section == 0) {
> + /* reserve 2 bytes for the BBM */
> + region->offset = 2;
> + region->length = 14;
> + } else {
> + region->offset = section * 16;
> + region->length = 16;
> + }
Isn't that just one big 62 bytes section starting at 2?
> +
> + return 0;
> +}
Rest lgtm.
Thanks,
Miquèl
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
prev parent reply other threads:[~2026-04-28 12:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <TYZPR01MB5556A3E71554A2EC08597EA4C9CDA@TYZPR01MB5556.apcprd01.prod.exchangelabs.com>
2026-04-15 15:31 ` [PATCH v2] mtd: spinand: fmsh: add support for FM25G{01,02}B Ziyang Huang
2026-04-28 12:49 ` Miquel Raynal [this message]
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=87340fdzcm.fsf@bootlin.com \
--to=miquel.raynal@bootlin.com \
--cc=cnsztl@gmail.com \
--cc=csharper2005@gmail.com \
--cc=hzyitc@outlook.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=mikhail.kshevetskiy@iopsys.eu \
--cc=richard@nod.at \
--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