Skip to contentSkip to conversation

mtd/spinand: rework detect procedure for different READ_ID operation

PATCH Applied Frieder Schrempf 6 participants 22 messages Jan 10, 2023 – May 31, 2023

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/5 mtd/spinand: rework detect procedure for different READ_ID operation

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

---
 drivers/mtd/nand/spi/core.c       | 104 +++++++++++++++++++-----------
 drivers/mtd/nand/spi/gigadevice.c |  30 ++-------
 drivers/mtd/nand/spi/macronix.c   |  45 +++++--------
 drivers/mtd/nand/spi/micron.c     |  50 ++++++--------
 drivers/mtd/nand/spi/toshiba.c    |  66 +++++++++----------
 drivers/mtd/nand/spi/winbond.c    |  34 ++--------
 include/linux/mtd/spinand.h       |  66 ++++++++++++-------
 7 files changed, 187 insertions(+), 208 deletions(-)
drivers/mtd/nand/spi/core.c +65 -39
index 134bf22c805..d92de9c24e3 100644
@@ -17,6 +17,7 @@
 #include <linux/mtd/spinand.h>
 #include <linux/of.h>
 #include <linux/slab.h>
+#include <linux/string.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/spi-mem.h>
 #else
@@ -451,9 +452,11 @@ out:
 	return status & STATUS_BUSY ? -ETIMEDOUT : 0;
 }
 
-static int spinand_read_id_op(struct spinand_device *spinand, u8 *buf)
+static int spinand_read_id_op(struct spinand_device *spinand, u8 naddr,
+			      u8 ndummy, u8 *buf)
 {
-	struct spi_mem_op op = SPINAND_READID_OP(0, spinand->scratchbuf,
+	struct spi_mem_op op = SPINAND_READID_OP(naddr, ndummy,
+						 spinand->scratchbuf,
 						 SPINAND_MAX_ID_LEN);
 	int ret;
 
@@ -807,21 +810,6 @@ static int spinand_mtd_block_isreserved(struct mtd_info *mtd, loff_t offs)
 	return ret;
 }
 
-const struct spi_mem_op *
-spinand_find_supported_op(struct spinand_device *spinand,
-			  const struct spi_mem_op *ops,
-			  unsigned int nops)
-{
-	unsigned int i;
-
-	for (i = 0; i < nops; i++) {
-		if (spi_mem_supports_op(spinand->slave, &ops[i]))
-			return &ops[i];
-	}
-
-	return NULL;
-}
-
 static const struct nand_ops spinand_ops = {
 	.erase = spinand_erase,
 	.markbad = spinand_markbad,
@@ -836,24 +824,62 @@ static const struct spinand_manufacturer *spinand_manufacturers[] = {
 	&winbond_spinand_manufacturer,
 };
 
-static int spinand_manufacturer_detect(struct spinand_device *spinand)
+static int spinand_manufacturer_match(struct spinand_device *spinand,
+				      enum spinand_readid_method rdid_method)
 {
+	u8 *id = spinand->id.data;
 	unsigned int i;
 	int ret;
 
 	for (i = 0; i < ARRAY_SIZE(spinand_manufacturers); i++) {
-		ret = spinand_manufacturers[i]->ops->detect(spinand);
-		if (ret > 0) {
-			spinand->manufacturer = spinand_manufacturers[i];
-			return 0;
-		} else if (ret < 0) {
-			return ret;
-		}
-	}
+		const struct spinand_manufacturer *manufacturer =
+			spinand_manufacturers[i];
 
+		if (id[0] != manufacturer->id)
+			continue;
+
+		ret = spinand_match_and_init(spinand,
+					     manufacturer->chips,
+					     manufacturer->nchips,
+					     rdid_method);
+		if (ret < 0)
+			continue;
+
+		spinand->manufacturer = manufacturer;
+		return 0;
+	}
 	return -ENOTSUPP;
 }
 
+static int spinand_id_detect(struct spinand_device *spinand)
+{
+	u8 *id = spinand->id.data;
+	int ret;
+
+	ret = spinand_read_id_op(spinand, 0, 0, id);
+	if (ret)
+		return ret;
+	ret = spinand_manufacturer_match(spinand, SPINAND_READID_METHOD_OPCODE);
+	if (!ret)
+		return 0;
+
+	ret = spinand_read_id_op(spinand, 1, 0, id);
+	if (ret)
+		return ret;
+	ret = spinand_manufacturer_match(spinand,
+					 SPINAND_READID_METHOD_OPCODE_ADDR);
+	if (!ret)
+		return 0;
+
+	ret = spinand_read_id_op(spinand, 0, 1, id);
+	if (ret)
+		return ret;
+	ret = spinand_manufacturer_match(spinand,
+					 SPINAND_READID_METHOD_OPCODE_DUMMY);
+
+	return ret;
+}
+
 static int spinand_manufacturer_init(struct spinand_device *spinand)
 {
 	if (spinand->manufacturer->ops->init)
@@ -909,9 +935,9 @@ spinand_select_op_variant(struct spinand_device *spinand,
  * @spinand: SPI NAND object
  * @table: SPI NAND device description table
  * @table_size: size of the device description table
+ * @rdid_method: read id method to match
  *
- * Should be used by SPI NAND manufacturer drivers when they want to find a
- * match between a device ID retrieved through the READ_ID command and an
+ * Match between a device ID retrieved through the READ_ID command and an
  * entry in the SPI NAND description table. If a match is found, the spinand
  * object will be initialized with information provided by the matching
  * spinand_info entry.
@@ -920,8 +946,10 @@ spinand_select_op_variant(struct spinand_device *spinand,
  */
 int spinand_match_and_init(struct spinand_device *spinand,
 			   const struct spinand_info *table,
-			   unsigned int table_size, u8 devid)
+			   unsigned int table_size,
+			   enum spinand_readid_method rdid_method)
 {
+	u8 *id = spinand->id.data;
 	struct nand_device *nand = spinand_to_nand(spinand);
 	unsigned int i;
 
@@ -929,13 +957,17 @@ int spinand_match_and_init(struct spinand_device *spinand,
 		const struct spinand_info *info = &table[i];
 		const struct spi_mem_op *op;
 
-		if (devid != info->devid)
+		if (rdid_method != info->devid.method)
+			continue;
+
+		if (memcmp(id + 1, info->devid.id, info->devid.len))
 			continue;
 
 		nand->memorg = table[i].memorg;
 		nand->eccreq = table[i].eccreq;
 		spinand->eccinfo = table[i].eccinfo;
 		spinand->flags = table[i].flags;
+		spinand->id.len = 1 + table[i].devid.len;
 		spinand->select_target = table[i].select_target;
 
 		op = spinand_select_op_variant(spinand,
@@ -971,13 +1003,7 @@ static int spinand_detect(struct spinand_device *spinand)
 	if (ret)
 		return ret;
 
-	ret = spinand_read_id_op(spinand, spinand->id.data);
-	if (ret)
-		return ret;
-
-	spinand->id.len = SPINAND_MAX_ID_LEN;
-
-	ret = spinand_manufacturer_detect(spinand);
+	ret = spinand_id_detect(spinand);
 	if (ret) {
 		dev_err(spinand->slave->dev, "unknown raw ID %*phN\n",
 			SPINAND_MAX_ID_LEN, spinand->id.data);
@@ -1081,11 +1107,11 @@ static int spinand_init(struct spinand_device *spinand)
 	for (i = 0; i < nand->memorg.ntargets; i++) {
 		ret = spinand_select_target(spinand, i);
 		if (ret)
-			goto err_free_bufs;
+			goto err_manuf_cleanup;
 
 		ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED);
 		if (ret)
-			goto err_free_bufs;
+			goto err_manuf_cleanup;
 	}
 
 	ret = nanddev_init(nand, &spinand_ops, THIS_MODULE);
drivers/mtd/nand/spi/gigadevice.c +6 -24
index a2c93486f49..43b353a3e7e 100644
@@ -158,7 +158,8 @@ static const struct mtd_ooblayout_ops gd5fxgqxxexxg_ooblayout = {
 };
 
 static const struct spinand_info gigadevice_spinand_table[] = {
-	SPINAND_INFO("GD5F1GQ4UExxG", 0xd1,
+	SPINAND_INFO("GD5F1GQ4UExxG",
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_ADDR, 0xd1),
 		     NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&gd5fxgq4_read_cache_variants,
@@ -167,7 +168,8 @@ static const struct spinand_info gigadevice_spinand_table[] = {
 		     0,
 		     SPINAND_ECCINFO(&gd5fxgqxxexxg_ooblayout,
 				     gd5fxgq4xexxg_ecc_get_status)),
-	SPINAND_INFO("GD5F1GQ5UExxG", 0x51,
+	SPINAND_INFO("GD5F1GQ5UExxG",
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0x51),
 		     NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
 		     NAND_ECCREQ(4, 512),
 		     SPINAND_INFO_OP_VARIANTS(&gd5f1gq5_read_cache_variants,
@@ -178,33 +180,13 @@ static const struct spinand_info gigadevice_spinand_table[] = {
 				     gd5fxgq5xexxg_ecc_get_status)),
 };
 
-static int gigadevice_spinand_detect(struct spinand_device *spinand)
-{
-	u8 *id = spinand->id.data;
-	int ret;
-
-	/*
-	 * For GD NANDs, There is an address byte needed to shift in before IDs
-	 * are read out, so the first byte in raw_id is dummy.
-	 */
-	if (id[1] != SPINAND_MFR_GIGADEVICE)
-		return 0;
-
-	ret = spinand_match_and_init(spinand, gigadevice_spinand_table,
-				     ARRAY_SIZE(gigadevice_spinand_table),
-				     id[2]);
-	if (ret)
-		return ret;
-
-	return 1;
-}
-
 static const struct spinand_manufacturer_ops gigadevice_spinand_manuf_ops = {
-	.detect = gigadevice_spinand_detect,
 };
 
 const struct spinand_manufacturer gigadevice_spinand_manufacturer = {
 	.id = SPINAND_MFR_GIGADEVICE,
 	.name = "GigaDevice",
+	.chips = gigadevice_spinand_table,
+	.nchips = ARRAY_SIZE(gigadevice_spinand_table),
 	.ops = &gigadevice_spinand_manuf_ops,
 };
drivers/mtd/nand/spi/macronix.c +16 -29

98 lines not on this page · raw message

drivers/mtd/nand/spi/micron.c +20 -30

121 lines not on this page · raw message

drivers/mtd/nand/spi/toshiba.c +30 -36

161 lines not on this page · raw message

drivers/mtd/nand/spi/winbond.c +6 -28
index c119486efb7..66ed0a51d2f 100644
@@ -79,7 +79,8 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
 }
 
 static const struct spinand_info winbond_spinand_table[] = {
-	SPINAND_INFO("W25M02GV", 0xAB,
+	SPINAND_INFO("W25M02GV",
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab),
 		     NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 2),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -88,7 +89,8 @@ static const struct spinand_info winbond_spinand_table[] = {
 		     0,
 		     SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
 		     SPINAND_SELECT_TARGET(w25m02gv_select_target)),
-	SPINAND_INFO("W25N01GV", 0xAA,
+	SPINAND_INFO("W25N01GV",
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa),
 		     NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 1),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -98,31 +100,6 @@ static const struct spinand_info winbond_spinand_table[] = {
 		     SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
 };
 
-/**
- * winbond_spinand_detect - initialize device related part in spinand_device
- * struct if it is a Winbond device.
- * @spinand: SPI NAND device structure
- */
-static int winbond_spinand_detect(struct spinand_device *spinand)
-{
-	u8 *id = spinand->id.data;
-	int ret;
-
-	/*
-	 * Winbond SPI NAND read ID need a dummy byte,
-	 * so the first byte in raw_id is dummy.
-	 */
-	if (id[1] != SPINAND_MFR_WINBOND)
-		return 0;
-
-	ret = spinand_match_and_init(spinand, winbond_spinand_table,
-				     ARRAY_SIZE(winbond_spinand_table), id[2]);
-	if (ret)
-		return ret;
-
-	return 1;
-}
-
 static int winbond_spinand_init(struct spinand_device *spinand)
 {
 	struct nand_device *nand = spinand_to_nand(spinand);
@@ -142,12 +119,13 @@ static int winbond_spinand_init(struct spinand_device *spinand)
 }
 
 static const struct spinand_manufacturer_ops winbond_spinand_manuf_ops = {
-	.detect = winbond_spinand_detect,
 	.init = winbond_spinand_init,
 };
 
 const struct spinand_manufacturer winbond_spinand_manufacturer = {
 	.id = SPINAND_MFR_WINBOND,
 	.name = "Winbond",
+	.chips = winbond_spinand_table,
+	.nchips = ARRAY_SIZE(winbond_spinand_table),
 	.ops = &winbond_spinand_manuf_ops,
 };
include/linux/mtd/spinand.h +44 -22

123 lines not on this page · raw message

Signature · 1 line
2.39.0
#1 lore raw

PATCH 2/5 mtd/spinand: sync core spinand code with linux-5.10.118

From: Mikhail Kshevetskiy <[email protected]>

This brings us closer to the current Linux kernel implementation of the spinand core and makes backporting features and fixes easier.

This does not include the latest kernel implementation as this would require a substantial amount of extra work due to the missing ECC engine abstraction layer in U-Boot.

---
 drivers/mtd/nand/spi/core.c | 24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)
drivers/mtd/nand/spi/core.c +14 -10
index d92de9c24e3..886e66e7847 100644
@@ -326,6 +326,13 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
 	u16 column = 0;
 	int ret;
 
+	/*
+	 * Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset
+	 * the cache content to 0xFF (depends on vendor implementation), so we
+	 * must fill the page cache entirely even if we only want to program
+	 * the data portion of the page, otherwise we might corrupt the BBM or
+	 * user data previously programmed in OOB area.
+	 */
 	memset(spinand->databuf, 0xff,
 	       nanddev_page_size(nand) +
 	       nanddev_per_page_oobsize(nand));
@@ -598,12 +605,12 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
 		if (ret == -EBADMSG) {
 			ecc_failed = true;
 			mtd->ecc_stats.failed++;
-			ret = 0;
 		} else {
 			mtd->ecc_stats.corrected += ret;
 			max_bitflips = max_t(unsigned int, max_bitflips, ret);
 		}
 
+		ret = 0;
 		ops->retlen += iter.req.datalen;
 		ops->oobretlen += iter.req.ooblen;
 	}
@@ -669,16 +676,9 @@ static bool spinand_isbad(struct nand_device *nand, const struct nand_pos *pos)
 		.oobbuf.in = marker,
 		.mode = MTD_OPS_RAW,
 	};
-	int ret;
-
-	ret = spinand_select_target(spinand, pos->target);
-	if (ret)
-		return ret;
-
-	ret = spinand_read_page(spinand, &req, false);
-	if (ret)
-		return ret;
 
+	spinand_select_target(spinand, pos->target);
+	spinand_read_page(spinand, &req, false);
 	if (marker[0] != 0xff || marker[1] != 0xff)
 		return true;
 
@@ -722,6 +722,10 @@ static int spinand_markbad(struct nand_device *nand, const struct nand_pos *pos)
 	if (ret)
 		return ret;
 
+	ret = spinand_write_enable_op(spinand);
+	if (ret)
+		return ret;
+
 	return spinand_write_page(spinand, &req);
 }
 
Signature · 1 line
2.39.0
#2 lore raw

PATCH 3/5 mtd/spinand: sync supported devices with linux-5.15.43

In reply to Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

This adds more supported spinand devices from the Linux kernel implementation.

This does not include the latest kernel implementation as this would require a substantial amount of extra work due to the missing ECC engine abstraction layer in U-Boot.

---
 drivers/mtd/nand/spi/Makefile     |   2 +-
 drivers/mtd/nand/spi/core.c       |   1 +
 drivers/mtd/nand/spi/gigadevice.c | 223 ++++++++++++++++++++++++++----
 drivers/mtd/nand/spi/macronix.c   | 145 +++++++++++++++++--
 drivers/mtd/nand/spi/micron.c     | 144 +++++++++++++------
 drivers/mtd/nand/spi/paragon.c    | 133 ++++++++++++++++++
 drivers/mtd/nand/spi/toshiba.c    |  38 ++---
 drivers/mtd/nand/spi/winbond.c    |   6 +-
 include/linux/mtd/nand.h          |   5 +-
 include/linux/mtd/spinand.h       |  31 +++++
 10 files changed, 626 insertions(+), 102 deletions(-)
 create mode 100644 drivers/mtd/nand/spi/paragon.c
drivers/mtd/nand/spi/Makefile +1 -1
index 6c65b187e86..3051de4f7ef 100644
@@ -1,4 +1,4 @@
 # SPDX-License-Identifier: GPL-2.0
 
-spinand-objs := core.o gigadevice.o macronix.o micron.o toshiba.o winbond.o
+spinand-objs := core.o gigadevice.o macronix.o micron.o paragon.o toshiba.o winbond.o
 obj-$(CONFIG_MTD_SPI_NAND) += spinand.o
drivers/mtd/nand/spi/core.c +1 -0
index 886e66e7847..631ccfdab6a 100644
@@ -824,6 +824,7 @@ static const struct spinand_manufacturer *spinand_manufacturers[] = {
 	&gigadevice_spinand_manufacturer,
 	&macronix_spinand_manufacturer,
 	&micron_spinand_manufacturer,
+	&paragon_spinand_manufacturer,
 	&toshiba_spinand_manufacturer,
 	&winbond_spinand_manufacturer,
 };
drivers/mtd/nand/spi/gigadevice.c +197 -26

284 lines not on this page · raw message

drivers/mtd/nand/spi/macronix.c +135 -10

209 lines not on this page · raw message

drivers/mtd/nand/spi/micron.c +103 -41

244 lines not on this page · raw message

drivers/mtd/nand/spi/paragon.c new file +133 -0

133 lines not on this page · raw message

drivers/mtd/nand/spi/toshiba.c +19 -19
index e057b08c703..b9908e79271 100644
@@ -7,13 +7,13 @@
  */
 
 #ifndef __UBOOT__
-#include <malloc.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
 #include <linux/bug.h>
 #include <linux/mtd/spinand.h>
 
+/* Kioxia is new name of Toshiba memory. */
 #define SPINAND_MFR_TOSHIBA		0x98
 #define TOSH_STATUS_ECC_HAS_BITFLIPS_T	(3 << 4)
 
@@ -31,7 +31,7 @@ static SPINAND_OP_VARIANTS(update_cache_x4_variants,
 		SPINAND_PROG_LOAD_X4(false, 0, NULL, 0),
 		SPINAND_PROG_LOAD(false, 0, NULL, 0));
 
-/**
+/*
  * Backward compatibility for 1st generation Serial NAND devices
  * which don't support Quad Program Load operation.
  */
@@ -42,7 +42,7 @@ static SPINAND_OP_VARIANTS(update_cache_variants,
 		SPINAND_PROG_LOAD(false, 0, NULL, 0));
 
 static int tx58cxgxsxraix_ooblayout_ecc(struct mtd_info *mtd, int section,
-				     struct mtd_oob_region *region)
+					struct mtd_oob_region *region)
 {
 	if (section > 0)
 		return -ERANGE;
@@ -54,7 +54,7 @@ static int tx58cxgxsxraix_ooblayout_ecc(struct mtd_info *mtd, int section,
 }
 
 static int tx58cxgxsxraix_ooblayout_free(struct mtd_info *mtd, int section,
-				      struct mtd_oob_region *region)
+					 struct mtd_oob_region *region)
 {
 	if (section > 0)
 		return -ERANGE;
@@ -72,7 +72,7 @@ static const struct mtd_ooblayout_ops tx58cxgxsxraix_ooblayout = {
 };
 
 static int tx58cxgxsxraix_ecc_get_status(struct spinand_device *spinand,
-				      u8 status)
+					 u8 status)
 {
 	struct nand_device *nand = spinand_to_nand(spinand);
 	u8 mbf = 0;
@@ -113,7 +113,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 1Gb (1st generation) */
 	SPINAND_INFO("TC58CVG0S3HRAIG",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xC2),
-		     NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -124,7 +124,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 2Gb (1st generation) */
 	SPINAND_INFO("TC58CVG1S3HRAIG",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCB),
-		     NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -135,7 +135,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 4Gb (1st generation) */
 	SPINAND_INFO("TC58CVG2S0HRAIG",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xCD),
-		     NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -146,7 +146,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 1Gb (1st generation) */
 	SPINAND_INFO("TC58CYG0S3HRAIG",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xB2),
-		     NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -157,7 +157,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 2Gb (1st generation) */
 	SPINAND_INFO("TC58CYG1S3HRAIG",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBB),
-		     NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -168,7 +168,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 4Gb (1st generation) */
 	SPINAND_INFO("TC58CYG2S0HRAIG",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xBD),
-		     NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -184,7 +184,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 1Gb (2nd generation) */
 	SPINAND_INFO("TC58CVG0S3HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE2),
-		     NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -195,7 +195,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 2Gb (2nd generation) */
 	SPINAND_INFO("TC58CVG1S3HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xEB),
-		     NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -206,7 +206,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 4Gb (2nd generation) */
 	SPINAND_INFO("TC58CVG2S0HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xED),
-		     NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -217,7 +217,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 3.3V 8Gb (2nd generation) */
 	SPINAND_INFO("TH58CVG3S0HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xE4),
-		     NAND_MEMORG(1, 4096, 256, 64, 4096, 1, 1, 1),
+		     NAND_MEMORG(1, 4096, 256, 64, 4096, 80, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -228,7 +228,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 1Gb (2nd generation) */
 	SPINAND_INFO("TC58CYG0S3HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD2),
-		     NAND_MEMORG(1, 2048, 128, 64, 1024, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -239,7 +239,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 2Gb (2nd generation) */
 	SPINAND_INFO("TC58CYG1S3HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xDB),
-		     NAND_MEMORG(1, 2048, 128, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -250,7 +250,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 4Gb (2nd generation) */
 	SPINAND_INFO("TC58CYG2S0HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xDD),
-		     NAND_MEMORG(1, 4096, 256, 64, 2048, 1, 1, 1),
+		     NAND_MEMORG(1, 4096, 256, 64, 2048, 40, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
@@ -261,7 +261,7 @@ static const struct spinand_info toshiba_spinand_table[] = {
 	/* 1.8V 8Gb (2nd generation) */
 	SPINAND_INFO("TH58CYG3S0HRAIJ",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xD4),
-		     NAND_MEMORG(1, 4096, 256, 64, 4096, 1, 1, 1),
+		     NAND_MEMORG(1, 4096, 256, 64, 4096, 80, 1, 1, 1),
 		     NAND_ECCREQ(8, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_x4_variants,
drivers/mtd/nand/spi/winbond.c +2 -4
index 66ed0a51d2f..4e5a6eaecd7 100644
@@ -8,11 +8,9 @@
  */
 
 #ifndef __UBOOT__
-#include <malloc.h>
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
-#include <linux/bitops.h>
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_WINBOND		0xEF
@@ -81,7 +79,7 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
 static const struct spinand_info winbond_spinand_table[] = {
 	SPINAND_INFO("W25M02GV",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab),
-		     NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 2),
+		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 2),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
@@ -91,7 +89,7 @@ static const struct spinand_info winbond_spinand_table[] = {
 		     SPINAND_SELECT_TARGET(w25m02gv_select_target)),
 	SPINAND_INFO("W25N01GV",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa),
-		     NAND_MEMORG(1, 2048, 64, 64, 1024, 1, 1, 1),
+		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
 					      &write_cache_variants,
include/linux/mtd/nand.h +4 -1
index aeb38dec2e0..651f8706df5 100644
@@ -19,6 +19,7 @@
  * @oobsize: OOB area size
  * @pages_per_eraseblock: number of pages per eraseblock
  * @eraseblocks_per_lun: number of eraseblocks per LUN (Logical Unit Number)
+ * @max_bad_eraseblocks_per_lun: maximum number of eraseblocks per LUN
  * @planes_per_lun: number of planes per LUN
  * @luns_per_target: number of LUN per target (target is a synonym for die)
  * @ntargets: total number of targets exposed by the NAND device
@@ -29,18 +30,20 @@ struct nand_memory_organization {
 	unsigned int oobsize;
 	unsigned int pages_per_eraseblock;
 	unsigned int eraseblocks_per_lun;
+	unsigned int max_bad_eraseblocks_per_lun;
 	unsigned int planes_per_lun;
 	unsigned int luns_per_target;
 	unsigned int ntargets;
 };
 
-#define NAND_MEMORG(bpc, ps, os, ppe, epl, ppl, lpt, nt)	\
+#define NAND_MEMORG(bpc, ps, os, ppe, epl, mbb, ppl, lpt, nt)	\
 	{							\
 		.bits_per_cell = (bpc),				\
 		.pagesize = (ps),				\
 		.oobsize = (os),				\
 		.pages_per_eraseblock = (ppe),			\
 		.eraseblocks_per_lun = (epl),			\
+		.max_bad_eraseblocks_per_lun = (mbb),		\
 		.planes_per_lun = (ppl),			\
 		.luns_per_target = (lpt),			\
 		.ntargets = (nt),				\
include/linux/mtd/spinand.h +31 -0
index 1ae4dc6b15b..e8d6feb9705 100644
@@ -75,30 +75,60 @@
 		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 1))
 
+#define SPINAND_PAGE_READ_FROM_CACHE_OP_3A(fast, addr, ndummy, buf, len) \
+	SPI_MEM_OP(SPI_MEM_OP_CMD(fast ? 0x0b : 0x03, 1),		\
+		   SPI_MEM_OP_ADDR(3, addr, 1),				\
+		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
+		   SPI_MEM_OP_DATA_IN(len, buf, 1))
+
 #define SPINAND_PAGE_READ_FROM_CACHE_X2_OP(addr, ndummy, buf, len)	\
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1),				\
 		   SPI_MEM_OP_ADDR(2, addr, 1),				\
 		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 2))
 
+#define SPINAND_PAGE_READ_FROM_CACHE_X2_OP_3A(addr, ndummy, buf, len)	\
+	SPI_MEM_OP(SPI_MEM_OP_CMD(0x3b, 1),				\
+		   SPI_MEM_OP_ADDR(3, addr, 1),				\
+		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
+		   SPI_MEM_OP_DATA_IN(len, buf, 2))
+
 #define SPINAND_PAGE_READ_FROM_CACHE_X4_OP(addr, ndummy, buf, len)	\
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1),				\
 		   SPI_MEM_OP_ADDR(2, addr, 1),				\
 		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 4))
 
+#define SPINAND_PAGE_READ_FROM_CACHE_X4_OP_3A(addr, ndummy, buf, len)	\
+	SPI_MEM_OP(SPI_MEM_OP_CMD(0x6b, 1),				\
+		   SPI_MEM_OP_ADDR(3, addr, 1),				\
+		   SPI_MEM_OP_DUMMY(ndummy, 1),				\
+		   SPI_MEM_OP_DATA_IN(len, buf, 4))
+
 #define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP(addr, ndummy, buf, len)	\
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1),				\
 		   SPI_MEM_OP_ADDR(2, addr, 2),				\
 		   SPI_MEM_OP_DUMMY(ndummy, 2),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 2))
 
+#define SPINAND_PAGE_READ_FROM_CACHE_DUALIO_OP_3A(addr, ndummy, buf, len) \
+	SPI_MEM_OP(SPI_MEM_OP_CMD(0xbb, 1),				\
+		   SPI_MEM_OP_ADDR(3, addr, 2),				\
+		   SPI_MEM_OP_DUMMY(ndummy, 2),				\
+		   SPI_MEM_OP_DATA_IN(len, buf, 2))
+
 #define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP(addr, ndummy, buf, len)	\
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1),				\
 		   SPI_MEM_OP_ADDR(2, addr, 4),				\
 		   SPI_MEM_OP_DUMMY(ndummy, 4),				\
 		   SPI_MEM_OP_DATA_IN(len, buf, 4))
 
+#define SPINAND_PAGE_READ_FROM_CACHE_QUADIO_OP_3A(addr, ndummy, buf, len) \
+	SPI_MEM_OP(SPI_MEM_OP_CMD(0xeb, 1),				\
+		   SPI_MEM_OP_ADDR(3, addr, 4),				\
+		   SPI_MEM_OP_DUMMY(ndummy, 4),				\
+		   SPI_MEM_OP_DATA_IN(len, buf, 4))
+
 #define SPINAND_PROG_EXEC_OP(addr)					\
 	SPI_MEM_OP(SPI_MEM_OP_CMD(0x10, 1),				\
 		   SPI_MEM_OP_ADDR(3, addr, 1),				\
@@ -218,6 +248,7 @@ struct spinand_manufacturer {
 extern const struct spinand_manufacturer gigadevice_spinand_manufacturer;
 extern const struct spinand_manufacturer macronix_spinand_manufacturer;
 extern const struct spinand_manufacturer micron_spinand_manufacturer;
+extern const struct spinand_manufacturer paragon_spinand_manufacturer;
 extern const struct spinand_manufacturer toshiba_spinand_manufacturer;
 extern const struct spinand_manufacturer winbond_spinand_manufacturer;
 
Signature · 1 line
2.39.0
#3 lore raw

PATCH 4/5 mtd: spinand: winbond: fix flash identification

In reply to Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Winbond uses 3 bytes to identify flash: vendor_id, dev_id_0, dev_id_1, but current driver uses only first 2 bytes of it for devices identification. As result Winbond W25N02KV flash (id_bytes: EF, AA, 22) is identified as W25N01GV (id_bytes: EF, AA, 21).

Fix this by adding missed identification bytes.

---
 drivers/mtd/nand/spi/winbond.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/nand/spi/winbond.c +2 -2
index 4e5a6eaecd7..3c0ae545cdb 100644
@@ -78,7 +78,7 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
 
 static const struct spinand_info winbond_spinand_table[] = {
 	SPINAND_INFO("W25M02GV",
-		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab),
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab, 0x21),
 		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 2),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
@@ -88,7 +88,7 @@ static const struct spinand_info winbond_spinand_table[] = {
 		     SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL),
 		     SPINAND_SELECT_TARGET(w25m02gv_select_target)),
 	SPINAND_INFO("W25N01GV",
-		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa),
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x21),
 		     NAND_MEMORG(1, 2048, 64, 64, 1024, 20, 1, 1, 1),
 		     NAND_ECCREQ(1, 512),
 		     SPINAND_INFO_OP_VARIANTS(&read_cache_variants,
Signature · 1 line
2.39.0
#4 lore raw

PATCH 5/5 mtd: spinand: winbond: add Winbond W25N02KV flash support

In reply to Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Add support of Winbond W25N02KV flash

---
 drivers/mtd/nand/spi/winbond.c | 76 ++++++++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
drivers/mtd/nand/spi/winbond.c +76 -0
index 3c0ae545cdb..dd4ed257a83 100644
@@ -11,6 +11,7 @@
 #include <linux/device.h>
 #include <linux/kernel.h>
 #endif
+#include <linux/bug.h>
 #include <linux/mtd/spinand.h>
 
 #define SPINAND_MFR_WINBOND		0xEF
@@ -76,6 +77,72 @@ static int w25m02gv_select_target(struct spinand_device *spinand,
 	return spi_mem_exec_op(spinand->slave, &op);
 }
 
+static int w25n02kv_ooblayout_ecc(struct mtd_info *mtd, int section,
+				  struct mtd_oob_region *region)
+{
+	if (section > 3)
+		return -ERANGE;
+
+	region->offset = 64 + (16 * section);
+	region->length = 13;
+
+	return 0;
+}
+
+static int w25n02kv_ooblayout_free(struct mtd_info *mtd, int section,
+				   struct mtd_oob_region *region)
+{
+	if (section > 3)
+		return -ERANGE;
+
+	region->offset = (16 * section) + 2;
+	region->length = 14;
+
+	return 0;
+}
+
+static const struct mtd_ooblayout_ops w25n02kv_ooblayout = {
+	.ecc = w25n02kv_ooblayout_ecc,
+	.rfree = w25n02kv_ooblayout_free,
+};
+
+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:
+		return 0;
+
+	case STATUS_ECC_UNCOR_ERROR:
+		return -EBADMSG;
+
+	case STATUS_ECC_HAS_BITFLIPS:
+		/*
+		 * 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->slave, &op))
+			return nand->eccreq.strength;
+
+		mbf >>= 4;
+
+		if (WARN_ON(mbf > nand->eccreq.strength || !mbf))
+			return nand->eccreq.strength;
+
+		return mbf;
+
+	default:
+		break;
+	}
+
+	return -EINVAL;
+}
+
 static const struct spinand_info winbond_spinand_table[] = {
 	SPINAND_INFO("W25M02GV",
 		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xab, 0x21),
@@ -96,6 +163,15 @@ static const struct spinand_info winbond_spinand_table[] = {
 					      &update_cache_variants),
 		     0,
 		     SPINAND_ECCINFO(&w25m02gv_ooblayout, NULL)),
+	SPINAND_INFO("W25N02KV",
+		     SPINAND_ID(SPINAND_READID_METHOD_OPCODE_DUMMY, 0xaa, 0x22),
+		     NAND_MEMORG(1, 2048, 128, 64, 2048, 40, 1, 1, 1),
+		     NAND_ECCREQ(8, 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)
Signature · 1 line
2.39.0
#5 lore raw
In reply to Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Any ideas how to proceed?

Thanks
Frieder

#6 lore raw
Quoted 39 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

Quoted 7 lines

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

Signature · 1 line
Tom
#7 lore raw

Hi

I will review

Quoted 47 lines · Tom Rini
Quoted 45 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Quoted 6 lines
Quoted 1 line

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties weeked

Michael

Quoted 3 lines

--
Tom

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#8 lore raw
Quoted 52 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 47 lines · Tom Rini
Quoted 45 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties weeked

Thanks Tom and Michael!

I just sent out a patch for the MAINTAINERS file to add Michael and Dario as SPI NAND maintainers and myself as a reviewer. I hope that you agree to handle it like this.

#9 lore raw
In reply to Michael Nazzareno Trimarchi

Hi Michael,

Quoted 52 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 47 lines · Tom Rini
Quoted 45 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Quoted 8 lines
Quoted 6 lines
Quoted 1 line

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties weeked

Any news regarding reviewing/picking these patches?

Thanks
Frieder

#10 lore raw

Hi Michael, Dario,

Quoted 57 lines · Frieder Schrempf

Hi Michael,

Quoted 54 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 49 lines · Tom Rini
Quoted 46 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Any ideas how to proceed?

Quoted 8 lines
Quoted 6 lines
Quoted 4 lines

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties weeked

Any news regarding reviewing/picking these patches?

Ping!

Can you please apply these patches, that have been waiting for so long?

Thanks
Frieder

#11 lore raw

Hi Frieder

Quoted 68 lines · Frieder Schrempf

Hi Michael, Dario,

Quoted 64 lines · Frieder Schrempf

Hi Michael,

Quoted 60 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 47 lines · Tom Rini
Quoted 45 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Quoted 6 lines
Quoted 1 line

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties weeked

Quoted 8 lines
Quoted 1 line

Any news regarding reviewing/picking these patches?

Ping!

Can you please apply these patches, that have been waiting for so long?

Thanks
Frieder

Yes, waiting for Jagan, please way 1 day more

Michael

#12 lore raw

I can try to resend patches (flash drivers synced with linux-6.1). Unfortunately I am not sure I will be able to do it after changes in our mail system.

Mikhail Kshevetskiy

Quoted 82 lines · Michael Nazzareno Trimarchi

[External email]

Hi Frieder

Quoted 61 lines · Frieder Schrempf

Hi Michael, Dario,

Quoted 58 lines · Frieder Schrempf

Hi Michael,

Quoted 55 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 50 lines · Tom Rini
Quoted 38 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

Quoted 7 lines

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

They can come from our tree. I will try to sort out all my duties weeked

Any news regarding reviewing/picking these patches?

Ping!

Can you please apply these patches, that have been waiting for so long?

Thanks
Frieder

Yes, waiting for Jagan, please way 1 day more

Michael

#13 lore raw

Hi

Quoted 4 lines · Mikhail Kshevetskiy

I can try to resend patches (flash drivers synced with linux-6.1). Unfortunately I am not sure I will be able to do it after changes in our mail system.

I don't think that re-sync now is what we want to do. The idea here is to have easy patch that we can review.

We should go for this for now

Michael

Quoted 86 lines

Mikhail Kshevetskiy

Quoted 82 lines · Michael Nazzareno Trimarchi

[External email]

Hi Frieder

Quoted 61 lines · Frieder Schrempf

Hi Michael, Dario,

Quoted 58 lines · Frieder Schrempf

Hi Michael,

Quoted 55 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 50 lines · Tom Rini
Quoted 38 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

Quoted 7 lines

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

They can come from our tree. I will try to sort out all my duties weeked

Any news regarding reviewing/picking these patches?

Ping!

Can you please apply these patches, that have been waiting for so long?

Thanks
Frieder

Yes, waiting for Jagan, please way 1 day more

Michael

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com
#14 lore raw
Quoted 5 lines · Michael Nazzareno Trimarchi

Hi

Quoted 1 line · Mikhail Kshevetskiy
Quoted 8 lines
Quoted 3 lines

I can try to resend patches (flash drivers synced with linux-6.1). Unfortunately I am not sure I will be able to do it after changes in our mail system.

I don't think that re-sync now is what we want to do. The idea here is to have easy patch that we can review.

We should go for this for now

Yes, there is no resend or resync needed. The patchset I sent [1] still applies on current master.

Resyncing with a later version of Linux, like 6.1 won't be that easy because of the upstream ECC engine abstraction.

Mikhail, if you are willing to do this, this is fine and appreciated, but we should do that after merging this series.

[1]
https://patchwork.ozlabs.org/project/uboot/patch/[email protected]/

#15 lore raw
In reply to Frieder Schrempf

Hi Michael, hi Dario,

Quoted 65 lines · Frieder Schrempf

Hi Michael, Dario,

Quoted 62 lines · Frieder Schrempf

Hi Michael,

Quoted 59 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 53 lines · Tom Rini
Quoted 39 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

Quoted 7 lines

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

Quoted 7 lines
Quoted 3 lines
Quoted 1 line

They can come from our tree. I will try to sort out all my duties weeked

Any news regarding reviewing/picking these patches?

Ping!

Can you please apply these patches, that have been waiting for so long?

I still can't see this applied anywhere. You already told me to take care of it multiple times. Can you please get it done?

Thanks
Frieder

#16 lore raw
Quoted 70 lines · Frieder Schrempf

Hi Michael, hi Dario,

Quoted 67 lines · Frieder Schrempf

Hi Michael, Dario,

Quoted 64 lines · Frieder Schrempf

Hi Michael,

Quoted 60 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 47 lines · Tom Rini
Quoted 45 lines · Frieder Schrempf

Hi,

Quoted 25 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id implementation:
1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported chips.

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that equals to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

Quoted 5 lines

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been around for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer for drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script didn't even add him to Cc, of course.

Quoted 6 lines
Quoted 1 line

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties weeked

Quoted 8 lines
Quoted 5 lines
Quoted 1 line

Any news regarding reviewing/picking these patches?

Ping!

Can you please apply these patches, that have been waiting for so long?

I still can't see this applied anywhere. You already told me to take care of it multiple times. Can you please get it done?

Yes, I'd really like to see a PR at least vs -next at this point so things aren't lost, thanks!

Signature · 1 line
Tom
#17 lore raw

Hi

Il lun 15 mag 2023, 23:12 Tom Rini <[email protected]> ha scritto:

Quoted 83 lines · Frieder Schrempf
Quoted 22 lines

Hi Michael, hi Dario,

Quoted 19 lines · Frieder Schrempf

Hi Michael, Dario,

Quoted 16 lines · Frieder Schrempf

Hi Michael,

Quoted 13 lines · Michael Nazzareno Trimarchi

Hi

I will review

Quoted 8 lines · Tom Rini
Quoted 6 lines · Frieder Schrempf

Hi,

Quoted 3 lines · Frieder Schrempf

From: Mikhail Kshevetskiy <[email protected]>

Currently there are 3 different variants of read_id

implementation:

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

1. opcode only. Found in GD5FxGQ4xF.
2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
3. opcode + 1 dummy byte. Found in other currently supported

chips.

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

Original implementation was for variant 1 and let detect function of chips with variant 2 and 3 to ignore the first byte. This isn't robust:

1. For chips of variant 2, if SPI master doesn't keep MOSI low during read, chip will get a random id offset, and the entire id buffer will shift by that offset, causing detect failure.

2. For chips of variant 1, if it happens to get a devid that

equals

Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines
Quoted 12 lines

to manufacture id of variant 2 or 3 chips, it'll get incorrectly detected.

This patch reworks detect procedure to address problems above. New logic do detection for all variants separatedly, in 1-2-3 order. Since all current detect methods do exactly the same id matching procedure, unify them into core.c and remove detect method from manufacture_ops.

This is a rework of Chuanhong Guo <[email protected]> patch submitted to linux kernel

Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
Quoted 3 lines

+Cc: Jagan, Tom

Who is supposed to pick up these patches? Some of them have been

around

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

for some months (before I resent them).

There is no maintainer for drivers/mtd/spinand/ and no maintainer

for

Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

drivers/mtd/ in general.

In Patchwork Jagan got assigned, but the get_maintainer.pl script

didn't

Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Quoted 8 lines
Quoted 3 lines

even add him to Cc, of course.

Any ideas how to proceed?

We don't have anyone dedicated to that area, yes, sadly. I've added Michael and Dario as they've also been doing mtd-but-not-spi work of late to see if they're interested. Or since you've long been working here, would you like to more formally maintain the area? Thanks!

They can come from our tree. I will try to sort out all my duties

weeked

Quoted 5 lines
Quoted 5 lines
Quoted 2 lines

Any news regarding reviewing/picking these patches?

Ping!

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

Can you please apply these patches, that have been waiting for so long?

I still can't see this applied anywhere. You already told me to take care of it multiple times. Can you please get it done?

Yes, I'd really like to see a PR at least vs -next at this point so things aren't lost, thanks!

I think that we pick already it so it will happen.

Michael

Quoted 4 lines

--
Tom

#18 lore raw

Hi Michael, hi Dario,

Quoted 112 lines · Michael Nazzareno Trimarchi

Hi

Il lun 15 mag 2023, 23:12 Tom Rini <[email protected] <mailto:[email protected]>> ha scritto:

    On Tue, May 09, 2023 at 09:09:28AM +0200, Frieder Schrempf wrote:
    > Hi Michael, hi Dario,
    >
    > On 18.04.23 15:46, Frieder Schrempf wrote:
    > > Hi Michael, Dario,
    > >
    > > On 28.03.23 09:57, Frieder Schrempf wrote:
    > >> Hi Michael,
    > >>
    > >> On 10.02.23 12:57, Michael Nazzareno Trimarchi wrote:
    > >>> Hi
    > >>>
    > >>> I will review
    > >>>
    > >>> On Thu, Feb 9, 2023 at 5:52 PM Tom Rini <[email protected]
    <mailto:[email protected]>> wrote:
    > >>>>
    > >>>> On Thu, Feb 09, 2023 at 10:24:47AM +0100, Frieder Schrempf wrote:
    > >>>>> Hi,
    > >>>>>
    > >>>>> On 10.01.23 12:58, Frieder Schrempf wrote:
    > >>>>>> From: Mikhail Kshevetskiy <[email protected]
    <mailto:[email protected]>>
    > >>>>>>
    > >>>>>> Currently there are 3 different variants of read_id
    implementation:
    > >>>>>> 1. opcode only. Found in GD5FxGQ4xF.
    > >>>>>> 2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
    > >>>>>> 3. opcode + 1 dummy byte. Found in other currently
    supported chips.
    > >>>>>>
    > >>>>>> Original implementation was for variant 1 and let detect
    function
    > >>>>>> of chips with variant 2 and 3 to ignore the first byte.
    This isn't
    > >>>>>> robust:
    > >>>>>>
    > >>>>>> 1. For chips of variant 2, if SPI master doesn't keep MOSI low
    > >>>>>> during read, chip will get a random id offset, and the
    entire id
    > >>>>>> buffer will shift by that offset, causing detect failure.
    > >>>>>>
    > >>>>>> 2. For chips of variant 1, if it happens to get a devid
    that equals
    > >>>>>> to manufacture id of variant 2 or 3 chips, it'll get
    incorrectly
    > >>>>>> detected.
    > >>>>>>
    > >>>>>> This patch reworks detect procedure to address problems
    above. New
    > >>>>>> logic do detection for all variants separatedly, in 1-2-3
    order.
    > >>>>>> Since all current detect methods do exactly the same id
    matching
    > >>>>>> procedure, unify them into core.c and remove detect method from
    > >>>>>> manufacture_ops.
    > >>>>>>
    > >>>>>> This is a rework of Chuanhong Guo <[email protected]
    <mailto:[email protected]>> patch
    > >>>>>> submitted to linux kernel
    > >>>>>>
    > >>>>>> Signed-off-by: Mikhail Kshevetskiy
    <[email protected] <mailto:[email protected]>>
    > >>>>>> Signed-off-by: Frieder Schrempf
    <[email protected] <mailto:[email protected]>>
    > >>>>>
    > >>>>> +Cc: Jagan, Tom
    > >>>>>
    > >>>>> Who is supposed to pick up these patches? Some of them have
    been around
    > >>>>> for some months (before I resent them).
    > >>>>>
    > >>>>> There is no maintainer for drivers/mtd/spinand/ and no
    maintainer for
    > >>>>> drivers/mtd/ in general.
    > >>>>>
    > >>>>> In Patchwork Jagan got assigned, but the get_maintainer.pl
    <http://get_maintainer.pl/> script didn't
    > >>>>> even add him to Cc, of course.
    > >>>>>
    > >>>>> Any ideas how to proceed?
    > >>>>
    > >>>> We don't have anyone dedicated to that area, yes, sadly. I've
    added
    > >>>> Michael and Dario as they've also been doing mtd-but-not-spi
    work of
    > >>>> late to see if they're interested. Or since you've long been
    working
    > >>>> here, would you like to more formally maintain the area? Thanks!
    > >>>
    > >>> They can come from our tree. I will try to sort out all my
    duties weeked
    > >>
    > >> Any news regarding reviewing/picking these patches?
    > >
    > > Ping!
    > >
    > > Can you please apply these patches, that have been waiting for
    so long?
    >
    > I still can't see this applied anywhere. You already told me to take
    > care of it multiple times. Can you please get it done?

    Yes, I'd really like to see a PR at least vs -next at this point so
    things aren't lost, thanks!
Quoted 1 line

I think that we pick already it so it will happen.

I can see patch 1/5 of this series in the nand-next tree. What about the other four patches of this series? Please pick them up, too!

Thanks
Frieder

#19 lore raw
Quoted 111 lines · Frieder Schrempf

Hi Michael, hi Dario,

Quoted 108 lines · Michael Nazzareno Trimarchi

Hi

Il lun 15 mag 2023, 23:12 Tom Rini <[email protected] <mailto:[email protected]>> ha scritto:

    On Tue, May 09, 2023 at 09:09:28AM +0200, Frieder Schrempf wrote:
    > Hi Michael, hi Dario,
    >
    > On 18.04.23 15:46, Frieder Schrempf wrote:
    > > Hi Michael, Dario,
    > >
    > > On 28.03.23 09:57, Frieder Schrempf wrote:
    > >> Hi Michael,
    > >>
    > >> On 10.02.23 12:57, Michael Nazzareno Trimarchi wrote:
    > >>> Hi
    > >>>
    > >>> I will review
    > >>>
    > >>> On Thu, Feb 9, 2023 at 5:52 PM Tom Rini <[email protected]
    <mailto:[email protected]>> wrote:
    > >>>>
    > >>>> On Thu, Feb 09, 2023 at 10:24:47AM +0100, Frieder Schrempf wrote:
    > >>>>> Hi,
    > >>>>>
    > >>>>> On 10.01.23 12:58, Frieder Schrempf wrote:
    > >>>>>> From: Mikhail Kshevetskiy <[email protected]
    <mailto:[email protected]>>
    > >>>>>>
    > >>>>>> Currently there are 3 different variants of read_id
    implementation:
    > >>>>>> 1. opcode only. Found in GD5FxGQ4xF.
    > >>>>>> 2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
    > >>>>>> 3. opcode + 1 dummy byte. Found in other currently
    supported chips.
    > >>>>>>
    > >>>>>> Original implementation was for variant 1 and let detect
    function
    > >>>>>> of chips with variant 2 and 3 to ignore the first byte.
    This isn't
    > >>>>>> robust:
    > >>>>>>
    > >>>>>> 1. For chips of variant 2, if SPI master doesn't keep MOSI low
    > >>>>>> during read, chip will get a random id offset, and the
    entire id
    > >>>>>> buffer will shift by that offset, causing detect failure.
    > >>>>>>
    > >>>>>> 2. For chips of variant 1, if it happens to get a devid
    that equals
    > >>>>>> to manufacture id of variant 2 or 3 chips, it'll get
    incorrectly
    > >>>>>> detected.
    > >>>>>>
    > >>>>>> This patch reworks detect procedure to address problems
    above. New
    > >>>>>> logic do detection for all variants separatedly, in 1-2-3
    order.
    > >>>>>> Since all current detect methods do exactly the same id
    matching
    > >>>>>> procedure, unify them into core.c and remove detect method from
    > >>>>>> manufacture_ops.
    > >>>>>>
    > >>>>>> This is a rework of Chuanhong Guo <[email protected]
    <mailto:[email protected]>> patch
    > >>>>>> submitted to linux kernel
    > >>>>>>
    > >>>>>> Signed-off-by: Mikhail Kshevetskiy
    <[email protected] <mailto:[email protected]>>
    > >>>>>> Signed-off-by: Frieder Schrempf
    <[email protected] <mailto:[email protected]>>
    > >>>>>
    > >>>>> +Cc: Jagan, Tom
    > >>>>>
    > >>>>> Who is supposed to pick up these patches? Some of them have
    been around
    > >>>>> for some months (before I resent them).
    > >>>>>
    > >>>>> There is no maintainer for drivers/mtd/spinand/ and no
    maintainer for
    > >>>>> drivers/mtd/ in general.
    > >>>>>
    > >>>>> In Patchwork Jagan got assigned, but the get_maintainer.pl
    <http://get_maintainer.pl/> script didn't
    > >>>>> even add him to Cc, of course.
    > >>>>>
    > >>>>> Any ideas how to proceed?
    > >>>>
    > >>>> We don't have anyone dedicated to that area, yes, sadly. I've
    added
    > >>>> Michael and Dario as they've also been doing mtd-but-not-spi
    work of
    > >>>> late to see if they're interested. Or since you've long been
    working
    > >>>> here, would you like to more formally maintain the area? Thanks!
    > >>>
    > >>> They can come from our tree. I will try to sort out all my
    duties weeked
    > >>
    > >> Any news regarding reviewing/picking these patches?
    > >
    > > Ping!
    > >
    > > Can you please apply these patches, that have been waiting for
    so long?
    >
    > I still can't see this applied anywhere. You already told me to take
    > care of it multiple times. Can you please get it done?
Quoted 8 lines
Quoted 5 lines

Yes, I'd really like to see a PR at least vs -next at this point so things aren't lost, thanks!

I think that we pick already it so it will happen.

I can see patch 1/5 of this series in the nand-next tree. What about the other four patches of this series? Please pick them up, too!

Ping, again! I will just keep on doing this and hope at some point you will pick up the patches.

#20 lore raw

Hi Frieder, All

Quoted 117 lines · Frieder Schrempf
Quoted 115 lines · Frieder Schrempf

Hi Michael, hi Dario,

Quoted 112 lines · Michael Nazzareno Trimarchi

Hi

Il lun 15 mag 2023, 23:12 Tom Rini <[email protected] <mailto:[email protected]>> ha scritto:

    On Tue, May 09, 2023 at 09:09:28AM +0200, Frieder Schrempf wrote:
    > Hi Michael, hi Dario,
    >
    > On 18.04.23 15:46, Frieder Schrempf wrote:
    > > Hi Michael, Dario,
    > >
    > > On 28.03.23 09:57, Frieder Schrempf wrote:
    > >> Hi Michael,
    > >>
    > >> On 10.02.23 12:57, Michael Nazzareno Trimarchi wrote:
    > >>> Hi
    > >>>
    > >>> I will review
    > >>>
    > >>> On Thu, Feb 9, 2023 at 5:52 PM Tom Rini <[email protected]
    <mailto:[email protected]>> wrote:
    > >>>>
    > >>>> On Thu, Feb 09, 2023 at 10:24:47AM +0100, Frieder Schrempf wrote:
    > >>>>> Hi,
    > >>>>>
    > >>>>> On 10.01.23 12:58, Frieder Schrempf wrote:
    > >>>>>> From: Mikhail Kshevetskiy <[email protected]
    <mailto:[email protected]>>
    > >>>>>>
    > >>>>>> Currently there are 3 different variants of read_id
    implementation:
    > >>>>>> 1. opcode only. Found in GD5FxGQ4xF.
    > >>>>>> 2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
    > >>>>>> 3. opcode + 1 dummy byte. Found in other currently
    supported chips.
    > >>>>>>
    > >>>>>> Original implementation was for variant 1 and let detect
    function
    > >>>>>> of chips with variant 2 and 3 to ignore the first byte.
    This isn't
    > >>>>>> robust:
    > >>>>>>
    > >>>>>> 1. For chips of variant 2, if SPI master doesn't keep MOSI low
    > >>>>>> during read, chip will get a random id offset, and the
    entire id
    > >>>>>> buffer will shift by that offset, causing detect failure.
    > >>>>>>
    > >>>>>> 2. For chips of variant 1, if it happens to get a devid
    that equals
    > >>>>>> to manufacture id of variant 2 or 3 chips, it'll get
    incorrectly
    > >>>>>> detected.
    > >>>>>>
    > >>>>>> This patch reworks detect procedure to address problems
    above. New
    > >>>>>> logic do detection for all variants separatedly, in 1-2-3
    order.
    > >>>>>> Since all current detect methods do exactly the same id
    matching
    > >>>>>> procedure, unify them into core.c and remove detect method from
    > >>>>>> manufacture_ops.
    > >>>>>>
    > >>>>>> This is a rework of Chuanhong Guo <[email protected]
    <mailto:[email protected]>> patch
    > >>>>>> submitted to linux kernel
    > >>>>>>
    > >>>>>> Signed-off-by: Mikhail Kshevetskiy
    <[email protected] <mailto:[email protected]>>
    > >>>>>> Signed-off-by: Frieder Schrempf
    <[email protected] <mailto:[email protected]>>
    > >>>>>
    > >>>>> +Cc: Jagan, Tom
    > >>>>>
    > >>>>> Who is supposed to pick up these patches? Some of them have
    been around
    > >>>>> for some months (before I resent them).
    > >>>>>
    > >>>>> There is no maintainer for drivers/mtd/spinand/ and no
    maintainer for
    > >>>>> drivers/mtd/ in general.
    > >>>>>
    > >>>>> In Patchwork Jagan got assigned, but the get_maintainer.pl
    <http://get_maintainer.pl/> script didn't
    > >>>>> even add him to Cc, of course.
    > >>>>>
    > >>>>> Any ideas how to proceed?
    > >>>>
    > >>>> We don't have anyone dedicated to that area, yes, sadly. I've
    added
    > >>>> Michael and Dario as they've also been doing mtd-but-not-spi
    work of
    > >>>> late to see if they're interested. Or since you've long been
    working
    > >>>> here, would you like to more formally maintain the area? Thanks!
    > >>>
    > >>> They can come from our tree. I will try to sort out all my
    duties weeked
    > >>
    > >> Any news regarding reviewing/picking these patches?
    > >
    > > Ping!
    > >
    > > Can you please apply these patches, that have been waiting for
    so long?
    >
    > I still can't see this applied anywhere. You already told me to take
    > care of it multiple times. Can you please get it done?

    Yes, I'd really like to see a PR at least vs -next at this point so
    things aren't lost, thanks!
Quoted 7 lines
Quoted 4 lines
Quoted 1 line

I think that we pick already it so it will happen.

I can see patch 1/5 of this series in the nand-next tree. What about the other four patches of this series? Please pick them up, too!

Ping, again! I will just keep on doing this and hope at some point you will pick up the patches.

Applied to nand-next.
https://source.denx.de/u-boot/custodians/u-boot-nand-flash/-/pipelines/16443

Thanks and regards
Dario

Signature · 17 lines
Dario Binacchi

Senior Embedded Linux Developer

[email protected]

__________________________________


Amarula Solutions SRL

Via Le Canevare 30, 31100 Treviso, Veneto, IT

T. +39 042 243 5310
[email protected]

www.amarulasolutions.com
#21 lore raw
Quoted 123 lines · Dario Binacchi

Hi Frieder, All

Quoted 119 lines · Frieder Schrempf
Quoted 117 lines · Frieder Schrempf

Hi Michael, hi Dario,

Quoted 113 lines · Michael Nazzareno Trimarchi

Hi

Il lun 15 mag 2023, 23:12 Tom Rini <[email protected] <mailto:[email protected]>> ha scritto:

    On Tue, May 09, 2023 at 09:09:28AM +0200, Frieder Schrempf wrote:
    > Hi Michael, hi Dario,
    >
    > On 18.04.23 15:46, Frieder Schrempf wrote:
    > > Hi Michael, Dario,
    > >
    > > On 28.03.23 09:57, Frieder Schrempf wrote:
    > >> Hi Michael,
    > >>
    > >> On 10.02.23 12:57, Michael Nazzareno Trimarchi wrote:
    > >>> Hi
    > >>>
    > >>> I will review
    > >>>
    > >>> On Thu, Feb 9, 2023 at 5:52 PM Tom Rini <[email protected]
    <mailto:[email protected]>> wrote:
    > >>>>
    > >>>> On Thu, Feb 09, 2023 at 10:24:47AM +0100, Frieder Schrempf wrote:
    > >>>>> Hi,
    > >>>>>
    > >>>>> On 10.01.23 12:58, Frieder Schrempf wrote:
    > >>>>>> From: Mikhail Kshevetskiy <[email protected]
    <mailto:[email protected]>>
    > >>>>>>
    > >>>>>> Currently there are 3 different variants of read_id
    implementation:
    > >>>>>> 1. opcode only. Found in GD5FxGQ4xF.
    > >>>>>> 2. opcode + 1 addr byte. Found in GD5GxGQ4xA/E
    > >>>>>> 3. opcode + 1 dummy byte. Found in other currently
    supported chips.
    > >>>>>>
    > >>>>>> Original implementation was for variant 1 and let detect
    function
    > >>>>>> of chips with variant 2 and 3 to ignore the first byte.
    This isn't
    > >>>>>> robust:
    > >>>>>>
    > >>>>>> 1. For chips of variant 2, if SPI master doesn't keep MOSI low
    > >>>>>> during read, chip will get a random id offset, and the
    entire id
    > >>>>>> buffer will shift by that offset, causing detect failure.
    > >>>>>>
    > >>>>>> 2. For chips of variant 1, if it happens to get a devid
    that equals
    > >>>>>> to manufacture id of variant 2 or 3 chips, it'll get
    incorrectly
    > >>>>>> detected.
    > >>>>>>
    > >>>>>> This patch reworks detect procedure to address problems
    above. New
    > >>>>>> logic do detection for all variants separatedly, in 1-2-3
    order.
    > >>>>>> Since all current detect methods do exactly the same id
    matching
    > >>>>>> procedure, unify them into core.c and remove detect method from
    > >>>>>> manufacture_ops.
    > >>>>>>
    > >>>>>> This is a rework of Chuanhong Guo <[email protected]
    <mailto:[email protected]>> patch
    > >>>>>> submitted to linux kernel
    > >>>>>>
    > >>>>>> Signed-off-by: Mikhail Kshevetskiy
    <[email protected] <mailto:[email protected]>>
    > >>>>>> Signed-off-by: Frieder Schrempf
    <[email protected] <mailto:[email protected]>>
    > >>>>>
    > >>>>> +Cc: Jagan, Tom
    > >>>>>
    > >>>>> Who is supposed to pick up these patches? Some of them have
    been around
    > >>>>> for some months (before I resent them).
    > >>>>>
    > >>>>> There is no maintainer for drivers/mtd/spinand/ and no
    maintainer for
    > >>>>> drivers/mtd/ in general.
    > >>>>>
    > >>>>> In Patchwork Jagan got assigned, but the get_maintainer.pl
    <http://get_maintainer.pl/> script didn't
    > >>>>> even add him to Cc, of course.
    > >>>>>
    > >>>>> Any ideas how to proceed?
    > >>>>
    > >>>> We don't have anyone dedicated to that area, yes, sadly. I've
    added
    > >>>> Michael and Dario as they've also been doing mtd-but-not-spi
    work of
    > >>>> late to see if they're interested. Or since you've long been
    working
    > >>>> here, would you like to more formally maintain the area? Thanks!
    > >>>
    > >>> They can come from our tree. I will try to sort out all my
    duties weeked
    > >>
    > >> Any news regarding reviewing/picking these patches?
    > >
    > > Ping!
    > >
    > > Can you please apply these patches, that have been waiting for
    so long?
    >
    > I still can't see this applied anywhere. You already told me to take
    > care of it multiple times. Can you please get it done?

    Yes, I'd really like to see a PR at least vs -next at this point so
    things aren't lost, thanks!

I think that we pick already it so it will happen.

Quoted 7 lines
Quoted 5 lines
Quoted 2 lines

I can see patch 1/5 of this series in the nand-next tree. What about the other four patches of this series? Please pick them up, too!

Ping, again! I will just keep on doing this and hope at some point you will pick up the patches.

Applied to nand-next.

Thanks a lot, Dario!