All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael Walle" <mwalle@kernel.org>
To: "Srikanth Boyapally" <srikanth.boyapally@amd.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<michal.simek@amd.com>, <git@amd.com>,
	"Amit Kumar Mahapatra" <amit.kumar-mahapatra@amd.com>
Subject: Re: [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device during resume
Date: Fri, 20 Nov 2026 13:33:31 +0100	[thread overview]
Message-ID: <DN01HTG5U6PY.1I5VK9AJ07JLO@kernel.org> (raw)
In-Reply-To: <20261120-nor_11_20-v1-1-70332a54037f@amd.com>

[-- 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 --]

WARNING: multiple messages have this Message-ID (diff)
From: "Michael Walle" <mwalle@kernel.org>
To: "Srikanth Boyapally" <srikanth.boyapally@amd.com>,
	"Pratyush Yadav" <pratyush@kernel.org>,
	"Takahiro Kuwano" <takahiro.kuwano@infineon.com>,
	"Miquel Raynal" <miquel.raynal@bootlin.com>,
	"Richard Weinberger" <richard@nod.at>,
	"Vignesh Raghavendra" <vigneshr@ti.com>
Cc: <linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<michal.simek@amd.com>, <git@amd.com>,
	"Amit Kumar Mahapatra" <amit.kumar-mahapatra@amd.com>
Subject: Re: [PATCH 1/2] mtd: spi-nor: Store GPIO info for resetting device during resume
Date: Fri, 20 Nov 2026 13:33:31 +0100	[thread overview]
Message-ID: <DN01HTG5U6PY.1I5VK9AJ07JLO@kernel.org> (raw)
In-Reply-To: <20261120-nor_11_20-v1-1-70332a54037f@amd.com>


[-- 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/

  reply	other threads:[~2026-11-20 12:33 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DN01HTG5U6PY.1I5VK9AJ07JLO@kernel.org \
    --to=mwalle@kernel.org \
    --cc=amit.kumar-mahapatra@amd.com \
    --cc=git@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=michal.simek@amd.com \
    --cc=miquel.raynal@bootlin.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=srikanth.boyapally@amd.com \
    --cc=takahiro.kuwano@infineon.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.