linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Tudor Ambarus <tudor.ambarus@linaro.org>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	Pratyush Yadav <pratyush@kernel.org>,
	Michael Walle <michael@walle.cc>,
	linux-mtd@lists.infradead.org,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Subject: Re: [PATCH v3] mtd: spi-nor: Add support for sst26vf032b flash
Date: Thu, 13 Jul 2023 09:34:25 +0200	[thread overview]
Message-ID: <20230713093425.02188b71@xps-13> (raw)
In-Reply-To: <8b7d2420-26b6-405b-8ef7-75e0a0201402@linaro.org>

Hi Tudor,

tudor.ambarus@linaro.org wrote on Thu, 13 Jul 2023 05:20:01 +0300:

> Hi, Miquel,
> 
> On 12.07.2023 19:15, Miquel Raynal wrote:
> > Describe this new part. The datasheet is public.
> > 
> > Link: https://ww1.microchip.com/downloads/aemDocuments/documents/MPD/ProductDocuments/DataSheets/SST26VF032B-SST26VF032BA-2.5V-3.0V-32-Mbit-Serial-Quad-IO-%28SQI%29-Flash-Memory-20005218K.pdf
> > 
> > Here are the sfdp tables plus base testing to show it works.
> > 
> > $ cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
> > sst26vf032b
> > $ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
> > bf2642
> > $ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
> > sst
> > $ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> > 53464450060102ff00060110300000ff81000106000100ffbf0001180002
> > 0001fffffffffffffffffffffffffffffffffd20f1ffffffff0144eb086b
> > 083b80bbfeffffffffff00ffffff440b0c200dd80fd810d820914824806f
> > 1d81ed0f773830b030b0f7ffffff29c25cfff030c080ffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffff0004fff37f0000f57f0000f9ff
> > 3d00f57f0000f37f0000ffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
> > ffffbf2642ffb95ffdff30f260f332ff0a122346ff0f19320f1919ffffff
> > ffffffff00669938ff05013506040232b03072428de89888a585c09faf5a
> > ffff06ec060c0003080bffffffffff07ffff0202ff060300fdfd040600fc
> > 0300fefe0202070e
> > $ md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> > e7efddddb3d5ee89ca37bf6b6e789645  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
> > 
> > $ dd if=/dev/urandom of=./qspi_test bs=1M count=1
> > 1+0 records in
> > 1+0 records out
> > $ mtd_debug write /dev/mtd0 0 1048576 qspi_test
> > Copied 1048576 bytes from qspi_test to address 0x00000000 in flash
> > $ mtd_debug erase /dev/mtd0 0 1048576
> > Erased 1048576 bytes from address 0x00000000 in flash
> > $ mtd_debug read /dev/mtd0 0 1048576 qspi_read
> > Copied 1048576 bytes from address 0x00000000 in flash to qspi_read
> > $ hexdump qspi_read
> > 0000000 ffff ffff ffff ffff ffff ffff ffff ffff
> > *
> > 0100000
> > $ mtd_debug write /dev/mtd0 0 1048576 qspi_test
> > Copied 1048576 bytes from qspi_test to address 0x00000000 in flash
> > $ mtd_debug read /dev/mtd0 0 1048576 qspi_read
> > Copied 1048576 bytes from address 0x00000000 in flash to qspi_read
> > $ sha1sum qspi_test qspi_read
> > 2f2f191c7a937eca5db21a1c39e79e7327587cc1  qspi_test
> > 2f2f191c7a937eca5db21a1c39e79e7327587cc1  qspi_read
> > 
> > Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> > ---
> > 
> > Changes in v3:
> > * Dropped the second patch (untested changes as advised by Tudor).  
> 
> thanks
> > * Avoided playing with locking as I cannot test it either: simplified
> >   the diff by just using the PARSE_SFDP flag.> * Rebased on top of -rc1 and adapted the patch to the current state.
> > 
> >  drivers/mtd/spi-nor/sst.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c
> > index 688eb20c763e..754e49f7ac33 100644
> > --- a/drivers/mtd/spi-nor/sst.c
> > +++ b/drivers/mtd/spi-nor/sst.c
> > @@ -111,6 +111,8 @@ static const struct flash_info sst_nor_parts[] = {
> >  			      SPI_NOR_QUAD_READ) },
> >  	{ "sst26vf016b", INFO(0xbf2641, 0, 64 * 1024, 32)
> >  		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ) },
> > +	{ "sst26vf032b", INFO(0xbf2642, 0, 0, 0)
> > +		PARSE_SFDP  
> 
> if it's just a matter of PARSE_SFDP flag then this flash is a candidate
> for the SPI NOR generic driver, we don't need an explicit flash
> declaration for it.
> 
> But I assume you need
> .fixups = &sst26vf_nor_fixups
> otherwise the flash comes write protected by default at boot, thus
> erases/writes will be ignored. Are you positive you run the tests again
> for v3?

I tested the initial submissions with a l4m kernel, because the
board does not boot well on a vanilla kernel, I did rebase on v6.5-rc1
and figured a number of flags got removed on one part, so I also
removed them from my submission, and on the other part I figured the
l4m kernel was carrying alone a change adding the .fixup for the 16b
variant, which was not upstream. The commit log basically says "we need
the fixup because we enabled the "HAS_LOCK" flag, IIRC. I don't use
this feature, I don't think the flash uses it on my design (not 100%
sure for that, maybe a wrong interpretation on my side) so as you
prefer to not have untested changes I dropped the fixup as well because
I cannot be sure it serves a purpose/is useful.

I will try to clarify all that.

> 
> Cheers,
> ta
> >  	{ "sst26vf064b", INFO(0xbf2643, 0, 64 * 1024, 128)
> >  		FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE)
> >  		NO_SFDP_FLAGS(SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ)  


Thanks,
Miquèl

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

      parent reply	other threads:[~2023-07-13  7:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-12 16:15 [PATCH v3] mtd: spi-nor: Add support for sst26vf032b flash Miquel Raynal
2023-07-12 21:18 ` Michael Walle
2023-07-13  2:20 ` Tudor Ambarus
2023-07-13  7:08   ` Michael Walle
2023-07-13  7:34   ` Miquel Raynal [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230713093425.02188b71@xps-13 \
    --to=miquel.raynal@bootlin.com \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tudor.ambarus@linaro.org \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).