]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
spi: sh-msiof: Avoid writing to registers from spi_master.setup()
authorGeert Uytterhoeven <geert+renesas@glider.be>
Wed, 13 Dec 2017 19:05:10 +0000 (20:05 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Mon, 26 Mar 2018 12:16:20 +0000 (09:16 -0300)
commit8950792b7e1465a857582099649b7558cdd65823
treeb03f0cc31b3ae60ab1634ca18db1f6e2fc3ea887
parentd09cb159a92f39acccdac24cdad4945202b46014
spi: sh-msiof: Avoid writing to registers from spi_master.setup()

BugLink: http://bugs.launchpad.net/bugs/1758886
[ Upstream commit 7ff0b53c4051145d1cf992d2f60987e6447eed4f ]

The spi_master.setup() callback must not change configuration registers,
as that could corrupt I/O that is in progress for other SPI slaves.

The only exception is the configuration of the native chip select
polarity in SPI master mode, as a wrong chip select polarity will cause
havoc during all future transfers to any other SPI slave.

Hence stop writing to registers in sh_msiof_spi_setup(), unless it is
the first call for a controller using a native chip select, or unless
native chip select polarity has changed (note that you'll loose anyway
if I/O is in progress).  Even then, only do what is strictly necessary,
instead of calling sh_msiof_spi_set_pin_regs().

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/spi/spi-sh-msiof.c