Skip to contentSkip to conversation

Patch "MIPS: pci: lantiq: restore reset gpio polarity" has been added to the 6.9-stable tree

DISCUSSION Martin Schiller 2 participants 2 messages Jun 25, 2024 1 message not in the archive Stable branch

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 6 lines · On 2024-06-24 19:01, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

MIPS: pci: lantiq: restore reset gpio polarity

to the 6.9-stable tree which can be found at:

Quoted 8 lines

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-pci-lantiq-restore-reset-gpio-polarity.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

This patch is buggy and should not go into the stable trees. It has already been reverted upstream in the mips-fixes.

Thank you very much and sorry for the inconvenience, Martin

Quoted 76 lines

From 277a0363120276645ae598d8d5fea7265e076ae9 Mon Sep 17 00:00:00 2001
From: Martin Schiller <[email protected]>
Date: Fri, 7 Jun 2024 11:04:00 +0200
Subject: MIPS: pci: lantiq: restore reset gpio polarity

From: Martin Schiller <[email protected]>

commit 277a0363120276645ae598d8d5fea7265e076ae9 upstream.

Commit 90c2d2eb7ab5 ("MIPS: pci: lantiq: switch to using gpiod API") not only switched to the gpiod API, but also inverted / changed the polarity of the GPIO.

According to the PCI specification, the RST# pin is an active-low signal. However, most of the device trees that have been widely used for a long time (mainly in the openWrt project) define this GPIO as active-high and the old driver code inverted the signal internally.

Apparently there are actually boards where the reset gpio must be operated inverted. For this reason, we cannot use the GPIOD_OUT_LOW/HIGH flag for initialization. Instead, we must explicitly set the gpio to value 1 in order to take into account any "GPIO_ACTIVE_LOW" flag that may have been set.

In order to remain compatible with all these existing device trees, we should therefore keep the logic as it was before the commit.

Fixes 90c2d2eb7ab5 ("MIPS: pci: lantiq: switch to using gpiod API")
---
 arch/mips/pci/pci-lantiq.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
arch/mips/pci/pci-lantiq.c +2 -2
@@ -124,14 +124,14 @@ static int ltq_pci_startup(struct platfo
 		clk_disable(clk_external);
 
 	/* setup reset gpio used by pci */
-	reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset",
-					     GPIOD_OUT_LOW);
+	reset_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", 
 GPIOD_ASIS);
 	error = PTR_ERR_OR_ZERO(reset_gpio);
 	if (error) {
 		dev_err(&pdev->dev, "failed to request gpio: %d\n", error);
 		return error;
 	}
 	gpiod_set_consumer_name(reset_gpio, "pci_reset");
+	gpiod_direction_output(reset_gpio, 1);
 
 	/* enable auto-switching between PCI and EBU */
arch/mips/pci/pci-lantiq.c +2 -2
 	ltq_pci_w32(0xa, PCI_CR_CLK_CTRL);
@@ -194,10 +194,10 @@ static int ltq_pci_startup(struct platfo
 
 	/* toggle reset pin */
 	if (reset_gpio) {
-		gpiod_set_value_cansleep(reset_gpio, 1);
+		gpiod_set_value_cansleep(reset_gpio, 0);
 		wmb();
 		mdelay(1);
-		gpiod_set_value_cansleep(reset_gpio, 0);
+		gpiod_set_value_cansleep(reset_gpio, 1);
 	}
 	return 0;
 }

Patches currently in stable-queue which might be from [email protected] are

queue-6.9/mips-pci-lantiq-restore-reset-gpio-polarity.patch

maintainer
#2 lore raw
Quoted 13 lines · Martin Schiller
Quoted 12 lines · On 2024-06-24 19:01, [email protected] wrote:

This is a note to let you know that I've just added the patch titled

MIPS: pci: lantiq: restore reset gpio polarity

to the 6.9-stable tree which can be found at:

http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
mips-pci-lantiq-restore-reset-gpio-polarity.patch
and it can be found in the queue-6.9 subdirectory.

Quoted 8 lines
Quoted 2 lines

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

This patch is buggy and should not go into the stable trees. It has already been reverted upstream in the mips-fixes.

Thank you very much and sorry for the inconvenience,

Thanks for letting us know, now dropped.

greg k-h