All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] m25p80: Use a 512 byte page size for Spansion flash s25fl512s
@ 2017-01-24 13:52 mark.marshall
  2017-01-24 16:48 ` Marek Vasut
  0 siblings, 1 reply; 12+ messages in thread
From: mark.marshall @ 2017-01-24 13:52 UTC (permalink / raw)
  To: computersforpeace, linux-mtd
  Cc: markmarshall14, cyrille.pitchen, marek.vasut, dwmw2,
	boris.brezillon, richard, Mark Marshall

From: Mark Marshall <mark.marshall@omicronenergy.com>

The s25fl512s flash from Spansion has a 512 byte write page size,
which means that we can write 512 bytes at a time (instead of 256).

This single change makes writing to the flash about 2x faster.

Signed-off-by: Mark Marshall <mark.marshall@omicronenergy.com>
---
 drivers/mtd/spi-nor/spi-nor.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index da7cd69..c9ac0bf 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -775,6 +775,21 @@ static int spi_nor_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len)
 		.page_size = 256,					\
 		.flags = (_flags),
 
+/* Used to set a custom (non 256) page_size */
+#define INFOP(_jedec_id, _ext_id, _sector_size, _n_sectors, _pg_sz, _flags) \
+		.id = {							\
+			((_jedec_id) >> 16) & 0xff,			\
+			((_jedec_id) >> 8) & 0xff,			\
+			(_jedec_id) & 0xff,				\
+			((_ext_id) >> 8) & 0xff,			\
+			(_ext_id) & 0xff,				\
+			},						\
+		.id_len = (!(_jedec_id) ? 0 : (3 + ((_ext_id) ? 2 : 0))), \
+		.sector_size = (_sector_size),				\
+		.n_sectors = (_n_sectors),				\
+		.page_size = (_pg_sz),					\
+		.flags = (_flags),					\
+
 #define CAT25_INFO(_sector_size, _n_sectors, _page_size, _addr_width, _flags)	\
 		.sector_size = (_sector_size),				\
 		.n_sectors = (_n_sectors),				\
@@ -905,7 +920,7 @@ static const struct flash_info spi_nor_ids[] = {
 	{ "s25sl064p",  INFO(0x010216, 0x4d00,  64 * 1024, 128, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
 	{ "s25fl256s0", INFO(0x010219, 0x4d00, 256 * 1024, 128, 0) },
 	{ "s25fl256s1", INFO(0x010219, 0x4d01,  64 * 1024, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
-	{ "s25fl512s",  INFO(0x010220, 0x4d00, 256 * 1024, 256, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
+	{ "s25fl512s",  INFOP(0x010220, 0x4d00, 256 * 1024, 256, 512, SPI_NOR_DUAL_READ | SPI_NOR_QUAD_READ) },
 	{ "s70fl01gs",  INFO(0x010221, 0x4d00, 256 * 1024, 256, 0) },
 	{ "s25sl12800", INFO(0x012018, 0x0300, 256 * 1024,  64, 0) },
 	{ "s25sl12801", INFO(0x012018, 0x0301,  64 * 1024, 256, 0) },
-- 
2.7.4

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

end of thread, other threads:[~2017-08-01 16:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-24 13:52 [PATCH] m25p80: Use a 512 byte page size for Spansion flash s25fl512s mark.marshall
2017-01-24 16:48 ` Marek Vasut
2017-01-26 14:58   ` Mark Marshall
2017-02-04 22:25     ` Marek Vasut
2017-02-13 13:53       ` [PATCH] mtd: spi-nor: flash_info table, use a u64 for the ID mark.marshall
2017-02-14  5:02         ` Marek Vasut
2017-02-14 10:22           ` Cyrille Pitchen
2017-02-14 15:35             ` [PATCH v2 0/3] " mark.marshall
2017-02-14 15:35               ` [PATCH v2 1/3] " mark.marshall
2017-02-14 15:35               ` [PATCH v2 2/3] mtd: spi-nor: Use more explicit macros to generate the flash_info table mark.marshall
2017-02-14 15:35               ` [PATCH v2 3/3] mtd: spi-nor: s25fl512s: Set a page size of 512 mark.marshall
2017-08-01 16:49                 ` Cyrille Pitchen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.