Skip to content

Commit 13fd04b

Browse files
miquelraynalbroonie
authored andcommitted
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 <[email protected]> Signed-off-by: Miquel Raynal <[email protected]> Link: https://patch.msgid.link/20241224-winbond-6-11-rc1-quad-support-v2-10-ad218dbc406f@bootlin.com Signed-off-by: Mark Brown <[email protected]>
1 parent 1352964 commit 13fd04b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/spi/spi-mt65xx.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -961,7 +961,7 @@ static int mtk_spi_mem_exec_op(struct spi_mem *mem,
961961

962962
mtk_spi_reset(mdata);
963963
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);
965965

966966
reg_val = readl(mdata->base + SPI_CFG3_IPM_REG);
967967
/* opcode byte len */
@@ -1122,6 +1122,10 @@ static const struct spi_controller_mem_ops mtk_spi_mem_ops = {
11221122
.exec_op = mtk_spi_mem_exec_op,
11231123
};
11241124

1125+
static const struct spi_controller_mem_caps mtk_spi_mem_caps = {
1126+
.per_op_freq = true,
1127+
};
1128+
11251129
static int mtk_spi_probe(struct platform_device *pdev)
11261130
{
11271131
struct device *dev = &pdev->dev;
@@ -1160,6 +1164,7 @@ static int mtk_spi_probe(struct platform_device *pdev)
11601164
if (mdata->dev_comp->ipm_design) {
11611165
mdata->dev = dev;
11621166
host->mem_ops = &mtk_spi_mem_ops;
1167+
host->mem_caps = &mtk_spi_mem_caps;
11631168
init_completion(&mdata->spimem_done);
11641169
}
11651170

0 commit comments

Comments
 (0)