kernel: add support for FudanMicro FM25G02B

(cherry picked from commit 3c9b601fc7)
This commit is contained in:
Abramk
2026-01-27 22:00:01 +08:00
committed by Tianling Shen
parent ab7ab3554d
commit 1cfb77854b
@@ -3,21 +3,21 @@ From: Jon Lin <jon.lin@rock-chips.com>
Date: Sun, 17 Oct 2021 09:59:10 +0800
Subject: [PATCH] mtd: spinand: Support fmsh
FM25S01A, FM25S02A, FM25S01
FM25S01A, FM25S02A, FM25S01, FM25G02B
Change-Id: I7e0ceec39c57dc591d77a4ebde599ad326cf25b7
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
---
drivers/mtd/nand/spi/Makefile | 2 +-
drivers/mtd/nand/spi/core.c | 1 +
drivers/mtd/nand/spi/fmsh.c | 122 ++++++++++++++++++++++++++++++++++
drivers/mtd/nand/spi/fmsh.c | 213 ++++++++++++++++++++++++++++++++++
include/linux/mtd/spinand.h | 1 +
4 files changed, 125 insertions(+), 1 deletion(-)
4 files changed, 216 insertions(+), 1 deletion(-)
create mode 100644 drivers/mtd/nand/spi/fmsh.c
--- a/drivers/mtd/nand/spi/fmsh.c
+++ b/drivers/mtd/nand/spi/fmsh.c
@@ -50,6 +50,115 @@ static const struct mtd_ooblayout_ops fm
@@ -50,6 +50,144 @@ static const struct mtd_ooblayout_ops fm
.free = fm25s01a_ooblayout_free,
};
@@ -129,11 +129,40 @@ Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
+ else
+ return -EBADMSG;
+}
+
+static int fm25g02b_ooblayout_ecc(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section >= 8)
+ return -ERANGE;
+
+ region->offset = 64 + section * 8;
+ region->length = 8;
+
+ return 0;
+}
+
+static int fm25g02b_ooblayout_free(struct mtd_info *mtd, int section,
+ struct mtd_oob_region *region)
+{
+ if (section)
+ return -ERANGE;
+
+ region->offset = 2;
+ region->length = 62;
+
+ return 0;
+}
+
+static const struct mtd_ooblayout_ops fm25g02b_ooblayout = {
+ .ecc = fm25g02b_ooblayout_ecc,
+ .free = fm25g02b_ooblayout_free,
+};
+
static const struct spinand_info fmsh_spinand_table[] = {
SPINAND_INFO("FM25S01A",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
@@ -60,6 +169,60 @@ static const struct spinand_info fmsh_sp
@@ -60,6 +198,69 @@ static const struct spinand_info fmsh_sp
&update_cache_variants),
0,
SPINAND_ECCINFO(&fm25s01a_ooblayout, NULL)),
@@ -182,6 +211,15 @@ Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&fm25s01_ooblayout, fm25s01bi3_ecc_ecc_get_status)),
+ SPINAND_INFO("FM25G02B",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD2),
+ NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
+ NAND_ECCREQ(8, 528),
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
+ &write_cache_variants,
+ &update_cache_variants),
+ SPINAND_HAS_QE_BIT,
+ SPINAND_ECCINFO(&fm25g02b_ooblayout, NULL)),
+ SPINAND_INFO("FM25G02D",
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xF2),
+ NAND_MEMORG(1, 2048, 64, 64, 2048, 40, 1, 1, 1),