mirror of https://lore.kernel.org/lkml/
 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] mtd: spi-nor: atmel: add at25ff321a entry
Date: Fri, 8 Sep 2023 17:14:00 +0200	[thread overview]
Message-ID: <20230908151400.164470-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>
---
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 is the test I ran:
root@sama7g5ek-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.932896 s, 3.4 MB/s
root@sama7g5ek-sd:~# mtd_debug write /dev/mtd0 0 3145728 spi_test 
Copied 3145728 bytes from spi_test to address 0x00000000 in flash
root@sama7g5ek-sd:~# mtd_debug erase /dev/mtd0 0 3145728 
Erased 3145728 bytes from address 0x00000000 in flash
root@sama7g5ek-sd:~# mtd_debug read /dev/mtd0 0 3145728 spi_read 
Copied 3145728 bytes from address 0x00000000 in flash to spi_read
root@sama7g5ek-sd:~# hexdump spi_read 
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0300000
root@sama7g5ek-sd:~# mtd_debug write /dev/mtd0 0 3145728 spi_test 
 Copied 3145728 bytes from spi_test to address 0x00000000 in flash
root@sama7g5ek-sd:~# mtd_debug read /dev/mtd0 0 3145728 spi_read 
Copied 3145728 bytes from address 0x00000000 in flash to spi_read
root@sama7g5ek-sd:~# sha1sum spi_test spi_read 
06d5459972d51a2ff4270e612270c6519e797a0b  spi_test
06d5459972d51a2ff4270e612270c6519e797a0b  spi_read

Here are the data from sysfs:

root@sama7g5ek-sd:~#  cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
at25ff321a
root@sama7g5ek-sd:~# cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
1f4708
root@sama7g5ek-sd:~# cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
atmel
root@sama7g5ek-sd:~# hexdump -C /sys/bus/spi/devices/spi0.0/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@sama7g5ek-sd:~# md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
d540f07cbfb7c9c19654c453b561b311  /sys/bus/spi/devices/spi0.0/spi-nor/sfdp

Best regards,
  Nicolas

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

diff --git a/drivers/mtd/spi-nor/atmel.c b/drivers/mtd/spi-nor/atmel.c
index 58968c1e7d2f..c94d52951481 100644
--- a/drivers/mtd/spi-nor/atmel.c
+++ b/drivers/mtd/spi-nor/atmel.c
@@ -184,6 +184,10 @@ 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 },
+	{ "at25ff321a", INFO(0x1f4708, 0, 64 * 1024,  64)
+		FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE)
+		PARSE_SFDP
+		.fixups = &atmel_nor_global_protection_fixups },
 	{ "at25df641",  INFO(0x1f4800, 0, 64 * 1024, 128)
 		FLAGS(SPI_NOR_HAS_LOCK | SPI_NOR_SWP_IS_VOLATILE)
 		NO_SFDP_FLAGS(SECT_4K)
-- 
2.39.2


             reply	other threads:[~2023-09-08 15:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-08 15:14 nicolas.ferre [this message]
2023-09-19 16:12 ` Tudor Ambarus
2023-09-20 16:16   ` Nicolas Ferre
2023-09-21  7:14     ` Tudor Ambarus
2023-09-26 12:59       ` Nicolas Ferre
2023-09-26 13:18         ` 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=20230908151400.164470-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

all inboxes | Powered by JetHome®