diff mbox series

[v2,15/27] spi: spi-ti-qspi: Support per spi-mem operation frequency switches

Message ID 20241224-winbond-6-11-rc1-quad-support-v2-15-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-15-test-1 success .github/scripts/patches/tests/build_rv32_defconfig.sh took 138.72s
conchuod/patch-15-test-2 success .github/scripts/patches/tests/build_rv64_clang_allmodconfig.sh took 1378.14s
conchuod/patch-15-test-3 success .github/scripts/patches/tests/build_rv64_gcc_allmodconfig.sh took 1609.65s
conchuod/patch-15-test-4 success .github/scripts/patches/tests/build_rv64_nommu_k210_defconfig.sh took 20.92s
conchuod/patch-15-test-5 success .github/scripts/patches/tests/build_rv64_nommu_virt_defconfig.sh took 23.09s
conchuod/patch-15-test-6 success .github/scripts/patches/tests/checkpatch.sh took 0.46s
conchuod/patch-15-test-7 success .github/scripts/patches/tests/dtb_warn_rv64.sh took 43.47s
conchuod/patch-15-test-8 success .github/scripts/patches/tests/header_inline.sh took 0.01s
conchuod/patch-15-test-9 success .github/scripts/patches/tests/kdoc.sh took 0.56s
conchuod/patch-15-test-10 success .github/scripts/patches/tests/module_param.sh took 0.01s
conchuod/patch-15-test-11 success .github/scripts/patches/tests/verify_fixes.sh took 0.00s
conchuod/patch-15-test-12 success .github/scripts/patches/tests/verify_signedoff.sh took 0.03s

Commit Message

Miquel Raynal Dec. 24, 2024, 5:06 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.

Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/spi/spi-ti-qspi.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c
index 9122350402b5062dfc8bcf70ac47ba51fad64b3e..49516fee74b0f2062c43d714fcb97c7a55580b37 100644
--- a/drivers/spi/spi-ti-qspi.c
+++ b/drivers/spi/spi-ti-qspi.c
@@ -623,7 +623,7 @@  static int ti_qspi_exec_mem_op(struct spi_mem *mem,
 	mutex_lock(&qspi->list_lock);
 
 	if (!qspi->mmap_enabled || qspi->current_cs != spi_get_chipselect(mem->spi, 0)) {
-		ti_qspi_setup_clk(qspi, mem->spi->max_speed_hz);
+		ti_qspi_setup_clk(qspi, op->max_freq);
 		ti_qspi_enable_memory_map(mem->spi);
 	}
 	ti_qspi_setup_mmap_read(mem->spi, op->cmd.opcode, op->data.buswidth,
@@ -658,6 +658,10 @@  static const struct spi_controller_mem_ops ti_qspi_mem_ops = {
 	.adjust_op_size = ti_qspi_adjust_op_size,
 };
 
+static const struct spi_controller_mem_caps ti_qspi_mem_caps = {
+	.per_op_freq = true,
+};
+
 static int ti_qspi_start_transfer_one(struct spi_controller *host,
 		struct spi_message *m)
 {
@@ -777,6 +781,7 @@  static int ti_qspi_probe(struct platform_device *pdev)
 	host->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
 				   SPI_BPW_MASK(8);
 	host->mem_ops = &ti_qspi_mem_ops;
+	host->mem_caps = &ti_qspi_mem_caps;
 
 	if (!of_property_read_u32(np, "num-cs", &num_cs))
 		host->num_chipselect = num_cs;