mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tudor Ambarus <tudor.ambarus@linaro.org>
To: Pratyush Yadav <pratyush@kernel.org>
Cc: michael@walle.cc, linux-mtd@lists.infradead.org,
	linux-doc@vger.kernel.org, corbet@lwn.net,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] docs: mtd: spi-nor: add sections about flash additions and testing
Date: Fri, 24 Nov 2023 15:57:04 +0000	[thread overview]
Message-ID: <42cc0ae2-d61a-41cc-b46e-132dace301b0@linaro.org> (raw)
In-Reply-To: <mafs0sf4vdxqd.fsf@kernel.org>



On 11/24/23 14:36, Pratyush Yadav wrote:
> Hi,
> 
> 
> On Thu, Nov 23 2023, Tudor Ambarus wrote:
> 
>> Add sections about how to propose a new flash addition and about the
>> minimum testing requirements.
>>
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
>> ---
>>  Documentation/driver-api/mtd/spi-nor.rst | 189 +++++++++++++++++++++++
>>  1 file changed, 189 insertions(+)
>>
>> diff --git a/Documentation/driver-api/mtd/spi-nor.rst b/Documentation/driver-api/mtd/spi-nor.rst
>> index c22f8c0f7950..cc8e81e09544 100644
>> --- a/Documentation/driver-api/mtd/spi-nor.rst
>> +++ b/Documentation/driver-api/mtd/spi-nor.rst
>> @@ -63,3 +63,192 @@ The main API is spi_nor_scan(). Before you call the hook, a driver should
>>  initialize the necessary fields for spi_nor{}. Please see
>>  drivers/mtd/spi-nor/spi-nor.c for detail. Please also refer to spi-fsl-qspi.c
>>  when you want to write a new driver for a SPI NOR controller.
> [...]
>> +4/ Use `mtd-utils <https://git.infradead.org/mtd-utils.git>`__
>> +and verify that erase, read and page program operations work fine.
>> +
>> +a/ Generate a 2 MB file::
>> +
>> +    root@1:~# dd if=/dev/urandom of=./spi_test bs=1M count=2
>> +    2+0 records in
>> +    2+0 records out
>> +    2097152 bytes (2.1 MB, 2.0 MiB) copied, 0.848566 s, 2.5 MB/s
>> +
>> +b/ Verify erase::
>> +
>> +    root@1:~# mtd_debug write /dev/mtd1 0 2097152 spi_test
>> +    Copied 2097152 bytes from spi_test to address 0x00000000 in flash
> 
> Perhaps mention that the 2 MiB region should already be erased.
> Otherwise some flashes might refuse the writes (like the ones with ECC

right, then maybe we could do a

/erase
/read
/dump and see 0xff
/sha1sum to have the 0xff checksum
/write
/read what was written
/sha1sum on the read to make it's different that the 0xff checksum and
that the write worked

> -- Cypress S28 family comes to mind). Experienced engineers should know
> this already but it might trip up some beginners.
> 
> Looks good otherwise. Thanks for working on this.
> 
> Reviewed-by: Pratyush Yadav <pratyush@kernel.org>
> 
>> +
>> +    root@1:~# mtd_debug erase /dev/mtd1 0 2097152
>> +    Erased 2097152 bytes from address 0x00000000 in flash
>> +
>> +    root@1:~# mtd_debug read /dev/mtd1 0 2097152 spi_read
>> +    Copied 2097152 bytes from address 0x00000000 in flash to spi_read
>> +
>> +    root@1:~# hexdump -C spi_read
>> +    00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
>> +    *
>> +    00200000
>> +
> [...]
> 

  reply	other threads:[~2023-11-24 15:57 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-23 16:07 [PATCH 0/2] " Tudor Ambarus
2023-11-23 16:07 ` [PATCH 1/2] " Tudor Ambarus
2023-11-23 16:14   ` Michael Walle
2023-11-24  7:12   ` Bagas Sanjaya
2023-11-24 17:01     ` Tudor Ambarus
2023-11-24 14:36   ` Pratyush Yadav
2023-11-24 15:57     ` Tudor Ambarus [this message]
2023-11-23 16:07 ` [PATCH 2/2] docs: mtd: spi-nor: drop obsolete info Tudor Ambarus
2023-11-23 16:15   ` Michael Walle
2023-11-24 14:38   ` Pratyush Yadav

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=42cc0ae2-d61a-41cc-b46e-132dace301b0@linaro.org \
    --to=tudor.ambarus@linaro.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michael@walle.cc \
    --cc=pratyush@kernel.org \
    /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

all inboxes | Powered by JetHome®