gpio: of: parse stmmac PHY reset line specific active-low property
authorMartin Blumenstingl <martin.blumenstingl@googlemail.com>
Mon, 10 Jun 2019 17:05:23 +0000 (19:05 +0200)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 12 Jun 2019 07:46:52 +0000 (09:46 +0200)
commitedc1ef3ff34202e6ffdd51644356bca033d729f8
tree436603fbb035074fcad690e1e4d5aba838a96f79
parenta188339ca5a396acc588e5851ed7e19f66b0ebd9
gpio: of: parse stmmac PHY reset line specific active-low property

The stmmac driver currently ignores the GPIO flags which are passed via
devicetree because it operates with legacy GPIO numbers instead of GPIO
descriptors. stmmac assumes that the GPIO is "active HIGH" by default.
This can be overwritten by setting "snps,reset-active-low" to make the
reset line "active LOW".

Recent Amlogic SoCs (G12A which includes S905X2 and S905D2 as well as
G12B which includes S922X) use GPIOZ_14 or GPIOZ_15 for the PHY reset
line. These GPIOs are special because they are marked as "3.3V input
tolerant open drain" pins which means they can only drive the pin output
LOW (to reset the PHY) or to switch to input mode (to take the PHY out
of reset).
The GPIO subsystem already supports this with the GPIO_OPEN_DRAIN and
GPIO_OPEN_SOURCE flags in the devicetree bindings.

Add the stmmac PHY reset line specific active low parsing to gpiolib-of
so stmmac can be ported to GPIO descriptors while being backwards
compatible with device trees which use the "old" way of specifying the
polarity.

Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/gpio/gpiolib-of.c