linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: spi-nor: Add documentation for spi_nor_soft_reset()
@ 2021-05-11  9:39 Pratyush Yadav
  2021-05-20 19:49 ` Michael Walle
  2021-05-27 14:07 ` Vignesh Raghavendra
  0 siblings, 2 replies; 3+ messages in thread
From: Pratyush Yadav @ 2021-05-11  9:39 UTC (permalink / raw)
  To: Vignesh Raghavendra, Tudor Ambarus
  Cc: Pratyush Yadav, Michael Walle, Miquel Raynal, Richard Weinberger,
	linux-kernel, linux-mtd

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>

---

 drivers/mtd/spi-nor/core.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 265d8b25fc7f..59e207f2e0e3 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -2988,6 +2988,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;
-- 
2.30.0


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spi-nor: Add documentation for spi_nor_soft_reset()
  2021-05-11  9:39 [PATCH] mtd: spi-nor: Add documentation for spi_nor_soft_reset() Pratyush Yadav
@ 2021-05-20 19:49 ` Michael Walle
  2021-05-27 14:07 ` Vignesh Raghavendra
  1 sibling, 0 replies; 3+ messages in thread
From: Michael Walle @ 2021-05-20 19:49 UTC (permalink / raw)
  To: Pratyush Yadav
  Cc: Vignesh Raghavendra, Tudor Ambarus, Miquel Raynal,
	Richard Weinberger, linux-kernel, linux-mtd

Am 2021-05-11 11:39, schrieb Pratyush Yadav:
> 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>

Reviewed-by: Michael Walle <michael@walle.cc>

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: spi-nor: Add documentation for spi_nor_soft_reset()
  2021-05-11  9:39 [PATCH] mtd: spi-nor: Add documentation for spi_nor_soft_reset() Pratyush Yadav
  2021-05-20 19:49 ` Michael Walle
@ 2021-05-27 14:07 ` Vignesh Raghavendra
  1 sibling, 0 replies; 3+ messages in thread
From: Vignesh Raghavendra @ 2021-05-27 14:07 UTC (permalink / raw)
  To: Tudor Ambarus, Pratyush Yadav
  Cc: Vignesh Raghavendra, Richard Weinberger, linux-kernel,
	Michael Walle, Miquel Raynal, linux-mtd

On Tue, 11 May 2021 15:09:58 +0530, Pratyush Yadav wrote:
> 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.

Applied to spi-nor/next, thanks!
[1/1] mtd: spi-nor: Add documentation for spi_nor_soft_reset()
      https://git.kernel.org/mtd/c/ccfb7cf18f

--
Regards
Vignesh


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-27 14:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-11  9:39 [PATCH] mtd: spi-nor: Add documentation for spi_nor_soft_reset() Pratyush Yadav
2021-05-20 19:49 ` Michael Walle
2021-05-27 14:07 ` Vignesh Raghavendra

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).