[PATCH 2/2] SPI Nand Patch code for SkyHigh Momory

KR Kim kr.kim at skyhighmemory.com
Tue Mar 5 20:15:32 PST 2024


---
 drivers/mtd/nand/spi/Makefile  |  2 +-
 drivers/mtd/nand/spi/skyhigh.c | 57 ++++++----------------------------
 2 files changed, 11 insertions(+), 48 deletions(-)

diff --git a/drivers/mtd/nand/spi/Makefile b/drivers/mtd/nand/spi/Makefile
index 48b429d90460..1e61ab21893a 100755
--- a/drivers/mtd/nand/spi/Makefile
+++ b/drivers/mtd/nand/spi/Makefile
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 spinand-objs := core.o alliancememory.o ato.o esmt.o foresee.o gigadevice.o macronix.o
-spinand-objs += micron.o paragon.o toshiba.o winbond.o xtx.o skyhigh.o
+spinand-objs += micron.o paragon.o skyhigh.o toshiba.o winbond.o xtx.o
 obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
diff --git a/drivers/mtd/nand/spi/skyhigh.c b/drivers/mtd/nand/spi/skyhigh.c
index 71de4fa34406..dd348849216d 100644
--- a/drivers/mtd/nand/spi/skyhigh.c
+++ b/drivers/mtd/nand/spi/skyhigh.c
@@ -12,8 +12,8 @@
 #define SPINAND_MFR_SKYHIGH		0x01
 
 #define SKYHIGH_STATUS_ECC_1TO2_BITFLIPS	(1 << 4)
-#define SKYHIGH_STATUS_ECC_3TO4_BITFLIPS	(2 << 4)
-#define SKYHIGH_STATUS_ECC_5TO6_BITFLIPS	(3 << 4)
+#define SKYHIGH_STATUS_ECC_3TO6_BITFLIPS	(2 << 4)
+#define SKYHIGH_STATUS_ECC_UNCOR_ERROR  	(3 << 4)
 
 #define SKYHIGH_CONFIG_PROTECT_EN	BIT(1)
 
@@ -62,49 +62,15 @@ static const struct mtd_ooblayout_ops skyhigh_spinand_ooblayout = {
 	.free = skyhigh_spinand_ooblayout_free,
 };
 
-#if 0
-bool skyhigh_spinand_isbad(struct spinand_device *spinand,
-			   const struct nand_pos *pos)
-{
-	u8 marker;
-	struct nand_page_io_req req = {
-		.pos = *pos,
-		.ooblen = 1,
-		.ooboffs = 0,
-		.oobbuf.in = &marker,
-		.mode = MTD_OPS_RAW,
-	};
-
-	req.pos.page = 0;
-	spinand_read_page(spinand, &req);
-	if (marker != 0xff)
-		return true;
-
-#if 0
-	req.pos.page = 1;
-	spinand_read_page(spinand, &req);
-	if (marker != 0xff)
-		return true;
-
-	req.pos.page = 63;
-	spinand_read_page(spinand, &req);
-	if (marker != 0xff)
-		return true;
-#endif
-
-	return false;
-}
-#endif
-
 static int skyhigh_spinand_ecc_get_status(struct spinand_device *spinand,
 				  u8 status)
 {
 	/* SHM
-	00 : No bit-flip
-	01 : 1-2 errors corrected
-	10 : 3-6 errors corrected         
-	11 : uncorrectable
-	*/
+	 * 00 : No bit-flip
+	 * 01 : 1-2 errors corrected
+	 * 10 : 3-6 errors corrected         
+	 * 11 : uncorrectable
+	 */
 
 	switch (status & STATUS_ECC_MASK) {
 	case STATUS_ECC_NO_BITFLIPS:
@@ -113,12 +79,10 @@ static int skyhigh_spinand_ecc_get_status(struct spinand_device *spinand,
 	case SKYHIGH_STATUS_ECC_1TO2_BITFLIPS:
 		return 2;
 
-	/* change from 4 to 6 */
-	case SKYHIGH_STATUS_ECC_3TO4_BITFLIPS:
+ 	case SKYHIGH_STATUS_ECC_3TO6_BITFLIPS:
 		return 6; 
 
-	/* uncorrectable for '11' */
-	case SKYHIGH_STATUS_ECC_5TO6_BITFLIPS:
+ 	case SKYHIGH_STATUS_ECC_UNCOR_ERROR:
 		return -EBADMSG;;
 
 	default:
@@ -179,8 +143,7 @@ static int skyhigh_spinand_init(struct spinand_device *spinand)
 
 static const struct spinand_manufacturer_ops skyhigh_spinand_manuf_ops = {
 	.init = skyhigh_spinand_init,
-/*	.isbad = skyhigh_spinand_isbad,*/
-};
+ };
 
 const struct spinand_manufacturer skyhigh_spinand_manufacturer = {
 	.id = SPINAND_MFR_SKYHIGH,
-- 
2.34.1




More information about the linux-mtd mailing list