From: Santhosh Kumar K <s-k6@ti.com>
To: Pratyush Yadav <pratyush@kernel.org>,
Miquel Raynal <miquel.raynal@bootlin.com>
Cc: <richard@nod.at>, <vigneshr@ti.com>, <broonie@kernel.org>,
<tudor.ambarus@linaro.org>, <mwalle@kernel.org>,
<p-mantena@ti.com>, <linux-spi@vger.kernel.org>,
<linux-mtd@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
<a-dutta@ti.com>, <u-kumar1@ti.com>, <praneeth@ti.com>,
<s-k6@ti.com>
Subject: Re: [RFC PATCH 01/10] spi: spi-mem: Introduce support for tuning controller
Date: Wed, 3 Dec 2025 13:32:16 +0530 [thread overview]
Message-ID: <cf87ced7-aa66-4b15-98e5-92cb76737073@ti.com> (raw)
In-Reply-To: <mafs0ms4j4fuz.fsf@kernel.org>
Hello Miquel and Pratyush,
On 18/11/25 19:12, Pratyush Yadav wrote:
> On Wed, Nov 05 2025, Miquel Raynal wrote:
>
>> Hello Santhosh,
>>
>>>>> - On tuning failure, retry by re-running spi_mem_needs_tuning() with
>>>>> the second best set of ops (max throughput - 1)
>>>> I would like to challenge this need. Can the same calibration fail if
>>>> attempted multiple times (eg. because of the heat?) If yes, then we need
>>>> a fallback indeed. Otherwise, I'd be in favor of just failing the
>>>> probe. Calibration is an opt-in -> users must allow a higher frequency
>>>> than they use to in order to enable the feature?
>>>
>>> It's possible the same calibration will fail intermittently for
>>> different reasons (temperature changes, as you mentioned). If tuning
>>> fails, the driver should fallback to the non-PHY frequency so the flash
>>> continues operating with slower reads/writes rather than failing the
>>> probe (availability should be prioritized, right?).
>>
>> Agreed, if the tuning may fail we must fallback in this case. However
>> there is another situation that must be handled in this case: once
>> tuning is done and we want to use PHY-optimized paths, we must fallback
>> to more basic/slower reads if for some external reason, they start
>> failing, right?
>
> How would you even detect that your tuning is out-of-date because of
> temperature changes? You would need some sort of on-flash ECC to detect
> that. I think many of the flashes that support DDR reads at high
> frequencies also have ECC, but AFAIK the SPI NOR core does not support
> it.
>
> Anyway, I think we should limit the scope of the problem. Let's first
> start with the expectation that the tuning supports the whole operation
> range of the device. This was true at least for the spi-cadence-quadspi
> tuning that I worked on when I was at TI. The tuning parameters had
> enough margin to ensure it worked for the device's whole temperature
> range.
>
> If there is a tuning algorithm that can't do that, then we can extend
> the core to either do ECC or perhaps let temperature sensors signal the
> need for re-calibration.
>
> But for now I think it is easiest to just ignore the problem and focus
> on the other ones like how to get the calibration pattern and how to do
> the tuning.
>
>>
>> The obvious choice in this case would be to let this error handling to
>> the controller driver. Re-using the same operation at a lower speed
>> would be suboptimal, because the fastest operation at a high speed might
>> not be the most efficient at slower speeds due to the number of dummy
>> cycles needed,. But I believe this is negligible based on the fact that
>> we already are in degraded mode at that stage.
>>
>> However, this may conflict with:
>> - read retries
>> - continuous reads (?)
>>
>> So in practice the fallback might be needed on the SPI NAND/NOR side
>> (this can be further discussed).
Just to summarize, fallback logic during probe:
- If the controller reports a tuning failure, the spi-mem client may
either retry tuning with the next-best (max-1) operation or fallback to
the non-PHY, slower operation and adjust the dummy cycles accordingly to
use the optimal non-PHY variant.
And yes, for now the priority is to have a robust probe-time tuning flow
before addressing any runtime tuning concerns.
>>
>> But once we solve this, comes a similar problem on the write side. How
>> do we know if a write will or did fail because of a temperature change?
>> What may be the heuristics to fallback in this case?
>
> Santhosh, do you have any numbers on write performance improvements? I
> am curious if it is even worth the effort.
There's no real performance gain for SPI NOR, but SPI NAND shows notable
improvement wrt. page size.
Write performance numbers from AM62A SK with W35N01JW OSPI NAND:
- without PHY: 6 MB/s
- with PHY: 9.2 MB/s
Thanks,
Santhosh.
>
>>
>> Thanks,
>> Miquèl
>
next prev parent reply other threads:[~2025-12-03 8:02 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-11 19:32 [RFC PATCH 00/10] SPINAND PHY Tuning Series Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 01/10] spi: spi-mem: Introduce support for tuning controller Santhosh Kumar K
2025-08-13 20:26 ` Mark Brown
2025-08-14 11:34 ` Santhosh Kumar K
2025-08-14 12:34 ` Mark Brown
2025-08-22 6:05 ` Santhosh Kumar K
2025-09-10 8:07 ` Miquel Raynal
2025-08-24 17:02 ` Miquel Raynal
2025-09-10 8:21 ` Miquel Raynal
2025-09-20 17:55 ` Santhosh Kumar K
2025-10-28 15:41 ` Miquel Raynal
2025-11-05 8:55 ` Santhosh Kumar K
2025-11-05 9:35 ` Miquel Raynal
2025-11-18 13:42 ` Pratyush Yadav
2025-12-03 8:02 ` Santhosh Kumar K [this message]
2025-12-03 8:58 ` Miquel Raynal
2025-12-10 11:33 ` Santhosh Kumar K
2025-12-12 6:43 ` Pratyush Yadav
2025-11-18 13:49 ` Pratyush Yadav
2025-12-03 8:02 ` Santhosh Kumar K
2025-12-03 9:28 ` Michael Walle
2025-12-03 9:50 ` Miquel Raynal
2025-12-03 14:12 ` Michael Walle
2025-12-10 11:36 ` Santhosh Kumar K
2025-12-10 11:34 ` Santhosh Kumar K
2025-12-11 14:16 ` Miquel Raynal
2025-12-04 16:54 ` Mahapatra, Amit Kumar
2025-12-10 11:34 ` Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 02/10] spi: spi-mem: Define spi_mem_tuning_params and spi_mem_get_tuning_params() Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 03/10] mtd: nand: spi: Introduce _execute_tuning for mtd devices Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 04/10] mtd: mtdcore: Call mtd_execute_tuning during mtd_register Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 05/10] spi: cadence-quadspi: Move cqspi_readdata_capture() above all operations Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 06/10] spi: cadence-quadspi: Use BIT() macro for CQSPI_REG_READCAPTURE_BYPASS Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 07/10] spi: cadence-quadspi: Enable PHY for aligned DAC reads Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 08/10] spi: cadence-quadspi: Enable PHY for data writes Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 09/10] spi: cadence-quadspi: Implement PHY for higher frequencies in SDR mode Santhosh Kumar K
2025-08-11 19:32 ` [RFC PATCH 10/10] spi: cadence-quadspi: Define cqspi_get_tuning_params() Santhosh Kumar K
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=cf87ced7-aa66-4b15-98e5-92cb76737073@ti.com \
--to=s-k6@ti.com \
--cc=a-dutta@ti.com \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=miquel.raynal@bootlin.com \
--cc=mwalle@kernel.org \
--cc=p-mantena@ti.com \
--cc=praneeth@ti.com \
--cc=pratyush@kernel.org \
--cc=richard@nod.at \
--cc=tudor.ambarus@linaro.org \
--cc=u-kumar1@ti.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