spi: orion: Convert to use GPIO descriptors
authorLinus Walleij <linus.walleij@linaro.org>
Wed, 15 Apr 2020 17:56:13 +0000 (19:56 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 21 Apr 2020 18:48:05 +0000 (19:48 +0100)
commit66eb228988cf82abb5f633a7d585120923308caf
tree920e772c662ff539b19af475a38adb4f228d20ff
parent59fc9ad5cb108bce18043281c7cf67f2b425d55d
spi: orion: Convert to use GPIO descriptors

This converts the Orion SPI master to use GPIO descriptors.
The SPI core will obtain and manage the CS GPIOs, if any
are defined.

I make one sematic change: when a certain chip select is using
a GPIO line instead of the native CS I simply just enable the
1:1 mapped native CS that would have been used if the GPIO
was not there. As we set the SPI_MASTER_GPIO_SS the .set_cs()
callback will be called for all chip selects whether native
or not, and the important thing for the driver is that the
previous native chip select (if any) is deasserted, which
other chip select is asserted instead does not really matter.

The previous code went to great lengths to ascertain that the
first hw CS which was hiding behind a GPIO line was used for
all cases when the line is not using native chip select but
this should not matter at all, just use the one "underneath"
the GPIO at all times.

When a GPIO is used for CS, the SPI_CS_HIGH flag is enforced,
so the native chip select is also inverted. But that should
not matter since we are not using it anyways.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Cc: Gregory CLEMENT <gregory.clement@bootlin.com>
Cc: Tomas Paukrt <tomaspaukrt@email.cz>
Cc: Jan Kundrát <jan.kundrat@cesnet.cz>
Link: https://lore.kernel.org/r/20200415175613.220767-1-linus.walleij@linaro.org
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spi-orion.c