[RFC 2/3] mtd: spi-nor: Implement anyreg functions for fsl-quadspi

Prabhakar Kushwaha prabhakar.kushwaha at nxp.com
Fri Dec 29 03:53:51 PST 2017


Read Any Register and Write Any Register commands provides a way to
read or write all device registers - non-volatile and volatile.
These commands are followed by a 3- or 4-byte address, followed by
a number of latency (dummy) cycles set by volatile configuration
registers. Then the selected register contents are returned or written.

This patch update quadspi controller driver to implement above behavior.

Signed-off-by: Prabhakar Kushwaha <prabhakar.kushwaha at nxp.com>
---
 drivers/mtd/spi-nor/fsl-quadspi.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/mtd/spi-nor/fsl-quadspi.c b/drivers/mtd/spi-nor/fsl-quadspi.c
index a77f114..98bef6a 100644
--- a/drivers/mtd/spi-nor/fsl-quadspi.c
+++ b/drivers/mtd/spi-nor/fsl-quadspi.c
@@ -922,6 +922,22 @@ static int fsl_qspi_write_reg(struct spi_nor *nor, u8 opcode, u8 *buf, int len)
 	return ret;
 }
 
+static int fsl_qspi_read_anyreg(struct spi_nor *nor, u8 opcode, u32 offset,
+				u8 *buf, int len)
+{
+	/* TODO: It will be updated during controller changes*/
+
+	return 0;
+}
+
+static int fsl_qspi_write_anyreg(struct spi_nor *nor, u8 opcode, u32 offset,
+				 u8 *buf, int len)
+{
+	/* TODO: It will be updated during controller changes*/
+
+	return 0;
+}
+
 static ssize_t fsl_qspi_write(struct spi_nor *nor, loff_t to,
 			      size_t len, const u_char *buf)
 {
@@ -1154,6 +1170,8 @@ static int fsl_qspi_probe(struct platform_device *pdev)
 		/* fill the hooks */
 		nor->read_reg = fsl_qspi_read_reg;
 		nor->write_reg = fsl_qspi_write_reg;
+		nor->read_anyreg = fsl_qspi_read_anyreg;
+		nor->write_anyreg = fsl_qspi_write_anyreg;
 		nor->read = fsl_qspi_read;
 		nor->write = fsl_qspi_write;
 		nor->erase = fsl_qspi_erase;
-- 
2.7.4




More information about the linux-mtd mailing list