* [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors
@ 2019-06-10 17:05 Martin Blumenstingl
2019-06-10 17:05 ` [PATCH 1/1] gpio: of: parse stmmac PHY reset line specific active-low property Martin Blumenstingl
2019-06-12 7:49 ` [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors Linus Walleij
0 siblings, 2 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2019-06-10 17:05 UTC (permalink / raw)
To: linus.walleij, bgolaszewski, linux-gpio
Cc: andrew, netdev, linux-kernel, Martin Blumenstingl
This is a preparation patch which is needed before we can switch stmmac
to GPIO descriptors. stmmac has a custom "snps,reset-active-low"
property because it has ignored the GPIO flags including the polarity.
Add the parsing to gpiolib-of so we can port stmmac over to GPIO
descriptors.
This patch is split from my series at [0].
Linus W.: please create an immutable branch as discussed so I can send
the stmmac patches to the net-next tree (which will then have to pull
in your immutable branch).
[0] https://patchwork.kernel.org/cover/10983801/
Martin Blumenstingl (1):
gpio: of: parse stmmac PHY reset line specific active-low property
drivers/gpio/gpiolib-of.c | 6 ++++++
1 file changed, 6 insertions(+)
--
2.22.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/1] gpio: of: parse stmmac PHY reset line specific active-low property
2019-06-10 17:05 [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors Martin Blumenstingl
@ 2019-06-10 17:05 ` Martin Blumenstingl
2019-06-12 7:49 ` [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Martin Blumenstingl @ 2019-06-10 17:05 UTC (permalink / raw)
To: linus.walleij, bgolaszewski, linux-gpio
Cc: andrew, netdev, linux-kernel, Martin Blumenstingl
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>
---
drivers/gpio/gpiolib-of.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 00deb885409c..a8f02f551d6b 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -158,6 +158,12 @@ static void of_gpio_flags_quirks(struct device_node *np,
}
}
}
+
+ /* Legacy handling of stmmac's active-low PHY reset line */
+ if (IS_ENABLED(CONFIG_STMMAC_ETH) &&
+ !strcmp(propname, "snps,reset-gpio") &&
+ of_property_read_bool(np, "snps,reset-active-low"))
+ *flags |= OF_GPIO_ACTIVE_LOW;
}
/**
--
2.22.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors
2019-06-10 17:05 [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors Martin Blumenstingl
2019-06-10 17:05 ` [PATCH 1/1] gpio: of: parse stmmac PHY reset line specific active-low property Martin Blumenstingl
@ 2019-06-12 7:49 ` Linus Walleij
1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2019-06-12 7:49 UTC (permalink / raw)
To: Martin Blumenstingl
Cc: Bartosz Golaszewski, open list:GPIO SUBSYSTEM, Andrew Lunn,
netdev, linux-kernel
On Mon, Jun 10, 2019 at 7:05 PM Martin Blumenstingl
<martin.blumenstingl@googlemail.com> wrote:
> This is a preparation patch which is needed before we can switch stmmac
> to GPIO descriptors. stmmac has a custom "snps,reset-active-low"
> property because it has ignored the GPIO flags including the polarity.
>
> Add the parsing to gpiolib-of so we can port stmmac over to GPIO
> descriptors.
>
> This patch is split from my series at [0].
>
> Linus W.: please create an immutable branch as discussed so I can send
> the stmmac patches to the net-next tree (which will then have to pull
> in your immutable branch).
Thanks Martin!
I have applied the patch and created an immutable branch:
git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git
ib-snps-reset-gpio
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/log/?h=ib-snps-reset-gpio
Please refer to this so the network maintainer can pull it in.
It is based on v5.2-rc1
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-06-12 7:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10 17:05 [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors Martin Blumenstingl
2019-06-10 17:05 ` [PATCH 1/1] gpio: of: parse stmmac PHY reset line specific active-low property Martin Blumenstingl
2019-06-12 7:49 ` [PATCH 0/1] gpio: of: prepare for switching stmmac to GPIO descriptors Linus Walleij
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®