Skip to content

Commit 0abdb0f

Browse files
lpovlsenbroonie
authored andcommitted
spi: dw: Fix spi registration for controllers overriding CS
When SPI DW memory ops support was introduced, there was a check for excluding controllers which supplied their own CS function. Even so, the mem_ops pointer is *always* presented to the SPI core. This causes the SPI core sanity check in spi_controller_check_ops() to refuse registration, since a mem_ops pointer is being supplied without an exec_op member function. The end result is failure of the SPI DW driver on sparx5 and similar platforms. The fix in the core SPI DW driver is to avoid presenting the mem_ops pointer if the exec_op function is not set. Fixes: 6423207 (spi: dw: Add memory operations support) Signed-off-by: Lars Povlsen <lars.povlsen@microchip.com> Acked-by: Serge Semin <fancer.lancer@gmail.com> Link: https://lore.kernel.org/r/20201120213414.339701-1-lars.povlsen@microchip.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 7cd7120 commit 0abdb0f

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

drivers/spi/spi-dw-core.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,8 @@ int dw_spi_add_host(struct device *dev, struct dw_spi *dws)
875875
master->set_cs = dw_spi_set_cs;
876876
master->transfer_one = dw_spi_transfer_one;
877877
master->handle_err = dw_spi_handle_err;
878-
master->mem_ops = &dws->mem_ops;
878+
if (dws->mem_ops.exec_op)
879+
master->mem_ops = &dws->mem_ops;
879880
master->max_speed_hz = dws->max_freq;
880881
master->dev.of_node = dev->of_node;
881882
master->dev.fwnode = dev->fwnode;

0 commit comments

Comments
 (0)