From: Michael Walle <michael@walle.cc>
To: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Cc: Tudor Ambarus <tudor.ambarus@microchip.com>,
Pratyush Yadav <pratyush@kernel.org>,
Miquel Raynal <miquel.raynal@bootlin.com>,
Richard Weinberger <richard@nod.at>,
Vignesh Raghavendra <vigneshr@ti.com>,
Rob Herring <robh+dt@kernel.org>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>,
devicetree@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org, saikrishna12468@gmail.com,
git@amd.com
Subject: Re: [PATCH v2 2/2] mtd: spi-nor: Add support for flash reset
Date: Thu, 01 Sep 2022 09:39:17 +0200 [thread overview]
Message-ID: <f4c6e60a22a4252bcecdfb3a2c957b2a@walle.cc> (raw)
In-Reply-To: <20220901072914.30205-3-sai.krishna.potthuri@amd.com>
Am 2022-09-01 09:29, schrieb Sai Krishna Potthuri:
> Add support for spi-nor flash reset via GPIO controller by reading the
> reset-gpio property. If there is a valid GPIO specifier then reset will
> be performed by asserting and deasserting the GPIO using gpiod APIs
> otherwise it will not perform any operation.
>
> Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Reviewed-by: Michael Walle <michael@walle.cc>
Just one comment, see below
> ---
> drivers/mtd/spi-nor/core.c | 25 +++++++++++++++++++++++++
> 1 file changed, 25 insertions(+)
>
> diff --git a/drivers/mtd/spi-nor/core.c b/drivers/mtd/spi-nor/core.c
> index f2c64006f8d7..a78ab9bae2be 100644
> --- a/drivers/mtd/spi-nor/core.c
> +++ b/drivers/mtd/spi-nor/core.c
> @@ -2933,6 +2933,27 @@ static void spi_nor_set_mtd_info(struct spi_nor
> *nor)
> mtd->_put_device = spi_nor_put_device;
> }
>
> +static int spi_nor_hw_reset(struct spi_nor *nor)
> +{
> + struct gpio_desc *reset;
> +
> + reset = devm_gpiod_get_optional(nor->dev, "reset", GPIOD_OUT_LOW);
> + if (IS_ERR_OR_NULL(reset))
> + return PTR_ERR_OR_ZERO(reset);
> +
> + /*
> + * Experimental delay values by looking at different flash device
> + * vendors datasheets.
> + */
> + usleep_range(1, 5);
I think this is superfluous, because parts of the kernel
will boot which should take longer than 1us. But I'm
fine with leaving it here.
-michael
> + gpiod_set_value_cansleep(reset, 1);
> + usleep_range(100, 150);
> + gpiod_set_value_cansleep(reset, 0);
> + usleep_range(1000, 1200);
> +
> + return 0;
> +}
> +
> int spi_nor_scan(struct spi_nor *nor, const char *name,
> const struct spi_nor_hwcaps *hwcaps)
> {
> @@ -2965,6 +2986,10 @@ int spi_nor_scan(struct spi_nor *nor, const char
> *name,
> if (!nor->bouncebuf)
> return -ENOMEM;
>
> + ret = spi_nor_hw_reset(nor);
> + if (ret)
> + return ret;
> +
> info = spi_nor_get_flash_info(nor, name);
> if (IS_ERR(info))
> return PTR_ERR(info);
prev parent reply other threads:[~2022-09-01 7:39 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-01 7:29 [PATCH v2 0/2] mtd: spi-nor: Add flash device reset support Sai Krishna Potthuri
2022-09-01 7:29 ` [PATCH v2 1/2] dt-bindings: mtd: spi-nor: Add reset-gpios property Sai Krishna Potthuri
2022-09-01 7:56 ` Krzysztof Kozlowski
2022-09-01 10:18 ` Potthuri, Sai Krishna
2022-09-01 10:28 ` Krzysztof Kozlowski
2022-09-07 9:49 ` Potthuri, Sai Krishna
2022-09-07 10:24 ` Krzysztof Kozlowski
2022-09-01 7:29 ` [PATCH v2 2/2] mtd: spi-nor: Add support for flash reset Sai Krishna Potthuri
2022-09-01 7:39 ` Michael Walle [this message]
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=f4c6e60a22a4252bcecdfb3a2c957b2a@walle.cc \
--to=michael@walle.cc \
--cc=devicetree@vger.kernel.org \
--cc=git@amd.com \
--cc=krzysztof.kozlowski+dt@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=miquel.raynal@bootlin.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=robh+dt@kernel.org \
--cc=sai.krishna.potthuri@amd.com \
--cc=saikrishna12468@gmail.com \
--cc=tudor.ambarus@microchip.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 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).