OSDN Git Service

gpio: of: Handle SPI chipselect legacy bindings
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 4 Sep 2018 09:01:58 +0000 (11:01 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Tue, 11 Sep 2018 11:54:41 +0000 (13:54 +0200)
commit6953c57ab1721ce57914fc5741d0ce0568756bb0
treea3a94ceec8181b13dcae2994dc3276d294c988c9
parent1c939cb556b99519cc5e75b66543ac499acfd781
gpio: of: Handle SPI chipselect legacy bindings

The SPI chipselects are assumed to be active low in the current
binding, so when we want to use GPIO descriptors and handle
the active low/high semantics in gpiolib, we need a special
parsing quirk to deal with this.

We check for the property "spi-cs-high" and if that is
NOT present we assume the CS line is active low.

If the line is tagged as active low in the device tree and
has no "spi-cs-high" property all is fine, the device
tree and the SPI bindings are in agreement.

If the line is tagged as active high in the device tree with
the second cell flag and has no "spi-cs-high" property we
enforce active low semantics (as this is the exception we can
just tag on the flag).

If the line is tagged as active low with the second cell flag
AND tagged with "spi-cs-high" the SPI active high property
takes precedence and we print a warning.

Cc: Mark Brown <broonie@kernel.org>
Cc: linux-spi@vger.kernel.org
Cc: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-of.c