Skip to content

Commit 3645ffa

Browse files
dtorBartosz Golaszewski
authored andcommitted
gpiolib: of: fix lookup quirk for MIPS Lantiq
As it turns out, there is a large number of out-of-tree DTSes (in OpenWrt project) that used to specify incorrect (active high) polarity for the Lantiq reset GPIO, so to keep compatibility while they are being updated a quirk for force the polarity low is needed. Luckily these old DTSes used nonstandard name for the property ("gpio-reset" vs "reset-gpios") so the quirk will not hurt if there are any new devices that need inverted polarity as they can specify the right polarity in their DTS when using the standard "reset-gpios" property. Additionally the condition to enable the transition from standard to non-standard reset GPIO property name was inverted and the replacement name for the property was not correct. Fix this as well. Fixes: fbbbcd1 ("gpiolib: of: add quirk for locating reset lines with legacy bindings") Fixes: 90c2d2e ("MIPS: pci: lantiq: switch to using gpiod API") Reported-by: Martin Schiller <[email protected]> Acked-by: Martin Schiller <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Bartosz Golaszewski <[email protected]>
1 parent 22a40d1 commit 3645ffa

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

drivers/gpio/gpiolib-of.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,16 @@ static void of_gpio_try_fixup_polarity(const struct device_node *np,
202202
* helper, and be consistent with what other drivers do.
203203
*/
204204
{ "qi,lb60", "rb-gpios", true },
205+
#endif
206+
#if IS_ENABLED(CONFIG_PCI_LANTIQ)
207+
/*
208+
* According to the PCI specification, the RST# pin is an
209+
* active-low signal. However, most of the device trees that
210+
* have been widely used for a long time incorrectly describe
211+
* reset GPIO as active-high, and were also using wrong name
212+
* for the property.
213+
*/
214+
{ "lantiq,pci-xway", "gpio-reset", false },
205215
#endif
206216
};
207217
unsigned int i;
@@ -504,9 +514,9 @@ static struct gpio_desc *of_find_gpio_rename(struct device_node *np,
504514
{ "reset", "reset-n-io", "marvell,nfc-uart" },
505515
{ "reset", "reset-n-io", "mrvl,nfc-uart" },
506516
#endif
507-
#if !IS_ENABLED(CONFIG_PCI_LANTIQ)
517+
#if IS_ENABLED(CONFIG_PCI_LANTIQ)
508518
/* MIPS Lantiq PCI */
509-
{ "reset", "gpios-reset", "lantiq,pci-xway" },
519+
{ "reset", "gpio-reset", "lantiq,pci-xway" },
510520
#endif
511521

512522
/*

0 commit comments

Comments
 (0)