[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221011-gpiolib-quirks-v3-9-eae9cc2ed0a1@gmail.com>
Date: Mon, 17 Oct 2022 22:41:10 -0700
From: Dmitry Torokhov <dmitry.torokhov@...il.com>
To: Bartosz Golaszewski <brgl@...ev.pl>,
Linus Walleij <linus.walleij@...aro.org>
Cc: Alexander Stein <alexander.stein@...tq-group.com>,
linux-arm-kernel@...ts.infradead.org, linux-gpio@...r.kernel.org,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Daniel Thompson <daniel.thompson@...aro.org>,
linux-kernel@...r.kernel.org, linux-mediatek@...ts.infradead.org
Subject: [PATCH v3 09/10] gpiolib: of: add quirk for phy reset polarity for Freescale Ethernet
Bindings for Freescale Fast Ethernet Controller use a separate
property "phy-reset-active-high" to specify polarity of its phy
gpio line. To allow converting the driver to gpiod API we need
to add this quirk to gpiolib.
Reviewed-by: Linus Walleij <linus.walleij@...aro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@...il.com>
---
drivers/gpio/gpiolib-of.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 6faf0dc7bc31..c2a55ffb2b20 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -231,6 +231,33 @@ static void of_gpio_flags_quirks(const struct device_node *np,
!strcmp(propname, "snps,reset-gpio") &&
of_property_read_bool(np, "snps,reset-active-low"))
*flags |= OF_GPIO_ACTIVE_LOW;
+
+ /*
+ * Freescale Fast Ethernet Controller uses a separate property to
+ * describe polarity of the phy reset line.
+ */
+ if (IS_ENABLED(CONFIG_FEC)) {
+ static const char * const fec_devices[] = {
+ "fsl,imx25-fec",
+ "fsl,imx27-fec",
+ "fsl,imx28-fec",
+ "fsl,imx6q-fec",
+ "fsl,mvf600-fec",
+ "fsl,imx6sx-fec",
+ "fsl,imx6ul-fec",
+ "fsl,imx8mq-fec",
+ "fsl,imx8qm-fec",
+ "fsl,s32v234-fec",
+ NULL
+ };
+
+ if (!strcmp(propname, "phy-reset-gpios") &&
+ of_device_compatible_match(np, fec_devices)) {
+ bool active_high = of_property_read_bool(np,
+ "phy-reset-active-high");
+ of_gpio_quirk_polarity(np, active_high, flags);
+ }
+ }
}
/**
--
b4 0.11.0-dev-5166b
Powered by blists - more mailing lists