diff mbox series

[RFC,1/3] spi-nor: Add SPI_NOR_NO_WIP

Message ID 20201018213103.28798-1-richard@nod.at
State RFC
Delegated to: Vignesh R
Headers show
Series [RFC,1/3] spi-nor: Add SPI_NOR_NO_WIP | expand

Commit Message

Richard Weinberger Oct. 18, 2020, 9:31 p.m. UTC
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 mbox series

Patch

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;