spi: spi-nxp-fspi: add the support for sample data from DQS pad
authorHaibo Chen <haibo.chen@nxp.com>
Wed, 17 Sep 2025 07:27:09 +0000 (15:27 +0800)
committerMark Brown <broonie@kernel.org>
Thu, 18 Sep 2025 21:26:51 +0000 (22:26 +0100)
commitc07f270323175b83779c2c2b80b360ed476baec5
tree6b97f5f84691250ec167f5308c92dc454691c919
parent3c1000e15fd0eb387fcca420c9fb36ae07887782
spi: spi-nxp-fspi: add the support for sample data from DQS pad

flexspi define four mode for sample clock source selection.
Here is the list of modes:
mode 0: Dummy Read strobe generated by FlexSPI Controller and loopback
        internally
mode 1: Dummy Read strobe generated by FlexSPI Controller and loopback
        from DQS pad
mode 2: Reserved
mode 3: Flash provided Read strobe and input from DQS pad

In default, flexspi use mode 0 after reset. And for DTR mode, flexspi
only support 8D-8D-8D mode. For 8D-8D-8D mode, IC suggest to use mode 3,
otherwise read always get incorrect data.

For DTR mode, flexspi will automatically div 2 of the root clock
and output to device. the formula is:
    device_clock = root_clock / (is_dtr ? 2 : 1)
So correct the clock rate setting for DTR mode to get the max
performance.

Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Link: https://patch.msgid.link/20250917-flexspi-ddr-v2-4-bb9fe2a01889@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-nxp-fspi.c