[PATCH] mtd: spi-nor: micron-st: Add support for mt25qu01g

Fabio Estevam festevam at gmail.com
Tue Oct 24 04:43:24 PDT 2023


Hi Michael and Tudor,

On Tue, Oct 24, 2023 at 6:26 AM Michael Walle <michael at walle.cc> wrote:

> > +             .id = SNOR_ID(0x20, 0xbb, 0x21, 0x10, 0x44, 0x00),
> > +             .name = "mt25qu01g",
> > +             .size = SZ_128M,
>
> Not needed, parsed by SFDP.
>
> > +             .flags = NO_CHIP_ERASE,
>
> Is it fair to assume that this is the usual case for multi die chips?
> See also,
> https://lore.kernel.org/linux-mtd/cover.1680849425.git.Takahiro.Kuwano@infineon.com/
>
> So "if n_dice > 1" will implicitly be NO_CHIP_ERASE. n_dice should be
> parsed from SFDP.
>
> > +             .no_sfdp_flags = SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ,
>
> .no_sfdp_flags are legacy and shouldn't be used with new flashes.

I tried your suggestion and tested with the change below:

--- a/drivers/mtd/spi-nor/micron-st.c
+++ b/drivers/mtd/spi-nor/micron-st.c
@@ -429,6 +429,10 @@ static const struct flash_info st_nor_parts[] = {
                         SPI_NOR_BP3_SR_BIT6,
                .no_sfdp_flags = SECT_4K | SPI_NOR_QUAD_READ,
                .mfr_flags = USE_FSR,
+       }, {
+               .id = SNOR_ID(0x20, 0xbb, 0x21, 0x10, 0x44, 0x00),
+               .name = "mt25qu01g",
+               .mfr_flags = USE_FSR,
        }, {
                .id = SNOR_ID(0x20, 0xbb, 0x21),
                .name = "n25q00a",

~# hexdump -C -n16 /dev/mtd0
00000000  01 02 03 04 05 ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000010
~# flash_erase /dev/mtd0 0 0
Erasing 131072 Kibyte @ 0 -- 100 % complete

The flash_erase operation completes immediately, but after checking the content
of the flash, I noticed that the original content is still there:

~# hexdump -C -n16 /dev/mtd0
00000000  01 02 03 04 05 ff ff ff  ff ff ff ff ff ff ff ff  |................|
00000010

With the original patch, the erase operation took about 2 minutes to
complete and the erase succeeded.

Below are the requested dumps, thanks.

Please let me know if you have any suggestions.

~# cat /sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/jedec_id
20bb21104400
~# cat /sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/manufacturer
st
~# cat /sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/partname
mt25qu01g
~# xxd -p  /sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp
53464450060101ff00060110300000ff84000102800000ffffffffffffff
ffffffffffffffffffffffffffffffffffffe520fbffffffff3f29eb276b
273b27bbffffffffffff27bbffff29eb0c2010d80f520000244a99008b8e
03e1ac0127387a757a75fbbdd55c4a0f82ff81bd3d36ffffffffffffffff
ffffffffffffffffffe7ffff21dcffff
~# md5sum  /sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp
9d28d1b11de8b15ba9152644219d9a78
/sys/devices/platform/soc at 0/30800000.bus/30bb0000.spi/spi_master/spi0/spi0.0/spi-nor/sfdp
~#



More information about the linux-mtd mailing list