[RFC][PATCH 2/3] spi-nor: Add INFO_PGZ

Richard Weinberger richard at nod.at
Sun Oct 18 17:31:02 EDT 2020


Allow much larger page sizes than just 256 bytes.

Signed-off-by: Richard Weinberger <richard at nod.at>
---
 drivers/mtd/spi-nor/core.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 621202fda5d0..76c3f8ef47e9 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -268,7 +268,7 @@ struct flash_info {
 	unsigned	sector_size;
 	u16		n_sectors;
 
-	u16		page_size;
+	u32		page_size;
 	u16		addr_width;
 
 	u32		flags;
@@ -319,7 +319,7 @@ struct flash_info {
 };
 
 /* Used when the "_ext_id" is two bytes at most */
-#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
+#define INFO_PGZ(_jedec_id, _ext_id, _sector_size, _n_sectors, _page_size, _flags)	\
 		.id = {							\
 			((_jedec_id) >> 16) & 0xff,			\
 			((_jedec_id) >> 8) & 0xff,			\
@@ -330,9 +330,12 @@ struct flash_info {
 		.id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))),	\
 		.sector_size = (_sector_size),				\
 		.n_sectors = (_n_sectors),				\
-		.page_size = 256,					\
+		.page_size = (_page_size),				\
 		.flags = (_flags),
 
+#define INFO(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
+	INFO_PGZ(_jedec_id, _ext_id, _sector_size, _n_sectors, 256, _flags)
+
 #define INFO6(_jedec_id, _ext_id, _sector_size, _n_sectors, _flags)	\
 		.id = {							\
 			((_jedec_id) >> 16) & 0xff,			\
-- 
2.26.1




More information about the linux-mtd mailing list