devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Petr Štetiar" <ynezz@true.cz>
To: devicetree@vger.kernel.org
Cc: "Mark Rutland" <mark.rutland@arm.com>,
	"Fabio Estevam" <festevam@gmail.com>,
	"Russell King" <linux@arm.linux.org.uk>,
	"Pawel Moll" <pawel.moll@arm.com>,
	"Ian Campbell" <ijc+devicetree@hellion.org.uk>,
	"Marcel Ziswiler" <marcel.ziswiler@toradex.com>,
	linux-pci@vger.kernel.org, "Tim Harvey" <tharvey@gateworks.com>,
	"Richard Zhu" <Richard.Zhu@freescale.com>,
	stefan@agner.ch, "Rob Herring" <robh+dt@kernel.org>,
	"Krzysztof Hałasa" <khalasa@piap.pl>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	"Kumar Gala" <galak@codeaurora.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Petr Štetiar" <ynezz@true.cz>, "Shawn Guo" <shawnguo@kernel.org>,
	linux-arm-kernel@lists.infradead.org,
	"Lucas Stach" <l.stach@pengutronix.de>
Subject: [PATCH 2/2] PCI: imx6: Add reset-gpio-active-high boolean property to DT
Date: Fri,  1 Apr 2016 14:41:48 +0200	[thread overview]
Message-ID: <1459514508-8557-3-git-send-email-ynezz@true.cz> (raw)
In-Reply-To: <1459514508-8557-1-git-send-email-ynezz@true.cz>

We need that property in order to make the Toradex Apalis SoMs working
without breaking old DTBs. On Apalis SoMs the GPIO1_IO28 used to PCIe
reset is not connected directly to PERST# PCIe signal, but it's ORed
with RESETBMCU coming off the PMIC, and thus is inverted, active-high.

Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 drivers/pci/host/pci-imx6.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/host/pci-imx6.c b/drivers/pci/host/pci-imx6.c
index 2f817fa..1b3bcfe 100644
--- a/drivers/pci/host/pci-imx6.c
+++ b/drivers/pci/host/pci-imx6.c
@@ -33,6 +33,7 @@
 
 struct imx6_pcie {
 	int			reset_gpio;
+	bool			gpio_active_high;
 	struct clk		*pcie_bus;
 	struct clk		*pcie_phy;
 	struct clk		*pcie;
@@ -310,9 +311,11 @@ static int imx6_pcie_deassert_core_reset(struct pcie_port *pp)
 
 	/* Some boards don't have PCIe reset GPIO. */
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
-		gpio_set_value_cansleep(imx6_pcie->reset_gpio, 0);
+		gpio_set_value_cansleep(imx6_pcie->reset_gpio,
+					!!imx6_pcie->gpio_active_high);
 		msleep(100);
-		gpio_set_value_cansleep(imx6_pcie->reset_gpio, 1);
+		gpio_set_value_cansleep(imx6_pcie->reset_gpio,
+					!imx6_pcie->gpio_active_high);
 	}
 	return 0;
 
@@ -546,9 +549,14 @@ static int __init imx6_pcie_probe(struct platform_device *pdev)
 
 	/* Fetch GPIOs */
 	imx6_pcie->reset_gpio = of_get_named_gpio(np, "reset-gpio", 0);
+	imx6_pcie->gpio_active_high = of_property_read_bool(np,
+						"reset-gpio-active-high");
 	if (gpio_is_valid(imx6_pcie->reset_gpio)) {
 		ret = devm_gpio_request_one(&pdev->dev, imx6_pcie->reset_gpio,
-					    GPIOF_OUT_INIT_LOW, "PCIe reset");
+				imx6_pcie->gpio_active_high ?
+					GPIOF_OUT_INIT_HIGH :
+					GPIOF_OUT_INIT_LOW,
+				"PCIe reset");
 		if (ret) {
 			dev_err(&pdev->dev, "unable to get reset gpio\n");
 			return ret;
-- 
1.9.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2016-04-01 12:41 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-01 12:41 [PATCH] ARM: imx6: Fix PCIe reset gpio polarity on Toradex Apalis Petr Štetiar
2016-04-01 12:41 ` [PATCH 1/2] ARM: dts: imx6: Fix PCIe reset gpio polarity on Toradex Apalis Ixora Petr Štetiar
2016-04-01 12:41 ` Petr Štetiar [this message]
     [not found]   ` <1459514508-8557-3-git-send-email-ynezz-knWk7/PSn+s@public.gmane.org>
2016-04-05 15:46     ` [PATCH 2/2] PCI: imx6: Add reset-gpio-active-high boolean property to DT Fabio Estevam
2016-04-06  8:11       ` Petr Štetiar
2016-04-06  9:34       ` [PATCH v2 " Petr Štetiar
     [not found]         ` <1459935244-10077-1-git-send-email-ynezz-knWk7/PSn+s@public.gmane.org>
2016-04-06  9:48           ` Lucas Stach
2016-04-06 12:36             ` [PATCH v3 " Petr Štetiar
     [not found]               ` <1459946207-11923-1-git-send-email-ynezz-knWk7/PSn+s@public.gmane.org>
2016-04-06 12:40                 ` Lucas Stach
2016-04-11 13:38               ` Rob Herring
2016-04-14 15:28               ` Tim Harvey
2016-04-20  0:48 ` [PATCH] ARM: imx6: Fix PCIe reset gpio polarity on Toradex Apalis Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1459514508-8557-3-git-send-email-ynezz@true.cz \
    --to=ynezz@true.cz \
    --cc=Richard.Zhu@freescale.com \
    --cc=bhelgaas@google.com \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=kernel@pengutronix.de \
    --cc=khalasa@piap.pl \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@arm.linux.org.uk \
    --cc=marcel.ziswiler@toradex.com \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=shawnguo@kernel.org \
    --cc=stefan@agner.ch \
    --cc=tharvey@gateworks.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).