summaryrefslogtreecommitdiff
path: root/drivers/mtd/spi-nor
diff options
context:
space:
mode:
authorPratyush Yadav <p.yadav@ti.com>2021-05-11 12:39:58 +0300
committerVignesh Raghavendra <vigneshr@ti.com>2021-05-26 19:17:34 +0300
commitccfb7cf18f9680958e76991c8f15562ff42f4bc9 (patch)
tree187c547a4551fe8b4c1ff6cf0a1fb9881389d860 /drivers/mtd/spi-nor
parent5c26d52c9e5c9a22d04b805470e1143716b69789 (diff)
downloadlinux-ccfb7cf18f9680958e76991c8f15562ff42f4bc9.tar.xz
mtd: spi-nor: Add documentation for spi_nor_soft_reset()
Document what the function does and that it should only be used when it is known that the device supports it. This will avoid unaware programmers thinking that they can arbitrarily use it to reset the device. Suggested-by: Michael Walle <michael@walle.cc> Signed-off-by: Pratyush Yadav <p.yadav@ti.com> Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com> Reviewed-by: Michael Walle <michael@walle.cc>
Diffstat (limited to 'drivers/mtd/spi-nor')
-rw-r--r--drivers/mtd/spi-nor/core.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index bd2c7717eb10..f6a6ef2d8bd8 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2839,6 +2839,21 @@ static int spi_nor_init(struct spi_nor *nor)
return 0;
}
+/**
+ * spi_nor_soft_reset() - Perform a software reset
+ * @nor: pointer to 'struct spi_nor'
+ *
+ * Performs a "Soft Reset and Enter Default Protocol Mode" sequence which resets
+ * the device to its power-on-reset state. This is useful when the software has
+ * made some changes to device (volatile) registers and needs to reset it before
+ * shutting down, for example.
+ *
+ * Not every flash supports this sequence. The same set of opcodes might be used
+ * for some other operation on a flash that does not support this. Support for
+ * this sequence can be discovered via SFDP in the BFPT table.
+ *
+ * Return: 0 on success, -errno otherwise.
+ */
static void spi_nor_soft_reset(struct spi_nor *nor)
{
struct spi_mem_op op;