All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marc Zyngier <maz@kernel.org>
To: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org
Cc: kernel-team@android.com, Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH] PCI: apple: Reset the port for 100ms on probe
Date: Wed, 17 Nov 2021 16:00:53 +0000	[thread overview]
Message-ID: <20211117160053.232158-1-maz@kernel.org> (raw)

While the Apple PCIe driver works correctly when directly booted
from the firmware, it fails to initialise when the kernel is booted
from a bootloader using PCIe such as u-boot.

That's beacuse we're missing a proper reset of the port (we only
clear the reset, but never assert it).

Bring the port back to life by wiggling the #PERST pin for 100ms
(as per the spec).

Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/controller/pcie-apple.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index 1bf4d75b61be..bbea5f6e0a68 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -543,6 +543,9 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
 	if (ret < 0)
 		return ret;
 
+	/* Hold #PERST for 100ms as per the spec */
+	gpiod_set_value(reset, 0);
+	msleep(100);
 	rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
 	gpiod_set_value(reset, 1);
 
-- 
2.30.2


WARNING: multiple messages have this Message-ID (diff)
From: Marc Zyngier <maz@kernel.org>
To: linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org
Cc: kernel-team@android.com, Alyssa Rosenzweig <alyssa@rosenzweig.io>,
	Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
	Bjorn Helgaas <bhelgaas@google.com>
Subject: [PATCH] PCI: apple: Reset the port for 100ms on probe
Date: Wed, 17 Nov 2021 16:00:53 +0000	[thread overview]
Message-ID: <20211117160053.232158-1-maz@kernel.org> (raw)

While the Apple PCIe driver works correctly when directly booted
from the firmware, it fails to initialise when the kernel is booted
from a bootloader using PCIe such as u-boot.

That's beacuse we're missing a proper reset of the port (we only
clear the reset, but never assert it).

Bring the port back to life by wiggling the #PERST pin for 100ms
(as per the spec).

Fixes: 1e33888fbe44 ("PCI: apple: Add initial hardware bring-up")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Cc: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
---
 drivers/pci/controller/pcie-apple.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index 1bf4d75b61be..bbea5f6e0a68 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -543,6 +543,9 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
 	if (ret < 0)
 		return ret;
 
+	/* Hold #PERST for 100ms as per the spec */
+	gpiod_set_value(reset, 0);
+	msleep(100);
 	rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
 	gpiod_set_value(reset, 1);
 
-- 
2.30.2


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

             reply	other threads:[~2021-11-17 16:01 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-17 16:00 Marc Zyngier [this message]
2021-11-17 16:00 ` [PATCH] PCI: apple: Reset the port for 100ms on probe Marc Zyngier
2021-11-17 20:12 ` Bjorn Helgaas
2021-11-17 20:12   ` Bjorn Helgaas
2021-11-17 20:28   ` Pali Rohár
2021-11-17 20:28     ` Pali Rohár
2021-11-18 10:01     ` Marc Zyngier
2021-11-18 10:01       ` Marc Zyngier
2021-11-18 10:31       ` Pali Rohár
2021-11-18 10:31         ` Pali Rohár
2021-11-18 12:57         ` Marc Zyngier
2021-11-18 12:57           ` Marc Zyngier
2021-11-20 11:32           ` Pali Rohár
2021-11-20 11:32             ` Pali Rohár
2021-11-18 10:45       ` Marc Zyngier
2021-11-18 10:45         ` Marc Zyngier

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=20211117160053.232158-1-maz@kernel.org \
    --to=maz@kernel.org \
    --cc=alyssa@rosenzweig.io \
    --cc=bhelgaas@google.com \
    --cc=kernel-team@android.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lorenzo.pieralisi@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.