mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: let SFDP determine the flash and sector size
@ 2023-07-22  4:59 Tudor Ambarus
  2023-07-22  5:14 ` Tudor Ambarus
  2023-07-22 12:56 ` Michael Walle
  0 siblings, 2 replies; 3+ messages in thread
From: Tudor Ambarus @ 2023-07-22  4:59 UTC (permalink / raw)
  To: tkuw584924, takahiro.kuwano, michael, pratyush
  Cc: linux-mtd, linux-kernel, bacem.daassi, miquel.raynal, richard,
	Tudor Ambarus

sector_size is used to determine the flash size and the erase size in
case of uniform erase. n_sectors is used to determine the flash_size.
But the flash size and the erase sizes are determined when parsing SFDP,
let SFDP determine them.

Signed-off-by: Tudor Ambarus <tudor.ambarus@linaro.org>
---
 drivers/mtd/spi-nor/spansion.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/mtd/spi-nor/spansion.c b/drivers/mtd/spi-nor/spansion.c
index 6b199112a533..5f2a76969c76 100644
--- a/drivers/mtd/spi-nor/spansion.c
+++ b/drivers/mtd/spi-nor/spansion.c
@@ -878,11 +878,11 @@ static const struct flash_info spansion_nor_parts[] = {
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s25fs256t_fixups },
-	{ "s25hl512t",  INFO6(0x342a1a, 0x0f0390, 256 * 1024, 256)
+	{ "s25hl512t",  INFO6(0x342a1a, 0x0f0390, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s25hx_t_fixups },
-	{ "s25hl01gt",  INFO6(0x342a1b, 0x0f0390, 256 * 1024, 512)
+	{ "s25hl01gt",  INFO6(0x342a1b, 0x0f0390, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s25hx_t_fixups },
@@ -891,11 +891,11 @@ static const struct flash_info spansion_nor_parts[] = {
 		MFR_FLAGS(USE_CLPEF)
 		FLAGS(NO_CHIP_ERASE)
 		.fixups = &s25hx_t_fixups },
-	{ "s25hs512t",  INFO6(0x342b1a, 0x0f0390, 256 * 1024, 256)
+	{ "s25hs512t",  INFO6(0x342b1a, 0x0f0390, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s25hx_t_fixups },
-	{ "s25hs01gt",  INFO6(0x342b1b, 0x0f0390, 256 * 1024, 512)
+	{ "s25hs01gt",  INFO6(0x342b1b, 0x0f0390, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s25hx_t_fixups },
@@ -906,22 +906,22 @@ static const struct flash_info spansion_nor_parts[] = {
 		.fixups = &s25hx_t_fixups },
 	{ "cy15x104q",  INFO6(0x042cc2, 0x7f7f7f, 512 * 1024, 1)
 		FLAGS(SPI_NOR_NO_ERASE) },
-	{ "s28hl512t",   INFO(0x345a1a,      0, 256 * 1024, 256)
+	{ "s28hl512t",   INFO(0x345a1a,      0, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s28hx_t_fixups,
 	},
-	{ "s28hl01gt",   INFO(0x345a1b,      0, 256 * 1024, 512)
+	{ "s28hl01gt",   INFO(0x345a1b,      0, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s28hx_t_fixups,
 	},
-	{ "s28hs512t",   INFO(0x345b1a,      0, 256 * 1024, 256)
+	{ "s28hs512t",   INFO(0x345b1a,      0, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s28hx_t_fixups,
 	},
-	{ "s28hs01gt",   INFO(0x345b1b,      0, 256 * 1024, 512)
+	{ "s28hs01gt",   INFO(0x345b1b,      0, 0, 0)
 		PARSE_SFDP
 		MFR_FLAGS(USE_CLPEF)
 		.fixups = &s28hx_t_fixups,
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spi-nor: let SFDP determine the flash and sector size
  2023-07-22  4:59 [PATCH] mtd: spi-nor: let SFDP determine the flash and sector size Tudor Ambarus
@ 2023-07-22  5:14 ` Tudor Ambarus
  2023-07-22 12:56 ` Michael Walle
  1 sibling, 0 replies; 3+ messages in thread
From: Tudor Ambarus @ 2023-07-22  5:14 UTC (permalink / raw)
  To: tkuw584924, takahiro.kuwano, michael, pratyush
  Cc: linux-mtd, linux-kernel, bacem.daassi, miquel.raynal, richard

subject should have started with "mtd: spi-nor: spansion:"

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spi-nor: let SFDP determine the flash and sector size
  2023-07-22  4:59 [PATCH] mtd: spi-nor: let SFDP determine the flash and sector size Tudor Ambarus
  2023-07-22  5:14 ` Tudor Ambarus
@ 2023-07-22 12:56 ` Michael Walle
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Walle @ 2023-07-22 12:56 UTC (permalink / raw)
  To: Tudor Ambarus
  Cc: tkuw584924, takahiro.kuwano, pratyush, linux-mtd, linux-kernel,
	bacem.daassi, miquel.raynal, richard, Tudor Ambarus

Am 2023-07-22 06:59, schrieb Tudor Ambarus:
> sector_size is used to determine the flash size and the erase size in
> case of uniform erase. n_sectors is used to determine the flash_size.
> But the flash size and the erase sizes are determined when parsing 
> SFDP,
> let SFDP determine them.

Great! I have a similar patch in my preparation for the flash info
cleanup, but for all the flashes.

The flash size is overwritten if PARSE_SFDP is set anyway. So
that's fine. The sector_size is used for the erase ops and the BP
locking. The erase ops should be initialized with the BFPT, too.
So whats left is the BP locking, which is just used for gd25q256.
For now we'd need to leave the sector_size there.

Would you also drop the size and sector size for all other
PARSE_SFDP flashes?

In any case:
Reviewed-by: Michael Walle <michael@walle.cc>

-michael

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-22 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-22  4:59 [PATCH] mtd: spi-nor: let SFDP determine the flash and sector size Tudor Ambarus
2023-07-22  5:14 ` Tudor Ambarus
2023-07-22 12:56 ` Michael Walle

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®