diff options
| author | Haibo Chen <haibo.chen@nxp.com> | 2025-09-22 16:47:13 +0800 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-10-29 14:10:26 +0100 |
| commit | 2b26747b85b1882f84fff57c22d3c4957df8b85e (patch) | |
| tree | 8d81a195a9618c105e0e8d688b4a39acc0a1967b /drivers/spi | |
| parent | ac6845a5bae63dc784279b207f5d12b42660995c (diff) | |
| download | linux-2b26747b85b1882f84fff57c22d3c4957df8b85e.tar.gz linux-2b26747b85b1882f84fff57c22d3c4957df8b85e.tar.bz2 linux-2b26747b85b1882f84fff57c22d3c4957df8b85e.zip | |
spi: spi-nxp-fspi: re-config the clock rate when operation require new clock rate
[ Upstream commit a89103f67112453fa36c9513e951c19eed9d2d92 ]
Current operation contain the max_freq, so new coming operation may use
new clock rate, need to re-config the clock rate to match the requirement.
Fixes: 26851cf65ffc ("spi: nxp-fspi: Support per spi-mem operation frequency switches")
Signed-off-by: Haibo Chen <haibo.chen@nxp.com>
Link: https://patch.msgid.link/20250922-fspi-fix-v1-1-ff4315359d31@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers/spi')
| -rw-r--r-- | drivers/spi/spi-nxp-fspi.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c index 7cbe774f1f39..542d6f57c1ae 100644 --- a/drivers/spi/spi-nxp-fspi.c +++ b/drivers/spi/spi-nxp-fspi.c @@ -402,6 +402,8 @@ struct nxp_fspi { #define FSPI_NEED_INIT BIT(0) #define FSPI_DTR_MODE BIT(1) int flags; + /* save the previous operation clock rate */ + unsigned long pre_op_rate; }; static inline int needs_ip_only(struct nxp_fspi *f) @@ -757,11 +759,17 @@ static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi, uint64_t size_kb; /* - * Return, if previously selected target device is same as current - * requested target device. Also the DTR or STR mode do not change. + * Return when following condition all meet, + * 1, if previously selected target device is same as current + * requested target device. + * 2, the DTR or STR mode do not change. + * 3, previous operation max rate equals current one. + * + * For other case, need to re-config. */ if ((f->selected == spi_get_chipselect(spi, 0)) && - (!!(f->flags & FSPI_DTR_MODE) == op_is_dtr)) + (!!(f->flags & FSPI_DTR_MODE) == op_is_dtr) && + (f->pre_op_rate == op->max_freq)) return; /* Reset FLSHxxCR0 registers */ @@ -807,6 +815,8 @@ static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi, if (rate > 100000000) nxp_fspi_dll_calibration(f); + f->pre_op_rate = op->max_freq; + f->selected = spi_get_chipselect(spi, 0); } |
