]> git.baikalelectronics.ru Git - kernel.git/commit
spi: dw: Correct handling of native chipselect
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Wed, 27 Nov 2019 15:39:36 +0000 (15:39 +0000)
committerMark Brown <broonie@kernel.org>
Thu, 28 Nov 2019 13:16:36 +0000 (13:16 +0000)
commit0717b7cbdea1a5a1907894d913294dea7b1e7073
tree36568e356559dd6cfe7dc4e474764650ce008416
parenta4c99af93ea1569a462c3f3df251e4682058d5a5
spi: dw: Correct handling of native chipselect

This patch reverts commit e004072215ac ("spi: dw: Fix default polarity
of native chipselect").

The SPI framework always called the set_cs callback with the logic
level it desired on the chip select line, which is what the drivers
original handling supported. commit 9bc982f86df7 ("spi: Optionally
use GPIO descriptors for CS GPIOs") changed these symantics, but only
in the case of drivers that also support GPIO chip selects, to true
meaning apply slave select rather than logic high. This left things in
an odd state where a driver that only supports hardware chip selects,
the core would handle polarity but if the driver supported GPIOs as
well the driver should handle polarity.  At this point the reverted
change was applied to change the logic in the driver to match new
system.

This was then broken by commit b2d6d99a0530 ("spi: Fix SPI_CS_HIGH
setting when using native and GPIO CS") which reverted the core back
to consistently calling set_cs with a logic level.

This fix reverts the driver code back to its original state to match
the current core code. This is probably a better fix as a) the set_cs
callback is always called with consistent symantics and b) the
inversion for SPI_CS_HIGH can be handled in the core and doesn't need
to be coded in each driver supporting it.

Fixes: b2d6d99a0530 ("spi: Fix SPI_CS_HIGH setting when using native and GPIO CS")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://lore.kernel.org/r/20191127153936.29719-1-ckeepax@opensource.cirrus.com
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-dw.c