diff mbox series

[v3,20/25] mtd: spi-nor: sst: sst26vf064b: Init flash based on SFDP

Message ID 20211029172633.886453-21-tudor.ambarus@microchip.com (mailing list archive)
State New, archived
Headers show
Series mtd: spi-nor: Clean params init | expand

Commit Message

Tudor Ambarus Oct. 29, 2021, 5:26 p.m. UTC
Get rid of the static initialization of the flash parameters and
init them when parsing SFDP.
Generated a 256 Kbyte random data and did an erase, write, read back
and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb,
for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
 drivers/mtd/spi-nor/sst.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Tudor Ambarus Oct. 29, 2021, 5:31 p.m. UTC | #1
On 10/29/21 8:26 PM, Tudor Ambarus wrote:
> Get rid of the static initialization of the flash parameters and
> init them when parsing SFDP.
> Generated a 256 Kbyte random data and did an erase, write, read back
> and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb,
> for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02.
> 
> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
> ---

root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id
bf2643
root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer
sst
root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname
sst26vf064b
root@sama5d2-xplained:~# cat /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp > sst26vf064b-sfdp
root@sama5d2-xplained:~# hexdump sst26vf064b-sfdp 
0000000 4653 5044 0106 ff02 0600 1001 0030 ff00
0000010 0081 0601 0100 ff00 00bf 1801 0200 0100
0000020 ffff ffff ffff ffff ffff ffff ffff ffff
0000030 20fd fff1 ffff 03ff eb44 6b08 3b08 bb80
0000040 fffe ffff ffff ff00 ffff 0b44 200c d80d
0000050 d80f d810 9120 2448 6f80 811d 0fed 3877
0000060 b030 b030 fff7 ffff c229 ff5c 30f0 80c0
0000070 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000100 00ff ff04 7ff3 0000 7ff5 0000 fff9 007d
0000110 7ff5 0000 7ff3 0000 ffff ffff ffff ffff
0000120 ffff ffff ffff ffff ffff ffff ffff ffff
*
0000200 26bf ff43 5fb9 fffd f230 f360 ff32 120a
0000210 4623 0fff 3219 190f ff19 ffff ffff ffff
0000220 6600 3899 05ff 3501 0406 3202 30b0 4272
0000230 e88d 8898 85a5 9fc0 5aaf ffff ec06 0c06
0000240 0300 0b08 ffff ffff 07ff ffff 0202 06ff
0000250 0003 fdfd 0704 fc00 0003 fefe 0202 0e07
0000260

>  drivers/mtd/spi-nor/sst.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
Michael Walle Nov. 9, 2021, 12:25 p.m. UTC | #2
Am 2021-10-29 19:31, schrieb Tudor.Ambarus@microchip.com:
> On 10/29/21 8:26 PM, Tudor Ambarus wrote:
>> Get rid of the static initialization of the flash parameters and
>> init them when parsing SFDP.
>> Generated a 256 Kbyte random data and did an erase, write, read back
>> and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb,
>> for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02.
>> 
>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>> ---
> 
> root@sama5d2-xplained:~# cat
> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id
> bf2643
> root@sama5d2-xplained:~# cat
> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer
> sst
> root@sama5d2-xplained:~# cat
> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname
> sst26vf064b
> root@sama5d2-xplained:~# cat
> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp
> > sst26vf064b-sfdp
> root@sama5d2-xplained:~# hexdump sst26vf064b-sfdp

xxd please, and md5sum or sha256sum or really any
checksum is missing.

same goes for the other flashes.

-michael
Tudor Ambarus Nov. 9, 2021, 12:33 p.m. UTC | #3
On 11/9/21 2:25 PM, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> 
> Am 2021-10-29 19:31, schrieb Tudor.Ambarus@microchip.com:
>> On 10/29/21 8:26 PM, Tudor Ambarus wrote:
>>> Get rid of the static initialization of the flash parameters and
>>> init them when parsing SFDP.
>>> Generated a 256 Kbyte random data and did an erase, write, read back
>>> and compare test. The flash uses for reads SPINOR_OP_READ_1_4_4 0xeb,
>>> for erases SPINOR_OP_BE_4K 0x20, and for writes SPINOR_OP_PP 0x02.
>>>
>>> Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
>>> ---
>>
>> root@sama5d2-xplained:~# cat
>> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/jedec_id
>> bf2643
>> root@sama5d2-xplained:~# cat
>> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/manufacturer
>> sst
>> root@sama5d2-xplained:~# cat
>> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/partname
>> sst26vf064b
>> root@sama5d2-xplained:~# cat
>> /sys/devices/platform/ahb/ahb:apb/f0020000.spi/spi_master/spi1/spi1.0/spi-nor/sfdp
>> > sst26vf064b-sfdp
>> root@sama5d2-xplained:~# hexdump sst26vf064b-sfdp
> 
> xxd please, and md5sum or sha256sum or really any
> checksum is missing.
> 

right, I forgot the checksum.
Just curious, why do you prefer xxd over hexdump? Does it matter
which tool we use?

> same goes for the other flashes.

ok, will do.
Michael Walle Nov. 9, 2021, 12:37 p.m. UTC | #4
Am 2021-11-09 13:33, schrieb Tudor.Ambarus@microchip.com:

>> xxd please, and md5sum or sha256sum or really any
>> checksum is missing.
>> 
> 
> right, I forgot the checksum.
> Just curious, why do you prefer xxd over hexdump? Does it matter
> which tool we use?

xxd can do the reverse and its easier to get the binary version
of it again. also, if you use hexdump without -C (or -c) I'm not
sure about the endianess.

-michael
diff mbox series

Patch

diff --git a/drivers/mtd/spi-nor/sst.c b/drivers/mtd/spi-nor/sst.c
index 40e55b531edb..b3fd54b24e25 100644
--- a/drivers/mtd/spi-nor/sst.c
+++ b/drivers/mtd/spi-nor/sst.c
@@ -199,8 +199,9 @@  static const struct flash_info sst_parts[] = {
 	{ "sst26vf016b", INFO(0xbf2641, 0, 64 * 1024, 32,
 			      SECT_4K | SPI_NOR_DUAL_READ) },
 	{ "sst26vf064b", INFO(0xbf2643, 0, 64 * 1024, 128,
-			      SECT_4K | SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ |
-			      SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE)
+			      SPI_NOR_PARSE_SFDP |
+			      NON_SFDP_FLAGS(SPI_NOR_HAS_LOCK |
+					     SPI_NOR_SWP_IS_VOLATILE))
 		.fixups = &sst26vf_fixups },
 };