Skip to content

Commit 1a20634

Browse files
miquelraynalbroonie
authored andcommitted
spi: spi-sn-f-ospi: 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-14-ad218dbc406f@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent d3f35dd commit 1a20634

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/spi/spi-sn-f-ospi.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,14 @@ static void f_ospi_config_indir_protocol(struct f_ospi *ospi,
335335
static int f_ospi_indir_prepare_op(struct f_ospi *ospi, struct spi_mem *mem,
336336
const struct spi_mem_op *op)
337337
{
338-
struct spi_device *spi = mem->spi;
339338
u32 irq_stat_en;
340339
int ret;
341340

342341
ret = f_ospi_prepare_config(ospi);
343342
if (ret)
344343
return ret;
345344

346-
f_ospi_config_clk(ospi, spi->max_speed_hz);
345+
f_ospi_config_clk(ospi, op->max_freq);
347346

348347
f_ospi_config_indir_protocol(ospi, mem, op);
349348

@@ -577,6 +576,10 @@ static const struct spi_controller_mem_ops f_ospi_mem_ops = {
577576
.exec_op = f_ospi_exec_op,
578577
};
579578

579+
static const struct spi_controller_mem_caps f_ospi_mem_caps = {
580+
.per_op_freq = true,
581+
};
582+
580583
static int f_ospi_init(struct f_ospi *ospi)
581584
{
582585
int ret;
@@ -614,6 +617,7 @@ static int f_ospi_probe(struct platform_device *pdev)
614617
| SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL
615618
| SPI_MODE_0 | SPI_MODE_1 | SPI_LSB_FIRST;
616619
ctlr->mem_ops = &f_ospi_mem_ops;
620+
ctlr->mem_caps = &f_ospi_mem_caps;
617621
ctlr->bus_num = -1;
618622
of_property_read_u32(dev->of_node, "num-cs", &num_cs);
619623
if (num_cs > OSPI_NUM_CS) {

0 commit comments

Comments
 (0)