diff mbox series

[v2,1/2] mtd: spi-nor: Add support for SNOR_ID3 macro

Message ID 20220715105716.2415068-2-biju.das.jz@bp.renesas.com
State Changes Requested
Delegated to: Ambarus Tudor
Headers show
Series Add Renesas AT25QL128A serial nor flash | expand

Commit Message

Biju Das July 15, 2022, 10:57 a.m. UTC
Add SNOR_ID3 macro to get chip info by parsing sfdp.

Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com>
---
v2:
 * New patch
---
 drivers/mtd/spi-nor/core.h | 9 +++++++++
 1 file changed, 9 insertions(+)

Comments

Michael Walle July 15, 2022, 11:57 a.m. UTC | #1
Am 2022-07-15 12:57, schrieb Biju Das:
> Add SNOR_ID3 macro to get chip info by parsing sfdp.

This is the same as [1]. I'd expect that patch 2/2 will go
in as soon as [1] is merged.

-michael

[1] 
https://lore.kernel.org/linux-mtd/20220510140232.3519184-2-michael@walle.cc/
Biju Das July 18, 2022, 5:53 a.m. UTC | #2
Hi Michael,

Thanks for the feedback.

> Subject: Re: [PATCH v2 1/2] mtd: spi-nor: Add support for SNOR_ID3 macro
> 
> Am 2022-07-15 12:57, schrieb Biju Das:
> > Add SNOR_ID3 macro to get chip info by parsing sfdp.
> 
> This is the same as [1]. I'd expect that patch 2/2 will go in as soon as
> [1] is merged.

> [1] https://lore.kernel.org/linux-mtd/20220715121934.5ZgUHBT77rYsJx0CTx_IWZaI7IBPvFynsy-xSQS8fQY@z/

There are 2 users(siliconkaiser sk25lp128 chip and Renesas Renesas AT25QL128A)
already tested this macro. Hopefully, this macro will get merged to mainline
soon.

Cheers,
Biju
diff mbox series

Patch

diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 61886868cd02..153c1a0b2eda 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -548,6 +548,15 @@  struct flash_info {
 		.n_sectors = (_n_sectors),				\
 		.page_size = 256,					\
 
+#define SNOR_ID3(_jedec_id)						\
+	.id = {								\
+		((_jedec_id) >> 16) & 0xff,				\
+		((_jedec_id) >> 8) & 0xff,				\
+		(_jedec_id) & 0xff,					\
+	},								\
+	.id_len = 3,							\
+	.parse_sfdp = true,						\
+
 #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width)	\
 		.sector_size = (_sector_size),				\
 		.n_sectors = (_n_sectors),				\