Re: [PATCH V1] spi: Add support for Double Transfer Rate (DTR) mode

From: Mukesh Kumar Savaliya
Date: Thu Mar 27 2025 - 06:04:42 EST


Thanks Mark !

On 3/26/2025 8:12 PM, Mark Brown wrote:
On Wed, Mar 26, 2025 at 07:55:05PM +0530, Mukesh Kumar Savaliya wrote:
On 3/26/2025 6:34 PM, Mark Brown wrote:

We should have a flag in the controller indicating if it supports this,
and code in the core which returns an error if a driver attempts to use
it when the controller doesn't support it.

Have added below in spi.h which can be set by client and controller driver
should be using it to decide mode.

+ bool dtr_mode;

since default it's false, should continue with SDR.
I believe for QSPI, it supports SDR or DDR, but it's not applicable to
standard SPI right ? So not sure in which case we should return an error ?

Standard SPI is the main thing I'm thinking of here, or possibly some
limited QSPI controller that doesn't support DTR. It's not something
that should actually come up really, it's more error handling if things
aren't set up properly.

IIUC, It comes to the point of first identifying if it's in context of QSPI controller or SPI controller right ?

Identify if SPI/QSPI controller has this capability using dtr_caps = true/false. Then check if it's supporting SDR/DDR mode. Can we then introduce below struct to first mark capability as true/false and then process dtr_mode ?

if not supported (dtr_caps = false), then don't care dtr_mode.
struct spi_caps {
bool dtr_mode;
bool dtr_caps;
};

OR we can have an API spi_controller_dtr_caps() which returns this flag set by individual SPI/QSPI controller. We can use above struct OR separate struct spi_controller_dtr_caps { bool dtr_caps };.

Please confirm if i am correct OR suggest more. Else you may approve one of the above option. (Sorry if i am missing anything ).