Unverified Commit 1a206344 authored by Miquel Raynal's avatar Miquel Raynal Committed by Mark Brown
Browse files

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: default avatarMiquel 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: default avatarMark Brown <broonie@kernel.org>
parent d3f35dd3
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -335,7 +335,6 @@ static void f_ospi_config_indir_protocol(struct f_ospi *ospi,
static int f_ospi_indir_prepare_op(struct f_ospi *ospi, struct spi_mem *mem,
				   const struct spi_mem_op *op)
{
	struct spi_device *spi = mem->spi;
	u32 irq_stat_en;
	int ret;

@@ -343,7 +342,7 @@ static int f_ospi_indir_prepare_op(struct f_ospi *ospi, struct spi_mem *mem,
	if (ret)
		return ret;

	f_ospi_config_clk(ospi, spi->max_speed_hz);
	f_ospi_config_clk(ospi, op->max_freq);

	f_ospi_config_indir_protocol(ospi, mem, op);

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

static const struct spi_controller_mem_caps f_ospi_mem_caps = {
	.per_op_freq = true,
};

static int f_ospi_init(struct f_ospi *ospi)
{
	int ret;
@@ -614,6 +617,7 @@ static int f_ospi_probe(struct platform_device *pdev)
		| SPI_RX_DUAL | SPI_RX_QUAD | SPI_RX_OCTAL
		| SPI_MODE_0 | SPI_MODE_1 | SPI_LSB_FIRST;
	ctlr->mem_ops = &f_ospi_mem_ops;
	ctlr->mem_caps = &f_ospi_mem_caps;
	ctlr->bus_num = -1;
	of_property_read_u32(dev->of_node, "num-cs", &num_cs);
	if (num_cs > OSPI_NUM_CS) {