Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

spi: mt65xx: 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.

Cc: Matthias Brugger <matthias.bgg@gmail.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Link: https://patch.msgid.link/20241224-winbond-6-11-rc1-quad-support-v2-10-ad218dbc406f@bootlin.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Miquel Raynal and committed by
Mark Brown
13fd04b5 13529647

+6 -1
+6 -1
drivers/spi/spi-mt65xx.c
··· 961 961 962 962 mtk_spi_reset(mdata); 963 963 mtk_spi_hw_init(mem->spi->controller, mem->spi); 964 - mtk_spi_prepare_transfer(mem->spi->controller, mem->spi->max_speed_hz); 964 + mtk_spi_prepare_transfer(mem->spi->controller, op->max_freq); 965 965 966 966 reg_val = readl(mdata->base + SPI_CFG3_IPM_REG); 967 967 /* opcode byte len */ ··· 1122 1122 .exec_op = mtk_spi_mem_exec_op, 1123 1123 }; 1124 1124 1125 + static const struct spi_controller_mem_caps mtk_spi_mem_caps = { 1126 + .per_op_freq = true, 1127 + }; 1128 + 1125 1129 static int mtk_spi_probe(struct platform_device *pdev) 1126 1130 { 1127 1131 struct device *dev = &pdev->dev; ··· 1164 1160 if (mdata->dev_comp->ipm_design) { 1165 1161 mdata->dev = dev; 1166 1162 host->mem_ops = &mtk_spi_mem_ops; 1163 + host->mem_caps = &mtk_spi_mem_caps; 1167 1164 init_completion(&mdata->spimem_done); 1168 1165 } 1169 1166