summaryrefslogtreecommitdiff
path: root/drivers/spi
diff options
context:
space:
mode:
authorHeikki Keranen <heikki.keranen@bittium.com>2024-04-22 14:41:50 +0300
committerMark Brown <broonie@kernel.org>2024-04-23 10:39:49 +0900
commit856d9e8e9d42759b7fe6c6e13a2d6ff325b65f91 (patch)
treef39c17ba3b275e6083352dd6d8b5a1f803b668dd /drivers/spi
parentf63175733f91da6b668018c1c31786ec448adaed (diff)
spi: mux: Fix master controller settings after mux select
In some cases SPI child devices behind spi-mux require different settings like: max_speed_hz, mode and bits_per_word. Typically the slave device driver puts the settings in place and calls spi_setup() once during probe and assumes they stay in place for all following spi transfers. However spi-mux forwarded spi_setup() -call to SPI master driver only when slave driver calls spi_setup(). If second slave device was accessed meanwhile and that driver called spi_setup(), the settings did not change back to the first spi device. In case of wrong max_speed_hz this caused spi trasfers to fail. This commit adds spi_setup() call after mux is changed. This way the right device specific parameters are set to the master driver. The fix has been tested by using custom hardware and debugging spi master driver speed settings. Co-authored-by: Petri Tauriainen <petri.tauriainen@bittium.com> Signed-off-by: Heikki Keranen <heikki.keranen@bittium.com> Link: https://lore.kernel.org/r/20240422114150.84426-1-heikki.keranen@bittium.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi')
-rw-r--r--drivers/spi/spi-mux.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/spi/spi-mux.c b/drivers/spi/spi-mux.c
index bd988f53753e..5d72e3d59df8 100644
--- a/drivers/spi/spi-mux.c
+++ b/drivers/spi/spi-mux.c
@@ -68,6 +68,8 @@ static int spi_mux_select(struct spi_device *spi)
priv->current_cs = spi_get_chipselect(spi, 0);
+ spi_setup(priv->spi);
+
return 0;
}