2022-05-14 04:06:56

by Michael Walle

[permalink] [raw]
Subject: [PATCH 0/6] mtd: spi-nor: generic flash driver

Add a generic flash driver, which is used when we don't find a matching
flash in our database. All the basic features of a flash can be discovered
by SFDP and most (if not all) newer flashes support it.

Michael Walle (6):
mtd: spi-nor: hide jedec_id sysfs attribute if not present
mtd: spi-nor: sysfs: hide manufacturer if it is not set
mtd: spi-nor: remember full JEDEC flash ID
mtd: spi-nor: move function declaration out of sfdp.h
mtd: spi-nor: add generic flash driver
mtd: spi-nor: sysfs: print JEDEC ID for generic flash driver

.../ABI/testing/sysfs-bus-spi-devices-spi-nor | 6 +++++
drivers/mtd/spi-nor/core.c | 18 +++++++++++++
drivers/mtd/spi-nor/core.h | 3 +++
drivers/mtd/spi-nor/debugfs.c | 2 +-
drivers/mtd/spi-nor/sfdp.c | 27 +++++++++++++++++++
drivers/mtd/spi-nor/sfdp.h | 2 --
drivers/mtd/spi-nor/sysfs.c | 20 +++++++++++++-
include/linux/mtd/spi-nor.h | 3 +++
8 files changed, 77 insertions(+), 4 deletions(-)

--
2.30.2



2022-05-14 04:19:00

by Michael Walle

[permalink] [raw]
Subject: [PATCH 4/6] mtd: spi-nor: move function declaration out of sfdp.h

sfdp.h should only contain constants related to the JEDEC SFDP
specification(s).

Signed-off-by: Michael Walle <[email protected]>
---
drivers/mtd/spi-nor/core.h | 2 ++
drivers/mtd/spi-nor/sfdp.h | 2 --
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 61886868cd02..3a19b8092ab8 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -694,6 +694,8 @@ int spi_nor_controller_ops_read_reg(struct spi_nor *nor, u8 opcode,
int spi_nor_controller_ops_write_reg(struct spi_nor *nor, u8 opcode,
const u8 *buf, size_t len);

+int spi_nor_parse_sfdp(struct spi_nor *nor);
+
static inline struct spi_nor *mtd_to_spi_nor(struct mtd_info *mtd)
{
return container_of(mtd, struct spi_nor, mtd);
diff --git a/drivers/mtd/spi-nor/sfdp.h b/drivers/mtd/spi-nor/sfdp.h
index bbf80d2990ab..c1969f0a2f46 100644
--- a/drivers/mtd/spi-nor/sfdp.h
+++ b/drivers/mtd/spi-nor/sfdp.h
@@ -107,6 +107,4 @@ struct sfdp_parameter_header {
u8 id_msb;
};

-int spi_nor_parse_sfdp(struct spi_nor *nor);
-
#endif /* __LINUX_MTD_SFDP_H */
--
2.30.2


2022-07-26 08:10:05

by Tudor Ambarus

[permalink] [raw]
Subject: Re: [PATCH 0/6] mtd: spi-nor: generic flash driver

Hi, Takahiro,

Would you please review this patch set?

Thanks,
ta

On 5/13/22 16:35, Michael Walle wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
>
> Add a generic flash driver, which is used when we don't find a matching
> flash in our database. All the basic features of a flash can be discovered
> by SFDP and most (if not all) newer flashes support it.
>
> Michael Walle (6):
> mtd: spi-nor: hide jedec_id sysfs attribute if not present
> mtd: spi-nor: sysfs: hide manufacturer if it is not set
> mtd: spi-nor: remember full JEDEC flash ID
> mtd: spi-nor: move function declaration out of sfdp.h
> mtd: spi-nor: add generic flash driver
> mtd: spi-nor: sysfs: print JEDEC ID for generic flash driver
>
> .../ABI/testing/sysfs-bus-spi-devices-spi-nor | 6 +++++
> drivers/mtd/spi-nor/core.c | 18 +++++++++++++
> drivers/mtd/spi-nor/core.h | 3 +++
> drivers/mtd/spi-nor/debugfs.c | 2 +-
> drivers/mtd/spi-nor/sfdp.c | 27 +++++++++++++++++++
> drivers/mtd/spi-nor/sfdp.h | 2 --
> drivers/mtd/spi-nor/sysfs.c | 20 +++++++++++++-
> include/linux/mtd/spi-nor.h | 3 +++
> 8 files changed, 77 insertions(+), 4 deletions(-)
>
> --
> 2.30.2
>


--
Cheers,
ta

2022-07-26 23:45:04

by Takahiro Kuwano

[permalink] [raw]
Subject: Re: [PATCH 4/6] mtd: spi-nor: move function declaration out of sfdp.h

On 5/13/2022 10:35 PM, Michael Walle wrote:
> sfdp.h should only contain constants related to the JEDEC SFDP
> specification(s).
>
> Signed-off-by: Michael Walle <[email protected]>

I think sfdp.h can contain declaration for a function implemented in sfdp.c,
but not a strong preference.

Reviewed-by: Takahiro Kuwano <[email protected]>

Thanks,
Takahiro

2022-07-29 02:30:00

by Takahiro Kuwano

[permalink] [raw]
Subject: Re: [PATCH 0/6] mtd: spi-nor: generic flash driver

Hi Tudor and Michael,

On 7/26/2022 5:06 PM, [email protected] wrote:
> Hi, Takahiro,
>
> Would you please review this patch set?
>
I tested a Flash device that is not yet in the database.
https://www.infineon.com/dgdl/Infineon-S25FS256T_256Mb_SEMPER_Nano_Flash_Quad_SPI_1.8V-DataSheet-v01_00-EN.pdf?fileId=8ac78c8c80027ecd0180740c5a46707a&da=t

And it works fine.


zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
spi-nor-generic
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
342b190f0890
zynq> cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
spansion
zynq> xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450080101ff00000114000100ff84000102500100ffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
ffffffffffffffffffffffffffffffffe7ffe2ffffffff0f48eb086bffff
ffffeeffffffffff00ffffff00ff11d810d800ff00ff321cfeff71e9ffe1
ec031c607a757a75f766805c00d65dfff938c0a100000000000000000000
0000ffffffff710600fedcdcffff
zynq> md5sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
13ecce2f195c4c71648e90d4a7e4a0df /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
zynq> test_qspi.sh
6+0 records in
6+0 records out
6291456 bytes (6.0MB) copied, 0.231887 seconds, 25.9MB/s
Copied 6291456 bytes from qspi_test to address 0x00000000 in flash
Erased 6291456 bytes from address 0x00000000 in flash
Copied 6291456 bytes from address 0x00000000 in flash to qspi_read
0000000 ffff ffff ffff ffff ffff ffff ffff ffff
*
0600000
Copied 6291456 bytes from qspi_test to address 0x00000000 in flash
Copied 6291456 bytes from address 0x00000000 in flash to qspi_read
20b1c32188a5e337ef7575ffb5e4fa424f6bf5a9 qspi_test
20b1c32188a5e337ef7575ffb5e4fa424f6bf5a9 qspi_read


Thanks,
Takahiro

2022-07-29 05:53:42

by Tudor Ambarus

[permalink] [raw]
Subject: Re: [PATCH 0/6] mtd: spi-nor: generic flash driver

On 7/29/22 04:52, Takahiro Kuwano wrote:
> Hi Tudor and Michael,

Hi!

>
> On 7/26/2022 5:06 PM, [email protected] wrote:
>> Hi, Takahiro,
>>
>> Would you please review this patch set?
>>
> I tested a Flash device that is not yet in the database.
> https://www.infineon.com/dgdl/Infineon-S25FS256T_256Mb_SEMPER_Nano_Flash_Quad_SPI_1.8V-DataSheet-v01_00-EN.pdf?fileId=8ac78c8c80027ecd0180740c5a46707a&da=t
>
> And it works fine.

Cool, thanks for the involvement!

Michael, I'll consider to include this once the merge window is open.
I'll stop queuing patches for now as we're late in the release cycle.

--
Cheers,
ta