Skip to contentSkip to conversation

Add octal DTR support for Macronix flash

PATCH Superseded Jaime Liao 3 participants 16 messages Jul 27, 2023 – Aug 1, 2023

Subsystems (2)

v2 of 8 Superseded Latest is v8 →

lore
Share & tools
lore

Jaime Liao

author
#0 lore raw

v2 cover Add octal DTR support for Macronix flash

From: JaimeLiao <[email protected]>

This series add method for Macronix Octal DTR Eable/Disable and add Macronix Octal flash support.

v2:
Following exsting rules to re-create Macronix specify Octal DTR method. change signature to [email protected]
Clear sector size information in flash INFO.

JaimeLiao (2):
mtd: spi-nor: add Octal DTR support for Macronix flash
mtd: spi-nor: add support for Macronix Octal flash

 drivers/mtd/spi-nor/macronix.c | 123 ++++++++++++++++++++++++++++++++-
 1 file changed, 121 insertions(+), 2 deletions(-)
Signature · 6 lines
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
author
#1 lore raw

PATCH v2 1/2 mtd: spi-nor: add Octal DTR support for Macronix flash

From: JaimeLiao <[email protected]>

Create Macronix specify method for enable Octal DTR mode and set 20 dummy cycles to allow running at the maximum supported frequency for Macronix Octal flash.

For enable Macronix flashes in Octal DTR mode, Configuration Register2 DOPI bit should be set and DC bit setting for dummy cycles.

---
 drivers/mtd/spi-nor/macronix.c | 97 ++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
drivers/mtd/spi-nor/macronix.c +97 -0
index 04888258e891..b397fd274868 100644
@@ -8,6 +8,22 @@
 
 #include "core.h"
 
+#define SPINOR_OP_MXIC_RD_ANY_REG	0x71		/* Read volatile configuration register 2 */
+#define SPINOR_OP_MXIC_WR_ANY_REG	0x72		/* Write volatile configuration register 2 */
+#define SPINOR_REG_MXIC_CR2_MODE	0x00000000	/* For setting octal DTR mode */
+#define SPINOR_REG_MXIC_CR2_DC		0x00000300	/* For setting dummy cycles */
+#define SPINOR_REG_MXIC_OPI_DTR_EN	0x2		/* Enable Octal DTR */
+#define SPINOR_REG_MXIC_SPI_EN		0x0		/* Enable SPI */
+#define SPINOR_REG_MXIC_DC_20		0x0		/* Setting dummy cycles to 20 */
+#define SPINOR_REG_MXIC_ADDR_BYTES	4		/* Fixed R/W volatile address bytes to 4 */
+
+/* Macronix SPI NOR flash operations. */
+#define MXIC_NOR_WR_ANY_REG_OP(naddr, addr, ndata, buf)		\
+	SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_MXIC_WR_ANY_REG, 0),		\
+		   SPI_MEM_OP_ADDR(naddr, addr, 0),			\
+		   SPI_MEM_OP_NO_DUMMY,					\
+		   SPI_MEM_OP_DATA_OUT(ndata, buf, 0))
+
 static int
 mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
 			    const struct sfdp_parameter_header *bfpt_header,
@@ -105,9 +121,90 @@ static const struct flash_info macronix_nor_parts[] = {
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 };
 
+static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
+{
+	struct spi_mem_op op;
+	u8 *buf = nor->bouncebuf, i;
+	int ret;
+
+	/* Use 20 dummy cycles for memory array reads. */
+	buf[0] = SPINOR_REG_MXIC_DC_20;
+	op = (struct spi_mem_op)
+		MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+				       SPINOR_REG_MXIC_CR2_DC, 1, buf);
+
+	ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+	if (ret)
+		return ret;
+
+	/* Set the octal and DTR enable bits. */
+	buf[0] = SPINOR_REG_MXIC_OPI_DTR_EN;
+	op = (struct spi_mem_op)
+		MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+				       SPINOR_REG_MXIC_CR2_MODE, 1, buf);
+	ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+	if (ret)
+		return ret;
+
+	/* Read flash ID to make sure the switch was successful. */
+	ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
+	if (ret) {
+		dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
+		return ret;
+	}
+
+	/* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */
+	for (i = 0; i < nor->info->id_len; i++)
+		if (buf[i * 2] != nor->info->id[i])
+			return -EINVAL;
+
+	return 0;
+}
+
+static int macronix_nor_octal_dtr_dis(struct spi_nor *nor)
+{
+	struct spi_mem_op op;
+	u8 *buf = nor->bouncebuf;
+	int ret;
+
+	/*
+	 * The register is 1-byte wide, but 1-byte transactions are not
+	 * allowed in 8D-8D-8D mode. Since there is no register at the
+	 * next location, just initialize the value to 0 and let the
+	 * transaction go on.
+	 */
+	buf[0] = SPINOR_REG_MXIC_SPI_EN;
+	buf[1] = 0x0;
+	op = (struct spi_mem_op)
+		MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+				       SPINOR_REG_MXIC_CR2_MODE, 2, buf);
+	ret = spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR);
+	if (ret)
+		return ret;
+
+	/* Read flash ID to make sure the switch was successful. */
+	ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1);
+	if (ret) {
+		dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret);
+		return ret;
+	}
+
+	if (memcmp(buf, nor->info->id, nor->info->id_len))
+		return -EINVAL;
+
+	return 0;
+}
+
+static int macronix_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)
+{
+	return enable ? macronix_nor_octal_dtr_en(nor) :
+			macronix_nor_octal_dtr_dis(nor);
+}
+
 static void macronix_nor_default_init(struct spi_nor *nor)
 {
 	nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
+	nor->params->octal_dtr_enable = macronix_nor_octal_dtr_enable;
 }
 
 static void macronix_nor_late_init(struct spi_nor *nor)
Signature · 6 lines
2.25.1


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

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

Quoted 5 lines · Jaime Liao

From: JaimeLiao <[email protected]>

Create Macronix specify method for enable Octal DTR mode and set 20 dummy cycles to allow running at the maximum supported frequency for Macronix Octal flash.

20 dummy cycles is particular for a specific operating frequency.

If you test the flash at different speeds, let's say at 30 MHz, and at their highest frequency (133, 200 MHZ?) does the flash work with current settings?

Quoted 4 lines

For enable Macronix flashes in Octal DTR mode, Configuration Register2 DOPI bit should be set and DC bit setting for dummy cycles.

Use imperative.

Quoted 112 lines
---
 drivers/mtd/spi-nor/macronix.c | 97 ++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
drivers/mtd/spi-nor/macronix.c +90 -0
index 04888258e891..b397fd274868 100644
@@ -8,6 +8,22 @@
 
 #include "core.h"
 
+#define SPINOR_OP_MXIC_RD_ANY_REG	0x71		/* Read volatile configuration register 2 */
+#define SPINOR_OP_MXIC_WR_ANY_REG	0x72		/* Write volatile configuration register 2 */
+#define SPINOR_REG_MXIC_CR2_MODE	0x00000000	/* For setting octal DTR mode */
+#define SPINOR_REG_MXIC_CR2_DC		0x00000300	/* For setting dummy cycles */
+#define SPINOR_REG_MXIC_OPI_DTR_EN	0x2		/* Enable Octal DTR */
+#define SPINOR_REG_MXIC_SPI_EN		0x0		/* Enable SPI */
+#define SPINOR_REG_MXIC_DC_20		0x0		/* Setting dummy cycles to 20 */
+#define SPINOR_REG_MXIC_ADDR_BYTES	4		/* Fixed R/W volatile address bytes to 4 */
+
+/* Macronix SPI NOR flash operations. */
+#define MXIC_NOR_WR_ANY_REG_OP(naddr, addr, ndata, buf)		\
+	SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_MXIC_WR_ANY_REG, 0),		\
+		   SPI_MEM_OP_ADDR(naddr, addr, 0),			\
+		   SPI_MEM_OP_NO_DUMMY,					\
+		   SPI_MEM_OP_DATA_OUT(ndata, buf, 0))
+
 static int
 mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
 			    const struct sfdp_parameter_header *bfpt_header,
@@ -105,9 +121,90 @@ static const struct flash_info macronix_nor_parts[] = {
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 };
 
+static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
+{
+	struct spi_mem_op op;
+	u8 *buf = nor->bouncebuf, i;
+	int ret;
+
+	/* Use 20 dummy cycles for memory array reads. */
+	buf[0] = SPINOR_REG_MXIC_DC_20;
+	op = (struct spi_mem_op)
+		MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+				       SPINOR_REG_MXIC_CR2_DC, 1, buf);
+
+	ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+	if (ret)
+		return ret;
+
+	/* Set the octal and DTR enable bits. */
+	buf[0] = SPINOR_REG_MXIC_OPI_DTR_EN;
+	op = (struct spi_mem_op)
+		MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+				       SPINOR_REG_MXIC_CR2_MODE, 1, buf);
+	ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+	if (ret)
+		return ret;
+
+	/* Read flash ID to make sure the switch was successful. */
+	ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
+	if (ret) {
+		dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
+		return ret;
+	}
+
+	/* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */
+	for (i = 0; i < nor->info->id_len; i++)
+		if (buf[i * 2] != nor->info->id[i])
+			return -EINVAL;
+
+	return 0;
+}
+
+static int macronix_nor_octal_dtr_dis(struct spi_nor *nor)
+{
+	struct spi_mem_op op;
+	u8 *buf = nor->bouncebuf;
+	int ret;
+
+	/*
+	 * The register is 1-byte wide, but 1-byte transactions are not
+	 * allowed in 8D-8D-8D mode. Since there is no register at the
+	 * next location, just initialize the value to 0 and let the
+	 * transaction go on.
+	 */
+	buf[0] = SPINOR_REG_MXIC_SPI_EN;
+	buf[1] = 0x0;
+	op = (struct spi_mem_op)
+		MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+				       SPINOR_REG_MXIC_CR2_MODE, 2, buf);
+	ret = spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR);
+	if (ret)
+		return ret;
+
+	/* Read flash ID to make sure the switch was successful. */
+	ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1);
+	if (ret) {
+		dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret);
+		return ret;
+	}
+
+	if (memcmp(buf, nor->info->id, nor->info->id_len))
+		return -EINVAL;
+
+	return 0;
+}
+

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 207

Quoted 10 lines
drivers/mtd/spi-nor/macronix.c +7 -0
+static int macronix_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)
+{
+	return enable ? macronix_nor_octal_dtr_en(nor) :
+			macronix_nor_octal_dtr_dis(nor);
+}
+
 static void macronix_nor_default_init(struct spi_nor *nor)
 {
 	nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
+	nor->params->octal_dtr_enable = macronix_nor_octal_dtr_enable;

this must be done in the late_init hook, I'd like to get rid of the default_init hook.

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 210

Quoted 3 lines
drivers/mtd/spi-nor/macronix.c +0 -0
 }
 
 static void macronix_nor_late_init(struct spi_nor *nor)

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

#3 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 159

Quoted 4 lines · Tudor Ambarus
drivers/mtd/spi-nor/macronix.c +4 -0
+	/* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */
+	for (i = 0; i < nor->info->id_len; i++)
+		if (buf[i * 2] != nor->info->id[i])
+			return -EINVAL;

check all the bytes, not just some

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

#4 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

In reply to Tudor Ambarus

Hi,

Quoted 5 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 159

Quoted 5 lines
(quoted diff) +1 -0
+	/* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data 

A-A-B-B-C-C */

drivers/mtd/spi-nor/macronix.c +3 -0
+	for (i = 0; i < nor->info->id_len; i++)
+		if (buf[i * 2] != nor->info->id[i])
+			return -EINVAL;

We need some kind of per flash rdid override. I guess rdid won't work in octal mode then. Are any other commands also affected?

I had something like a per flash .rdid op in mind where for this flash you do like

rdid() {

   if (octal mode) {
       buf = spi_xfer(2 * SPI_NOR_MAX_ID_LEN);
       strip_every_other_byte(buf);
       return buf;
   } else {
      spi_nor_default_read_id();

}
}

rename spi_nor_read_id() to spi_nor_default_read_id()

spi_nor_read_id() {
if (nor->info->rdid)

      return nor->info->rdid();

return spi_nor_default_read_id();
}

And also move the readid and compare code to a common helper, as discussed.

-michael

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

#5 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

Hi,

Quoted 8 lines
Quoted 5 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 159

Quoted 5 lines
(quoted diff) +1 -0
+	/* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data 

A-A-B-B-C-C */

drivers/mtd/spi-nor/macronix.c +3 -0
+	for (i = 0; i < nor->info->id_len; i++)
+		if (buf[i * 2] != nor->info->id[i])
+			return -EINVAL;

We need some kind of per flash rdid override. I guess rdid won't work in octal mode then. Are any other commands also affected?

Jaime was kind enough to send me some datasheets and it looks like some commands will return the response bytes in STR mode. So, technically, the correct thing to do here would be to use 8D-8D-8S mode. Other commands will also respond in STR mode, but I guess we don't notice because most of them are just one byte. But I think we should get this correct in the core.

-michael

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

#6 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

Quoted 10 lines · Michael Walle

Hi,

Quoted 7 lines
Quoted 4 lines
Quoted 4 lines

+    /* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */ +    for (i = 0; i < nor->info->id_len; i++)
+        if (buf[i * 2] != nor->info->id[i])
+            return -EINVAL;

We need some kind of per flash rdid override. I guess rdid won't work in octal mode then. Are any other commands also affected?

Quoted 7 lines

Jaime was kind enough to send me some datasheets and it looks like some commands will return the response bytes in STR mode. So, technically, the correct thing to do here would be to use 8D-8D-8S mode. Other commands will also respond in STR mode, but I guess we don't notice because most of them are just one byte. But I think we should get this correct in the core.

happy to get patches for review!

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

author
#7 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

In reply to Tudor Ambarus

Hi Tudor

Quoted 10 lines · Jaime Liao
Quoted 5 lines

From: JaimeLiao <[email protected]>

Create Macronix specify method for enable Octal DTR mode and set 20 dummy cycles to allow running at the maximum supported frequency for Macronix Octal flash.

Quoted 5 lines

20 dummy cycles is particular for a specific operating frequency.

If you test the flash at different speeds, let's say at 30 MHz, and at their highest frequency (133, 200 MHZ?) does the flash work with current settings?

Yes, datasheet include "Dummy Cycle and Frequency Table" for checking. For Macronix spi-nor flash, 20 or 18 dummy cycles should be use at 200MHz. It alse means that DC 20 is suit for other frequency(<=200MHz).

Quoted 6 lines
Quoted 4 lines

For enable Macronix flashes in Octal DTR mode, Configuration Register2 DOPI bit should be set and DC bit setting for dummy cycles.

Use imperative.

I didn't get it.

Quoted 117 lines
Quoted 117 lines
---
 drivers/mtd/spi-nor/macronix.c | 97 ++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
drivers/mtd/spi-nor/macronix.c +95 -0
index 04888258e891..b397fd274868 100644
@@ -8,6 +8,22 @@
 
 #include "core.h"
 
+#define SPINOR_OP_MXIC_RD_ANY_REG    0x71            /* Read volatile configuration register 2 */
+#define SPINOR_OP_MXIC_WR_ANY_REG    0x72            /* Write volatile configuration register 2 */
+#define SPINOR_REG_MXIC_CR2_MODE     0x00000000      /* For setting octal DTR mode */
+#define SPINOR_REG_MXIC_CR2_DC               0x00000300      /* For setting dummy cycles */
+#define SPINOR_REG_MXIC_OPI_DTR_EN   0x2             /* Enable Octal DTR */
+#define SPINOR_REG_MXIC_SPI_EN               0x0             /* Enable SPI */
+#define SPINOR_REG_MXIC_DC_20                0x0             /* Setting dummy cycles to 20 */
+#define SPINOR_REG_MXIC_ADDR_BYTES   4               /* Fixed R/W volatile address bytes to 4 */
+
+/* Macronix SPI NOR flash operations. */
+#define MXIC_NOR_WR_ANY_REG_OP(naddr, addr, ndata, buf)              \
+     SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_MXIC_WR_ANY_REG, 0),                \
+                SPI_MEM_OP_ADDR(naddr, addr, 0),                     \
+                SPI_MEM_OP_NO_DUMMY,                                 \
+                SPI_MEM_OP_DATA_OUT(ndata, buf, 0))
+
 static int
 mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
                          const struct sfdp_parameter_header *bfpt_header,
@@ -105,9 +121,90 @@ static const struct flash_info macronix_nor_parts[] = {
              FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 };
 
+static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
+{
+     struct spi_mem_op op;
+     u8 *buf = nor->bouncebuf, i;
+     int ret;
+
+     /* Use 20 dummy cycles for memory array reads. */
+     buf[0] = SPINOR_REG_MXIC_DC_20;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_DC, 1, buf);
+
+     ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+     if (ret)
+             return ret;
+
+     /* Set the octal and DTR enable bits. */
+     buf[0] = SPINOR_REG_MXIC_OPI_DTR_EN;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_MODE, 1, buf);
+     ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+     if (ret)
+             return ret;
+
+     /* Read flash ID to make sure the switch was successful. */
+     ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
+     if (ret) {
+             dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
+             return ret;
+     }
+
+     /* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */
+     for (i = 0; i < nor->info->id_len; i++)
+             if (buf[i * 2] != nor->info->id[i])
+                     return -EINVAL;
+
+     return 0;
+}
+
+static int macronix_nor_octal_dtr_dis(struct spi_nor *nor)
+{
+     struct spi_mem_op op;
+     u8 *buf = nor->bouncebuf;
+     int ret;
+
+     /*
+      * The register is 1-byte wide, but 1-byte transactions are not
+      * allowed in 8D-8D-8D mode. Since there is no register at the
+      * next location, just initialize the value to 0 and let the
+      * transaction go on.
+      */
+     buf[0] = SPINOR_REG_MXIC_SPI_EN;
+     buf[1] = 0x0;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_MODE, 2, buf);
+     ret = spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR);
+     if (ret)
+             return ret;
+
+     /* Read flash ID to make sure the switch was successful. */
+     ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1);
+     if (ret) {
+             dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret);
+             return ret;
+     }
+
+     if (memcmp(buf, nor->info->id, nor->info->id_len))
+             return -EINVAL;
+
+     return 0;
+}
+
+static int macronix_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)
+{
+     return enable ? macronix_nor_octal_dtr_en(nor) :
+                     macronix_nor_octal_dtr_dis(nor);
+}
Quoted 8 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 207

Quoted 5 lines
drivers/mtd/spi-nor/macronix.c +2 -0
+
 static void macronix_nor_default_init(struct spi_nor *nor)
 {
      nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
+     nor->params->octal_dtr_enable = macronix_nor_octal_dtr_enable;

this must be done in the late_init hook, I'd like to get rid of the default_init hook.

nor->params->quad_enable should be move in late_init or nor->params->octal_dtr_enable only?

Quoted 3 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 210

Quoted 3 lines
drivers/mtd/spi-nor/macronix.c +0 -0
 }
 
 static void macronix_nor_late_init(struct spi_nor *nor)

Thanks
Jaime

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

#8 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

Quoted 12 lines · liao jaime

Hi Tudor

Quoted 10 lines · Jaime Liao
Quoted 5 lines

From: JaimeLiao <[email protected]>

Create Macronix specify method for enable Octal DTR mode and set 20 dummy cycles to allow running at the maximum supported frequency for Macronix Octal flash.

Quoted 9 lines
Quoted 5 lines

20 dummy cycles is particular for a specific operating frequency.

If you test the flash at different speeds, let's say at 30 MHz, and at their highest frequency (133, 200 MHZ?) does the flash work with current settings?

Yes, datasheet include "Dummy Cycle and Frequency Table" for checking. For Macronix spi-nor flash, 20 or 18 dummy cycles should be use at 200MHz. It alse means that DC 20 is suit for other frequency(<=200MHz).

You didn't answer my question. Does the flash work at 30 MHz by using 20 dummy cycles?

Quoted 7 lines
Quoted 6 lines
Quoted 4 lines

For enable Macronix flashes in Octal DTR mode, Configuration Register2 DOPI bit should be set and DC bit setting for dummy cycles.

Use imperative.

I didn't get it.

Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour. Please read:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Quoted 126 lines
Quoted 118 lines
Quoted 118 lines
---
 drivers/mtd/spi-nor/macronix.c | 97 ++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
drivers/mtd/spi-nor/macronix.c +95 -0
index 04888258e891..b397fd274868 100644
@@ -8,6 +8,22 @@
 
 #include "core.h"
 
+#define SPINOR_OP_MXIC_RD_ANY_REG    0x71            /* Read volatile configuration register 2 */
+#define SPINOR_OP_MXIC_WR_ANY_REG    0x72            /* Write volatile configuration register 2 */
+#define SPINOR_REG_MXIC_CR2_MODE     0x00000000      /* For setting octal DTR mode */
+#define SPINOR_REG_MXIC_CR2_DC               0x00000300      /* For setting dummy cycles */
+#define SPINOR_REG_MXIC_OPI_DTR_EN   0x2             /* Enable Octal DTR */
+#define SPINOR_REG_MXIC_SPI_EN               0x0             /* Enable SPI */
+#define SPINOR_REG_MXIC_DC_20                0x0             /* Setting dummy cycles to 20 */
+#define SPINOR_REG_MXIC_ADDR_BYTES   4               /* Fixed R/W volatile address bytes to 4 */
+
+/* Macronix SPI NOR flash operations. */
+#define MXIC_NOR_WR_ANY_REG_OP(naddr, addr, ndata, buf)              \
+     SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_MXIC_WR_ANY_REG, 0),                \
+                SPI_MEM_OP_ADDR(naddr, addr, 0),                     \
+                SPI_MEM_OP_NO_DUMMY,                                 \
+                SPI_MEM_OP_DATA_OUT(ndata, buf, 0))
+
 static int
 mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
                          const struct sfdp_parameter_header *bfpt_header,
@@ -105,9 +121,90 @@ static const struct flash_info macronix_nor_parts[] = {
              FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 };
 
+static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
+{
+     struct spi_mem_op op;
+     u8 *buf = nor->bouncebuf, i;
+     int ret;
+
+     /* Use 20 dummy cycles for memory array reads. */
+     buf[0] = SPINOR_REG_MXIC_DC_20;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_DC, 1, buf);
+
+     ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+     if (ret)
+             return ret;
+
+     /* Set the octal and DTR enable bits. */
+     buf[0] = SPINOR_REG_MXIC_OPI_DTR_EN;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_MODE, 1, buf);
+     ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+     if (ret)
+             return ret;
+
+     /* Read flash ID to make sure the switch was successful. */
+     ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
+     if (ret) {
+             dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
+             return ret;
+     }
+
+     /* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */
+     for (i = 0; i < nor->info->id_len; i++)
+             if (buf[i * 2] != nor->info->id[i])
+                     return -EINVAL;
+
+     return 0;
+}
+
+static int macronix_nor_octal_dtr_dis(struct spi_nor *nor)
+{
+     struct spi_mem_op op;
+     u8 *buf = nor->bouncebuf;
+     int ret;
+
+     /*
+      * The register is 1-byte wide, but 1-byte transactions are not
+      * allowed in 8D-8D-8D mode. Since there is no register at the
+      * next location, just initialize the value to 0 and let the
+      * transaction go on.
+      */
+     buf[0] = SPINOR_REG_MXIC_SPI_EN;
+     buf[1] = 0x0;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_MODE, 2, buf);
+     ret = spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR);
+     if (ret)
+             return ret;
+
+     /* Read flash ID to make sure the switch was successful. */
+     ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1);
+     if (ret) {
+             dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret);
+             return ret;
+     }
+
+     if (memcmp(buf, nor->info->id, nor->info->id_len))
+             return -EINVAL;
+
+     return 0;
+}
+
+static int macronix_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)
+{
+     return enable ? macronix_nor_octal_dtr_en(nor) :
+                     macronix_nor_octal_dtr_dis(nor);
+}
Quoted 8 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 207

Quoted 5 lines
drivers/mtd/spi-nor/macronix.c +2 -0
+
 static void macronix_nor_default_init(struct spi_nor *nor)
 {
      nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
+     nor->params->octal_dtr_enable = macronix_nor_octal_dtr_enable;

this must be done in the late_init hook, I'd like to get rid of the default_init hook.

Quoted 2 lines

nor->params->quad_enable should be move in late_init or nor->params->octal_dtr_enable only?

quad_enable should be parsed from sfdp, thus we have to get rid of setting quad_enable in a dedicated hook. Remove it entirely, but in a dedicated patch. Of course, I expect you test the change and verify that quad still works on all the affected flashes.

octal_dtr_enable should be set in late_init as we don't retrieve the octal dtr enable from SFDP yet.

Quoted 7 lines
Quoted 4 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 210

Quoted 4 lines
drivers/mtd/spi-nor/macronix.c +0 -0
 }
 
 static void macronix_nor_late_init(struct spi_nor *nor)

Thanks
Jaime

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

author
#9 lore raw

Re: [PATCH v2 1/2] mtd: spi-nor: add Octal DTR support for Macronix flash

Hi Tudor

Quoted 21 lines · liao jaime
Quoted 17 lines

Hi Tudor

Quoted 15 lines · Jaime Liao
Quoted 5 lines

From: JaimeLiao <[email protected]>

Create Macronix specify method for enable Octal DTR mode and set 20 dummy cycles to allow running at the maximum supported frequency for Macronix Octal flash.

20 dummy cycles is particular for a specific operating frequency.

If you test the flash at different speeds, let's say at 30 MHz, and at their highest frequency (133, 200 MHZ?) does the flash work with current settings?

Quoted 7 lines
Quoted 4 lines

Yes, datasheet include "Dummy Cycle and Frequency Table" for checking. For Macronix spi-nor flash, 20 or 18 dummy cycles should be use at 200MHz. It alse means that DC 20 is suit for other frequency(<=200MHz).

You didn't answer my question. Does the flash work at 30 MHz by using 20 dummy cycles?

Yes.

Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

For enable Macronix flashes in Octal DTR mode, Configuration Register2 DOPI bit should be set and DC bit setting for dummy cycles.

Quoted 8 lines
Quoted 2 lines
Quoted 1 line

Use imperative.

I didn't get it.

Describe your changes in imperative mood, e.g. "make xyzzy do frotz" instead of "[This patch] makes xyzzy do frotz" or "[I] changed xyzzy to do frotz", as if you are giving orders to the codebase to change its behaviour. Please read:
https://www.kernel.org/doc/html/latest/process/submitting-patches.html

Got it, thanks.

Quoted 130 lines
Quoted 127 lines
Quoted 119 lines
Quoted 119 lines
---
 drivers/mtd/spi-nor/macronix.c | 97 ++++++++++++++++++++++++++++++++++
 1 file changed, 97 insertions(+)
drivers/mtd/spi-nor/macronix.c +95 -0
index 04888258e891..b397fd274868 100644
@@ -8,6 +8,22 @@
 
 #include "core.h"
 
+#define SPINOR_OP_MXIC_RD_ANY_REG    0x71            /* Read volatile configuration register 2 */
+#define SPINOR_OP_MXIC_WR_ANY_REG    0x72            /* Write volatile configuration register 2 */
+#define SPINOR_REG_MXIC_CR2_MODE     0x00000000      /* For setting octal DTR mode */
+#define SPINOR_REG_MXIC_CR2_DC               0x00000300      /* For setting dummy cycles */
+#define SPINOR_REG_MXIC_OPI_DTR_EN   0x2             /* Enable Octal DTR */
+#define SPINOR_REG_MXIC_SPI_EN               0x0             /* Enable SPI */
+#define SPINOR_REG_MXIC_DC_20                0x0             /* Setting dummy cycles to 20 */
+#define SPINOR_REG_MXIC_ADDR_BYTES   4               /* Fixed R/W volatile address bytes to 4 */
+
+/* Macronix SPI NOR flash operations. */
+#define MXIC_NOR_WR_ANY_REG_OP(naddr, addr, ndata, buf)              \
+     SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_MXIC_WR_ANY_REG, 0),                \
+                SPI_MEM_OP_ADDR(naddr, addr, 0),                     \
+                SPI_MEM_OP_NO_DUMMY,                                 \
+                SPI_MEM_OP_DATA_OUT(ndata, buf, 0))
+
 static int
 mx25l25635_post_bfpt_fixups(struct spi_nor *nor,
                          const struct sfdp_parameter_header *bfpt_header,
@@ -105,9 +121,90 @@ static const struct flash_info macronix_nor_parts[] = {
              FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 };
 
+static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
+{
+     struct spi_mem_op op;
+     u8 *buf = nor->bouncebuf, i;
+     int ret;
+
+     /* Use 20 dummy cycles for memory array reads. */
+     buf[0] = SPINOR_REG_MXIC_DC_20;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_DC, 1, buf);
+
+     ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+     if (ret)
+             return ret;
+
+     /* Set the octal and DTR enable bits. */
+     buf[0] = SPINOR_REG_MXIC_OPI_DTR_EN;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_MODE, 1, buf);
+     ret = spi_nor_write_any_volatile_reg(nor, &op, nor->reg_proto);
+     if (ret)
+             return ret;
+
+     /* Read flash ID to make sure the switch was successful. */
+     ret = spi_nor_read_id(nor, 4, 4, buf, SNOR_PROTO_8_8_8_DTR);
+     if (ret) {
+             dev_dbg(nor->dev, "error %d reading JEDEC ID after enabling 8D-8D-8D mode\n", ret);
+             return ret;
+     }
+
+     /* Macronix SPI-NOR flash 8D-8D-8D read ID would get 6 bytes data A-A-B-B-C-C */
+     for (i = 0; i < nor->info->id_len; i++)
+             if (buf[i * 2] != nor->info->id[i])
+                     return -EINVAL;
+
+     return 0;
+}
+
+static int macronix_nor_octal_dtr_dis(struct spi_nor *nor)
+{
+     struct spi_mem_op op;
+     u8 *buf = nor->bouncebuf;
+     int ret;
+
+     /*
+      * The register is 1-byte wide, but 1-byte transactions are not
+      * allowed in 8D-8D-8D mode. Since there is no register at the
+      * next location, just initialize the value to 0 and let the
+      * transaction go on.
+      */
+     buf[0] = SPINOR_REG_MXIC_SPI_EN;
+     buf[1] = 0x0;
+     op = (struct spi_mem_op)
+             MXIC_NOR_WR_ANY_REG_OP(SPINOR_REG_MXIC_ADDR_BYTES,
+                                    SPINOR_REG_MXIC_CR2_MODE, 2, buf);
+     ret = spi_nor_write_any_volatile_reg(nor, &op, SNOR_PROTO_8_8_8_DTR);
+     if (ret)
+             return ret;
+
+     /* Read flash ID to make sure the switch was successful. */
+     ret = spi_nor_read_id(nor, 0, 0, buf, SNOR_PROTO_1_1_1);
+     if (ret) {
+             dev_dbg(nor->dev, "error %d reading JEDEC ID after disabling 8D-8D-8D mode\n", ret);
+             return ret;
+     }
+
+     if (memcmp(buf, nor->info->id, nor->info->id_len))
+             return -EINVAL;
+
+     return 0;
+}
+
+static int macronix_nor_octal_dtr_enable(struct spi_nor *nor, bool enable)
+{
+     return enable ? macronix_nor_octal_dtr_en(nor) :
+                     macronix_nor_octal_dtr_dis(nor);
+}
Quoted 8 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 207

Quoted 5 lines
drivers/mtd/spi-nor/macronix.c +2 -0
+
 static void macronix_nor_default_init(struct spi_nor *nor)
 {
      nor->params->quad_enable = spi_nor_sr1_bit6_quad_enable;
+     nor->params->octal_dtr_enable = macronix_nor_octal_dtr_enable;

this must be done in the late_init hook, I'd like to get rid of the default_init hook.

Quoted 2 lines

nor->params->quad_enable should be move in late_init or nor->params->octal_dtr_enable only?

Quoted 7 lines

quad_enable should be parsed from sfdp, thus we have to get rid of setting quad_enable in a dedicated hook. Remove it entirely, but in a dedicated patch. Of course, I expect you test the change and verify that quad still works on all the affected flashes.

octal_dtr_enable should be set in late_init as we don't retrieve the octal dtr enable from SFDP yet.

Ok, I will move it to late_init.

Quoted 7 lines
Quoted 7 lines
Quoted 4 lines

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 210

Quoted 4 lines
drivers/mtd/spi-nor/macronix.c +0 -0
 }
 
 static void macronix_nor_late_init(struct spi_nor *nor)

Thanks
Jaime

Thanks
Jaime

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

author
#10 lore raw

PATCH v2 2/2 mtd: spi-nor: add support for Macronix Octal flash

In reply to Jaime Liao

From: JaimeLiao <[email protected]>

Adding Macronix Octal flash for Octal DTR support.

The octaflash series can be divided into the following types:

MX25 series : Serial NOR Flash.
MX66 series : Serial NOR Flash with stacked die.(Size larger than 1Gb) LM/UM series : Up to 250MHz clock frequency with both DTR/STR operation. LW/UW series : Support simultaneous Read-while-Write operation in multiple
bank architecture. Read-while-write feature which means read data one bank while another bank is programing or erasing.

MX25LM : 3.0V Octal I/O
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8729/MX25LM51245G,%203V,%20512Mb,%20v1.1.pdf

MX25UM : 1.8V Octal I/O
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8967/MX25UM51245G,%201.8V,%20512Mb,%20v1.5.pdf

MX66LM : 3.0V Octal I/O with stacked die
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8748/MX66LM1G45G,%203V,%201Gb,%20v1.1.pdf

MX66UM : 1.8V Octal I/O with stacked die
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8711/MX66UM1G45G,%201.8V,%201Gb,%20v1.1.pdf

MX25LW : 3.0V Octal I/O with Read-while-Write MX25UW : 1.8V Octal I/O with Read-while-Write MX66LW : 3.0V Octal I/O with Read-while-Write and stack die MX66UW : 1.8V Octal I/O with Read-while-Write and stack die

MX25UM51245G : 512Mb flash, with Word mode data output format when Octal DTR read MX25UM51345G : 512Mb flash, with Byte mode data output format when Octal DTR read

Macronix Octal flash with two types, "byte mode" and "word mode". Because of word mode flash with byte swap issue when Octal DTR read, adding byte mode flash in this patchset only.

About LW/UW series, please contact us freely if you have any questions. For adding Octal NOR Flash IDs, we have validated each Flash on plateform zynq-picozed.

As below are the SFDP table dump.

zynq> cat jedec_id
c2943c
zynq> cat manufacturer
macronix
zynq> cat partname
mx66uw2g345gx0
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff7f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87790100841200e2cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043061f0021dcffff
zynq> md5sum sfdp
839ad44d1e758bea30bd9917ba763ba6 sfdp

zynq> cat jedec_id
c2843c
zynq> cat manufacturer
macronix
zynq> cat partname
mx66uw2g345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff7f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87790100841200e2cc04674630b030b0f4bdd55c 000000ff101000200000147c00007c234800000000007777000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000000001445988043061f0021dcffff
zynq> md5sum sfdp
00447475e039e67c256a8d75d5885ae8 sfdp

zynq> cat jedec_id
c2843a
zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw51345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff1f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff8b7901008f1200e2cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
cdccbfad3c384e77f3a5f7847b57b148 sfdp

zynq> cat jedec_id
c28439
zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw25345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87790100841200d2cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
f7712440f8ce0adb538dfa0c10579c79 sfdp

zynq> cat jedec_id
c28339
zynq> cat manufacturer
macronix
zynq> cat partname
mx25um25345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87690100821200d2cc02673830b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 040900001445988043060f0021dcffff
zynq> md5sum sfdp
950e623745a002e1747008592e6dbdf9 sfdp

zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw12345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0700ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff8b7901008f1200c9cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
a3eb609c08894c84270ad06efc03766c sfdp

zynq> cat jedec_id
c28437
zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw6345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0300ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff8b7901008f1200c4cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
c6fb57b8fdd4c35b5f0dacc4a1f7d4f4 sfdp

---
 drivers/mtd/spi-nor/macronix.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/macronix.c +24 -2
index b397fd274868..a5aee10590b8 100644
@@ -99,8 +99,8 @@ static const struct flash_info macronix_nor_parts[] = {
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 	{ "mx25uw51245g", INFOB(0xc2813a, 0, 0, 0, 4)
-		PARSE_SFDP
-		FLAGS(SPI_NOR_RWW) },
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
 	{ "mx25v8035f",  INFO(0xc22314, 0, 64 * 1024,  16)
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
 			      SPI_NOR_QUAD_READ) },
@@ -119,6 +119,28 @@ static const struct flash_info macronix_nor_parts[] = {
 	{ "mx66u2g45g",	 INFO(0xc2253c, 0, 64 * 1024, 4096)
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
+	{ "mx66uw2g345g", INFOB(0xc2843c, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ |
+			      SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx66uw2g345gx0", INFOB(0xc2943c, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ |
+			      SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw51345g", INFOB(0xc2843a, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25um25345g", INFO(0xc28339, 0, 0, 0)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw25345g", INFOB(0xc28439, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw12345g", INFOB(0xc28438, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw6345g", INFOB(0xc28437, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
 };
 
 static int macronix_nor_octal_dtr_en(struct spi_nor *nor)
Signature · 6 lines
2.25.1


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

Re: [PATCH v2 2/2] mtd: spi-nor: add support for Macronix Octal flash

Quoted 25 lines · Jaime Liao

From: JaimeLiao <[email protected]>

Adding Macronix Octal flash for Octal DTR support.

The octaflash series can be divided into the following types:

MX25 series : Serial NOR Flash.
MX66 series : Serial NOR Flash with stacked die.(Size larger than 1Gb) LM/UM series : Up to 250MHz clock frequency with both DTR/STR operation. LW/UW series : Support simultaneous Read-while-Write operation in multiple
bank architecture. Read-while-write feature which means read data one bank while another bank is programing or erasing.

MX25LM : 3.0V Octal I/O
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8729/MX25LM51245G,%203V,%20512Mb,%20v1.1.pdf

MX25UM : 1.8V Octal I/O
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8967/MX25UM51245G,%201.8V,%20512Mb,%20v1.5.pdf

MX66LM : 3.0V Octal I/O with stacked die
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8748/MX66LM1G45G,%203V,%201Gb,%20v1.1.pdf

MX66UM : 1.8V Octal I/O with stacked die
-https://www.mxic.com.tw/Lists/Datasheet/Attachments/8711/MX66UM1G45G,%201.8V,%201Gb,%20v1.1.pdf

Quoted 7 lines

MX25LW : 3.0V Octal I/O with Read-while-Write MX25UW : 1.8V Octal I/O with Read-while-Write MX66LW : 3.0V Octal I/O with Read-while-Write and stack die MX66UW : 1.8V Octal I/O with Read-while-Write and stack die

MX25UM51245G : 512Mb flash, with Word mode data output format when Octal DTR read MX25UM51345G : 512Mb flash, with Byte mode data output format when Octal DTR read

split this in multiple patches and send a patch for each family please.

Quoted 4 lines

Macronix Octal flash with two types, "byte mode" and "word mode". Because of word mode flash with byte swap issue when Octal DTR read, adding byte mode flash in this patchset only.

Please reformulate this paragraph. So all these flashes that you're adding don't swap bytes on a 2 byte boundary?

Quoted 4 lines

About LW/UW series, please contact us freely if you have any questions. For adding Octal NOR Flash IDs, we have validated each Flash on plateform zynq-picozed.

remove this paragraph.

Quoted 2 lines

As below are the SFDP table dump.

I'd like you to do some sanity checks as well, using mtd_debug. There was a script that I advertised, please search ml for other flash updates to see how to do it.

Quoted 156 lines

zynq> cat jedec_id
c2943c
zynq> cat manufacturer
macronix
zynq> cat partname
mx66uw2g345gx0
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff7f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87790100841200e2cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043061f0021dcffff
zynq> md5sum sfdp
839ad44d1e758bea30bd9917ba763ba6 sfdp

zynq> cat jedec_id
c2843c
zynq> cat manufacturer
macronix
zynq> cat partname
mx66uw2g345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff7f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87790100841200e2cc04674630b030b0f4bdd55c 000000ff101000200000147c00007c234800000000007777000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000000001445988043061f0021dcffff
zynq> md5sum sfdp
00447475e039e67c256a8d75d5885ae8 sfdp

zynq> cat jedec_id
c2843a
zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw51345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff1f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff8b7901008f1200e2cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
cdccbfad3c384e77f3a5f7847b57b148 sfdp

zynq> cat jedec_id
c28439
zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw25345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87790100841200d2cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
f7712440f8ce0adb538dfa0c10579c79 sfdp

zynq> cat jedec_id
c28339
zynq> cat manufacturer
macronix
zynq> cat partname
mx25um25345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0f00ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff87690100821200d2cc02673830b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 040900001445988043060f0021dcffff
zynq> md5sum sfdp
950e623745a002e1747008592e6dbdf9 sfdp

zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw12345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0700ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff8b7901008f1200c9cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
a3eb609c08894c84270ad06efc03766c sfdp

zynq> cat jedec_id
c28437
zynq> cat manufacturer
macronix
zynq> cat partname
mx25uw6345g
zynq> xxd -p sfdp 53464450080104fd00070114400000ff8701011c900000ff0a0001080001 00ff05000105200100ff84000102340100ff0000000000000000ffffffff ffffffffe5208affffffff0300ff00ff00ff00ffeeffffffffff00ffffff 00ff0c2010d800ff00ff8b7901008f1200c4cc04674630b030b0f4bdd55c 000000ff101000200000000000007c234800000000008888000000000000 00400fd1fff30fd1fff300050090000500b1002b0095002b0096727103b8 727103b80000000090a3188200c069960000000000000000727100987271 00b8727100990000000072710098727100f872710099727100f900000000 00000000011501d0727106d8000086500000060100000000020001030002 00000000060100000000000072060002000000eec0697272717100d8f7f6 000a00001445988043060f0021dcffff
zynq> md5sum sfdp
c6fb57b8fdd4c35b5f0dacc4a1f7d4f4 sfdp

---
 drivers/mtd/spi-nor/macronix.c | 26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)
drivers/mtd/spi-nor/macronix.c +0 -0
index b397fd274868..a5aee10590b8 100644

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 103

Quoted 7 lines
drivers/mtd/spi-nor/macronix.c +2 -2
@@ -99,8 +99,8 @@ static const struct flash_info macronix_nor_parts[] = {
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
 	{ "mx25uw51245g", INFOB(0xc2813a, 0, 0, 0, 4)
-		PARSE_SFDP
-		FLAGS(SPI_NOR_RWW) },
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },

why? Here you don't add a new flash, but change an existing one. Add a dedicated patch for this. Why can't you use SFDP?

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 125

Quoted 11 lines
drivers/mtd/spi-nor/macronix.c +4 -0
 	{ "mx25v8035f",  INFO(0xc22314, 0, 64 * 1024,  16)
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ |
 			      SPI_NOR_QUAD_READ) },
@@ -119,6 +119,28 @@ static const struct flash_info macronix_nor_parts[] = {
 	{ "mx66u2g45g",	 INFO(0xc2253c, 0, 64 * 1024, 4096)
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
+	{ "mx66uw2g345g", INFOB(0xc2843c, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ |
+			      SPI_NOR_OCTAL_DTR_PP) },

PARSE_SFDP instead.

Quoted 8 lines
drivers/mtd/spi-nor/macronix.c +8 -0
+	{ "mx66uw2g345gx0", INFOB(0xc2943c, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ |
+			      SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw51345g", INFOB(0xc2843a, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25um25345g", INFO(0xc28339, 0, 0, 0)

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 143

Quoted 10 lines
drivers/mtd/spi-nor/macronix.c +10 -0
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw25345g", INFOB(0xc28439, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw12345g", INFOB(0xc28438, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw6345g", INFOB(0xc28437, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },

PARSE_SFDP for all the flashes please.

drivers/mtd/spi-nor/macronix.c static const struct flash_info macronix_nor_parts[] = { · line 146

Quoted 3 lines
drivers/mtd/spi-nor/macronix.c +0 -0
 };
 
 static int macronix_nor_octal_dtr_en(struct spi_nor *nor)

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

#12 lore raw

Re: [PATCH v2 2/2] mtd: spi-nor: add support for Macronix Octal flash

Hi,

Quoted 18 lines
Quoted 18 lines
drivers/mtd/spi-nor/macronix.c +3 -0
+	{ "mx66uw2g345gx0", INFOB(0xc2943c, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ 

|

drivers/mtd/spi-nor/macronix.c +4 -0
+			      SPI_NOR_OCTAL_DTR_PP) },
+	{ "mx25uw51345g", INFOB(0xc2843a, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | 

SPI_NOR_OCTAL_DTR_PP) },

(quoted diff) +2 -0
+	{ "mx25um25345g", INFO(0xc28339, 0, 0, 0)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | 

SPI_NOR_OCTAL_DTR_PP) },

drivers/mtd/spi-nor/macronix.c +3 -0
+	{ "mx25uw25345g", INFOB(0xc28439, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | 

SPI_NOR_OCTAL_DTR_PP) },

(quoted diff) +2 -0
+	{ "mx25uw12345g", INFOB(0xc28438, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
Quoted 8 lines
Quoted 6 lines
(quoted diff) +1 -0
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | 

SPI_NOR_OCTAL_DTR_PP) },

drivers/mtd/spi-nor/macronix.c +3 -0
+	{ "mx25uw6345g", INFOB(0xc28437, 0, 0, 0, 4)
+		FLAGS(SPI_NOR_RWW)
+		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | 

SPI_NOR_OCTAL_DTR_PP) },

PARSE_SFDP for all the flashes please.

And no NO_SFDP_FLAGS() as discussed.

-michael

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

#13 lore raw

Re: [PATCH v2 2/2] mtd: spi-nor: add support for Macronix Octal flash

Quoted 21 lines · Michael Walle

Hi,

Quoted 19 lines
Quoted 18 lines

+    { "mx66uw2g345gx0", INFOB(0xc2943c, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ | +                  SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25uw51345g", INFOB(0xc2843a, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25um25345g", INFO(0xc28339, 0, 0, 0)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25uw25345g", INFOB(0xc28439, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25uw12345g", INFOB(0xc28438, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25uw6345g", INFOB(0xc28437, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },

Quoted 4 lines
Quoted 1 line

PARSE_SFDP for all the flashes please.

And no NO_SFDP_FLAGS() as discussed.

Are there flavors of these flashes that don't support SFDP, or why did you ask for NO_SFDP_FLAGS? Do each of these flashes have SFDP and no-SFDP flavors?

If that's the case, I'm not yet sure if we want to mix PARSE_SFDP with NO_SFDP_FLAGS().

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

#14 lore raw

Re: [PATCH v2 2/2] mtd: spi-nor: add support for Macronix Octal flash

Am 2023-07-27 12:10, schrieb Tudor Ambarus:

Quoted 28 lines · Michael Walle
Quoted 27 lines

Hi,

Quoted 25 lines
Quoted 24 lines

+    { "mx66uw2g345gx0", INFOB(0xc2943c, 0, 0, 0, 4) +        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ |
+                  SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25uw51345g", INFOB(0xc2843a, 0, 0, 0, 4) +        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25um25345g", INFO(0xc28339, 0, 0, 0)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25uw25345g", INFOB(0xc28439, 0, 0, 0, 4) +        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25uw12345g", INFOB(0xc28438, 0, 0, 0, 4) +        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25uw6345g", INFOB(0xc28437, 0, 0, 0, 4) +        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

PARSE_SFDP for all the flashes please.

And no NO_SFDP_FLAGS() as discussed.

Are there flavors of these flashes that don't support SFDP, or why did you ask for NO_SFDP_FLAGS? Do each of these flashes have SFDP and no-SFDP flavors?

I asked to drop NO_SFDP_FLAGS().

-michael

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

#15 lore raw

Re: [PATCH v2 2/2] mtd: spi-nor: add support for Macronix Octal flash

Quoted 25 lines · Michael Walle

Am 2023-07-27 12:10, schrieb Tudor Ambarus:

Quoted 24 lines · Michael Walle
Quoted 23 lines

Hi,

Quoted 20 lines
Quoted 10 lines

+    { "mx66uw2g345gx0", INFOB(0xc2943c, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_READ | SPI_NOR_OCTAL_DTR_READ | +                  SPI_NOR_OCTAL_DTR_PP) },
+    { "mx25uw51345g", INFOB(0xc2843a, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25um25345g", INFO(0xc28339, 0, 0, 0)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25uw25345g", INFOB(0xc28439, 0, 0, 0, 4)

Quoted 8 lines

+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25uw12345g", INFOB(0xc28438, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) }, +    { "mx25uw6345g", INFOB(0xc28437, 0, 0, 0, 4)
+        FLAGS(SPI_NOR_RWW)
+        NO_SFDP_FLAGS(SECT_4K | SPI_NOR_OCTAL_DTR_READ | SPI_NOR_OCTAL_DTR_PP) },

PARSE_SFDP for all the flashes please.

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

And no NO_SFDP_FLAGS() as discussed.

Are there flavors of these flashes that don't support SFDP, or why did you ask for NO_SFDP_FLAGS? Do each of these flashes have SFDP and no-SFDP flavors?

I asked to drop NO_SFDP_FLAGS().

Oh, yes, that's what I meant too. There was a previous comment which said "PARSE_SFDP instead".

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