mtd: spinand: winbond: Support new device

W25N01KV

Change-Id: Ib006080eabb431f1e0afed02a5de5001f8999fa0
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
Jon Lin
2022-07-15 18:00:11 +08:00
committed by Tao Huang
parent 59b0cb6562
commit 7113c9b0fb

View File

@@ -109,8 +109,6 @@ static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
u8 status)
{
struct nand_device *nand = spinand_to_nand(spinand);
u8 mbf = 0;
struct spi_mem_op op = SPINAND_GET_FEATURE_OP(0x30, &mbf);
switch (status & STATUS_ECC_MASK) {
case STATUS_ECC_NO_BITFLIPS:
@@ -120,24 +118,10 @@ static int w25n02kv_ecc_get_status(struct spinand_device *spinand,
return -EBADMSG;
case STATUS_ECC_HAS_BITFLIPS:
case WINBOND_STATUS_ECC_HAS_BITFLIPS_T:
/*
* Let's try to retrieve the real maximum number of bitflips
* in order to avoid forcing the wear-leveling layer to move
* data around if it's not necessary.
*/
if (spi_mem_exec_op(spinand->spimem, &op))
return nanddev_get_ecc_requirements(nand)->strength;
mbf >>= 4;
if (WARN_ON(mbf > nanddev_get_ecc_requirements(nand)->strength || !mbf))
return nanddev_get_ecc_requirements(nand)->strength;
return mbf;
return 1;
default:
break;
return nanddev_get_ecc_requirements(nand)->strength;
}
return -EINVAL;
@@ -177,7 +161,7 @@ static const struct spinand_info winbond_spinand_table[] = {
SPINAND_SELECT_TARGET(w25m02gv_select_target)),
SPINAND_INFO("W25N02KV",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xAA, 0x22),
NAND_MEMORG(1, 2048, 64, 64, 2048, 20, 1, 1, 1),
NAND_MEMORG(1, 2048, 128, 64, 2048, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
@@ -187,7 +171,7 @@ static const struct spinand_info winbond_spinand_table[] = {
w25n02kv_ecc_get_status)),
SPINAND_INFO("W25N04KV",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xAA, 0x23),
NAND_MEMORG(1, 2048, 64, 64, 4096, 40, 1, 1, 1),
NAND_MEMORG(1, 2048, 128, 64, 4096, 40, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
@@ -207,7 +191,7 @@ static const struct spinand_info winbond_spinand_table[] = {
SPINAND_SELECT_TARGET(w25m02gv_select_target)),
SPINAND_INFO("W25N02KW",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBA, 0x22),
NAND_MEMORG(1, 2048, 64, 64, 2048, 20, 1, 1, 1),
NAND_MEMORG(1, 2048, 128, 64, 2048, 20, 1, 1, 1),
NAND_ECCREQ(8, 512),
SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
&write_cache_variants,
@@ -215,6 +199,16 @@ static const struct spinand_info winbond_spinand_table[] = {
0,
SPINAND_ECCINFO(&w25n02kv_ooblayout,
w25n02kv_ecc_get_status)),
SPINAND_INFO("W25N01KV",
SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xAE, 0x21),
NAND_MEMORG(1, 2048, 128, 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(&w25n02kv_ooblayout,
w25n02kv_ecc_get_status)),
};
static int winbond_spinand_init(struct spinand_device *spinand)