Linux-mtd Archive mirror
 help / color / mirror / Atom feed
From: KR Kim <kr.kim@skyhighmemory.com>
To: miquel.raynal@bootlin.com, richard@nod.at, vigneshr@ti.com,
	mmkurbanov@salutedevices.com, ddrokosov@sberdevices.ru
Cc: kr.kim@skyhighmemory.com, gch981213@gmail.com,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org,
	moh.sardi@skyhighmemory.com, changsub.shim@skyhighmemory.com
Subject: [PATCH 2/2] SPI Nand Patch code for SkyHigh Momory
Date: Wed,  6 Mar 2024 13:15:32 +0900	[thread overview]
Message-ID: <20240306041532.16985-1-kr.kim@skyhighmemory.com> (raw)

---
 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


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

             reply	other threads:[~2024-03-06  4:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-06  4:15 KR Kim [this message]
2024-03-06  8:07 ` [PATCH 2/2] SPI Nand Patch code for SkyHigh Momory Miquel Raynal
2024-03-06  8:10 ` Chuanhong Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240306041532.16985-1-kr.kim@skyhighmemory.com \
    --to=kr.kim@skyhighmemory.com \
    --cc=changsub.shim@skyhighmemory.com \
    --cc=ddrokosov@sberdevices.ru \
    --cc=gch981213@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=mmkurbanov@salutedevices.com \
    --cc=moh.sardi@skyhighmemory.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).