Skip to content

Commit 856d9e8

Browse files
Heikki KeranenPetri Tauriainen
authored andcommitted
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 <[email protected]> Signed-off-by: Heikki Keranen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent f631757 commit 856d9e8

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/spi/spi-mux.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static int spi_mux_select(struct spi_device *spi)
6868

6969
priv->current_cs = spi_get_chipselect(spi, 0);
7070

71+
spi_setup(priv->spi);
72+
7173
return 0;
7274
}
7375

0 commit comments

Comments
 (0)