|
|
@@ -0,0 +1,76 @@
|
|
|
+From c5b3dd3b860b7eb65950c077a70b2e5ad68626b0 Mon Sep 17 00:00:00 2001
|
|
|
+From: Mikhail Zhilkin <[email protected]>
|
|
|
+Date: Wed, 13 Aug 2025 21:54:49 +0300
|
|
|
+Subject: uboot-mediatek: add support for FudanMicro FM25S01A
|
|
|
+
|
|
|
+This patch adds support for FudanMicro FM25S01A SPI NAND. It's required
|
|
|
+for some CMCC RAX3000Me hardware revisions.
|
|
|
+
|
|
|
+The patch was partially taken from ImmortalWrt.
|
|
|
+Link:
|
|
|
+https://raw.githubusercontent.com/immortalwrt/immortalwrt/refs/heads/master/package/boot/uboot-mediatek/patches/342-mtd-spinand-Support-fmsh.patch
|
|
|
+
|
|
|
+Signed-off-by: Mikhail Zhilkin <[email protected]>
|
|
|
+---
|
|
|
+
|
|
|
+--- a/drivers/mtd/nand/spi/fudanmicro.c
|
|
|
++++ b/drivers/mtd/nand/spi/fudanmicro.c
|
|
|
+@@ -27,6 +27,29 @@ static SPINAND_OP_VARIANTS(update_cache_
|
|
|
+ SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
|
|
|
+ SPINAND_PROG_LOAD(false, 0, NULL, 0));
|
|
|
+
|
|
|
++static int fm25s01a_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
|
++ struct mtd_oob_region *region)
|
|
|
++{
|
|
|
++ return -ERANGE;
|
|
|
++}
|
|
|
++
|
|
|
++static int fm25s01a_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 fm25s01a_ooblayout = {
|
|
|
++ .ecc = fm25s01a_ooblayout_ecc,
|
|
|
++ .rfree = fm25s01a_ooblayout_free,
|
|
|
++};
|
|
|
++
|
|
|
+ static int fm25s01b_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
|
+ struct mtd_oob_region *region)
|
|
|
+ {
|
|
|
+@@ -83,8 +106,17 @@ static int fm25s01b_ecc_get_status(struc
|
|
|
+ }
|
|
|
+
|
|
|
+ static const struct spinand_info fudan_spinand_table[] = {
|
|
|
+- SPINAND_INFO("FM25s01B",
|
|
|
+- SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD4),
|
|
|
++ SPINAND_INFO("FM25S01A",
|
|
|
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
|
|
|
++ NAND_MEMORG(1, 2048, 64, 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(&fm25s01a_ooblayout, NULL)),
|
|
|
++ SPINAND_INFO("FM25S01B",
|
|
|
++ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD4),
|
|
|
+ NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
|
|
|
+ NAND_ECCREQ(8, 512),
|
|
|
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
|
|
+@@ -100,7 +132,7 @@ static const struct spinand_manufacturer
|
|
|
+
|
|
|
+ const struct spinand_manufacturer fudan_spinand_manufacturer = {
|
|
|
+ .id = SPINAND_MFR_FUDAN,
|
|
|
+- .name = "FUDAN Micron",
|
|
|
++ .name = "FudanMicro",
|
|
|
+ .chips = fudan_spinand_table,
|
|
|
+ .nchips = ARRAY_SIZE(fudan_spinand_table),
|
|
|
+ .ops = &fudan_spinand_manuf_ops,
|