* [PATCH] mtd: nand: spi: fmsh: add FM25S01 support
@ 2026-11-30 22:49 Florian Fainelli
2026-11-30 22:56 ` sashiko-bot
0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2026-11-30 22:49 UTC (permalink / raw)
To: linux-mtd
Cc: bcm-kernel-feedback-list, David Regan, Florian Fainelli,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra,
Aleksandr Mineev, Ziyang Huang
From: David Regan <david.regan@broadcom.com>
FM25S01 is an earlier, lower-density sibling of the already supported
FM25S01A (same manufacturer ID, same read/write/update cache variants
and memory geometry, 1 bit/512 bytes ECC requirement), identified by
device ID 0xa1. Unlike FM25S01A it exposes a real ECC OOB region
(64/64 split) rather than none.
Signed-off-by: David Regan <david.regan@broadcom.com>
[florian: commit message]
Signed-off-by: Florian Fainelli <florian.fainelli@broadcom.com>
---
drivers/mtd/nand/spi/fmsh.c | 39 +++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)
diff --git a/drivers/mtd/nand/spi/fmsh.c b/drivers/mtd/nand/spi/fmsh.c
index 6352e9c9e502..2bf73e6dfb7a 100644
--- a/drivers/mtd/nand/spi/fmsh.c
+++ b/drivers/mtd/nand/spi/fmsh.c
@@ -112,6 +112,31 @@ static int fm25g01b_ecc_get_status(struct spinand_device *spinand,
return -EINVAL;
}
+static int fm25s01_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 fm25s01_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section)
+ return -ERANGE;
+
+ /* reserve 2 bytes for the BBM */
+ region->offset = 2;
+ region->length = 62;
+
+ return 0;
+}
+
static int fm25s01a_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
@@ -185,6 +210,11 @@ static const struct mtd_ooblayout_ops fm25g01b_ooblayout = {
.free = fm25g01b_ooblayout_free,
};
+static const struct mtd_ooblayout_ops fm25s01_ooblayout = {
+ .ecc = fm25s01_ooblayout_ecc,
+ .free = fm25s01_ooblayout_free,
+};
+
static const struct mtd_ooblayout_ops fm25s01a_ooblayout = {
.ecc = fm25s01a_ooblayout_ecc,
.free = fm25s01a_ooblayout_free,
@@ -216,6 +246,15 @@ static const struct spinand_info fmsh_spinand_table[] = {
SPINAND_HAS_QE_BIT,
SPINAND_ECCINFO(&fm25g01b_ooblayout,
fm25g01b_ecc_get_status)),
+ SPINAND_INFO("FM25S01",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa1),
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
+ NAND_ECCREQ(1, 512),
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ 0,
+ SPINAND_ECCINFO(&fm25s01_ooblayout, NULL)),
SPINAND_INFO("FM25S01A",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
--
2.34.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] mtd: nand: spi: fmsh: add FM25S01 support
2026-11-30 22:49 [PATCH] mtd: nand: spi: fmsh: add FM25S01 support Florian Fainelli
@ 2026-11-30 22:56 ` sashiko-bot
2026-11-30 23:01 ` Florian Fainelli
0 siblings, 1 reply; 3+ messages in thread
From: sashiko-bot @ 2026-11-30 22:56 UTC (permalink / raw)
To: Florian Fainelli, linux-mtd
Cc: bcm-kernel-feedback-list, David Regan, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Aleksandr Mineev,
Ziyang Huang
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] mtd: spinand: fmsh: fm25s01_ooblayout duplicates
fm25g01b_ooblayout
--
commit 01eac4352ba75888872f9ede79d4df0245a7723e
Author: David Regan <david.regan@broadcom.com>
mtd: nand: spi: fmsh: add FM25S01 support
This commit adds SPI NAND support for the FudanMicro FM25S01 flash chip,
including its OOB layout callbacks and device table entry.
> diff --git a/drivers/mtd/nand/spi/fmsh.c b/drivers/mtd/nand/spi/fmsh.c
> index 6352e9c9e502f..2bf73e6dfb7a6 100644
> --- a/drivers/mtd/nand/spi/fmsh.c
> +++ b/drivers/mtd/nand/spi/fmsh.c
> @@ -112,6 +112,31 @@ static int fm25g01b_ecc_get_status(struct spinand_device *spinand,
> return -EINVAL;
> }
>
> +static int fm25s01_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 fm25s01_ooblayout_free(struct mtd_info *mtd, int section,
> + struct mtd_oob_region *region)
> +{
> + if (section)
> + return -ERANGE;
> +
> + /* reserve 2 bytes for the BBM */
> + region->offset = 2;
> + region->length = 62;
> +
> + return 0;
> +}
> +
> static int fm25s01a_ooblayout_ecc(struct mtd_info *mtd, int section,
> struct mtd_oob_region *region)
> {
> @@ -185,6 +210,11 @@ static const struct mtd_ooblayout_ops fm25g01b_ooblayout = {
> .free = fm25g01b_ooblayout_free,
> };
>
> +static const struct mtd_ooblayout_ops fm25s01_ooblayout = {
> + .ecc = fm25s01_ooblayout_ecc,
> + .free = fm25s01_ooblayout_free,
> +};
> +
> static const struct mtd_ooblayout_ops fm25s01a_ooblayout = {
> .ecc = fm25s01a_ooblayout_ecc,
> .free = fm25s01a_ooblayout_free,
> @@ -216,6 +246,15 @@ static const struct spinand_info fmsh_spinand_table[] = {
> SPINAND_HAS_QE_BIT,
> SPINAND_ECCINFO(&fm25g01b_ooblayout,
> fm25g01b_ecc_get_status)),
> + SPINAND_INFO("FM25S01",
> + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa1),
> + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
> + NAND_ECCREQ(1, 512),
> + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
> + &write_cache_variants,
> + &update_cache_variants),
> + 0,
> + SPINAND_ECCINFO(&fm25s01_ooblayout, NULL)),
> SPINAND_INFO("FM25S01A",
> SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
> NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
[Severity: Low]
Can FM25S01 reuse fm25g01b_ooblayout instead of defining
fm25s01_ooblayout_ecc(), fm25s01_ooblayout_free(), and fm25s01_ooblayout?
fm25g01b_ooblayout_ecc() and fm25g01b_ooblayout_free() in this file
already implement the same 64/64 OOB split with 2 bytes reserved for the
BBM, and FM25G02B already shares fm25g01b_ooblayout.
Also, the commit message describes FM25S01 as a lower-density sibling of
FM25S01A with the same memory geometry, whereas both parts have the same
1 Gbit (128 MiB) main array capacity and FM25S01 has a larger 128-byte OOB
size per page in NAND_MEMORG than FM25S01A's 64 bytes.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261130224944.1690846-1-florian.fainelli@broadcom.com?part=1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] mtd: nand: spi: fmsh: add FM25S01 support
2026-11-30 22:56 ` sashiko-bot
@ 2026-11-30 23:01 ` Florian Fainelli
0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2026-11-30 23:01 UTC (permalink / raw)
To: sashiko-reviews, linux-mtd
Cc: bcm-kernel-feedback-list, David Regan, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra, Aleksandr Mineev,
Ziyang Huang
On 11/30/26 14:56, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential
> issue to consider:
> - [Low] mtd: spinand: fmsh: fm25s01_ooblayout duplicates
> fm25g01b_ooblayout
> --
>
> commit 01eac4352ba75888872f9ede79d4df0245a7723e
> Author: David Regan <david.regan@broadcom.com>
>
> mtd: nand: spi: fmsh: add FM25S01 support
>
> This commit adds SPI NAND support for the FudanMicro FM25S01 flash chip,
> including its OOB layout callbacks and device table entry.
>
>> diff --git a/drivers/mtd/nand/spi/fmsh.c b/drivers/mtd/nand/spi/fmsh.c
>> index 6352e9c9e502f..2bf73e6dfb7a6 100644
>> --- a/drivers/mtd/nand/spi/fmsh.c
>> +++ b/drivers/mtd/nand/spi/fmsh.c
>> @@ -112,6 +112,31 @@ static int fm25g01b_ecc_get_status(struct spinand_device *spinand,
>> return -EINVAL;
>> }
>>
>> +static int fm25s01_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 fm25s01_ooblayout_free(struct mtd_info *mtd, int section,
>> + struct mtd_oob_region *region)
>> +{
>> + if (section)
>> + return -ERANGE;
>> +
>> + /* reserve 2 bytes for the BBM */
>> + region->offset = 2;
>> + region->length = 62;
>> +
>> + return 0;
>> +}
>> +
>> static int fm25s01a_ooblayout_ecc(struct mtd_info *mtd, int section,
>> struct mtd_oob_region *region)
>> {
>> @@ -185,6 +210,11 @@ static const struct mtd_ooblayout_ops fm25g01b_ooblayout = {
>> .free = fm25g01b_ooblayout_free,
>> };
>>
>> +static const struct mtd_ooblayout_ops fm25s01_ooblayout = {
>> + .ecc = fm25s01_ooblayout_ecc,
>> + .free = fm25s01_ooblayout_free,
>> +};
>> +
>> static const struct mtd_ooblayout_ops fm25s01a_ooblayout = {
>> .ecc = fm25s01a_ooblayout_ecc,
>> .free = fm25s01a_ooblayout_free,
>> @@ -216,6 +246,15 @@ static const struct spinand_info fmsh_spinand_table[] = {
>> SPINAND_HAS_QE_BIT,
>> SPINAND_ECCINFO(&fm25g01b_ooblayout,
>> fm25g01b_ecc_get_status)),
>> + SPINAND_INFO("FM25S01",
>> + SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xa1),
>> + NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
>> + NAND_ECCREQ(1, 512),
>> + SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
>> + &write_cache_variants,
>> + &update_cache_variants),
>> + 0,
>> + SPINAND_ECCINFO(&fm25s01_ooblayout, NULL)),
>> SPINAND_INFO("FM25S01A",
>> SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
>> NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
>
> [Severity: Low]
> Can FM25S01 reuse fm25g01b_ooblayout instead of defining
> fm25s01_ooblayout_ecc(), fm25s01_ooblayout_free(), and fm25s01_ooblayout?
> fm25g01b_ooblayout_ecc() and fm25g01b_ooblayout_free() in this file
> already implement the same 64/64 OOB split with 2 bytes reserved for the
> BBM, and FM25G02B already shares fm25g01b_ooblayout.
>
> Also, the commit message describes FM25S01 as a lower-density sibling of
> FM25S01A with the same memory geometry, whereas both parts have the same
> 1 Gbit (128 MiB) main array capacity and FM25S01 has a larger 128-byte OOB
> size per page in NAND_MEMORG than FM25S01A's 64 bytes.
>
Both points are valid and will be addressed in the next revision:
- FM25S01 now uses fm25g01b_ooblayout directly. The 64/64 OOB split with
2 bytes reserved for the BBM is identical, so the new
fm25s01_ooblayout_ecc(), fm25s01_ooblayout_free() and fm25s01_ooblayout
definitions are dropped.
- The commit message no longer describes FM25S01 as a "lower-density"
sibling with the "same memory geometry". It now says the array
organization (1 Gbit), cache variants and ECC requirement match
FM25S01A, that the OOB is 128 bytes per page instead of 64, and that the
ECC layout is the same as FM25G01B.
--
Florian
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-30 23:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 22:49 [PATCH] mtd: nand: spi: fmsh: add FM25S01 support Florian Fainelli
2026-11-30 22:56 ` sashiko-bot
2026-11-30 23:01 ` Florian Fainelli
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox