diff mbox series

[v2,12/27] spi: nxp-fspi: Support per spi-mem operation frequency switches

Message ID 20241224-winbond-6-11-rc1-quad-support-v2-12-ad218dbc406f@bootlin.com (mailing list archive)
State New
Headers show
Series spi-nand/spi-mem DTR support | expand

Checks

Context Check Description
conchuod/vmtest-for-next-PR fail PR summary
conchuod/patch-12-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 138.50s
conchuod/patch-12-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1380.07s
conchuod/patch-12-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1609.49s
conchuod/patch-12-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 21.00s
conchuod/patch-12-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 23.06s
conchuod/patch-12-test-6 success .github/scripts/patches/tests/checkpatch.sh took 0.48s
conchuod/patch-12-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 43.73s
conchuod/patch-12-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.01s
conchuod/patch-12-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.55s
conchuod/patch-12-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-12-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.00s
conchuod/patch-12-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.04s

Commit Message

Miquel Raynal Dec. 24, 2024, 5:05 p.m. UTC
Every ->exec_op() call correctly configures the spi bus speed to the
maximum allowed frequency for the memory using the constant spi default
parameter. Since we can now have per-operation constraints, let's use
the value that comes from the spi-mem operation structure instead. In
case there is no specific limitation for this operation, the default spi
device value will be given anyway.

The per-operation frequency capability is thus advertised to the spi-mem
core.

Cc: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/spi/spi-nxp-fspi.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/drivers/spi/spi-nxp-fspi.c b/drivers/spi/spi-nxp-fspi.c
index 1161b9e5a4dce633718e22022410b5e7435bb51c..bad6b30bab0ecb90d0aaf603b6de5bc834d19de6 100644
--- a/drivers/spi/spi-nxp-fspi.c
+++ b/drivers/spi/spi-nxp-fspi.c
@@ -705,9 +705,10 @@  static void nxp_fspi_dll_calibration(struct nxp_fspi *f)
  * Value for rest of the CS FLSHxxCR0 register would be zero.
  *
  */
-static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi)
+static void nxp_fspi_select_mem(struct nxp_fspi *f, struct spi_device *spi,
+				const struct spi_mem_op *op)
 {
-	unsigned long rate = spi->max_speed_hz;
+	unsigned long rate = op->max_freq;
 	int ret;
 	uint64_t size_kb;
 
@@ -931,7 +932,7 @@  static int nxp_fspi_exec_op(struct spi_mem *mem, const struct spi_mem_op *op)
 				   FSPI_STS0_ARB_IDLE, 1, POLL_TOUT, true);
 	WARN_ON(err);
 
-	nxp_fspi_select_mem(f, mem->spi);
+	nxp_fspi_select_mem(f, mem->spi, op);
 
 	nxp_fspi_prepare_lut(f, op);
 	/*
@@ -1149,6 +1150,10 @@  static const struct spi_controller_mem_ops nxp_fspi_mem_ops = {
 	.get_name = nxp_fspi_get_name,
 };
 
+static const struct spi_controller_mem_caps nxp_fspi_mem_caps = {
+	.per_op_freq = true,
+};
+
 static int nxp_fspi_probe(struct platform_device *pdev)
 {
 	struct spi_controller *ctlr;
@@ -1246,6 +1251,7 @@  static int nxp_fspi_probe(struct platform_device *pdev)
 	ctlr->bus_num = -1;
 	ctlr->num_chipselect = NXP_FSPI_MAX_CHIPSELECT;
 	ctlr->mem_ops = &nxp_fspi_mem_ops;
+	ctlr->mem_caps = &nxp_fspi_mem_caps;
 
 	nxp_fspi_default_setup(f);