* [PATCH 0/2] mtd: spi-nor: Add flash reset support during resume
@ 2026-11-20 11:01 ` Srikanth Boyapally
0 siblings, 0 replies; 9+ messages in thread
From: Srikanth Boyapally @ 2026-11-20 11:01 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Srikanth Boyapally,
Amit Kumar Mahapatra, Sai Krishna Potthuri
This series adds support for resetting SPI NOR devices during resume.
The first patch stores the reset GPIO information required to reset the
flash device, and the second patch uses it to perform the reset during
resume.
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
---
Amit Kumar Mahapatra (1):
mtd: spi-nor: Store GPIO info for resetting device during resume
Sai Krishna Potthuri (1):
mtd: spi-nor: Reset flash device on resume
drivers/mtd/spi-nor/core.c | 18 ++++++++++++++----
include/linux/mtd/spi-nor.h | 2 ++
2 files changed, 16 insertions(+), 4 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261120-nor_11_20-63a5987645e7
Best regards,
--
Srikanth Boyapally <srikanth.boyapally@amd.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 0/2] mtd: spi-nor: Add flash reset support during resume
@ 2026-11-20 11:01 ` Srikanth Boyapally
0 siblings, 0 replies; 9+ messages in thread
From: Srikanth Boyapally @ 2026-11-20 11:01 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Srikanth Boyapally,
Amit Kumar Mahapatra, Sai Krishna Potthuri
This series adds support for resetting SPI NOR devices during resume.
The first patch stores the reset GPIO information required to reset the
flash device, and the second patch uses it to perform the reset during
resume.
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
---
Amit Kumar Mahapatra (1):
mtd: spi-nor: Store GPIO info for resetting device during resume
Sai Krishna Potthuri (1):
mtd: spi-nor: Reset flash device on resume
drivers/mtd/spi-nor/core.c | 18 ++++++++++++++----
include/linux/mtd/spi-nor.h | 2 ++
2 files changed, 16 insertions(+), 4 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261120-nor_11_20-63a5987645e7
Best regards,
--
Srikanth Boyapally <srikanth.boyapally@amd.com>
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device during resume
2026-11-20 11:01 ` Srikanth Boyapally
@ 2026-11-20 11:01 ` Srikanth Boyapally
-1 siblings, 0 replies; 9+ messages in thread
From: Srikanth Boyapally @ 2026-11-20 11:01 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Srikanth Boyapally,
Amit Kumar Mahapatra
From: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Upon resume, SPI-NOR triggers the hardware reset API to reset the flash
device by toggling the GPIO. This step is necessary because after resume,
the flash needs to be put in SDR mode. To facilitate this, SPI-NOR needs
GPIO information to reset the flash device. Therefore, a gpio_desc member
is added to the spi_nor structure to retain the GPIO information and
utilize it for resetting the device.
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
---
drivers/mtd/spi-nor/core.c | 11 +++++++----
include/linux/mtd/spi-nor.h | 2 ++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 90524c58602e..11227f8fa8ea 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3389,11 +3389,14 @@ static int spi_nor_set_mtd_info(struct spi_nor *nor)
static int spi_nor_hw_reset(struct spi_nor *nor)
{
- struct gpio_desc *reset;
+ struct gpio_desc *reset = nor->reset;
- reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
- if (IS_ERR_OR_NULL(reset))
- return PTR_ERR_OR_ZERO(reset);
+ if (!reset) {
+ reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR_OR_NULL(reset))
+ return PTR_ERR_OR_ZERO(reset);
+ nor->reset = reset;
+ }
/*
* Experimental delay values by looking at different flash device
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index b3e3c6b10186..46b1f92a490a 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -374,6 +374,7 @@ struct spi_nor_flash_parameter;
* settings that can be overwritten by the spi_nor_fixups
* hooks, or dynamically when parsing the SFDP tables.
* @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
+ * @reset: GPIO descriptor for device reset.
* @priv: pointer to the private data
*/
struct spi_nor {
@@ -415,6 +416,7 @@ struct spi_nor {
struct spi_mem_dirmap_desc *rdesc;
struct spi_mem_dirmap_desc *wdesc;
} dirmap;
+ struct gpio_desc *reset;
void *priv;
};
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device during resume
@ 2026-11-20 11:01 ` Srikanth Boyapally
0 siblings, 0 replies; 9+ messages in thread
From: Srikanth Boyapally @ 2026-11-20 11:01 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Srikanth Boyapally,
Amit Kumar Mahapatra
From: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Upon resume, SPI-NOR triggers the hardware reset API to reset the flash
device by toggling the GPIO. This step is necessary because after resume,
the flash needs to be put in SDR mode. To facilitate this, SPI-NOR needs
GPIO information to reset the flash device. Therefore, a gpio_desc member
is added to the spi_nor structure to retain the GPIO information and
utilize it for resetting the device.
Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
---
drivers/mtd/spi-nor/core.c | 11 +++++++----
include/linux/mtd/spi-nor.h | 2 ++
2 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 90524c58602e..11227f8fa8ea 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -3389,11 +3389,14 @@ static int spi_nor_set_mtd_info(struct spi_nor *nor)
static int spi_nor_hw_reset(struct spi_nor *nor)
{
- struct gpio_desc *reset;
+ struct gpio_desc *reset = nor->reset;
- reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
- if (IS_ERR_OR_NULL(reset))
- return PTR_ERR_OR_ZERO(reset);
+ if (!reset) {
+ reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
+ if (IS_ERR_OR_NULL(reset))
+ return PTR_ERR_OR_ZERO(reset);
+ nor->reset = reset;
+ }
/*
* Experimental delay values by looking at different flash device
diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
index b3e3c6b10186..46b1f92a490a 100644
--- a/include/linux/mtd/spi-nor.h
+++ b/include/linux/mtd/spi-nor.h
@@ -374,6 +374,7 @@ struct spi_nor_flash_parameter;
* settings that can be overwritten by the spi_nor_fixups
* hooks, or dynamically when parsing the SFDP tables.
* @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
+ * @reset: GPIO descriptor for device reset.
* @priv: pointer to the private data
*/
struct spi_nor {
@@ -415,6 +416,7 @@ struct spi_nor {
struct spi_mem_dirmap_desc *rdesc;
struct spi_mem_dirmap_desc *wdesc;
} dirmap;
+ struct gpio_desc *reset;
void *priv;
};
--
2.43.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] mtd: spi-nor: Reset flash device on resume
2026-11-20 11:01 ` Srikanth Boyapally
@ 2026-11-20 11:01 ` Srikanth Boyapally
-1 siblings, 0 replies; 9+ messages in thread
From: Srikanth Boyapally @ 2026-11-20 11:01 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Srikanth Boyapally,
Sai Krishna Potthuri
From: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Reset the SPI NOR device before reinitializing it during resume.
This ensures that the flash is brought back to a known state before
spi_nor_init() restores the device configuration.
Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
---
drivers/mtd/spi-nor/core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 11227f8fa8ea..29bce6b7348d 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -45,6 +45,9 @@
#define SPI_NOR_SRST_SLEEP_MIN 200
#define SPI_NOR_SRST_SLEEP_MAX 400
+/* Perform a device reset */
+static int spi_nor_hw_reset(struct spi_nor *nor);
+
/**
* spi_nor_get_cmd_ext() - Get the command opcode extension based on the
* extension type.
@@ -3191,6 +3194,10 @@ static void spi_nor_resume(struct mtd_info *mtd)
struct device *dev = nor->dev;
int ret;
+ ret = spi_nor_hw_reset(nor);
+ if (ret)
+ dev_err(dev, "device reset failed during resume()\n");
+
/* re-initialize the nor chip */
ret = spi_nor_init(nor);
if (ret)
--
2.43.0
^ permalink raw reply related [flat|nested] 9+ messages in thread
* [PATCH 2/2] mtd: spi-nor: Reset flash device on resume
@ 2026-11-20 11:01 ` Srikanth Boyapally
0 siblings, 0 replies; 9+ messages in thread
From: Srikanth Boyapally @ 2026-11-20 11:01 UTC (permalink / raw)
To: Pratyush Yadav, Michael Walle, Takahiro Kuwano, Miquel Raynal,
Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Srikanth Boyapally,
Sai Krishna Potthuri
From: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Reset the SPI NOR device before reinitializing it during resume.
This ensures that the flash is brought back to a known state before
spi_nor_init() restores the device configuration.
Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
---
drivers/mtd/spi-nor/core.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
index 11227f8fa8ea..29bce6b7348d 100644
--- a/drivers/mtd/spi-nor/core.c
+++ b/drivers/mtd/spi-nor/core.c
@@ -45,6 +45,9 @@
#define SPI_NOR_SRST_SLEEP_MIN 200
#define SPI_NOR_SRST_SLEEP_MAX 400
+/* Perform a device reset */
+static int spi_nor_hw_reset(struct spi_nor *nor);
+
/**
* spi_nor_get_cmd_ext() - Get the command opcode extension based on the
* extension type.
@@ -3191,6 +3194,10 @@ static void spi_nor_resume(struct mtd_info *mtd)
struct device *dev = nor->dev;
int ret;
+ ret = spi_nor_hw_reset(nor);
+ if (ret)
+ dev_err(dev, "device reset failed during resume()\n");
+
/* re-initialize the nor chip */
ret = spi_nor_init(nor);
if (ret)
--
2.43.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] mtd: spi-nor: Reset flash device on resume
2026-11-20 11:01 ` Srikanth Boyapally
(?)
@ 2026-11-20 11:19 ` sashiko-bot
-1 siblings, 0 replies; 9+ messages in thread
From: sashiko-bot @ 2026-11-20 11:19 UTC (permalink / raw)
To: Srikanth Boyapally, Pratyush Yadav, Michael Walle,
Takahiro Kuwano, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra
Cc: linux-mtd, michal.simek, git, Sai Krishna Potthuri
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] mtd: spi-nor: address mode desync after spi_nor_hw_reset() in
spi_nor_resume()
- [Low] mtd: spi-nor: devm_gpiod_get_optional() called on every resume
without reset GPIO
--
commit 8bc5dd906a0cb0351d12cf228c9c04ee639a4d57
Author: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
mtd: spi-nor: Reset flash device on resume
This commit calls spi_nor_hw_reset() in spi_nor_resume() to reset the
flash device before reinitializing it with spi_nor_init().
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 11227f8fa8ea9..29bce6b7348d0 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
[ ... ]
> @@ -3191,6 +3194,10 @@ static void spi_nor_resume(struct mtd_info *mtd)
> struct device *dev = nor->dev;
> int ret;
>
> + ret = spi_nor_hw_reset(nor);
> + if (ret)
> + dev_err(dev, "device reset failed during resume()\n");
> +
> /* re-initialize the nor chip */
> ret = spi_nor_init(nor);
> if (ret)
[Severity: High]
Does spi_nor_hw_reset() desynchronize nor->params->addr_mode_nbytes from
the flash's hardware address mode on resume?
When 4-byte address mode is enabled during probe,
spi_nor_set_4byte_addr_mode() sets nor->params->addr_mode_nbytes = 4.
Pulsing the reset GPIO in spi_nor_resume() resets the flash hardware back
to its power-on default 3-byte address mode while leaving
addr_mode_nbytes at 4.
spi_nor_init() then runs spi_nor_set_octal_dtr() and spi_nor_quad_enable()
before spi_nor_set_4byte_addr_mode():
drivers/mtd/spi-nor/core.c:spi_nor_init() {
err = spi_nor_set_octal_dtr(nor, true);
...
err = spi_nor_quad_enable(nor);
...
if (nor->addr_nbytes == 4 &&
nor->read_proto != SNOR_PROTO_8_8_8_DTR &&
!(params->flags & SNOR_F_4B_OPCODES))
return spi_nor_set_4byte_addr_mode(nor, true);
}
Callbacks such as micron_st_nor_octal_dtr_en(), cypress_nor_octal_dtr_en()
and cypress_nor_quad_enable_volatile_reg() use addr_mode_nbytes to send
Read/Write Any Register commands, so they will send 4 address bytes to a
chip expecting 3 and fail to re-enable octal DTR or quad mode.
In addition, multi-die Micron/ST flashes enable 4-byte address mode in
their late_init hooks (such as micron_st_nor_two_die_late_init()) even
when SNOR_F_4B_OPCODES is set or read_proto is SNOR_PROTO_8_8_8_DTR,
because SPINOR_OP_MT_DIE_ERASE has no 4-byte opcode. Because
spi_nor_init() skips spi_nor_set_4byte_addr_mode() for those flashes,
they remain stuck in 3-byte address mode after resume, breaking die erase.
[Severity: Low]
When a flash does not have an optional reset GPIO, nor->reset remains
NULL after probe. Does calling spi_nor_hw_reset() from spi_nor_resume()
cause devm_gpiod_get_optional() to be re-invoked on every resume cycle?
drivers/mtd/spi-nor/core.c:spi_nor_hw_reset() {
struct gpio_desc *reset = nor->reset;
if (!reset) {
reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
if (IS_ERR_OR_NULL(reset))
return PTR_ERR_OR_ZERO(reset);
nor->reset = reset;
}
...
}
Acquiring the devm-managed GPIO during probe and only toggling nor->reset
in spi_nor_hw_reset() when it is non-NULL would avoid repeated devm
lookups during resume.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261120-nor_11_20-v1-0-70332a54037f@amd.com?part=2
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device during resume
2026-11-20 11:01 ` Srikanth Boyapally
@ 2026-11-20 12:33 ` Michael Walle
-1 siblings, 0 replies; 9+ messages in thread
From: Michael Walle @ 2026-11-20 12:33 UTC (permalink / raw)
To: Srikanth Boyapally, Pratyush Yadav, Takahiro Kuwano,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Amit Kumar Mahapatra
[-- Attachment #1: Type: text/plain, Size: 2565 bytes --]
Hi,
On Fri Nov 20, 2026 at 12:01 PM CET, Srikanth Boyapally wrote:
> From: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
>
> Upon resume, SPI-NOR triggers the hardware reset API to reset the flash
> device by toggling the GPIO. This step is necessary because after resume,
> the flash needs to be put in SDR mode. To facilitate this, SPI-NOR needs
> GPIO information to reset the flash device. Therefore, a gpio_desc member
> is added to the spi_nor structure to retain the GPIO information and
> utilize it for resetting the device.
>
> Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
> Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
> ---
> drivers/mtd/spi-nor/core.c | 11 +++++++----
> include/linux/mtd/spi-nor.h | 2 ++
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 90524c58602e..11227f8fa8ea 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3389,11 +3389,14 @@ static int spi_nor_set_mtd_info(struct spi_nor *nor)
>
> static int spi_nor_hw_reset(struct spi_nor *nor)
> {
> - struct gpio_desc *reset;
> + struct gpio_desc *reset = nor->reset;
>
> - reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
> - if (IS_ERR_OR_NULL(reset))
> - return PTR_ERR_OR_ZERO(reset);
> + if (!reset) {
Please set this the proper way in spi_nor_scan() and just use it
here.
-michael
> + reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR_OR_NULL(reset))
> + return PTR_ERR_OR_ZERO(reset);
> + nor->reset = reset;
> + }
>
> /*
> * Experimental delay values by looking at different flash device
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index b3e3c6b10186..46b1f92a490a 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -374,6 +374,7 @@ struct spi_nor_flash_parameter;
> * settings that can be overwritten by the spi_nor_fixups
> * hooks, or dynamically when parsing the SFDP tables.
> * @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
> + * @reset: GPIO descriptor for device reset.
> * @priv: pointer to the private data
> */
> struct spi_nor {
> @@ -415,6 +416,7 @@ struct spi_nor {
> struct spi_mem_dirmap_desc *rdesc;
> struct spi_mem_dirmap_desc *wdesc;
> } dirmap;
> + struct gpio_desc *reset;
>
> void *priv;
> };
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device during resume
@ 2026-11-20 12:33 ` Michael Walle
0 siblings, 0 replies; 9+ messages in thread
From: Michael Walle @ 2026-11-20 12:33 UTC (permalink / raw)
To: Srikanth Boyapally, Pratyush Yadav, Takahiro Kuwano,
Miquel Raynal, Richard Weinberger, Vignesh Raghavendra
Cc: linux-mtd, linux-kernel, michal.simek, git, Amit Kumar Mahapatra
[-- Attachment #1.1: Type: text/plain, Size: 2565 bytes --]
Hi,
On Fri Nov 20, 2026 at 12:01 PM CET, Srikanth Boyapally wrote:
> From: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
>
> Upon resume, SPI-NOR triggers the hardware reset API to reset the flash
> device by toggling the GPIO. This step is necessary because after resume,
> the flash needs to be put in SDR mode. To facilitate this, SPI-NOR needs
> GPIO information to reset the flash device. Therefore, a gpio_desc member
> is added to the spi_nor structure to retain the GPIO information and
> utilize it for resetting the device.
>
> Signed-off-by: Amit Kumar Mahapatra <amit.kumar-mahapatra@amd.com>
> Signed-off-by: Srikanth Boyapally <srikanth.boyapally@amd.com>
> ---
> drivers/mtd/spi-nor/core.c | 11 +++++++----
> include/linux/mtd/spi-nor.h | 2 ++
> 2 files changed, 9 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index 90524c58602e..11227f8fa8ea 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -3389,11 +3389,14 @@ static int spi_nor_set_mtd_info(struct spi_nor *nor)
>
> static int spi_nor_hw_reset(struct spi_nor *nor)
> {
> - struct gpio_desc *reset;
> + struct gpio_desc *reset = nor->reset;
>
> - reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
> - if (IS_ERR_OR_NULL(reset))
> - return PTR_ERR_OR_ZERO(reset);
> + if (!reset) {
Please set this the proper way in spi_nor_scan() and just use it
here.
-michael
> + reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR_OR_NULL(reset))
> + return PTR_ERR_OR_ZERO(reset);
> + nor->reset = reset;
> + }
>
> /*
> * Experimental delay values by looking at different flash device
> diff --git a/include/linux/mtd/spi-nor.h b/include/linux/mtd/spi-nor.h
> index b3e3c6b10186..46b1f92a490a 100644
> --- a/include/linux/mtd/spi-nor.h
> +++ b/include/linux/mtd/spi-nor.h
> @@ -374,6 +374,7 @@ struct spi_nor_flash_parameter;
> * settings that can be overwritten by the spi_nor_fixups
> * hooks, or dynamically when parsing the SFDP tables.
> * @dirmap: pointers to struct spi_mem_dirmap_desc for reads/writes.
> + * @reset: GPIO descriptor for device reset.
> * @priv: pointer to the private data
> */
> struct spi_nor {
> @@ -415,6 +416,7 @@ struct spi_nor {
> struct spi_mem_dirmap_desc *rdesc;
> struct spi_mem_dirmap_desc *wdesc;
> } dirmap;
> + struct gpio_desc *reset;
>
> void *priv;
> };
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 297 bytes --]
[-- Attachment #2: Type: text/plain, Size: 144 bytes --]
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2026-11-20 12:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-20 11:01 [PATCH 0/2] mtd: spi-nor: Add flash reset support during resume Srikanth Boyapally
2026-11-20 11:01 ` Srikanth Boyapally
2026-11-20 11:01 ` [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device " Srikanth Boyapally
2026-11-20 11:01 ` Srikanth Boyapally
2026-11-20 12:33 ` Michael Walle
2026-11-20 12:33 ` Michael Walle
2026-11-20 11:01 ` [PATCH 2/2] mtd: spi-nor: Reset flash device on resume Srikanth Boyapally
2026-11-20 11:01 ` Srikanth Boyapally
2026-11-20 11:19 ` sashiko-bot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.