linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Pali Rohár" <pali@kernel.org>
To: linux-pci@vger.kernel.org, "Jason Cooper" <jason@lakedaemon.net>,
	"Andrew Lunn" <andrew@lunn.ch>,
	"Gregory Clement" <gregory.clement@bootlin.com>,
	"Sebastian Hesselbarth" <sebastian.hesselbarth@gmail.com>,
	"Thomas Petazzoni" <thomas.petazzoni@bootlin.com>,
	"Lorenzo Pieralisi" <lorenzo.pieralisi@arm.com>,
	"Andrew Murray" <amurray@thegoodpenguin.co.uk>,
	"Remi Pommarel" <repk@triplefau.lt>,
	"Tomasz Maciej Nowak" <tmn505@gmail.com>,
	Xogium <contact@xogium.me>, "Rob Herring" <robh@kernel.org>,
	"Marek Behún" <marek.behun@nic.cz>,
	"Bjorn Helgaas" <helgaas@kernel.org>
Subject: [PATCH v3 10/12] arm64: dts: marvell: armada-37xx: Set pcie_reset_pin to gpio function
Date: Fri, 24 Apr 2020 17:38:56 +0200	[thread overview]
Message-ID: <20200424153858.29744-11-pali@kernel.org> (raw)
In-Reply-To: <20200424153858.29744-1-pali@kernel.org>

From: Marek Behún <marek.behun@nic.cz>

We found out that we are unable to control the PERST# signal via the
default pin dedicated to be PERST# pin (GPIO2[3] pin) on A3700 SOC when
this pin is in EP_PCIE1_Resetn mode. There is a register in the PCIe
register space called PERSTN_GPIO_EN (D0088004[3]), but changing the
value of this register does not change the pin output when measuring
with voltmeter.

We do not know if this is a bug in the SOC, or if it works only when
PCIe controller is in a certain state.

Commit f4c7d053d7f7 ("PCI: aardvark: Wait for endpoint to be ready
before training link") says that when this pin changes pinctrl mode
from EP_PCIE1_Resetn to GPIO, the PERST# signal is asserted for a brief
moment.

So currently the situation is that on A3700 boards the PERST# signal is
asserted in U-Boot (because the code in U-Boot issues reset via this pin
via GPIO mode), and then in Linux by the obscure and undocumented
mechanism described by the above mentioned commit.

We want to issue PERST# signal in a known way, therefore this patch
changes the pcie_reset_pin function from "pcie" to "gpio" and adds the
reset-gpios property to the PCIe node in device tree files of
EspressoBin and Armada 3720 Dev Board (Turris Mox device tree already
has this property and uDPU does not have a PCIe port).

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Cc: Remi Pommarel <repk@triplefau.lt>
---
 arch/arm64/boot/dts/marvell/armada-3720-db.dts           | 3 +++
 arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi | 1 +
 arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts   | 4 ----
 arch/arm64/boot/dts/marvell/armada-37xx.dtsi             | 2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/arm64/boot/dts/marvell/armada-3720-db.dts b/arch/arm64/boot/dts/marvell/armada-3720-db.dts
index f2cc00594d64..3e5789f37206 100644
--- a/arch/arm64/boot/dts/marvell/armada-3720-db.dts
+++ b/arch/arm64/boot/dts/marvell/armada-3720-db.dts
@@ -128,6 +128,9 @@
 
 /* CON15(V2.0)/CON17(V1.4) : PCIe / CON15(V2.0)/CON12(V1.4) :mini-PCIe */
 &pcie0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>;
+	reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>;
 	status = "okay";
 };
 
diff --git a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi
index 42e992f9c8a5..c92ad664cb0e 100644
--- a/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi
+++ b/arch/arm64/boot/dts/marvell/armada-3720-espressobin.dtsi
@@ -47,6 +47,7 @@
 	phys = <&comphy1 0>;
 	pinctrl-names = "default";
 	pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>;
+	reset-gpios = <&gpiosb 3 GPIO_ACTIVE_LOW>;
 };
 
 /* J6 */
diff --git a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
index bb42d1e6a4e9..e496bd9d4737 100644
--- a/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
+++ b/arch/arm64/boot/dts/marvell/armada-3720-turris-mox.dts
@@ -128,10 +128,6 @@
 	};
 };
 
-&pcie_reset_pins {
-	function = "gpio";
-};
-
 &pcie0 {
 	pinctrl-names = "default";
 	pinctrl-0 = <&pcie_reset_pins &pcie_clkreq_pins>;
diff --git a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
index 000c135e39b7..7909c146eabf 100644
--- a/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
+++ b/arch/arm64/boot/dts/marvell/armada-37xx.dtsi
@@ -317,7 +317,7 @@
 
 				pcie_reset_pins: pcie-reset-pins {
 					groups = "pcie1";
-					function = "pcie";
+					function = "gpio";
 				};
 
 				pcie_clkreq_pins: pcie-clkreq-pins {
-- 
2.20.1


  parent reply	other threads:[~2020-04-24 15:39 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-24 15:38 [PATCH v3 00/12] PCI: aardvark: Fix support for Turris MOX and Compex wifi cards Pali Rohár
2020-04-24 15:38 ` [PATCH v3 01/12] PCI: aardvark: Train link immediately after enabling training Pali Rohár
2020-04-24 15:38 ` [PATCH v3 02/12] PCI: aardvark: Don't blindly enable ASPM L0s and don't write to read-only register Pali Rohár
2020-04-24 15:38 ` [PATCH v3 03/12] PCI: of: Return -ENOENT if max-link-speed property is not found Pali Rohár
2020-04-24 16:47   ` Rob Herring
2020-04-27  9:00     ` Pali Rohár
2020-04-28 15:52       ` Rob Herring
2020-04-28 16:01         ` Pali Rohár
2020-04-28 23:55           ` Marek Behun
2020-04-28 16:23         ` Bjorn Helgaas
2020-04-24 15:38 ` [PATCH v3 04/12] PCI: aardvark: Improve link training Pali Rohár
2020-04-24 17:00   ` Rob Herring
2020-04-24 18:55     ` Pali Rohár
2020-04-27  9:30       ` Pali Rohár
2020-04-24 15:38 ` [PATCH v3 05/12] PCI: aardvark: Issue PERST via GPIO Pali Rohár
2020-04-24 17:05   ` Rob Herring
2020-04-27  9:22     ` Pali Rohár
2020-04-24 15:38 ` [PATCH v3 06/12] PCI: aardvark: Add FIXME comment for PCIE_CORE_CMD_STATUS_REG access Pali Rohár
2020-04-24 15:38 ` [PATCH v3 07/12] PCI: aardvark: Add PHY support Pali Rohár
2020-04-24 15:38 ` [PATCH v3 08/12] PCI: aardvark: Replace custom macros by standard linux/pci_regs.h macros Pali Rohár
2020-04-24 18:52   ` Bjorn Helgaas
2020-04-24 15:38 ` [PATCH v3 09/12] dt-bindings: PCI: aardvark: Describe new properties Pali Rohár
2020-04-24 15:38 ` Pali Rohár [this message]
2020-04-24 15:38 ` [PATCH v3 11/12] arm64: dts: marvell: armada-37xx: Move PCIe comphy handle property Pali Rohár
2020-04-24 15:38 ` [PATCH v3 12/12] arm64: dts: marvell: armada-37xx: Move PCIe max-link-speed property Pali Rohár

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=20200424153858.29744-11-pali@kernel.org \
    --to=pali@kernel.org \
    --cc=amurray@thegoodpenguin.co.uk \
    --cc=andrew@lunn.ch \
    --cc=contact@xogium.me \
    --cc=gregory.clement@bootlin.com \
    --cc=helgaas@kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.com \
    --cc=marek.behun@nic.cz \
    --cc=repk@triplefau.lt \
    --cc=robh@kernel.org \
    --cc=sebastian.hesselbarth@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=tmn505@gmail.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).