mirror of
https://github.com/openwrt/openwrt.git
synced 2024-12-22 06:57:57 +00:00
13aa1fad5d
Add support for W25N01JW, W25N02JWZEIF, W25N512GW, W25N02KWZEIR and W25N01GWZEIG. Add support for W25N04KV. Signed-off-by: Mieczyslaw Nalewaj <namiltd@yahoo.com> Link: https://github.com/openwrt/openwrt/pull/16272 Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
64 lines
2.0 KiB
Diff
64 lines
2.0 KiB
Diff
From 446daf20b0a6790751459cdde0ff9fc8813e54d1 Mon Sep 17 00:00:00 2001
|
|
From: Robert Marko <robimarko@gmail.com>
|
|
Date: Mon, 29 Jul 2024 14:09:16 +0200
|
|
Subject: [PATCH] mtd: spinand: winbond: add support for W25N01KV
|
|
|
|
Add support for Winbond W25N01KV 1Gbit SPI-NAND.
|
|
|
|
It has 4-bit on-die ECC.
|
|
|
|
Signed-off-by: Robert Marko <robimarko@gmail.com>
|
|
---
|
|
drivers/mtd/nand/spi/winbond.c | 26 ++++++++++++++++++++++++++
|
|
1 file changed, 26 insertions(+)
|
|
|
|
--- a/drivers/mtd/nand/spi/winbond.c
|
|
+++ b/drivers/mtd/nand/spi/winbond.c
|
|
@@ -76,6 +76,18 @@ static int w25m02gv_select_target(struct
|
|
return spi_mem_exec_op(spinand->spimem, &op);
|
|
}
|
|
|
|
+static int w25n01kv_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
+ struct mtd_oob_region *region)
|
|
+{
|
|
+ if (section > 3)
|
|
+ return -ERANGE;
|
|
+
|
|
+ region->offset = 64 + (8 * section);
|
|
+ region->length = 7;
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
static int w25n02kv_ooblayout_ecc(struct mtd_info *mtd, int section,
|
|
struct mtd_oob_region *region)
|
|
{
|
|
@@ -100,6 +112,11 @@ static int w25n02kv_ooblayout_free(struc
|
|
return 0;
|
|
}
|
|
|
|
+static const struct mtd_ooblayout_ops w25n01kv_ooblayout = {
|
|
+ .ecc = w25n01kv_ooblayout_ecc,
|
|
+ .free = w25n02kv_ooblayout_free,
|
|
+};
|
|
+
|
|
static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
|
|
.ecc = w25n02kv_ooblayout_ecc,
|
|
.free = w25n02kv_ooblayout_free,
|
|
@@ -163,6 +180,15 @@ static const struct spinand_info winbond
|
|
&update_cache_variants),
|
|
0,
|
|
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
|
|
+ SPINAND_INFO("W25N01KV",
|
|
+ SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xae, 0x21),
|
|
+ NAND_MEMORG(1, 2048, 96, 64, 1024, 20, 1, 1, 1),
|
|
+ NAND_ECCREQ(4, 512),
|
|
+ SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
|
|
+ &write_cache_variants,
|
|
+ &update_cache_variants),
|
|
+ 0,
|
|
+ SPINAND_ECCINFO(&w25n01kv_ooblayout, w25n02kv_ecc_get_status)),
|
|
SPINAND_INFO("W25N02KV",
|
|
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x22),
|
|
NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
|