* [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size @ 2022-07-16 0:06 Jae Hyun Yoo 2022-07-16 0:06 ` [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ Jae Hyun Yoo 2022-11-21 15:24 ` (subset)Re: [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Tudor Ambarus 0 siblings, 2 replies; 5+ messages in thread From: Jae Hyun Yoo @ 2022-07-16 0:06 UTC (permalink / raw) To: Tudor Ambarus, Pratyush Yadav, Michael Walle Cc: Jamie Iles, Graeme Gregory, Cédric Le Goater, Jae Hyun Yoo, linux-mtd, linux-kernel From: Michael Walle <michael@walle.cc> 4bait will set the erase size to 0 if there is no corresponding opcode for the 4byte erase. Fix spi_nor_select_uniform_erase to skip the 0 erase size to avoid mtd device registration failure cases. Reported-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> Signed-off-by: Michael Walle <michael@walle.cc> Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> --- Changes in v3: * Added newly in v3. drivers/mtd/spi-nor/core.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c index 502967c76c5f..666ef6ce9549 100644 --- a/drivers/mtd/spi-nor/core.c +++ b/drivers/mtd/spi-nor/core.c @@ -2113,6 +2113,10 @@ spi_nor_select_uniform_erase(struct spi_nor_erase_map *map, tested_erase = &map->erase_type[i]; + /* Skip masked erase types. */ + if (!tested_erase->size) + continue; + /* * If the current erase size is the one, stop here: * we have found the right uniform Sector Erase command. -- 2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ 2022-07-16 0:06 [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Jae Hyun Yoo @ 2022-07-16 0:06 ` Jae Hyun Yoo 2022-07-16 9:11 ` Michael Walle 2022-11-21 15:24 ` (subset)Re: [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Tudor Ambarus 1 sibling, 1 reply; 5+ messages in thread From: Jae Hyun Yoo @ 2022-07-16 0:06 UTC (permalink / raw) To: Tudor Ambarus, Pratyush Yadav, Michael Walle Cc: Jamie Iles, Graeme Gregory, Cédric Le Goater, Jae Hyun Yoo, linux-mtd, linux-kernel Add support for Winbond W25Q512NW-IQ/IN Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> Link: https://www.winbond.com/resource-files/W25Q512NW%20RevB%2007192021.pdf Reviewed-by: Cédric Le Goater <clg@kaod.org> --- Changes in v2: * Change sector size and number of sector to zero so that it can use parsed info from sfdp. (Michael) * Added md5sum of sfdp block. (Michael) Changes in v2: * Refined commit message. (Michael) Test result on AST2600 SoC's SPI controller: $ cat /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/jedec_id ef6020 $ cat /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/manufacturer winbond $ cat /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/partname w25q512nwq $ hexdump /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/sfdp 0000000 4653 5044 0106 ff01 0600 1001 0080 ff00 0000010 0084 0201 00d0 ff00 ffff ffff ffff ffff 0000020 6f00 7074 7420 7365 ff74 ffff ffff ffff * 0000040 ffff ffff ffff ffff ffff ffff ffff ffff * 0000080 20e5 fffb ffff 1fff eb44 6b08 3b08 bb42 0000090 fffe ffff ffff 0000 ffff eb40 200c 520f 00000a0 d810 0000 0233 00a6 e781 d914 63e9 3376 00000b0 757a 757a bdf7 5cd5 f719 ff5d 70e9 a5f9 00000c0 ffff ffff ffff ffff ffff ffff ffff ffff 00000d0 0aff fff0 ff21 ffdc 00000d8 $ md5sum /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/sfdp e1484fe7c993adaee5ea0d6246f52817 $ flash_otp_info -u /dev/mtd0 Number of OTP user blocks on /dev/mtd0: 3 block 0: offset = 0x0000 size = 256 bytes [unlocked] block 1: offset = 0x0100 size = 256 bytes [unlocked] block 2: offset = 0x0200 size = 256 bytes [unlocked] $ flash_otp_dump -u /dev/mtd0 0x2d0 OTP user data for /dev/mtd0 0x02d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x02e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x02f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff $ echo -n otp test | flash_otp_write -u /dev/mtd0 0x2d0 Writing OTP user data on /dev/mtd0 at offset 0x2d0 Wrote 8 bytes of OTP user data $ flash_otp_dump -u /dev/mtd0 0x2d0 OTP user data for /dev/mtd0 0x02d0: 6f 74 70 20 74 65 73 74 ff ff ff ff ff ff ff ff 0x02e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x02f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff $ flash_otp_erase -u /dev/mtd0 0x200 0x100 $ flash_otp_dump -u /dev/mtd0 0x2d0 OTP user data for /dev/mtd0 0x02d0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x02e0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 0x02f0: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff drivers/mtd/spi-nor/winbond.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/mtd/spi-nor/winbond.c b/drivers/mtd/spi-nor/winbond.c index ffaa24055259..ca39acf4112c 100644 --- a/drivers/mtd/spi-nor/winbond.c +++ b/drivers/mtd/spi-nor/winbond.c @@ -133,6 +133,9 @@ static const struct flash_info winbond_nor_parts[] = { { "w25m512jv", INFO(0xef7119, 0, 64 * 1024, 1024) NO_SFDP_FLAGS(SECT_4K | SPI_NOR_QUAD_READ | SPI_NOR_DUAL_READ) }, + { "w25q512nwq", INFO(0xef6020, 0, 0, 0) + PARSE_SFDP + OTP_INFO(256, 3, 0x1000, 0x1000) }, { "w25q512nwm", INFO(0xef8020, 0, 64 * 1024, 1024) PARSE_SFDP OTP_INFO(256, 3, 0x1000, 0x1000) }, -- 2.25.1 ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ 2022-07-16 0:06 ` [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ Jae Hyun Yoo @ 2022-07-16 9:11 ` Michael Walle 2022-07-16 13:30 ` Jae Hyun Yoo 0 siblings, 1 reply; 5+ messages in thread From: Michael Walle @ 2022-07-16 9:11 UTC (permalink / raw) To: Jae Hyun Yoo Cc: Tudor Ambarus, Pratyush Yadav, Jamie Iles, Graeme Gregory, Cédric Le Goater, linux-mtd, linux-kernel Hi, Am 2022-07-16 02:06, schrieb Jae Hyun Yoo: > Add support for Winbond W25Q512NW-IQ/IN > > Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> > Link: > https://www.winbond.com/resource-files/W25Q512NW%20RevB%2007192021.pdf > Reviewed-by: Cédric Le Goater <clg@kaod.org> Thanks again for finding the real issue here! Reviewed-by: Michael Walle <michael@walle.cc> But also see below. > $ hexdump > /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/sfdp > 0000000 4653 5044 0106 ff01 0600 1001 0080 ff00 > 0000010 0084 0201 00d0 ff00 ffff ffff ffff ffff > 0000020 6f00 7074 7420 7365 ff74 ffff ffff ffff Did you noticed your SFDP data changed compared to: https://lore.kernel.org/linux-mtd/20220710145721.1207157-1-quic_jaehyoo@quicinc.com/ Which makes me wonder if you ever had an offset 0 with the OTP_INFO(). For Winbond the first OTP region is actually the SFDP.. So you might accidentally modified it. -michael ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ 2022-07-16 9:11 ` Michael Walle @ 2022-07-16 13:30 ` Jae Hyun Yoo 0 siblings, 0 replies; 5+ messages in thread From: Jae Hyun Yoo @ 2022-07-16 13:30 UTC (permalink / raw) To: Michael Walle Cc: Tudor Ambarus, Pratyush Yadav, Jamie Iles, Graeme Gregory, Cédric Le Goater, linux-mtd, linux-kernel Hi, On 7/16/2022 2:11 AM, Michael Walle wrote: > Hi, > > Am 2022-07-16 02:06, schrieb Jae Hyun Yoo: >> Add support for Winbond W25Q512NW-IQ/IN >> >> Signed-off-by: Jae Hyun Yoo <quic_jaehyoo@quicinc.com> >> Link: >> https://www.winbond.com/resource-files/W25Q512NW%20RevB%2007192021.pdf >> Reviewed-by: Cédric Le Goater <clg@kaod.org> > > Thanks again for finding the real issue here! > > Reviewed-by: Michael Walle <michael@walle.cc> Thanks for your review! > But also see below. > >> $ hexdump >> /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/sfdp >> >> 0000000 4653 5044 0106 ff01 0600 1001 0080 ff00 >> 0000010 0084 0201 00d0 ff00 ffff ffff ffff ffff >> 0000020 6f00 7074 7420 7365 ff74 ffff ffff ffff > > Did you noticed your SFDP data changed compared to: > https://lore.kernel.org/linux-mtd/20220710145721.1207157-1-quic_jaehyoo@quicinc.com/ > > > Which makes me wonder if you ever had an offset 0 > with the OTP_INFO(). For Winbond the first OTP > region is actually the SFDP.. So you might > accidentally modified it. Indeed. Looks like the region got modified while I was testing OTP. Please see below. I took the sfdp dump from a new clean part. $ hexdump /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/sfdp 0000000 4653 5044 0106 ff01 0600 1001 0080 ff00 0000010 0084 0201 00d0 ff00 ffff ffff ffff ffff 0000020 ffff ffff ffff ffff ffff ffff ffff ffff * 0000080 20e5 fffb ffff 1fff eb44 6b08 3b08 bb42 0000090 fffe ffff ffff 0000 ffff eb40 200c 520f 00000a0 d810 0000 0233 00a6 e781 d914 63e9 3376 00000b0 757a 757a bdf7 5cd5 f719 ff5d 70e9 a5f9 00000c0 ffff ffff ffff ffff ffff ffff ffff ffff 00000d0 0aff fff0 ff21 ffdc 00000d8 $ md5sum /sys/bus/platform/devices/1e620000.spi/spi_master/spi0/spi0.1/spi-nor/sfdp 347f0027ec5a09e8e78d5685485cceed Thanks, Jae ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 5+ messages in thread
* (subset)Re: [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size 2022-07-16 0:06 [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Jae Hyun Yoo 2022-07-16 0:06 ` [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ Jae Hyun Yoo @ 2022-11-21 15:24 ` Tudor Ambarus 1 sibling, 0 replies; 5+ messages in thread From: Tudor Ambarus @ 2022-11-21 15:24 UTC (permalink / raw) To: michael, quic_jaehyoo, p.yadav Cc: Tudor Ambarus, clg, linux-mtd, linux-kernel, quic_ggregory, quic_jiles On Fri, 15 Jul 2022 17:06:42 -0700, Jae Hyun Yoo wrote: > From: Michael Walle <michael@walle.cc> > > 4bait will set the erase size to 0 if there is no corresponding > opcode for the 4byte erase. Fix spi_nor_select_uniform_erase to skip > the 0 erase size to avoid mtd device registration failure cases. > > > [...] Applied [2/2] to spi-nor/next, thanks! I haven't applied 1/2 as Michael sent a similar patch which I had already taken at the time I got to your patch set, see: https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git/commit/?id=39eece67a3cf Sorry! [2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ https://git.kernel.org/mtd/c/ef434f08b056 Best regards, -- Tudor Ambarus <tudor.ambarus@microchip.com> ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2022-11-21 15:32 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2022-07-16 0:06 [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Jae Hyun Yoo 2022-07-16 0:06 ` [PATCH v3 2/2] mtd: spi-nor: winbond: add support for W25Q512NW-IQ Jae Hyun Yoo 2022-07-16 9:11 ` Michael Walle 2022-07-16 13:30 ` Jae Hyun Yoo 2022-11-21 15:24 ` (subset)Re: [PATCH v3 1/2] mtd: spi-nor: fix select_uniform_erase to skip 0 erase size Tudor Ambarus
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).