All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Santhosh Kumar K <s-k6@ti.com>
Cc: <broonie@kernel.org>,  <robh@kernel.org>,  <krzk+dt@kernel.org>,
	<conor+dt@kernel.org>,  <richard@nod.at>,  <vigneshr@ti.com>,
	<pratyush@kernel.org>,  <mwalle@kernel.org>,
	<takahiro.kuwano@infineon.com>,  <linux-spi@vger.kernel.org>,
	<devicetree@vger.kernel.org>,  <linux-kernel@vger.kernel.org>,
	<linux-mtd@lists.infradead.org>,  <praneeth@ti.com>,
	 <u-kumar1@ti.com>, <a-dutta@ti.com>
Subject: Re: [PATCH v3 09/13] spi: cadence-quadspi: reject 2-byte-address DDR ops on PHY-tunable hardware
Date: Tue, 02 Jun 2026 14:25:49 +0200	[thread overview]
Message-ID: <87se751642.fsf@bootlin.com> (raw)
In-Reply-To: <0ee42621-f970-451c-82cd-9a1a63ce197e@ti.com> (Santhosh Kumar K.'s message of "Mon, 1 Jun 2026 14:57:20 +0530")

On 01/06/2026 at 14:57:20 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:

> Hello Miquel,
>
> On 28/05/26 14:31, Miquel Raynal wrote:
>> On 27/05/2026 at 23:25:23 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:
>> 
>>> Erratum i2383 affects the AM654 OSPI controller: in PHY DDR mode,
>>> operations with a 2-byte address cause an internal state machine to
>>> mis-compare the transmitted address byte count against 1 instead of 2,
>>> locking up the address phase. [0]
>>>
>>> Add a CQSPI_NO_2BYTE_ADDR_PHY_DDR quirk flag and set it on the am654_ospi
>>> platform data. In cqspi_supports_mem_op(), when a controller carries this
>>> quirk and has PHY tuning support, reject DDR operations that use 2-byte
>>> addressing.
>>>
>>> [0] https://www.ti.com/lit/er/sprz544c/sprz544c.pdf
>>>
>>> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
>>> ---
>>>   drivers/spi/spi-cadence-quadspi.c | 15 ++++++++++++++-
>>>   1 file changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
>>> index 508bc5bc4ab5..72208d376305 100644
>>> --- a/drivers/spi/spi-cadence-quadspi.c
>>> +++ b/drivers/spi/spi-cadence-quadspi.c
>>> @@ -49,6 +49,7 @@ static_assert(CQSPI_MAX_CHIPSELECT <= SPI_DEVICE_CS_CNT_MAX);
>>>   #define CQSPI_DISABLE_RUNTIME_PM	BIT(10)
>>>   #define CQSPI_NO_INDIRECT_MODE		BIT(11)
>>>   #define CQSPI_HAS_WR_PROTECT		BIT(12)
>>> +#define CQSPI_NO_2BYTE_ADDR_PHY_DDR	BIT(13)
>>>     /* Capabilities */
>>>   #define CQSPI_SUPPORTS_OCTAL		BIT(0)
>>> @@ -1627,6 +1628,18 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem,
>>>   		if (op->data.nbytes && op->data.buswidth != 8)
>>>   			return false;
>>>   +		/*
>>> +		 * Erratum i2383: In PHY DDR mode, 2-byte addressing causes an
>>> +		 * internal state machine to mis-compare the transmitted
>>> +		 * address byte count against 1 instead of 2, locking up the
>>> +		 * address phase. Reject such ops on controllers that need it.
>>> +		 */
>>> +		if (cqspi->ddata &&
>>> +		    (cqspi->ddata->quirks & CQSPI_NO_2BYTE_ADDR_PHY_DDR)) {
>>> +			if (op->addr.nbytes == 2 && cqspi->ddata->execute_tuning)
>>> +				return false;
>>> +		}
>> I don't think this is a valid approach. What we want is to prevent
>> tuning in octal DTR mode with 2 bytes addressing, instead of preventing
>> reads/writes in octal DTR modes after tuning. Have you tried on an AM62A LP
>> SK? I bet probe fails..
>> The quirk should be handled at the beginning of the tuning procedure,
>> so
>> we skip tuning entirely in this case.
>
> I see your point. However, in my testing on AM62Ax LP SK, the controller
> and the flash probes and operates correctly in 8S PHY mode.
>
> The reason I handled this in supports_op() is that, for these devices,
> simply skipping tuning when a 2-byte DDR operation is selected may not
> lead to the best achievable operating point. The performance ordering I
> measured is:
>
> 8S non-PHY < 8D non-PHY < 8S PHY

Maybe this is not totally generic and cannot be used as a solid ground:
it highly depends on the base frequency. If the base frequency is rather
high (typically > 85MHz)n then 8D non-PHY might be faster. But maybe
this is not the typical case and is rare enough to ignore.

> So falling back from 8D PHY to 8D non-PHY would leave performance on the
> table compared to selecting and tuning an 8S operation.
>
> That said, I agree that encoding this as an operation support
> restriction is probably not the right place to handle it. I'll rework
> the initialization flow so that operation selection can take
> PHY-achievable frequencies and controller-specific restrictions such as
> i2383 into account when choosing the final operations.

Very interesting.

> Let me prototype this approach and will report back with the results.

I'm eager to see the result!

Thanks,
Miquèl

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Santhosh Kumar K <s-k6@ti.com>
Cc: <broonie@kernel.org>,  <robh@kernel.org>,  <krzk+dt@kernel.org>,
	<conor+dt@kernel.org>,  <richard@nod.at>,  <vigneshr@ti.com>,
	<pratyush@kernel.org>,  <mwalle@kernel.org>,
	<takahiro.kuwano@infineon.com>,  <linux-spi@vger.kernel.org>,
	<devicetree@vger.kernel.org>,  <linux-kernel@vger.kernel.org>,
	<linux-mtd@lists.infradead.org>,  <praneeth@ti.com>,
	 <u-kumar1@ti.com>, <a-dutta@ti.com>
Subject: Re: [PATCH v3 09/13] spi: cadence-quadspi: reject 2-byte-address DDR ops on PHY-tunable hardware
Date: Tue, 02 Jun 2026 14:25:49 +0200	[thread overview]
Message-ID: <87se751642.fsf@bootlin.com> (raw)
In-Reply-To: <0ee42621-f970-451c-82cd-9a1a63ce197e@ti.com> (Santhosh Kumar K.'s message of "Mon, 1 Jun 2026 14:57:20 +0530")

On 01/06/2026 at 14:57:20 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:

> Hello Miquel,
>
> On 28/05/26 14:31, Miquel Raynal wrote:
>> On 27/05/2026 at 23:25:23 +0530, Santhosh Kumar K <s-k6@ti.com> wrote:
>> 
>>> Erratum i2383 affects the AM654 OSPI controller: in PHY DDR mode,
>>> operations with a 2-byte address cause an internal state machine to
>>> mis-compare the transmitted address byte count against 1 instead of 2,
>>> locking up the address phase. [0]
>>>
>>> Add a CQSPI_NO_2BYTE_ADDR_PHY_DDR quirk flag and set it on the am654_ospi
>>> platform data. In cqspi_supports_mem_op(), when a controller carries this
>>> quirk and has PHY tuning support, reject DDR operations that use 2-byte
>>> addressing.
>>>
>>> [0] https://www.ti.com/lit/er/sprz544c/sprz544c.pdf
>>>
>>> Signed-off-by: Santhosh Kumar K <s-k6@ti.com>
>>> ---
>>>   drivers/spi/spi-cadence-quadspi.c | 15 ++++++++++++++-
>>>   1 file changed, 14 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/spi/spi-cadence-quadspi.c b/drivers/spi/spi-cadence-quadspi.c
>>> index 508bc5bc4ab5..72208d376305 100644
>>> --- a/drivers/spi/spi-cadence-quadspi.c
>>> +++ b/drivers/spi/spi-cadence-quadspi.c
>>> @@ -49,6 +49,7 @@ static_assert(CQSPI_MAX_CHIPSELECT <= SPI_DEVICE_CS_CNT_MAX);
>>>   #define CQSPI_DISABLE_RUNTIME_PM	BIT(10)
>>>   #define CQSPI_NO_INDIRECT_MODE		BIT(11)
>>>   #define CQSPI_HAS_WR_PROTECT		BIT(12)
>>> +#define CQSPI_NO_2BYTE_ADDR_PHY_DDR	BIT(13)
>>>     /* Capabilities */
>>>   #define CQSPI_SUPPORTS_OCTAL		BIT(0)
>>> @@ -1627,6 +1628,18 @@ static bool cqspi_supports_mem_op(struct spi_mem *mem,
>>>   		if (op->data.nbytes && op->data.buswidth != 8)
>>>   			return false;
>>>   +		/*
>>> +		 * Erratum i2383: In PHY DDR mode, 2-byte addressing causes an
>>> +		 * internal state machine to mis-compare the transmitted
>>> +		 * address byte count against 1 instead of 2, locking up the
>>> +		 * address phase. Reject such ops on controllers that need it.
>>> +		 */
>>> +		if (cqspi->ddata &&
>>> +		    (cqspi->ddata->quirks & CQSPI_NO_2BYTE_ADDR_PHY_DDR)) {
>>> +			if (op->addr.nbytes == 2 && cqspi->ddata->execute_tuning)
>>> +				return false;
>>> +		}
>> I don't think this is a valid approach. What we want is to prevent
>> tuning in octal DTR mode with 2 bytes addressing, instead of preventing
>> reads/writes in octal DTR modes after tuning. Have you tried on an AM62A LP
>> SK? I bet probe fails..
>> The quirk should be handled at the beginning of the tuning procedure,
>> so
>> we skip tuning entirely in this case.
>
> I see your point. However, in my testing on AM62Ax LP SK, the controller
> and the flash probes and operates correctly in 8S PHY mode.
>
> The reason I handled this in supports_op() is that, for these devices,
> simply skipping tuning when a 2-byte DDR operation is selected may not
> lead to the best achievable operating point. The performance ordering I
> measured is:
>
> 8S non-PHY < 8D non-PHY < 8S PHY

Maybe this is not totally generic and cannot be used as a solid ground:
it highly depends on the base frequency. If the base frequency is rather
high (typically > 85MHz)n then 8D non-PHY might be faster. But maybe
this is not the typical case and is rare enough to ignore.

> So falling back from 8D PHY to 8D non-PHY would leave performance on the
> table compared to selecting and tuning an 8S operation.
>
> That said, I agree that encoding this as an operation support
> restriction is probably not the right place to handle it. I'll rework
> the initialization flow so that operation selection can take
> PHY-achievable frequencies and controller-specific restrictions such as
> i2383 into account when choosing the final operations.

Very interesting.

> Let me prototype this approach and will report back with the results.

I'm eager to see the result!

Thanks,
Miquèl

  reply	other threads:[~2026-06-02 12:26 UTC|newest]

Thread overview: 142+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-27 17:55 [PATCH v3 00/13] spi: cadence-quadspi: add PHY tuning support Santhosh Kumar K
2026-05-27 17:55 ` Santhosh Kumar K
2026-05-27 17:55 ` [PATCH v3 01/13] spi: dt-bindings: allow spi-max-frequency to specify a frequency pair Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:17   ` sashiko-bot
2026-05-28  8:32   ` Miquel Raynal
2026-05-28  8:32     ` Miquel Raynal
2026-05-28 17:36   ` Conor Dooley
2026-05-28 17:36     ` Conor Dooley
2026-05-30  8:54     ` Krzysztof Kozlowski
2026-05-30  8:54       ` Krzysztof Kozlowski
2026-06-01  7:45     ` Santhosh Kumar K
2026-06-01  7:45       ` Santhosh Kumar K
2026-06-02 12:05       ` Miquel Raynal
2026-06-02 12:05         ` Miquel Raynal
2026-06-02 16:18         ` Conor Dooley
2026-06-02 16:18           ` Conor Dooley
2026-06-03 15:54           ` Miquel Raynal
2026-06-03 15:54             ` Miquel Raynal
2026-06-03 16:07             ` Conor Dooley
2026-06-03 16:07               ` Conor Dooley
2026-06-03 16:29               ` Miquel Raynal
2026-06-03 16:29                 ` Miquel Raynal
2026-06-03 16:40                 ` Conor Dooley
2026-06-03 16:40                   ` Conor Dooley
2026-06-04  7:14                   ` Miquel Raynal
2026-06-04  7:14                     ` Miquel Raynal
2026-06-04  8:36                     ` Conor Dooley
2026-06-04  8:36                       ` Conor Dooley
2026-06-05  6:32                       ` Miquel Raynal
2026-06-05  6:32                         ` Miquel Raynal
2026-06-05  7:17                         ` Conor Dooley
2026-06-05  7:17                           ` Conor Dooley
2026-06-05  7:26                           ` Miquel Raynal
2026-06-05  7:26                             ` Miquel Raynal
2026-06-05 15:20                             ` Conor Dooley
2026-06-05 15:20                               ` Conor Dooley
2026-06-05 16:55                               ` Miquel Raynal
2026-06-05 16:55                                 ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 02/13] spi: dt-bindings: cdns,qspi-nor: add PHY tuning pattern partition property Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:11   ` sashiko-bot
2026-05-28  8:34   ` Miquel Raynal
2026-05-28  8:34     ` Miquel Raynal
2026-05-30  8:52   ` Krzysztof Kozlowski
2026-05-30  8:52     ` Krzysztof Kozlowski
2026-06-01  8:26     ` Santhosh Kumar K
2026-06-01  8:26       ` Santhosh Kumar K
2026-06-01 11:26       ` Krzysztof Kozlowski
2026-06-01 11:26         ` Krzysztof Kozlowski
2026-06-01 11:47         ` Krzysztof Kozlowski
2026-06-01 11:47           ` Krzysztof Kozlowski
2026-06-02  6:30           ` Santhosh Kumar K
2026-06-02  6:30             ` Santhosh Kumar K
2026-06-02 12:08             ` Krzysztof Kozlowski
2026-06-02 12:08               ` Krzysztof Kozlowski
2026-06-02 12:36             ` Miquel Raynal
2026-06-02 12:36               ` Miquel Raynal
2026-06-02 12:48               ` Krzysztof Kozlowski
2026-06-02 12:48                 ` Krzysztof Kozlowski
2026-06-04 12:01                 ` Santhosh Kumar K
2026-06-04 12:01                   ` Santhosh Kumar K
2026-06-02 16:49   ` Rob Herring
2026-06-02 16:49     ` Rob Herring
2026-06-03 16:01     ` Miquel Raynal
2026-06-03 16:01       ` Miquel Raynal
2026-06-03 17:38       ` Rob Herring
2026-06-03 17:38         ` Rob Herring
2026-06-03 19:00         ` Michael Walle
2026-06-03 19:00           ` Michael Walle
2026-06-04 12:07           ` Santhosh Kumar K
2026-06-04 12:07             ` Santhosh Kumar K
2026-06-04  7:28         ` Miquel Raynal
2026-06-04  7:28           ` Miquel Raynal
2026-06-04 12:04           ` Santhosh Kumar K
2026-06-04 12:04             ` Santhosh Kumar K
2026-05-27 17:55 ` [PATCH v3 03/13] spi: parse two-element spi-max-frequency property Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:19   ` sashiko-bot
2026-05-28  8:37   ` Miquel Raynal
2026-05-28  8:37     ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 04/13] spi: spi-mem: add spi_mem_apply_base_freq_cap() Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:32   ` sashiko-bot
2026-05-28  8:43   ` Miquel Raynal
2026-05-28  8:43     ` Miquel Raynal
2026-06-04 12:10     ` Santhosh Kumar K
2026-06-04 12:10       ` Santhosh Kumar K
2026-06-05  6:15       ` Miquel Raynal
2026-06-05  6:15         ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 05/13] spi: spi-mem: add execute_tuning callback and spi_mem_execute_tuning() Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:21   ` sashiko-bot
2026-05-28  8:44   ` Miquel Raynal
2026-05-28  8:44     ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 06/13] spi: cadence-quadspi: move cqspi_readdata_capture earlier Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 17:55 ` [PATCH v3 07/13] spi: cadence-quadspi: add DQS support to read data capture Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:17   ` sashiko-bot
2026-05-27 17:55 ` [PATCH v3 08/13] spi: cadence-quadspi: add PHY tuning support Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:44   ` sashiko-bot
2026-05-28  8:54   ` Miquel Raynal
2026-05-28  8:54     ` Miquel Raynal
2026-06-01  8:44     ` Santhosh Kumar K
2026-06-01  8:44       ` Santhosh Kumar K
2026-05-27 17:55 ` [PATCH v3 09/13] spi: cadence-quadspi: reject 2-byte-address DDR ops on PHY-tunable hardware Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-28  9:01   ` Miquel Raynal
2026-05-28  9:01     ` Miquel Raynal
2026-06-01  9:27     ` Santhosh Kumar K
2026-06-01  9:27       ` Santhosh Kumar K
2026-06-02 12:25       ` Miquel Raynal [this message]
2026-06-02 12:25         ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 10/13] spi: cadence-quadspi: enable PHY for direct reads and indirect writes Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:36   ` sashiko-bot
2026-05-28  9:09   ` Miquel Raynal
2026-05-28  9:09     ` Miquel Raynal
2026-06-01  8:39     ` Santhosh Kumar K
2026-06-01  8:39       ` Santhosh Kumar K
2026-06-02 12:15       ` Miquel Raynal
2026-06-02 12:15         ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 11/13] mtd: spinand: run PHY tuning after init and update dirmap frequencies Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 19:04   ` sashiko-bot
2026-05-28  9:27   ` Miquel Raynal
2026-05-28  9:27     ` Miquel Raynal
2026-06-01  9:16     ` Santhosh Kumar K
2026-06-01  9:16       ` Santhosh Kumar K
2026-06-02 12:18       ` Miquel Raynal
2026-06-02 12:18         ` Miquel Raynal
2026-05-27 17:55 ` [PATCH v3 12/13] mtd: spi-nor: extract read op template construction into helper Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 17:55 ` [PATCH v3 13/13] mtd: spi-nor: run PHY tuning after init and update dirmap frequency Santhosh Kumar K
2026-05-27 17:55   ` Santhosh Kumar K
2026-05-27 18:59   ` sashiko-bot
2026-05-28  8:30 ` [PATCH v3 00/13] spi: cadence-quadspi: add PHY tuning support Miquel Raynal
2026-05-28  8:30   ` Miquel Raynal
2026-06-01  8:02   ` Santhosh Kumar K
2026-06-01  8:02     ` 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=87se751642.fsf@bootlin.com \
    --to=miquel.raynal@bootlin.com \
    --cc=a-dutta@ti.com \
    --cc=broonie@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mwalle@kernel.org \
    --cc=praneeth@ti.com \
    --cc=pratyush@kernel.org \
    --cc=richard@nod.at \
    --cc=robh@kernel.org \
    --cc=s-k6@ti.com \
    --cc=takahiro.kuwano@infineon.com \
    --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 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.