public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: <nicolas.ferre@microchip.com>
To: Tudor Ambarus <tudor.ambarus@linaro.org>,
	<miquel.raynal@bootlin.com>, <linux-mtd@lists.infradead.org>
Cc: <linux-arm-kernel@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Nicolas Ferre <nicolas.ferre@microchip.com>
Subject: [PATCH v2] mtd: spi-nor: atmel: add at25ff321a entry
Date: Tue, 26 Sep 2023 15:16:55 +0200	[thread overview]
Message-ID: <20230926131655.51224-1-nicolas.ferre@microchip.com> (raw)

From: Nicolas Ferre <nicolas.ferre@microchip.com>

Add the at25ff321a 4MB SPI flash which is able to provide
SFDP informations.
Datasheet: https://www.renesas.com/us/en/document/dst/at25ff321a-datasheet

Signed-off-by: Nicolas Ferre <nicolas.ferre@microchip.com>
---
v1 -> v2: - adapt to new struct flash_info atmel_nor_parts init
	  - don't set the no_sfdp_flags property

Hi,

This flash is present on the MikoE flash 10 Click board and was tested on
sama7g5-ek at spi frequency of 80 MHz:

Here are the tests that I ran:
root@sama5d27-wlsom1-ek-sd:~# dd if=/dev/urandom of=./spi_test bs=1M count=3
3+0 records in
3+0 records out
3145728 bytes (3.1 MB, 3.0 MiB) copied, 0.285407 s, 11.0 MB/s
root@sama5d27-wlsom1-ek-sd:~# mtd_debug write /dev/mtd0 0 3145728 spi_test
Copied 3145728 bytes from spi_test to address 0x00000000 in flash
root@sama5d27-wlsom1-ek-sd:~# mtd_debug erase /dev/mtd0 0 3145728
Erased 3145728 bytes from address 0x00000000 in flash
root@sama5d27-wlsom1-ek-sd:~# mtd_debug read /dev/mtd0 0 3145728 spi_read
Copied 3145728 bytes from address 0x00000000 in flash to spi_read
root@sama5d27-wlsom1-ek-sd:~# hexdump spi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0300000
root@sama5d27-wlsom1-ek-sd:~# mtd_debug write /dev/mtd0 0 3145728 spi_test
Copied 3145728 bytes from spi_test to address 0x00000000 in flash
root@sama5d27-wlsom1-ek-sd:~# mtd_debug read /dev/mtd0 0 3145728 spi_read
Copied 3145728 bytes from address 0x00000000 in flash to spi_read
root@sama5d27-wlsom1-ek-sd:~# sha1sum spi_test spi_read
4de5dbe39ab24b169e9dad01a8cc12c4756270a2  spi_test
4de5dbe39ab24b169e9dad01a8cc12c4756270a2  spi_read

root@sama5d27-wlsom1-ek-sd:~# cat /sys/bus/spi/devices/spi0.1/spi-nor/partname
at25ff321a
root@sama5d27-wlsom1-ek-sd:~# cat /sys/bus/spi/devices/spi0.1/spi-nor/jedec_id
1f4708
root@sama5d27-wlsom1-ek-sd:~# cat /sys/bus/spi/devices/spi0.1/spi-nor/manufacturer
atmel
root@sama5d27-wlsom1-ek-sd:~# hexdump -C /sys/bus/spi/devices/spi0.1/spi-nor/sfdp
00000000  53 46 44 50 06 01 00 ff  00 06 01 10 10 00 00 ff  |SFDP............|
00000010  e5 20 e1 ff ff ff ff 01  40 eb 08 6b 08 3b 00 ff  |. ......@..k.;..|
00000020  ee ff ff ff ff ff 00 ff  ff ff 00 ff 0c 20 0f 52  |............. .R|
00000030  10 d8 00 ff 50 2a 2a 01  82 ff 9c d2 64 c1 08 46  |....P**.....d..F|
00000040  7a 75 7a 75 f7 c4 d5 5c  00 06 51 ff 88 30 00 00  |zuzu...\..Q..0..|
00000050
root@sama5d27-wlsom1-ek-sd:~# md5sum /sys/bus/spi/devices/spi0.1/spi-nor/sfdp
d540f07cbfb7c9c19654c453b561b311  /sys/bus/spi/devices/spi0.1/spi-nor/sfdp

# # CONFIG_MTD_SPI_NOR_USE_4K_SECTORS is not set
root@sama5d27-wlsom1-ek-sd:~# mtdinfo /dev/mtd0
mtd0
Name:                           spi0.1
Type:                           nor
Eraseblock size:                65536 bytes, 64.0 KiB
Amount of eraseblocks:          64 (4194304 bytes, 4.0 MiB)
Minimum input/output unit size: 1 byte
Sub-page size:                  1 byte
Character device major/minor:   90:0
Bad blocks are allowed:         false
Device is writable:             true

Best regards,
  Nicolas

 drivers/mtd/spi-nor/atmel.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/mtd/spi-nor/atmel.c b/drivers/mtd/spi-nor/atmel.c
index 95f0e139284e..e13b8d2dd50a 100644
--- a/drivers/mtd/spi-nor/atmel.c
+++ b/drivers/mtd/spi-nor/atmel.c
@@ -213,6 +213,11 @@ static const struct flash_info atmel_nor_parts[] = {
 		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE,
 		.no_sfdp_flags = SECT_4K,
 		.fixups = &atmel_nor_global_protection_fixups
+	}, {
+		.id = SNOR_ID(0x1f, 0x47, 0x08),
+		.name = "at25ff321a",
+		.flags = SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE,
+		.fixups = &atmel_nor_global_protection_fixups
 	}, {
 		.id = SNOR_ID(0x1f, 0x48, 0x00),
 		.name = "at25df641",
-- 
2.39.2


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

             reply	other threads:[~2023-09-26 13:18 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26 13:16 nicolas.ferre [this message]
2023-09-27  8:47 ` [PATCH v2] mtd: spi-nor: atmel: add at25ff321a entry Tudor Ambarus

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=20230926131655.51224-1-nicolas.ferre@microchip.com \
    --to=nicolas.ferre@microchip.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=tudor.ambarus@linaro.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