Skip to contentSkip to conversation

mtd: spi-nor: Add support for Infineon s25hl-t/s25hs-t

PATCH Superseded [email protected] 1 participant 6 messages Apr 11, 2022 – Apr 18, 2022

Subsystems (2)

v10 of 16 Superseded Latest is v16 →

lore
Share & tools
lore
#0 lore raw

v10 cover mtd: spi-nor: Add support for Infineon s25hl-t/s25hs-t

From: Takahiro Kuwano <[email protected]>

The S25HL-T/S25HS-T family is the Infineon SEMPER Flash with Quad SPI.

The datasheets can be found in the following link.
https://www.infineon.com/dgdl/Infineon-S25HS256T_S25HS512T_S25HS01GT_S25HL256T_S25HL512T_S25HL01GT_256-Mb_(32-MB)_512-Mb_(64-MB)_1-Gb_(128-MB)_HS-T_(1.8-V)_HL-T_(3.0-V)_Semper_Flash_with_Quad_SPI-DataSheet-v02_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee674b86ee3&da=t

Device ID and SFDP dumps:
------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hl512t
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342a1a0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff1f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe3 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb03fe0302fff8fffb03f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff703f8ff0200f1ff0000ff0400ff f8ffff03
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 8a0aa90112e154ae3a797df2c211ef61 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hl01gt
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342a1b0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff3f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe6 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb07fe0302fff8fffb07f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff707f8ff0200f1ff0000ff0400ff f8ffff07
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 1ad5a0d7d7e0e656986c1e678c416a7e /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hs512t
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342b1a0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff1f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b91e8ffe3 ec031c608a857a75f766805c84d6ddfff938f8a100000000000080000000 0000f7f5ffff7b920ffe20ffffd80000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000ee72fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb03fe0302fff8fffb03f8ff0100f1ff 0100fe0104fff1ff0100f8ff0200f8fff703f8ff0200f1ff0100ff0400ff f8ffff03
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp f17d9e784602187a0933edec3688e30f /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hs01gt
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342b1b0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff3f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe6 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb07fe0302fff8fffb07f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff707f8ff0200f1ff0000ff0400ff f8ffff07
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 1ad5a0d7d7e0e656986c1e678c416a7e /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

---
Changes in v10:
- Rebase to v5.18-rc1
- Remove dependencies on other series
- Use nor->info->addr_width for SMPT parse
- Add a local function for page size discovery
- Clean up volatile QE function

Changes in v9:
- Rebase to v5.17-rc6
- Rename function and macro per mwalle's series
- Fix some issues in ID table and fixup hook

Changes in v8:
- Rebase to v5.17-rc4
- Use spi_nor_read_reg and spi_nor_write_reg()

Changes in v7:
- Some changes were missing in v6 patch. Fix it

Changes in v6:
- Remove 2Gb dual die package parts and related changes to split mulit die package support into another series of patches

Changes in v5:
- Fix 'if (ret == 1)' to 'if (ret < 0)' in spansion_read_any_reg()
- Add NO_CHIP_ERASE flag to S25HL02GT and S25HS02GT

Changes in v4:
- Reword 'legacy' to 'default'
- Rename spi_nor_read() to spi_nor_default_ready()
- Fix dummy cycle calculation in spansion_read_any_reg()
- Modify comment for spansion_write_any_reg()
- Merge block comments about SMPT in s25hx_t_post_sfdp_fixups()
- Remove USE_CLSR flags from S25HL02GT and S25HS02GT

Changes in v3:
- Split into multiple patches
- Remove S25HL256T and S25HS256T
- Add S25HL02GT and S25HS02GT
- Add support for multi-die package parts support
- Cleanup Read/Write Any Register implementation
- Remove erase_map fix for top/split sector layout
- Set ECC data unit size (16B) to writesize

Changes in v2:
- Remove SPI_NOR_SKIP_SFDP flag and clean up related fixups
- Check CFR3V[4] to determine page_size instead of force 512B
- Depend on the patchset below to support non-uniform sector layout

    https://lore.kernel.org/linux-mtd/[email protected]/

Takahiro Kuwano (4):
mtd: spi-nor: sfdp: Use nor->info->addr_width as address width for
SMPT parse
mtd: spi-nor: spansion: Add support for volatile QE bit
mtd: spi-nor: spansion: Add local function to discover page size
mtd: spi-nor: spansion: Add s25hl-t/s25hs-t IDs and fixups

 drivers/mtd/spi-nor/sfdp.c     |   7 ++
 drivers/mtd/spi-nor/spansion.c | 179 +++++++++++++++++++++++++++++----
 2 files changed, 164 insertions(+), 22 deletions(-)
Signature · 6 lines
2.25.1


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

PATCH v10 1/4 mtd: spi-nor: sfdp: Use nor->info->addr_width as address width for SMPT parse

From: Takahiro Kuwano <[email protected]>

At the point spi_nor_smpt_addr_width() is called, nor->addr_width is set to 4 while the S25HS/HL-T boots with 3 byte addressing by default and SMPT parse cannot be done correctly. To solve this, use nor->info->addr_width as default and current address width.

---
This is an alternative way to fix
https://patchwork.ozlabs.org/project/linux-mtd/patch/[email protected]/

 drivers/mtd/spi-nor/sfdp.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/mtd/spi-nor/sfdp.c +7 -0
index a5211543d30d..9f8897e7fd7c 100644
@@ -652,6 +652,13 @@ static u8 spi_nor_smpt_addr_width(const struct spi_nor *nor, const u32 settings)
 	case SMPT_CMD_ADDRESS_LEN_4:
 		return 4;
 	case SMPT_CMD_ADDRESS_LEN_USE_CURRENT:
+		/*
+		 * Let's assume 'nor->info->addr_width' has the default address
+		 * width and it is currently in use, if available.
+		 */
+		if (nor->info->addr_width)
+			return nor->info->addr_width;
+		fallthrough;
 	default:
 		return nor->addr_width;
 	}
Signature · 6 lines
2.25.1


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

PATCH v10 2/4 mtd: spi-nor: spansion: Add support for volatile QE bit

In reply to [email protected]

From: Takahiro Kuwano <[email protected]>

Some of Infineon chips support volatile version of configuration registers and it is recommended to update volatile registers in the field application due to a risk of the non-volatile registers corruption by power interrupt.

---
Changes in v10:
- Remove dependencies on other series

Changes in v9:
- Rename function per mwalle's series

Changes in v8:
- Use spi_nor_read/write_reg() functions
- Use nor->bouncebuf instead of a variable on stack

Changes in v7:
- Add missing macro definitions in v6

Changes in v6:
- Remove multi die package support

Changes in v5:
- No change

Changes in v4:
- No change

Changes in v3:
- Add multi-die package parts support

 drivers/mtd/spi-nor/spansion.c | 70 ++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)
drivers/mtd/spi-nor/spansion.c +70 -0
index f24e546e04a5..b073a7fe8e15 100644
@@ -14,6 +14,8 @@
 #define SPINOR_OP_CLSR		0x30	/* Clear status register 1 */
 #define SPINOR_OP_RD_ANY_REG			0x65	/* Read any register */
 #define SPINOR_OP_WR_ANY_REG			0x71	/* Write any register */
+#define SPINOR_REG_CYPRESS_CFR1V		0x00800002
+#define SPINOR_REG_CYPRESS_CFR1V_QUAD_EN	BIT(1)	/* Quad Enable */
 #define SPINOR_REG_CYPRESS_CFR2V		0x00800003
 #define SPINOR_REG_CYPRESS_CFR2V_MEMLAT_11_24	0xb
 #define SPINOR_REG_CYPRESS_CFR3V		0x00800004
@@ -23,6 +25,74 @@
 #define SPINOR_REG_CYPRESS_CFR5V_OCT_DTR_DS	0
 #define SPINOR_OP_CYPRESS_RD_FAST		0xee
 
+/**
+ * cypress_nor_quad_enable_volatile() - enable Quad I/O mode in volatile
+ *                                      register.
+ * @nor:	pointer to a 'struct spi_nor'
+ *
+ * It is recommended to update volatile registers in the field application due
+ * to a risk of the non-volatile registers corruption by power interrupt. This
+ * function sets Quad Enable bit in CFR1 volatile. If users set the Quad Enable
+ * bit in the CFR1 non-volatile in advance (typically by a Flash programmer
+ * before mounting Flash on PCB), the Quad Enable bit in the CFR1 volatile is
+ * also set during Flash power-up.
+ *
+ * Return: 0 on success, -errno otherwise.
+ */
+static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)
+{
+	struct spi_mem_op op;
+	u8 *buf = nor->bouncebuf;
+	u8 cfr1v_written;
+	int ret;
+
+	op = (struct spi_mem_op)
+		SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 1),
+			   SPI_MEM_OP_ADDR(3, SPINOR_REG_CYPRESS_CFR1V, 1),
+			   SPI_MEM_OP_NO_DUMMY,
+			   SPI_MEM_OP_DATA_IN(1, buf, 1));
+	ret = spi_mem_exec_op(nor->spimem, &op);
+	if (ret)
+		return ret;
+
+	if (buf[0] & SPINOR_REG_CYPRESS_CFR1V_QUAD_EN)
+		return 0;
+
+	/* Update the Quad Enable bit. */
+	ret = spi_nor_write_enable(nor);
+	if (ret)
+		return ret;
+
+	buf[0] |= SPINOR_REG_CYPRESS_CFR1V_QUAD_EN;
+	op = (struct spi_mem_op)
+		SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_WR_ANY_REG, 1),
+				SPI_MEM_OP_ADDR(3, SPINOR_REG_CYPRESS_CFR1V, 1),
+				SPI_MEM_OP_NO_DUMMY,
+				SPI_MEM_OP_DATA_OUT(1, buf, 1));
+	ret = spi_mem_exec_op(nor->spimem, &op);
+	if (ret)
+		return ret;
+
+	cfr1v_written = buf[0];
+
+	/* Read back and check it. */
+	op = (struct spi_mem_op)
+		SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 1),
+			   SPI_MEM_OP_ADDR(3, SPINOR_REG_CYPRESS_CFR1V, 1),
+			   SPI_MEM_OP_NO_DUMMY,
+			   SPI_MEM_OP_DATA_IN(1, buf, 1));
+	ret = spi_mem_exec_op(nor->spimem, &op);
+	if (ret)
+		return ret;
+
+	if (buf[0] != cfr1v_written) {
+		dev_err(nor->dev, "CFR1: Read back test failed\n");
+		return -EIO;
+	}
+
+	return 0;
+}
+
 /**
  * cypress_nor_octal_dtr_enable() - Enable octal DTR on Cypress flashes.
  * @nor:		pointer to a 'struct spi_nor'
Signature · 6 lines
2.25.1


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

PATCH v10 3/4 mtd: spi-nor: spansion: Add local function to discover page size

In reply to [email protected]

From: Takahiro Kuwano <[email protected]>

The page size check in s28hs512t fixup can be used for s25hs/hl-t as well. Move that to a newly created local function.

---
 drivers/mtd/spi-nor/spansion.c | 55 ++++++++++++++++++++--------------
 1 file changed, 33 insertions(+), 22 deletions(-)
drivers/mtd/spi-nor/spansion.c +33 -22
index b073a7fe8e15..e58e864c308d 100644
@@ -93,6 +93,38 @@ static int cypress_nor_quad_enable_volatile(struct spi_nor *nor)
 	return 0;
 }
 
+/**
+ * cypress_nor_set_page_size() - Set page size which corresponds to the flash
+ *                               configuration.
+ * @nor:	pointer to a 'struct spi_nor'
+ *
+ * The BFPT table advertises a 512B page size but the page size is actually
+ * configurable (with the default being 256B). Read from CFR3V[4] and set the
+ * correct size.
+ *
+ * Return: 0 on success, -errno otherwise.
+ */
+static int cypress_nor_set_page_size(struct spi_nor *nor)
+{
+	struct spi_mem_op op =
+		SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 1),
+			   SPI_MEM_OP_ADDR(3, SPINOR_REG_CYPRESS_CFR3V, 1),
+			   SPI_MEM_OP_NO_DUMMY,
+			   SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1));
+	int ret;
+
+	ret = spi_mem_exec_op(nor->spimem, &op);
+	if (ret)
+		return ret;
+
+	if (nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR3V_PGSZ)
+		nor->params->page_size = 512;
+	else
+		nor->params->page_size = 256;
+
+	return 0;
+}
+
 /**
  * cypress_nor_octal_dtr_enable() - Enable octal DTR on Cypress flashes.
  * @nor:		pointer to a 'struct spi_nor'
@@ -226,28 +258,7 @@ static int s28hs512t_post_bfpt_fixup(struct spi_nor *nor,
 				     const struct sfdp_parameter_header *bfpt_header,
 				     const struct sfdp_bfpt *bfpt)
 {
-	/*
-	 * The BFPT table advertises a 512B page size but the page size is
-	 * actually configurable (with the default being 256B). Read from
-	 * CFR3V[4] and set the correct size.
-	 */
-	struct spi_mem_op op =
-		SPI_MEM_OP(SPI_MEM_OP_CMD(SPINOR_OP_RD_ANY_REG, 1),
-			   SPI_MEM_OP_ADDR(3, SPINOR_REG_CYPRESS_CFR3V, 1),
-			   SPI_MEM_OP_NO_DUMMY,
-			   SPI_MEM_OP_DATA_IN(1, nor->bouncebuf, 1));
-	int ret;
-
-	ret = spi_mem_exec_op(nor->spimem, &op);
-	if (ret)
-		return ret;
-
-	if (nor->bouncebuf[0] & SPINOR_REG_CYPRESS_CFR3V_PGSZ)
-		nor->params->page_size = 512;
-	else
-		nor->params->page_size = 256;
-
-	return 0;
+	return cypress_nor_set_page_size(nor);
 }
 
 static const struct spi_nor_fixups s28hs512t_fixups = {
Signature · 6 lines
2.25.1


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

PATCH v10 4/4 mtd: spi-nor: spansion: Add s25hl-t/s25hs-t IDs and fixups

In reply to [email protected]

From: Takahiro Kuwano <[email protected]>

The S25HL-T/S25HS-T family is the Infineon SEMPER Flash with Quad SPI.

For the single-die package parts (512Mb and 1Gb), only bottom 4KB and uniform sector sizes are supported. This is due to missing or incorrect entries in SMPT. Fixup for other sector sizes configurations will be followed up as needed.

Tested on Xilinx Zynq-7000 FPGA board.

---
Changes in v10:
- Cleanup fixups and ID table based on other patches in this series

Changes in v9:
- Use late_init() hook to fix mode clocks and writesize
- Use PARSE_SFDP instead of NO_SFDP_FLAGS
- Use MFR_FLAGS for USE_CLSR
- Add comment block to explain about addr mode in post_bfpt_fixups()

Changes in v8:
- Call write_disable in error case only
- Use spi_nor_read_reg() helper
- Use nor->bouncebuf instead of variable on stack
- Update ID table to use FLAGS macro

Changes in v7:
- Add missing device info table in v6

Changes in v6:
- Remove 2Gb multi die pacakge support

Changes in v5:
- Add NO_CHIP_ERASE flag to S25HL02GT and S25HS02GT

Changes in v4:
- Merge block comments about SMPT in s25hx_t_post_sfdp_fixups()
- Remove USE_CLSR flags from S25HL02GT and S25HS02GT

Changes in v3:
- Remove S25HL256T and S25HS256T
- Add S25HL02GT and S25HS02GT
- Add support for multi-die package parts support
- Remove erase_map fix for top/split sector layout
- Set ECC data unit size (16B) to writesize

 drivers/mtd/spi-nor/spansion.c | 54 ++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
drivers/mtd/spi-nor/spansion.c +54 -0
index e58e864c308d..b78e5180b488 100644
@@ -125,6 +125,40 @@ static int cypress_nor_set_page_size(struct spi_nor *nor)
 	return 0;
 }
 
+static int s25hx_t_post_bfpt_fixup(struct spi_nor *nor,
+				   const struct sfdp_parameter_header *bfpt_header,
+				   const struct sfdp_bfpt *bfpt)
+{
+	/* Replace Quad Enable with volatile version */
+	nor->params->quad_enable = cypress_nor_quad_enable_volatile;
+
+	return cypress_nor_set_page_size(nor);
+}
+
+static void s25hx_t_post_sfdp_fixup(struct spi_nor *nor)
+{
+	/*
+	 * Some of the older versions of flash have 3byte opcodes in 4BAIT.
+	 * Unset the flag so that core can convert to 4byte opcodes.
+	 */
+	nor->flags &= ~SNOR_F_HAS_4BAIT;
+}
+
+void s25hx_t_late_init(struct spi_nor *nor)
+{
+	/* Fast Read 4B requires mode cycles */
+	nor->params->reads[SNOR_CMD_READ_FAST].num_mode_clocks = 8;
+
+	/* The writesize should be ECC data unit size */
+	nor->params->writesize = 16;
+}
+
+static struct spi_nor_fixups s25hx_t_fixups = {
+	.post_bfpt = s25hx_t_post_bfpt_fixup,
+	.post_sfdp = s25hx_t_post_sfdp_fixup,
+	.late_init = s25hx_t_late_init,
+};
+
 /**
  * cypress_nor_octal_dtr_enable() - Enable octal DTR on Cypress flashes.
  * @nor:		pointer to a 'struct spi_nor'
@@ -380,6 +414,26 @@ static const struct flash_info spansion_nor_parts[] = {
 	{ "s25fl256l",  INFO(0x016019,      0,  64 * 1024, 512)
 		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)
 		FIXUP_FLAGS(SPI_NOR_4B_OPCODES) },
+	{ "s25hs512t",  INFO6(0x342b1a, 0x0f0390, 256 * 1024, 256)
+		PARSE_SFDP
+		MFR_FLAGS(USE_CLSR)
+		.addr_width = 3,
+		.fixups = &s25hx_t_fixups },
+	{ "s25hl512t",  INFO6(0x342a1a, 0x0f0390, 256 * 1024, 256)
+		PARSE_SFDP
+		MFR_FLAGS(USE_CLSR)
+		.addr_width = 3,
+		.fixups = &s25hx_t_fixups },
+	{ "s25hs01gt",  INFO6(0x342b1b, 0x0f0390, 256 * 1024, 512)
+		PARSE_SFDP
+		MFR_FLAGS(USE_CLSR)
+		.addr_width = 3,
+		.fixups = &s25hx_t_fixups },
+	{ "s25hl01gt",  INFO6(0x342a1b, 0x0f0390, 256 * 1024, 512)
+		PARSE_SFDP
+		MFR_FLAGS(USE_CLSR)
+		.addr_width = 3,
+		.fixups = &s25hx_t_fixups },
 	{ "cy15x104q",  INFO6(0x042cc2, 0x7f7f7f, 512 * 1024, 1)
 		FLAGS(SPI_NOR_NO_ERASE) },
 	{ "s28hs512t",   INFO(0x345b1a,      0, 256 * 1024, 256)
Signature · 6 lines
2.25.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
#5 lore raw
In reply to [email protected]

Hello,

I will revise this series on top of Tudor's new series.
https://patchwork.ozlabs.org/project/linux-mtd/list/?series=294490

Besides, I would withdraw patch 1/4.
Static assignment for 'nor->info->addr_width' cannot handle different use case of addressing mode (3-byte or 4-byte at boot time). I will revert that back to v9.

Thanks,
Takahiro

Quoted 191 lines · On 4/11/2022 2:23 PM, [email protected] wrote:

From: Takahiro Kuwano <[email protected]>

The S25HL-T/S25HS-T family is the Infineon SEMPER Flash with Quad SPI.

The datasheets can be found in the following link.
https://www.infineon.com/dgdl/Infineon-S25HS256T_S25HS512T_S25HS01GT_S25HL256T_S25HL512T_S25HL01GT_256-Mb_(32-MB)_512-Mb_(64-MB)_1-Gb_(128-MB)_HS-T_(1.8-V)_HL-T_(3.0-V)_Semper_Flash_with_Quad_SPI-DataSheet-v02_00-EN.pdf?fileId=8ac78c8c7d0d8da4017d0ee674b86ee3&da=t

Device ID and SFDP dumps:
------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hl512t
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342a1a0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff1f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe3 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb03fe0302fff8fffb03f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff703f8ff0200f1ff0000ff0400ff f8ffff03
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 8a0aa90112e154ae3a797df2c211ef61 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hl01gt
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342a1b0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff3f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe6 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb07fe0302fff8fffb07f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff707f8ff0200f1ff0000ff0400ff f8ffff07
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 1ad5a0d7d7e0e656986c1e678c416a7e /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hs512t
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342b1a0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff1f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b91e8ffe3 ec031c608a857a75f766805c84d6ddfff938f8a100000000000080000000 0000f7f5ffff7b920ffe20ffffd80000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000ee72fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb03fe0302fff8fffb03f8ff0100f1ff 0100fe0104fff1ff0100f8ff0200f8fff703f8ff0200f1ff0100ff0400ff f8ffff03
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp f17d9e784602187a0933edec3688e30f /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

------------------------------------------------------------
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname s25hs01gt
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id 342b1b0f0390
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 53464450080103ff00000114000100ff84000102500100ff81000116c801 00ff8700011c580100ffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff ffffffffffffffffffffffffffffffffe720faffffffff3f48eb086b00ff 88bbfeffffffffff00ffffff48eb0c2000ff00ff12d823faff8b82e7ffe6 ec031c608a857a75f766805c8cd6ddfff938f8a1000000000000bc000000 0000f7f5ffff7b920ffe21ffffdc0000800000000000c0ffc3ebc8ffe3eb 00650090060500a10065009600650095716503d0716503d000000000b02e 000088a489aa716503967165039600000000000000000000000000000000 000000000000000000000000000000000000000000000000716505d57165 05d50000a015fc65ff0804008000fc65ff4002008000fd65ff0402008000 fe0002fff1ff0100f8ff0100f8fffb07fe0302fff8fffb07f8ff0100f1ff 0100fe0104fff1ff0000f8ff0200f8fff707f8ff0200f1ff0000ff0400ff f8ffff07
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp 1ad5a0d7d7e0e656986c1e678c416a7e /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
------------------------------------------------------------

---
Changes in v10:
- Rebase to v5.18-rc1
- Remove dependencies on other series
- Use nor->info->addr_width for SMPT parse
- Add a local function for page size discovery
- Clean up volatile QE function

Changes in v9:
- Rebase to v5.17-rc6
- Rename function and macro per mwalle's series
- Fix some issues in ID table and fixup hook

Changes in v8:
- Rebase to v5.17-rc4
- Use spi_nor_read_reg and spi_nor_write_reg()

Changes in v7:
- Some changes were missing in v6 patch. Fix it

Changes in v6:
- Remove 2Gb dual die package parts and related changes to split mulit die package support into another series of patches

Changes in v5:
- Fix 'if (ret == 1)' to 'if (ret < 0)' in spansion_read_any_reg()
- Add NO_CHIP_ERASE flag to S25HL02GT and S25HS02GT

Changes in v4:
- Reword 'legacy' to 'default'
- Rename spi_nor_read() to spi_nor_default_ready()
- Fix dummy cycle calculation in spansion_read_any_reg()
- Modify comment for spansion_write_any_reg()
- Merge block comments about SMPT in s25hx_t_post_sfdp_fixups()
- Remove USE_CLSR flags from S25HL02GT and S25HS02GT

Changes in v3:
- Split into multiple patches
- Remove S25HL256T and S25HS256T
- Add S25HL02GT and S25HS02GT
- Add support for multi-die package parts support
- Cleanup Read/Write Any Register implementation
- Remove erase_map fix for top/split sector layout
- Set ECC data unit size (16B) to writesize

Changes in v2:
- Remove SPI_NOR_SKIP_SFDP flag and clean up related fixups
- Check CFR3V[4] to determine page_size instead of force 512B
- Depend on the patchset below to support non-uniform sector layout

    https://lore.kernel.org/linux-mtd/[email protected]/

Takahiro Kuwano (4):
mtd: spi-nor: sfdp: Use nor->info->addr_width as address width for
SMPT parse
mtd: spi-nor: spansion: Add support for volatile QE bit
mtd: spi-nor: spansion: Add local function to discover page size
mtd: spi-nor: spansion: Add s25hl-t/s25hs-t IDs and fixups

Quoted 4 lines
 drivers/mtd/spi-nor/sfdp.c     |   7 ++
 drivers/mtd/spi-nor/spansion.c | 179 +++++++++++++++++++++++++++++----
 2 files changed, 164 insertions(+), 22 deletions(-)

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