From b1fecc211e06c035e77752a05675daca0e758e54 Mon Sep 17 00:00:00 2001 From: Jon Lin Date: Fri, 7 Jul 2023 12:06:40 +0800 Subject: [PATCH] mtd: spinand: skyhigh: The vendor requires the devices to be patched 1.Double OIP=0 after page 13H 2.The nand flash does not support 84H and 34H command Change-Id: Ie805f42a36e1a864115988087bdc43592cc94ded Signed-off-by: Jon Lin --- drivers/mtd/nand/spi/core.c | 12 +++++++++++- drivers/mtd/nand/spi/skyhigh.c | 4 ++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c index ef034e53ef70..ce7e8654a3b3 100644 --- a/drivers/mtd/nand/spi/core.c +++ b/drivers/mtd/nand/spi/core.c @@ -571,7 +571,7 @@ static int spinand_read_page(struct spinand_device *spinand, const struct nand_page_io_req *req) { struct nand_device *nand = spinand_to_nand(spinand); - u8 status; + u8 status = 0; int ret; ret = nand_ecc_prepare_io_req(nand, (struct nand_page_io_req *)req); @@ -586,6 +586,16 @@ static int spinand_read_page(struct spinand_device *spinand, SPINAND_READ_INITIAL_DELAY_US, SPINAND_READ_POLL_DELAY_US, &status); + /* + * When there is data outside of OIP in the status, the status data is + * inaccurate and needs to be reconfirmed + */ + if (spinand->id.data[0] == 0x01 && status && !ret) { + ret = spinand_wait(spinand, + SPINAND_READ_INITIAL_DELAY_US, + SPINAND_READ_POLL_DELAY_US, + &status); + } if (ret < 0) return ret; diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c index cda84089a5b2..3d075f12ed82 100644 --- a/drivers/mtd/nand/spi/skyhigh.c +++ b/drivers/mtd/nand/spi/skyhigh.c @@ -26,8 +26,8 @@ static SPINAND_OP_VARIANTS(write_cache_variants, SPINAND_PROG_LOAD(true, 0, NULL, 0)); static SPINAND_OP_VARIANTS(update_cache_variants, - SPINAND_PROG_LOAD_X4(false, 0, NULL, 0), - SPINAND_PROG_LOAD(false, 0, NULL, 0)); + SPINAND_PROG_LOAD_X4(true, 0, NULL, 0), + SPINAND_PROG_LOAD(true, 0, NULL, 0)); static int s35ml04g3_ooblayout_ecc(struct mtd_info *mtd, int section, struct mtd_oob_region *region)