Skip to contentSkip to conversation

mtd: spi-nor: Fix the qspi parallel memory issues

PATCH Applied Dominik Wernberger 2 participants 6 messages Dec 3, 2024 – Dec 6, 2024 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

Hello Venkatesh,

Is there any news on the status of this patch? I'm working with a Zynq 7z020 system where 2 Flashes operate in parallel QSPI mode. This patch is essential for the correct Flash erase in U-Boot v2025.01-rc3.

Without this patch Flash erase fails on every second multiple of Flash erase section size (FESS). Failing means that the Flash erase is not initiated or successful. I.e., the Flash section is not altered.

For example, lets assume a FESS with 0x20000 (128 kiB).

sf test 00000 20000 # Works
sf test 20000 20000 # Fails
sf test 40000 20000 # Works
sf test 60000 20000 # Fails

# ...

Note that executing

sf erase 20000 20000
SF: 131072 bytes @ 0x20000 Erased: OK

shows OK even though the Flash sector were not erased.

In case you have any new/rebased patches you want me to test, I would be happy to do so. I'm looking forward getting this patch into mainline U-Boot.

Best Regards,

Dominik

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

#1 lore raw

Hi Dominik,
Could you please let me know the details of the flash? I will check from my side.

Thanks
Venkatesh
From: Dominik Wernberger <[email protected]>
Sent: Tuesday, December 3, 2024 5:21 PM
To: Abbarapu, Venkatesh <[email protected]>
Cc: git (AMD-Xilinx) <[email protected]>; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: Re: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hello Venkatesh,

Is there any news on the status of this patch? I'm working with a Zynq 7z020 system where 2 Flashes operate in parallel QSPI mode. This patch is essential for the correct Flash erase in U-Boot v2025.01-rc3.

Without this patch Flash erase fails on every second multiple of Flash erase section size (FESS). Failing means that the Flash erase is not initiated or successful. I.e., the Flash section is not altered.

For example, lets assume a FESS with 0x20000 (128 kiB).

sf test 00000 20000 # Works
sf test 20000 20000 # Fails
sf test 40000 20000 # Works
sf test 60000 20000 # Fails

# ...

Note that executing

sf erase 20000 20000
SF: 131072 bytes @ 0x20000 Erased: OK

shows OK even though the Flash sector were not erased.

In case you have any new/rebased patches you want me to test, I would be happy to do so. I'm looking forward getting this patch into mainline U-Boot.

Best Regards,

Dominik

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

#2 lore raw

Hi Venkatesh,

Thanks for such a fast response.

Running ‘sf probe’ gives:
Flash: SF: Detected n25q256a with page size 512 Bytes, erase size 128 KiB, total 128 MiB

To be correct we use 2x MT25QL256ABA1EW9 [1, 2] which is basically the same as the n25q256a reported by sf. In defconfig I’ve specified CONFIG_ENV_SECT_SIZE=0x00040000 which is divided by 2 in parallel memories logic [3], resulting in the 128 KiB per Flash chip.

If you need any further information, please let me know.

[1] https://www.micron.com/products/storage/nor-flash/serial-nor/part-catalog/part-detail/mt25ql256aba1ew9-0sit
[2] https://xonstorage.blob.core.windows.net/pdf/micron_mt25ql256aba1ew90sit_apr22_xonlink.pdf
[3] https://lore.kernel.org/all/[email protected]/

BR
Dominik

From: Abbarapu, Venkatesh <[email protected]>
Sent: Tuesday, December 3, 2024 1:01 PM
To: Wernberger Dominik (1GS4) <[email protected]>
Cc: git (AMD-Xilinx) <[email protected]>; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: *EXT* RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Dominik,
Could you please let me know the details of the flash? I will check from my side.

Thanks
Venkatesh
From: Dominik Wernberger <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 5:21 PM
To: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hello Venkatesh,

Is there any news on the status of this patch? I'm working with a Zynq 7z020 system where 2 Flashes operate in parallel QSPI mode. This patch is essential for the correct Flash erase in U-Boot v2025.01-rc3.

Without this patch Flash erase fails on every second multiple of Flash erase section size (FESS). Failing means that the Flash erase is not initiated or successful. I.e., the Flash section is not altered.

For example, lets assume a FESS with 0x20000 (128 kiB).

sf test 00000 20000 # Works
sf test 20000 20000 # Fails
sf test 40000 20000 # Works
sf test 60000 20000 # Fails

# ...

Note that executing

sf erase 20000 20000
SF: 131072 bytes @ 0x20000 Erased: OK

shows OK even though the Flash sector were not erased.

In case you have any new/rebased patches you want me to test, I would be happy to do so. I'm looking forward getting this patch into mainline U-Boot.

Best Regards,

Dominik

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

#3 lore raw

Hi Dominik,
I have tried on the zc706 board and didn’t see any issues with the parallel configuration. This is the upstream commit f96e5133184aac377b54bd61f8abf78710f2ee56 + patch attached Zynq> sf probe 0 0 0
SF: Detected n25q512ax3 with page size 512 Bytes, erase size 128 KiB, total 128 MiB Verified with the below tests and didn’t see any issue.
Log:
U-Boot 2025.01-rc3-00046-gf96e5133184a-dirty (Dec 04 2024 - 19:50:42 +0530)

CPU:   Zynq 7z045
Silicon: v3.1
Model: Xilinx ZC706 board
DRAM:  ECC disabled 1 GiB
jedec_spi_nor flash@0: has no valid 'reg' property (0)
Core:  31 devices, 19 uclasses, devicetree: board
Flash: 0 Bytes
NAND:  0 MiB
MMC:   mmc@e0100000: 0
Loading Environment from nowhere... OK
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000

Net:
ZYNQ GEM: e000b000, mdio bus e000b000, phyaddr 7, interface rgmii-id

Warning: ethernet@e000b000 (eth0) using random MAC address - b6:69:a8:60:e2:de
eth0: ethernet@e000b000
Hit any key to stop autoboot: 0
Zynq> sf probe 0 0 0
SF: Detected n25q512ax3 with page size 512 Bytes, erase size 128 KiB, total 128 MiB
Zynq> time sf erase 0x0 0x2000000;mw.b 0x8000 aabbccdd 0x2000000;time sf write 0x8000 0x0 0x2000000;mw.b 0x8008000 0x0 0x2000000;time sf read 0x8008000 0x0 0x2000000;cmp.b 0x8000 0x8008000 0x2000000
SF: 33554432 bytes @ 0x0 Erased: OK

time: 3 minutes, 37.604 seconds
device 0 offset 0x0, size 0x2000000
SF: 33554432 bytes @ 0x0 Written: OK

time: 47.074 seconds
device 0 offset 0x0, size 0x2000000
SF: 33554432 bytes @ 0x0 Read: OK

time: 5.411 seconds
Total of 33554432 byte(s) were the same
Zynq> time sf erase 0x0 0x4000000; mw.b 0x10000000 dd 0x4000000; time sf write 0x10000000 0x0 0x4000000; mw.b 0x20000000 0x0 0x4000000; time sf read 0x20000000 0x0 0x4000000; cmp.b 0x10000000 0x20000000 0x4000000
SF: 67108864 bytes @ 0x0 Erased: OK

time: 6 minutes, 45.941 seconds
device 0 offset 0x0, size 0x4000000
SF: 67108864 bytes @ 0x0 Written: OK

time: 1 minutes, 34.443 seconds
device 0 offset 0x0, size 0x4000000
SF: 67108864 bytes @ 0x0 Read: OK

time: 10.821 seconds
Total of 67108864 byte(s) were the same
Zynq> time sf erase 0x0 0x8000000;mw.b 0x8000 aabbccdd 0x8000000;time sf write 0x8000 0x0 0x8000000;mw.b 0x8008000 0x0 0x8000000;time sf read 0x8008000 0x0 0x8000000;cmp.b 0x8000 0x8008000 0x8000000
SF: 134217728 bytes @ 0x0 Erased: OK

time: 12 minutes, 50.601 seconds
device 0 whole chip
SF: 134217728 bytes @ 0x0 Written: OK

time: 3 minutes, 6.852 seconds
device 0 whole chip
SF: 134217728 bytes @ 0x0 Read: OK

time: 21.643 seconds
Total of 134217728 byte(s) were the same
Zynq>

Let me know if you have any questions.

Thanks
Venkatesh

From: Dominik Wernberger <[email protected]>
Sent: Tuesday, December 3, 2024 5:57 PM
To: Abbarapu, Venkatesh <[email protected]>
Cc: git (AMD-Xilinx) <[email protected]>; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Venkatesh,

Thanks for such a fast response.

Running ‘sf probe’ gives:
Flash: SF: Detected n25q256a with page size 512 Bytes, erase size 128 KiB, total 128 MiB

To be correct we use 2x MT25QL256ABA1EW9 [1, 2] which is basically the same as the n25q256a reported by sf. In defconfig I’ve specified CONFIG_ENV_SECT_SIZE=0x00040000 which is divided by 2 in parallel memories logic [3], resulting in the 128 KiB per Flash chip.

If you need any further information, please let me know.

[1] https://www.micron.com/products/storage/nor-flash/serial-nor/part-catalog/part-detail/mt25ql256aba1ew9-0sit
[2] https://xonstorage.blob.core.windows.net/pdf/micron_mt25ql256aba1ew90sit_apr22_xonlink.pdf
[3] https://lore.kernel.org/all/[email protected]/

BR
Dominik

From: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 1:01 PM
To: Wernberger Dominik (1GS4) <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: *EXT* RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Dominik,
Could you please let me know the details of the flash? I will check from my side.

Thanks
Venkatesh
From: Dominik Wernberger <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 5:21 PM
To: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hello Venkatesh,

Is there any news on the status of this patch? I'm working with a Zynq 7z020 system where 2 Flashes operate in parallel QSPI mode. This patch is essential for the correct Flash erase in U-Boot v2025.01-rc3.

Without this patch Flash erase fails on every second multiple of Flash erase section size (FESS). Failing means that the Flash erase is not initiated or successful. I.e., the Flash section is not altered.

For example, lets assume a FESS with 0x20000 (128 kiB).

sf test 00000 20000 # Works
sf test 20000 20000 # Fails
sf test 40000 20000 # Works
sf test 60000 20000 # Fails

# ...

Note that executing

sf erase 20000 20000
SF: 131072 bytes @ 0x20000 Erased: OK

shows OK even though the Flash sector were not erased.

In case you have any new/rebased patches you want me to test, I would be happy to do so. I'm looking forward getting this patch into mainline U-Boot.

Best Regards,

Dominik

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

From 460b08642f36b8c4d655d3a7617a5003e0d86c67 Mon Sep 17 00:00:00 2001
From: Venkatesh Yadav Abbarapu <[email protected]>
Date: Thu, 5 Dec 2024 11:09:07 +0530
Subject: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

The below issues are fixed
1)Fix the read issue for 4byte address width as read_len is getting zero.
2)Fix the spi_nor_erase function by passing the correct offset when it is configured as dual parallel.

---
 drivers/mtd/spi/spi-nor-core.c | 35 ++++++++++++++++++++++------------
 1 file changed, 23 insertions(+), 12 deletions(-)
drivers/mtd/spi/spi-nor-core.c +23 -12
index ec841fb13b..ef7728e2b5 100644
@@ -1139,11 +1139,13 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 			else
 				nor->spi->flags &= ~SPI_XFER_U_PAGE;
 		}
+		if (nor->addr_width == 3) {
 #ifdef CONFIG_SPI_FLASH_BAR
-		ret = write_bar(nor, addr);
+		ret = write_bar(nor, offset);
 		if (ret < 0)
 			goto erase_err;
 #endif
+		}
 		ret = write_enable(nor);
 		if (ret < 0)
 			goto erase_err;
@@ -1152,7 +1154,7 @@ static int spi_nor_erase(struct mtd_info *mtd, struct erase_info *instr)
 		    !(nor->flags & SNOR_F_NO_OP_CHIP_ERASE)) {
 			ret = spi_nor_erase_chip(nor);
 		} else {
-			ret = spi_nor_erase_sector(nor, addr);
+			ret = spi_nor_erase_sector(nor, offset);
 		}
 		if (ret < 0)
 			goto erase_err;
@@ -1580,6 +1582,7 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 	loff_t offset = from;
 	u32 read_len = 0;
 	u32 rem_bank_len = 0;
+	u32 stack_shift = 0;
 	u8 bank;
 	bool is_ofst_odd = false;
 
@@ -1593,18 +1596,20 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 	}
 
 	while (len) {
-		bank = (u32)from / SZ_16M;
-		if (nor->flags & SNOR_F_HAS_PARALLEL)
-			bank /= 2;
-
-		rem_bank_len = SZ_16M * (bank + 1);
-		if (nor->flags & SNOR_F_HAS_PARALLEL)
-			rem_bank_len *= 2;
-		rem_bank_len -= from;
-
+		if (nor->addr_width == 3) {
+			bank = (u32)from / SZ_16M;
+			if (nor->flags & SNOR_F_HAS_PARALLEL)
+				bank /= 2;
+
+			rem_bank_len = SZ_16M * (bank + 1);
+			if (nor->flags & SNOR_F_HAS_PARALLEL)
+				rem_bank_len *= 2;
+			rem_bank_len -= from;
+		}
 		offset = from;
 
 		if (nor->flags & SNOR_F_HAS_STACKED) {
+			stack_shift = 1;
 			if (offset >= (mtd->size / 2)) {
 				offset = offset - (mtd->size / 2);
 				nor->spi->flags |= SPI_XFER_U_PAGE;
@@ -1613,14 +1618,19 @@ static int spi_nor_read(struct mtd_info *mtd, loff_t from, size_t len,
 			}
 		}
 
+		if (nor->addr_width == 4) {
+			rem_bank_len = (mtd->size >> stack_shift) - offset;
+		}
 		if (nor->flags & SNOR_F_HAS_PARALLEL)
 			offset /= 2;
 
+		if (nor->addr_width == 3) {
 #ifdef CONFIG_SPI_FLASH_BAR
 		ret = write_bar(nor, offset);
 		if (ret < 0)
 			return log_ret(ret);
 #endif
+		}
 
 		if (len < rem_bank_len)
 			read_len = len;
@@ -2002,12 +2012,13 @@ static int spi_nor_write(struct mtd_info *mtd, loff_t to, size_t len,
 				nor->spi->flags &= ~SPI_XFER_U_PAGE;
 			}
 		}
-
+		if (nor->addr_width == 3) {
 #ifdef CONFIG_SPI_FLASH_BAR
 		ret = write_bar(nor, offset);
 		if (ret < 0)
 			return ret;
 #endif
+		}
 
 		/* the size of data remaining on the first page */
 		page_remain = min_t(size_t,
Signature · 1 line
2.34.1
author Applied
#4 lore raw

Hi Venkatesh,

I applied your attached patch to v2025.01-rc3 (commit 3073246d1be682071d8b3d07d06c2484907aed60) and confirm that your patch resolves my Flash erase issue. The following commands now work correctly.

sf probe
sf test 0 100000

Just for clarification, were you able to reproduce the original issue on your side?

Thank you very much!

Best Regards

Dominik

From: Abbarapu, Venkatesh <[email protected]>
Sent: Thursday, December 5, 2024 6:46 AM
To: Wernberger Dominik (1GS4) <[email protected]>
Cc: git (AMD-Xilinx) <[email protected]>; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: *EXT* RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Dominik,
I have tried on the zc706 board and didn’t see any issues with the parallel configuration. This is the upstream commit f96e5133184aac377b54bd61f8abf78710f2ee56 + patch attached Zynq> sf probe 0 0 0
SF: Detected n25q512ax3 with page size 512 Bytes, erase size 128 KiB, total 128 MiB Verified with the below tests and didn’t see any issue.
Log:
U-Boot 2025.01-rc3-00046-gf96e5133184a-dirty (Dec 04 2024 - 19:50:42 +0530)

CPU:   Zynq 7z045
Silicon: v3.1
Model: Xilinx ZC706 board
DRAM:  ECC disabled 1 GiB
jedec_spi_nor flash@0: has no valid 'reg' property (0)
Core:  31 devices, 19 uclasses, devicetree: board
Flash: 0 Bytes
NAND:  0 MiB
MMC:   mmc@e0100000: 0
Loading Environment from nowhere... OK
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000

Net:
ZYNQ GEM: e000b000, mdio bus e000b000, phyaddr 7, interface rgmii-id

Warning: ethernet@e000b000 (eth0) using random MAC address - b6:69:a8:60:e2:de
eth0: ethernet@e000b000
Hit any key to stop autoboot: 0
Zynq> sf probe 0 0 0
SF: Detected n25q512ax3 with page size 512 Bytes, erase size 128 KiB, total 128 MiB
Zynq> time sf erase 0x0 0x2000000;mw.b 0x8000 aabbccdd 0x2000000;time sf write 0x8000 0x0 0x2000000;mw.b 0x8008000 0x0 0x2000000;time sf read 0x8008000 0x0 0x2000000;cmp.b 0x8000 0x8008000 0x2000000
SF: 33554432 bytes @ 0x0 Erased: OK

time: 3 minutes, 37.604 seconds
device 0 offset 0x0, size 0x2000000
SF: 33554432 bytes @ 0x0 Written: OK

time: 47.074 seconds
device 0 offset 0x0, size 0x2000000
SF: 33554432 bytes @ 0x0 Read: OK

time: 5.411 seconds
Total of 33554432 byte(s) were the same
Zynq> time sf erase 0x0 0x4000000; mw.b 0x10000000 dd 0x4000000; time sf write 0x10000000 0x0 0x4000000; mw.b 0x20000000 0x0 0x4000000; time sf read 0x20000000 0x0 0x4000000; cmp.b 0x10000000 0x20000000 0x4000000
SF: 67108864 bytes @ 0x0 Erased: OK

time: 6 minutes, 45.941 seconds
device 0 offset 0x0, size 0x4000000
SF: 67108864 bytes @ 0x0 Written: OK

time: 1 minutes, 34.443 seconds
device 0 offset 0x0, size 0x4000000
SF: 67108864 bytes @ 0x0 Read: OK

time: 10.821 seconds
Total of 67108864 byte(s) were the same
Zynq> time sf erase 0x0 0x8000000;mw.b 0x8000 aabbccdd 0x8000000;time sf write 0x8000 0x0 0x8000000;mw.b 0x8008000 0x0 0x8000000;time sf read 0x8008000 0x0 0x8000000;cmp.b 0x8000 0x8008000 0x8000000
SF: 134217728 bytes @ 0x0 Erased: OK

time: 12 minutes, 50.601 seconds
device 0 whole chip
SF: 134217728 bytes @ 0x0 Written: OK

time: 3 minutes, 6.852 seconds
device 0 whole chip
SF: 134217728 bytes @ 0x0 Read: OK

time: 21.643 seconds
Total of 134217728 byte(s) were the same
Zynq>

Let me know if you have any questions.

Thanks
Venkatesh

From: Dominik Wernberger <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 5:57 PM
To: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Venkatesh,

Thanks for such a fast response.

Running ‘sf probe’ gives:
Flash: SF: Detected n25q256a with page size 512 Bytes, erase size 128 KiB, total 128 MiB

To be correct we use 2x MT25QL256ABA1EW9 [1, 2] which is basically the same as the n25q256a reported by sf. In defconfig I’ve specified CONFIG_ENV_SECT_SIZE=0x00040000 which is divided by 2 in parallel memories logic [3], resulting in the 128 KiB per Flash chip.

If you need any further information, please let me know.

[1] https://www.micron.com/products/storage/nor-flash/serial-nor/part-catalog/part-detail/mt25ql256aba1ew9-0sit
[2] https://xonstorage.blob.core.windows.net/pdf/micron_mt25ql256aba1ew90sit_apr22_xonlink.pdf
[3] https://lore.kernel.org/all/[email protected]/

BR
Dominik

From: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 1:01 PM
To: Wernberger Dominik (1GS4) <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: *EXT* RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Dominik,
Could you please let me know the details of the flash? I will check from my side.

Thanks
Venkatesh
From: Dominik Wernberger <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 5:21 PM
To: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hello Venkatesh,

Is there any news on the status of this patch? I'm working with a Zynq 7z020 system where 2 Flashes operate in parallel QSPI mode. This patch is essential for the correct Flash erase in U-Boot v2025.01-rc3.

Without this patch Flash erase fails on every second multiple of Flash erase section size (FESS). Failing means that the Flash erase is not initiated or successful. I.e., the Flash section is not altered.

For example, lets assume a FESS with 0x20000 (128 kiB).

sf test 00000 20000 # Works
sf test 20000 20000 # Fails
sf test 40000 20000 # Works
sf test 60000 20000 # Fails

# ...

Note that executing

sf erase 20000 20000
SF: 131072 bytes @ 0x20000 Erased: OK

shows OK even though the Flash sector were not erased.

In case you have any new/rebased patches you want me to test, I would be happy to do so. I'm looking forward getting this patch into mainline U-Boot.

Best Regards,

Dominik

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

#5 lore raw

Hi Dominik,
Thanks for letting me know that the parallel configuration is working with the patch. Yes…I too observed the issue, so sent these patches
https://lore.kernel.org/u-boot/[email protected]/
https://lore.kernel.org/u-boot/[email protected]/

Thanks
Venkatesh
From: Dominik Wernberger <[email protected]>
Sent: Thursday, December 5, 2024 4:00 PM
To: Abbarapu, Venkatesh <[email protected]>
Cc: git (AMD-Xilinx) <[email protected]>; [email protected]; Simek, Michal <[email protected]>; [email protected]; [email protected]; [email protected]
Subject: RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Venkatesh,

I applied your attached patch to v2025.01-rc3 (commit 3073246d1be682071d8b3d07d06c2484907aed60) and confirm that your patch resolves my Flash erase issue. The following commands now work correctly.

sf probe
sf test 0 100000

Just for clarification, were you able to reproduce the original issue on your side?

Thank you very much!

Best Regards

Dominik

From: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Sent: Thursday, December 5, 2024 6:46 AM
To: Wernberger Dominik (1GS4) <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: *EXT* RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Dominik,
I have tried on the zc706 board and didn’t see any issues with the parallel configuration. This is the upstream commit f96e5133184aac377b54bd61f8abf78710f2ee56 + patch attached Zynq> sf probe 0 0 0
SF: Detected n25q512ax3 with page size 512 Bytes, erase size 128 KiB, total 128 MiB Verified with the below tests and didn’t see any issue.
Log:
U-Boot 2025.01-rc3-00046-gf96e5133184a-dirty (Dec 04 2024 - 19:50:42 +0530)

CPU:   Zynq 7z045
Silicon: v3.1
Model: Xilinx ZC706 board
DRAM:  ECC disabled 1 GiB
jedec_spi_nor flash@0: has no valid 'reg' property (0)
Core:  31 devices, 19 uclasses, devicetree: board
Flash: 0 Bytes
NAND:  0 MiB
MMC:   mmc@e0100000: 0
Loading Environment from nowhere... OK
In:    serial@e0001000
Out:   serial@e0001000
Err:   serial@e0001000

Net:
ZYNQ GEM: e000b000, mdio bus e000b000, phyaddr 7, interface rgmii-id

Warning: ethernet@e000b000 (eth0) using random MAC address - b6:69:a8:60:e2:de
eth0: ethernet@e000b000
Hit any key to stop autoboot: 0
Zynq> sf probe 0 0 0
SF: Detected n25q512ax3 with page size 512 Bytes, erase size 128 KiB, total 128 MiB
Zynq> time sf erase 0x0 0x2000000;mw.b 0x8000 aabbccdd 0x2000000;time sf write 0x8000 0x0 0x2000000;mw.b 0x8008000 0x0 0x2000000;time sf read 0x8008000 0x0 0x2000000;cmp.b 0x8000 0x8008000 0x2000000
SF: 33554432 bytes @ 0x0 Erased: OK

time: 3 minutes, 37.604 seconds
device 0 offset 0x0, size 0x2000000
SF: 33554432 bytes @ 0x0 Written: OK

time: 47.074 seconds
device 0 offset 0x0, size 0x2000000
SF: 33554432 bytes @ 0x0 Read: OK

time: 5.411 seconds
Total of 33554432 byte(s) were the same
Zynq> time sf erase 0x0 0x4000000; mw.b 0x10000000 dd 0x4000000; time sf write 0x10000000 0x0 0x4000000; mw.b 0x20000000 0x0 0x4000000; time sf read 0x20000000 0x0 0x4000000; cmp.b 0x10000000 0x20000000 0x4000000
SF: 67108864 bytes @ 0x0 Erased: OK

time: 6 minutes, 45.941 seconds
device 0 offset 0x0, size 0x4000000
SF: 67108864 bytes @ 0x0 Written: OK

time: 1 minutes, 34.443 seconds
device 0 offset 0x0, size 0x4000000
SF: 67108864 bytes @ 0x0 Read: OK

time: 10.821 seconds
Total of 67108864 byte(s) were the same
Zynq> time sf erase 0x0 0x8000000;mw.b 0x8000 aabbccdd 0x8000000;time sf write 0x8000 0x0 0x8000000;mw.b 0x8008000 0x0 0x8000000;time sf read 0x8008000 0x0 0x8000000;cmp.b 0x8000 0x8008000 0x8000000
SF: 134217728 bytes @ 0x0 Erased: OK

time: 12 minutes, 50.601 seconds
device 0 whole chip
SF: 134217728 bytes @ 0x0 Written: OK

time: 3 minutes, 6.852 seconds
device 0 whole chip
SF: 134217728 bytes @ 0x0 Read: OK

time: 21.643 seconds
Total of 134217728 byte(s) were the same
Zynq>

Let me know if you have any questions.

Thanks
Venkatesh

From: Dominik Wernberger <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 5:57 PM
To: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Venkatesh,

Thanks for such a fast response.

Running ‘sf probe’ gives:
Flash: SF: Detected n25q256a with page size 512 Bytes, erase size 128 KiB, total 128 MiB

To be correct we use 2x MT25QL256ABA1EW9 [1, 2] which is basically the same as the n25q256a reported by sf. In defconfig I’ve specified CONFIG_ENV_SECT_SIZE=0x00040000 which is divided by 2 in parallel memories logic [3], resulting in the 128 KiB per Flash chip.

If you need any further information, please let me know.

[1] https://www.micron.com/products/storage/nor-flash/serial-nor/part-catalog/part-detail/mt25ql256aba1ew9-0sit
[2] https://xonstorage.blob.core.windows.net/pdf/micron_mt25ql256aba1ew90sit_apr22_xonlink.pdf
[3] https://lore.kernel.org/all/[email protected]/

BR
Dominik

From: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 1:01 PM
To: Wernberger Dominik (1GS4) <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: *EXT* RE: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hi Dominik,
Could you please let me know the details of the flash? I will check from my side.

Thanks
Venkatesh
From: Dominik Wernberger <[email protected]<mailto:[email protected]>>
Sent: Tuesday, December 3, 2024 5:21 PM
To: Abbarapu, Venkatesh <[email protected]<mailto:[email protected]>>
Cc: git (AMD-Xilinx) <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; Simek, Michal <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] mtd: spi-nor: Fix the qspi parallel memory issues

Hello Venkatesh,

Is there any news on the status of this patch? I'm working with a Zynq 7z020 system where 2 Flashes operate in parallel QSPI mode. This patch is essential for the correct Flash erase in U-Boot v2025.01-rc3.

Without this patch Flash erase fails on every second multiple of Flash erase section size (FESS). Failing means that the Flash erase is not initiated or successful. I.e., the Flash section is not altered.

For example, lets assume a FESS with 0x20000 (128 kiB).

sf test 00000 20000 # Works
sf test 20000 20000 # Fails
sf test 40000 20000 # Works
sf test 60000 20000 # Fails

# ...

Note that executing

sf erase 20000 20000
SF: 131072 bytes @ 0x20000 Erased: OK

shows OK even though the Flash sector were not erased.

In case you have any new/rebased patches you want me to test, I would be happy to do so. I'm looking forward getting this patch into mainline U-Boot.

Best Regards,

Dominik

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.

Content provided within this e-mail including any attachments, is for the use of the intended recipients and may contain Rohde & Schwarz company restricted information. Any unauthorized use, disclosure, or distribution of this communication in whole or in part is strictly prohibited. If you are not the intended recipient, please notify the sender by reply email or by telephone and delete the communication in its entirety.