[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87tsvvgkks.fsf@bootlin.com>
Date: Thu, 05 Feb 2026 18:35:15 +0100
From: Miquel Raynal <miquel.raynal@...tlin.com>
To: Santhosh Kumar K <s-k6@...com>
Cc: <broonie@...nel.org>, <robh@...nel.org>, <krzk+dt@...nel.org>,
<conor+dt@...nel.org>, <richard@....at>, <vigneshr@...com>,
<tudor.ambarus@...aro.org>, <pratyush@...nel.org>, <mwalle@...nel.org>,
<linux-spi@...r.kernel.org>, <devicetree@...r.kernel.org>,
<linux-kernel@...r.kernel.org>, <linux-mtd@...ts.infradead.org>,
<praneeth@...com>, <u-kumar1@...com>, <p-mantena@...com>,
<a-dutta@...com>
Subject: Re: [RFC PATCH v2 03/12] mtd: spinand: perform controller tuning
during probe
Hi Santhosh,
On 13/01/2026 at 19:46:08 +0530, Santhosh Kumar K <s-k6@...com> wrote:
> SPI controllers may need tuning for reliable high-speed operation.
> Without it, controllers use conservative timing that limits performance.
>
> Call spi_mem_execute_tuning() during probe to optimize timing for
> the device's read and write operations. Failures are non-fatal as
> controllers fall back to default timing.
>
> Signed-off-by: Santhosh Kumar K <s-k6@...com>
> ---
> drivers/mtd/nand/spi/core.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index 0346916b032b..2a45d1047736 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -1658,6 +1658,7 @@ static int spinand_probe(struct spi_mem *mem)
> {
> struct spinand_device *spinand;
> struct mtd_info *mtd;
> + struct spi_mem_op read_op, write_op;
> int ret;
>
> spinand = devm_kzalloc(&mem->spi->dev, sizeof(*spinand),
> @@ -1676,6 +1677,19 @@ static int spinand_probe(struct spi_mem *mem)
> if (ret)
> return ret;
>
> + read_op = *spinand->op_templates.read_cache;
> + write_op = *spinand->op_templates.write_cache;
These will become:
+ read_op = *spinand->op_templates->read_cache;
+ write_op = *spinand->op_templates->write_cache;
after rebasing on nand/next or next -rc1.
> +
> + ret = spi_mem_execute_tuning(mem, &read_op, &write_op);
> + if (ret && ret != -EOPNOTSUPP) {
> + dev_warn(&mem->spi->dev, "Failed to execute PHY tuning: %d\n",
> + ret);
> + /*
> + * Tuning failure is non-fatal; the controller falls back to
> + * default timing, reducing speed but ensuring operation.
> + */
> + }
Can we move the comment before spi_mem_execute_timing()? Then no more
brackets needed and it will be easier to read (imo).
LGTM otherwise.
Thanks,
Miquèl
Powered by blists - more mailing lists