* [RFC][PATCH 1/3] spi-nor: Add SPI_NOR_NO_WIP
@ 2020-10-18 21:31 Richard Weinberger
2020-10-18 21:31 ` [RFC][PATCH 2/3] spi-nor: Add INFO_PGZ Richard Weinberger
2020-10-18 21:31 ` [RFC][PATCH 3/3] spi-nor: Speedup mb85rs1mt FRAM writes Richard Weinberger
0 siblings, 2 replies; 3+ messages in thread
From: Richard Weinberger @ 2020-10-18 21:31 UTC (permalink / raw)
To: linux-mtd; +Cc: Richard Weinberger, tudor.ambarus, vigneshr, miquel.raynal
Some flashes have their WIP bit hardwired to 0.
They are always ready and there there is no need query the status
register after a write command.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
drivers/mtd/spi-nor/core.c | 6 +++++-
drivers/mtd/spi-nor/core.h | 2 ++
2 files changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 0369d98b2d12..eb01a0798087 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -546,8 +546,12 @@ static void spi_nor_clear_sr(struct spi_nor *nor)
*/
static int spi_nor_sr_ready(struct spi_nor *nor)
{
- int ret = spi_nor_read_sr(nor, nor->bouncebuf);
+ int ret;
+
+ if (nor->flags & SPI_NOR_NO_WIP)
+ return 1;
+ ret = spi_nor_read_sr(nor, nor->bouncebuf);
if (ret)
return ret;
diff --git a/drivers/mtd/spi-nor/core.h b/drivers/mtd/spi-nor/core.h
index 6f2f6b27173f..621202fda5d0 100644
--- a/drivers/mtd/spi-nor/core.h
+++ b/drivers/mtd/spi-nor/core.h
@@ -311,6 +311,8 @@ struct flash_info {
* BP3 is bit 6 of status register.
* Must be used with SPI_NOR_4BIT_BP.
*/
+#define SPI_NOR_NO_WIP BIT(19) /* Flash is always reads, WIP status bit
+ has no meaning. */
/* Part specific fixup hooks. */
const struct spi_nor_fixups *fixups;
--
2.26.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC][PATCH 2/3] spi-nor: Add INFO_PGZ
2020-10-18 21:31 [RFC][PATCH 1/3] spi-nor: Add SPI_NOR_NO_WIP Richard Weinberger
@ 2020-10-18 21:31 ` Richard Weinberger
2020-10-18 21:31 ` [RFC][PATCH 3/3] spi-nor: Speedup mb85rs1mt FRAM writes Richard Weinberger
1 sibling, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2020-10-18 21:31 UTC (permalink / raw)
To: linux-mtd; +Cc: Richard Weinberger, tudor.ambarus, vigneshr, miquel.raynal
Allow much larger page sizes than just 256 bytes.
Signed-off-by: Richard Weinberger <richard@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
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [RFC][PATCH 3/3] spi-nor: Speedup mb85rs1mt FRAM writes
2020-10-18 21:31 [RFC][PATCH 1/3] spi-nor: Add SPI_NOR_NO_WIP Richard Weinberger
2020-10-18 21:31 ` [RFC][PATCH 2/3] spi-nor: Add INFO_PGZ Richard Weinberger
@ 2020-10-18 21:31 ` Richard Weinberger
1 sibling, 0 replies; 3+ messages in thread
From: Richard Weinberger @ 2020-10-18 21:31 UTC (permalink / raw)
To: linux-mtd; +Cc: Richard Weinberger, tudor.ambarus, vigneshr, miquel.raynal
This FRAM does not internally buffer writes, as soon the write
command returns, all data is stable.
Therefore the WIP bit is always 0 and we can skip the check.
The write command accepts infinitely data, the target address will
just roll over if you feed in more bytes than the flash can handle.
To speed up bulk writes, specify a page size of the sizeof the whole
FRAM. That way the whole FRAM can be written using single program
sequence.
With this changes I was able to double the write performance on
one of my systems.
Signed-off-by: Richard Weinberger <richard@nod.at>
---
drivers/mtd/spi-nor/fujitsu.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/fujitsu.c b/drivers/mtd/spi-nor/fujitsu.c
index e385d93e756c..3152999fbaa1 100644
--- a/drivers/mtd/spi-nor/fujitsu.c
+++ b/drivers/mtd/spi-nor/fujitsu.c
@@ -10,7 +10,7 @@
static const struct flash_info fujitsu_parts[] = {
/* Fujitsu */
- { "mb85rs1mt", INFO(0x047f27, 0, 128 * 1024, 1, SPI_NOR_NO_ERASE) },
+ { "mb85rs1mt", INFO_PGZ(0x047f27, 0, 1 << 17, 1, 1 << 17, SPI_NOR_NO_ERASE | SPI_NOR_NO_WIP) },
};
const struct spi_nor_manufacturer spi_nor_fujitsu = {
--
2.26.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-10-18 21:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-18 21:31 [RFC][PATCH 1/3] spi-nor: Add SPI_NOR_NO_WIP Richard Weinberger
2020-10-18 21:31 ` [RFC][PATCH 2/3] spi-nor: Add INFO_PGZ Richard Weinberger
2020-10-18 21:31 ` [RFC][PATCH 3/3] spi-nor: Speedup mb85rs1mt FRAM writes Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).