mtd: nand: spi: winbond: Add support for W35N01JW

Add op variants, oob layout and spinand_info for W35N01JW.

Datasheet: https://www.winbond.com/export/sites/winbond/datasheet/W35N01JW_Datasheet_Brief.pdf

Signed-off-by: Apurva Nandan <a-nandan@ti.com>
This commit is contained in:
Apurva Nandan 2023-05-26 14:42:23 +05:30 committed by Praneeth Bajjuri
parent a6ac83578f
commit e89c08f19c
1 changed files with 57 additions and 9 deletions

View File

@ -19,7 +19,7 @@
#define WINBOND_CFG_BUF_READ BIT(3) #define WINBOND_CFG_BUF_READ BIT(3)
static SPINAND_OP_VARIANTS(read_cache_variants, static SPINAND_OP_VARIANTS(read_cache_variants_w25m02gv,
SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(0, 2, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_X4_OP(0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(0, 1, NULL, 0),
@ -27,14 +27,24 @@ static SPINAND_OP_VARIANTS(read_cache_variants,
SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0), SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0)); SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
static SPINAND_OP_VARIANTS(write_cache_variants, static SPINAND_OP_VARIANTS(write_cache_variants_w25m02gv,
SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), SPINAND_PROG_LOAD_X4(true, 0, NULL, 0),
SPINAND_PROG_LOAD(true, 0, NULL, 0)); SPINAND_PROG_LOAD(true, 0, NULL, 0));
static SPINAND_OP_VARIANTS(update_cache_variants, static SPINAND_OP_VARIANTS(update_cache_variants_w25m02gv,
SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
SPINAND_PROG_LOAD(false, 0, NULL, 0)); SPINAND_PROG_LOAD(false, 0, NULL, 0));
static SPINAND_OP_VARIANTS(read_cache_variants_w35n01jw,
SPINAND_PAGE_READ_FROM_CACHE_OP(true, 0, 1, NULL, 0),
SPINAND_PAGE_READ_FROM_CACHE_OP(false, 0, 1, NULL, 0));
static SPINAND_OP_VARIANTS(write_cache_variants_w35n01jw,
SPINAND_PROG_LOAD(true, 0, NULL, 0));
static SPINAND_OP_VARIANTS(update_cache_variants_w35n01jw,
SPINAND_PROG_LOAD(false, 0, NULL, 0));
static int w25m02gv_ooblayout_ecc(struct mtd_info *mtd, int section, static int w25m02gv_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region) struct mtd_oob_region *region)
{ {
@ -59,11 +69,40 @@ static int w25m02gv_ooblayout_free(struct mtd_info *mtd, int section,
return 0; return 0;
} }
static int w35n01jw_ooblayout_ecc(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
if (section > 7)
return -ERANGE;
region->offset = (16 * section) + 12;
region->length = 4;
return 0;
}
static int w35n01jw_ooblayout_free(struct mtd_info *mtd, int section,
struct mtd_oob_region *region)
{
if (section > 7)
return -ERANGE;
region->offset = (16 * section) + 2;
region->length = 10;
return 0;
}
static const struct mtd_ooblayout_ops w25m02gv_ooblayout = { static const struct mtd_ooblayout_ops w25m02gv_ooblayout = {
.ecc = w25m02gv_ooblayout_ecc, .ecc = w25m02gv_ooblayout_ecc,
.rfree = w25m02gv_ooblayout_free, .rfree = w25m02gv_ooblayout_free,
}; };
static const struct mtd_ooblayout_ops w35n01jw_ooblayout = {
.ecc = w35n01jw_ooblayout_ecc,
.rfree = w35n01jw_ooblayout_free,
};
static int w25m02gv_select_target(struct spinand_device *spinand, static int w25m02gv_select_target(struct spinand_device *spinand,
unsigned int target) unsigned int target)
{ {
@ -82,20 +121,29 @@ static const struct spinand_info winbond_spinand_table[] = {
SPINAND_INFO("W25M02GV", 0xAB, SPINAND_INFO("W25M02GV", 0xAB,
NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 2), NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 2),
NAND_ECCREQ(1, 512), NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants, SPINAND_INFO_OP_VARIANTS(&read_cache_variants_w25m02gv,
&write_cache_variants, &write_cache_variants_w25m02gv,
&update_cache_variants), &update_cache_variants_w25m02gv),
0, 0,
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL), SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
SPINAND_SELECT_TARGET(w25m02gv_select_target)), SPINAND_SELECT_TARGET(w25m02gv_select_target)),
SPINAND_INFO("W25N01GV", 0xAA, SPINAND_INFO("W25N01GV", 0xAA,
NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 1), NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 1),
NAND_ECCREQ(1, 512), NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants, SPINAND_INFO_OP_VARIANTS(&read_cache_variants_w25m02gv,
&write_cache_variants, &write_cache_variants_w25m02gv,
&update_cache_variants), &update_cache_variants_w25m02gv),
0, 0,
SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)), SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
SPINAND_INFO("W35N01JW", 0xDC,
NAND_MEMORG(1, 4096, 128, 64, 512, 1, 1, 1),
NAND_ECCREQ(1, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants_w35n01jw,
&write_cache_variants_w35n01jw,
&update_cache_variants_w35n01jw),
0,
SPINAND_ECCINFO(&w35n01jw_ooblayout, NULL)),
}; };
/** /**