* [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips
@ 2024-09-25 7:49 Erez Geva
2024-09-25 7:49 ` [PATCH 1/2] mtd: spi-nor: core: add manufacturer flags Erez Geva
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Erez Geva @ 2024-09-25 7:49 UTC (permalink / raw)
To: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle
Cc: linux-kernel, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Esben Haabendal, Erez Geva
From: Erez Geva <ErezGeva2@gmail.com>
Add reading SFDP to all Macronix chips.
All chips in the Macronix competabilites table
have a replacement chip that support SFDP.
Macronix stop producing any chip without SFDP 15 years ago.
The benefit of reading SFDP is by supporting
fater op-codes for newer chips.
This patch do not add an all flashes support.
This patch extend the already support of SFDP to all Macronix chips.
The new chips that reuse JEDEC IDs and chips that
are absend from the Macronix competabilites table.
The patch just remove the restriction!
Erez Geva (2):
mtd: spi-nor: core: add manufacturer flags
mtd: spi-nor: macronix: add manufacturer flags
drivers/mtd/spi-nor/core.c | 9 +++++----
drivers/mtd/spi-nor/core.h | 4 ++++
drivers/mtd/spi-nor/macronix.c | 1 +
3 files changed, 10 insertions(+), 4 deletions(-)
--
2.39.5
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread* [PATCH 1/2] mtd: spi-nor: core: add manufacturer flags
2024-09-25 7:49 [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Erez Geva
@ 2024-09-25 7:49 ` Erez Geva
2024-09-25 7:49 ` [PATCH 2/2] mtd: spi-nor: macronix: " Erez Geva
2024-09-26 7:22 ` [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Esben Haabendal
2 siblings, 0 replies; 5+ messages in thread
From: Erez Geva @ 2024-09-25 7:49 UTC (permalink / raw)
To: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle
Cc: linux-kernel, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Esben Haabendal, Erez Geva
From: Erez Geva <ErezGeva2@gmail.com>
Add flag for always trying reading SFDP.
Some vendors reuse all JEDEC IDs on manufacture table
with new chips that support SFDP.
In this patch series we use the new flags with Macronix.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
---
drivers/mtd/spi-nor/core.c | 9 +++++----
drivers/mtd/spi-nor/core.h | 4 ++++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 9d6e85bf227b..d77a356d6f40 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2891,10 +2891,11 @@ static void spi_nor_init_params_deprecated(struct spi_nor *nor)
spi_nor_manufacturer_init_params(nor);
- if (nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
- SPI_NOR_QUAD_READ |
- SPI_NOR_OCTAL_READ |
- SPI_NOR_OCTAL_DTR_READ))
+ if ((nor->info->no_sfdp_flags & (SPI_NOR_DUAL_READ |
+ SPI_NOR_QUAD_READ |
+ SPI_NOR_OCTAL_READ |
+ SPI_NOR_OCTAL_DTR_READ)) ||
+ nor->manufacturer->flags & SPI_NOR_MANUFACT_TRY_SFDP)
spi_nor_sfdp_init_params_deprecated(nor);
}
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 1516b6d0dc37..9237c4ed66cd 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -560,12 +560,16 @@ struct flash_info {
* @parts: array of parts supported by this manufacturer
* @nparts: number of entries in the parts array
* @fixups: hooks called at various points in time during spi_nor_scan()
+ * @flags: manufacturer flags
*/
struct spi_nor_manufacturer {
const char *name;
const struct flash_info *parts;
unsigned int nparts;
const struct spi_nor_fixups *fixups;
+
+ u8 flags;
+#define SPI_NOR_MANUFACT_TRY_SFDP BIT(0)
};
/**
--
2.39.5
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 5+ messages in thread* [PATCH 2/2] mtd: spi-nor: macronix: add manufacturer flags
2024-09-25 7:49 [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Erez Geva
2024-09-25 7:49 ` [PATCH 1/2] mtd: spi-nor: core: add manufacturer flags Erez Geva
@ 2024-09-25 7:49 ` Erez Geva
2024-09-26 7:22 ` [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Esben Haabendal
2 siblings, 0 replies; 5+ messages in thread
From: Erez Geva @ 2024-09-25 7:49 UTC (permalink / raw)
To: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle
Cc: linux-kernel, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Esben Haabendal, Erez Geva
From: Erez Geva <ErezGeva2@gmail.com>
Add flag for always trying reading SFDP.
All new chips from Macronix support SFDP.
All old chips in the IDs table were reused by new chips.
There is no reason the skip SFDP
when using now chips that reuse old JEDEC IDs.
Signed-off-by: Erez Geva <ErezGeva2@gmail.com>
---
Notes:
* Testing with MX25L3233F using BeagleBone Black.
* After adding the new patch of always reading the SFDP
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/jedec_id
c22016
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/manufacturer
macronix
$ cat /sys/bus/spi/devices/spi0.0/spi-nor/partname
mx25l3205d
$ xxd -p /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
53464450000101ff00000109300000ffc2000104600000ffffffffffffff
ffffffffffffffffffffffffffffffffffffe520f1ffffffff0144eb086b
083b04bbeeffffffffff00ffffff00ff0c200f5210d800ffffffffffffff
ffffffffffff003650269ef97764fecfffffffffffff
$ sha256sum /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
22d5d34af77c3628300056a0fc4bfbeafa027f544998852cf27f7cebf7881196 /sys/bus/spi/devices/spi0.0/spi-nor/sfdp
$ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities
Supported read modes by the flash
1S-1S-1S
opcode 0x03
mode cycles 0
dummy cycles 0
1S-1S-2S
opcode 0x3b
mode cycles 0
dummy cycles 8
1S-2S-2S
opcode 0xbb
mode cycles 0
dummy cycles 4
1S-1S-4S
opcode 0x6b
mode cycles 0
dummy cycles 8
1S-4S-4S
opcode 0xeb
mode cycles 2
dummy cycles 4
Supported page program modes by the flash
1S-1S-1S
opcode 0x02
$ cat /sys/kernel/debug/spi-nor/spi0.0/params
name mx25l3205d
id c2 20 16 c2 20 16
size 4.00 MiB
write size 1
page size 256
address nbytes 3
flags HAS_16BIT_SR
opcodes
read 0x03
dummy cycles 0
erase 0x20
program 0x02
8D extension none
protocols
read 1S-1S-1S
write 1S-1S-1S
register 1S-1S-1S
erase commands
20 (4.00 KiB) [1]
52 (32.0 KiB) [2]
d8 (64.0 KiB) [3]
c7 (4.00 MiB)
sector map
region (in hex) | erase mask | flags
------------------+------------+----------
00000000-003fffff | [ 123] |
# mtd_debug info /dev/mtd0
mtd.type = MTD_NORFLASH
mtd.flags = MTD_CAP_NORFLASH
mtd.size = 4194304 (4M)
mtd.erasesize = 4096 (4K)
mtd.writesize = 1
mtd.oobsize = 0
regions = 0
* Test that mimic old Macronix chip lack SFDP.
* In order to check how will the driver cope with an old Macronix chip.
* As we do not posses such an old chip, we will change RDSFDP to an unused opcode.
$ git diff -U0
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index 4ebc527aadc1..784cba9b2d0d 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -47 +47 @@
-#define SPINOR_OP_RDSFDP 0x5a /* Read SFDP */
+#define SPINOR_OP_RDSFDP 0x57 /* Read SFDP */
# dmesg | grep spi
[ 42.436974] spi-nor spi0.0: mx25l3205d (4096 Kbytes)
* No error in kernel log!
# ls /sys/bus/spi/devices/spi0.0/spi-nor/
jedec_id manufacturer partname
* No SFDP, as expected!
$ cat /sys/kernel/debug/spi-nor/spi0.0/capabilities
Supported read modes by the flash
1S-1S-1S
opcode 0x03
mode cycles 0
dummy cycles 0
Supported page program modes by the flash
1S-1S-1S
opcode 0x02
$ cat /sys/kernel/debug/spi-nor/spi0.0/params
name mx25l3205d
id c2 20 16 c2 20 16
size 4.00 MiB
write size 1
page size 256
address nbytes 3
flags HAS_16BIT_SR
opcodes
read 0x03
dummy cycles 0
erase 0x20
program 0x02
8D extension none
protocols
read 1S-1S-1S
write 1S-1S-1S
register 1S-1S-1S
erase commands
20 (4.00 KiB) [0]
d8 (64.0 KiB) [1]
c7 (4.00 MiB)
sector map
region (in hex) | erase mask | flags
------------------+------------+----------
00000000-003fffff | [01 ] |
drivers/mtd/spi-nor/macronix.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/mtd/spi-nor/macronix.c b/drivers/mtd/spi-nor/macronix.c
index ea6be95e75a5..292a149c37d8 100644
--- a/drivers/mtd/spi-nor/macronix.c
+++ b/drivers/mtd/spi-nor/macronix.c
@@ -208,4 +208,5 @@ const struct spi_nor_manufacturer spi_nor_macronix = {
.parts = macronix_nor_parts,
.nparts = ARRAY_SIZE(macronix_nor_parts),
.fixups = ¯onix_nor_fixups,
+ .flags = SPI_NOR_MANUFACT_TRY_SFDP,
};
--
2.39.5
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips
2024-09-25 7:49 [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Erez Geva
2024-09-25 7:49 ` [PATCH 1/2] mtd: spi-nor: core: add manufacturer flags Erez Geva
2024-09-25 7:49 ` [PATCH 2/2] mtd: spi-nor: macronix: " Erez Geva
@ 2024-09-26 7:22 ` Esben Haabendal
2024-09-26 11:02 ` Erez
2 siblings, 1 reply; 5+ messages in thread
From: Esben Haabendal @ 2024-09-26 7:22 UTC (permalink / raw)
To: Erez Geva
Cc: linux-mtd, Tudor Ambarus, Pratyush Yadav, Michael Walle,
linux-kernel, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, Erez Geva
Erez Geva <erezgeva@nwtime.org> writes:
> From: Erez Geva <ErezGeva2@gmail.com>
>
> Add reading SFDP to all Macronix chips.
> All chips in the Macronix competabilites table
> have a replacement chip that support SFDP.
> Macronix stop producing any chip without SFDP 15 years ago.
> The benefit of reading SFDP is by supporting
> fater op-codes for newer chips.
>
> This patch do not add an all flashes support.
> This patch extend the already support of SFDP to all Macronix chips.
> The new chips that reuse JEDEC IDs and chips that
> are absend from the Macronix competabilites table.
> The patch just remove the restriction!
Hi Erez
Did you see the response I got to the last revision of my patch series
that tries to resolve the same problem that you are adressing?
https://lore.kernel.org/all/D2NGXHZ2VTK0.M0AOB4CM7MHM@kernel.org/
I think we should try go go in that direction. It sounds like it would
be a simple solution that would improve the overall situation, not just
for Macronix.
/Esben
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips
2024-09-26 7:22 ` [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Esben Haabendal
@ 2024-09-26 11:02 ` Erez
0 siblings, 0 replies; 5+ messages in thread
From: Erez @ 2024-09-26 11:02 UTC (permalink / raw)
To: Esben Haabendal
Cc: Erez Geva, linux-mtd, Tudor Ambarus, Pratyush Yadav,
Michael Walle, linux-kernel, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
On Thu, 26 Sept 2024 at 09:22, Esben Haabendal <esben@geanix.com> wrote:
>
> Erez Geva <erezgeva@nwtime.org> writes:
>
> > From: Erez Geva <ErezGeva2@gmail.com>
> >
> > Add reading SFDP to all Macronix chips.
> > All chips in the Macronix competabilites table
> > have a replacement chip that support SFDP.
> > Macronix stop producing any chip without SFDP 15 years ago.
> > The benefit of reading SFDP is by supporting
> > fater op-codes for newer chips.
> >
> > This patch do not add an all flashes support.
> > This patch extend the already support of SFDP to all Macronix chips.
> > The new chips that reuse JEDEC IDs and chips that
> > are absend from the Macronix competabilites table.
> > The patch just remove the restriction!
>
> Hi Erez
>
> Did you see the response I got to the last revision of my patch series
> that tries to resolve the same problem that you are adressing?
>
> https://lore.kernel.org/all/D2NGXHZ2VTK0.M0AOB4CM7MHM@kernel.org/
As for .
I agree that doing SFDP first is a better approach than mine.
If Tudor Ambarus. Pratyush Yadav. Michael Walle agrees on that.
Than let's do that
>
> I think we should try go go in that direction. It sounds like it would
> be a simple solution that would improve the overall situation, not just
> for Macronix.
Again I agree. Doing SFDP first seems a better approach.
Tudor expressed concern on sending RDSFDP as no-op to chips that do
not support SFDP.
I did a search on the Macronix chips that appear on the table and all
of them have a new chip or a new version that uses the same JEDEC ID,
that does support SFDP.
If other Vendors reused all their JEDEC IDs with new chips, then sure.
I did not check other Vendors, so I can not state the same on them.
Erez
>
>
> /Esben
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-09-26 11:03 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-25 7:49 [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Erez Geva
2024-09-25 7:49 ` [PATCH 1/2] mtd: spi-nor: core: add manufacturer flags Erez Geva
2024-09-25 7:49 ` [PATCH 2/2] mtd: spi-nor: macronix: " Erez Geva
2024-09-26 7:22 ` [PATCH 0/2] mtd: spi-nor: macronix: reading SFDP by all Macronix chips Esben Haabendal
2024-09-26 11:02 ` Erez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox