Thread (8 messages) flat view 8 messages, 3 authors, 2021-11-20
STALE1727d

[PATCH] PCI: apple: Reset the port for 100ms on probe

From: Marc Zyngier <maz@kernel.org>
Date: 2021-11-17 16:01:05
Also in: linux-pci, lkml
Subsystem: apple pcie controller driver, pci native host bridge and endpoint drivers, pci subsystem, the rest · Maintainers: Marc Zyngier, Lorenzo Pieralisi, Krzysztof Wilczyński, Manivannan Sadhasivam, Bjorn Helgaas, Linus Torvalds

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 <redacted>
Cc: Lorenzo Pieralisi <redacted>
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help