uboot-mediatek: add FM25G02B spi-nand flash support
Based on commit9a368bb4e4("kernel: add support for FudanMicro FM25G02B"). Signed-off-by: Tianling Shen <cnsztl@immortalwrt.org> (cherry picked from commit7851d11e3f)
This commit is contained in:
@@ -37,13 +37,12 @@ Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
|
||||
µn_spinand_manufacturer,
|
||||
--- /dev/null
|
||||
+++ b/drivers/mtd/nand/spi/fmsh.c
|
||||
@@ -0,0 +1,240 @@
|
||||
@@ -0,0 +1,277 @@
|
||||
+// SPDX-License-Identifier: GPL-2.0
|
||||
+/*
|
||||
+ * Copyright (c) 2020-2021 Rockchip Electronics Co., Ltd.
|
||||
+ *
|
||||
+ * Authors:
|
||||
+ * Dingqiang Lin <jon.lin@rock-chips.com>
|
||||
+ * Author: Dingqiang Lin <jon.lin@rock-chips.com>
|
||||
+ */
|
||||
+
|
||||
+#ifndef __UBOOT__
|
||||
@@ -202,6 +201,35 @@ Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
|
||||
+ 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,
|
||||
+ .rfree = fm25g02b_ooblayout_free,
|
||||
+};
|
||||
+
|
||||
+static const struct spinand_info fmsh_spinand_table[] = {
|
||||
+ SPINAND_INFO("FM25S01A",
|
||||
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
|
||||
@@ -257,6 +285,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),
|
||||
@@ -273,7 +310,7 @@ Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
|
||||
+
|
||||
+const struct spinand_manufacturer fmsh_spinand_manufacturer = {
|
||||
+ .id = SPINAND_MFR_FMSH,
|
||||
+ .name = "FMSH",
|
||||
+ .name = "Fudan Micro",
|
||||
+ .chips = fmsh_spinand_table,
|
||||
+ .nchips = ARRAY_SIZE(fmsh_spinand_table),
|
||||
+ .ops = &fmsh_spinand_manuf_ops,
|
||||
|
||||
Reference in New Issue
Block a user