Skip to content

Commit b2fac31

Browse files
miquelraynalbroonie
authored andcommitted
spi: spi-ti-qspi: Support per spi-mem operation frequency switches
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> Link: https://patch.msgid.link/20241224-winbond-6-11-rc1-quad-support-v2-15-ad218dbc406f@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 1a20634 commit b2fac31

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/spi/spi-ti-qspi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ static int ti_qspi_exec_mem_op(struct spi_mem *mem,
623623
mutex_lock(&qspi->list_lock);
624624

625625
if (!qspi->mmap_enabled || qspi->current_cs != spi_get_chipselect(mem->spi, 0)) {
626-
ti_qspi_setup_clk(qspi, mem->spi->max_speed_hz);
626+
ti_qspi_setup_clk(qspi, op->max_freq);
627627
ti_qspi_enable_memory_map(mem->spi);
628628
}
629629
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 = {
658658
.adjust_op_size = ti_qspi_adjust_op_size,
659659
};
660660

661+
static const struct spi_controller_mem_caps ti_qspi_mem_caps = {
662+
.per_op_freq = true,
663+
};
664+
661665
static int ti_qspi_start_transfer_one(struct spi_controller *host,
662666
struct spi_message *m)
663667
{
@@ -777,6 +781,7 @@ static int ti_qspi_probe(struct platform_device *pdev)
777781
host->bits_per_word_mask = SPI_BPW_MASK(32) | SPI_BPW_MASK(16) |
778782
SPI_BPW_MASK(8);
779783
host->mem_ops = &ti_qspi_mem_ops;
784+
host->mem_caps = &ti_qspi_mem_caps;
780785

781786
if (!of_property_read_u32(np, "num-cs", &num_cs))
782787
host->num_chipselect = num_cs;

0 commit comments

Comments
 (0)