diff mbox series

[3/4] mtd: spi-nor-core: set 4byte opcode when possible

Message ID 20210813072552.21772-4-jaimeliao.tw@gmail.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series Add octal DTR support for Macronix flash | expand

Commit Message

liao jaime Aug. 13, 2021, 7:25 a.m. UTC
Following linux kernel to check address width and 4byte flag to enable
4byte opcode setting.

Signed-off-by: JaimeLiao <jaimeliao.tw@gmail.com>
---
 drivers/mtd/spi/spi-nor-core.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
index be6c58ad40..1bddfc10a2 100644
--- a/drivers/mtd/spi/spi-nor-core.c
+++ b/drivers/mtd/spi/spi-nor-core.c
@@ -3919,6 +3919,10 @@  int spi_nor_scan(struct spi_nor *nor)
 		return -EINVAL;
 	}
 
+	/* Set 4byte opcodes when possible. */
+	if (nor->addr_width == 4 && info->flags & SPI_NOR_4B_OPCODES)
+		spi_nor_set_4byte_opcodes(nor, info);
+
 	/* Send all the required SPI flash commands to initialize device */
 	ret = spi_nor_init(nor);
 	if (ret)