diff mbox series

[RFCv3,3/3] mtd: Add pairing info for Hynix H27UCG8T2ETR NAND

Message ID 20210929150949.198-4-macroalpha82@gmail.com
State RFC
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series mtd: Support slc-mode for NTC CHIP | expand

Commit Message

Chris Morgan Sept. 29, 2021, 3:09 p.m. UTC
From: Chris Morgan <macromorgan@hotmail.com>

Add pairing info for the Hynix H27UCG8T2ETR NAND so that we may utilize
slc-mode emulation for enhanced reliability and compatibility with
upstream Linux.

I have checked with the team at #mtd and they can confirm based on
a cursory reading of the datasheet for this flash chip it appears to
use the same dist3 pairing scheme used by the Toshiba NAND which
already supports dist3 today in mainline Linux.

Signed-off-by: Chris Morgan <macromorgan@hotmail.com>
---
 drivers/mtd/nand/raw/nand_base.c | 8 ++++++++
 1 file changed, 8 insertions(+)
diff mbox series

Patch

diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index 70b4a76bad..fc6ee36514 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -4555,6 +4555,14 @@  ident_done:
 		mtd_set_pairing_scheme(mtd, &dist3_pairing_scheme);
 	}
 
+	/* Enable slc-mode on H27UCG8T2ETR to enable upstream Linux */
+	if (id_data[0] == NAND_MFR_HYNIX && id_data[1] == 0xde
+	    && id_data[2] == 0x14 && id_data[3] == 0xa7
+	    && id_data[4] == 0x42 && id_data[5] == 0x4a) {
+		chip->options |= NAND_NEED_SCRAMBLING;
+		mtd_set_pairing_scheme(mtd, &dist3_pairing_scheme);
+	}
+
 	if (chip->options & NAND_BUSWIDTH_AUTO) {
 		WARN_ON(chip->options & NAND_BUSWIDTH_16);
 		chip->options |= busw;