summaryrefslogtreecommitdiff
path: root/drivers/pci/controller/pcie-apple.c
diff options
context:
space:
mode:
authorJiri Kosina <jkosina@suse.cz>2022-01-10 09:56:57 +0100
committerJiri Kosina <jkosina@suse.cz>2022-01-10 09:56:57 +0100
commit3551a3ff8229e15d2a4b47b8234923bc72da65ef (patch)
treea62465753397b0268529a5d0b9ab43a8840069ad /drivers/pci/controller/pcie-apple.c
parent906095af85e8b2e53ee9f8c50b3dff365aa09df8 (diff)
parent33a5c2793451770cb6dcf0cc35c76cfd4b045513 (diff)
downloadlinux-3551a3ff8229e15d2a4b47b8234923bc72da65ef.tar.gz
linux-3551a3ff8229e15d2a4b47b8234923bc72da65ef.tar.bz2
linux-3551a3ff8229e15d2a4b47b8234923bc72da65ef.zip
Merge branch 'for-5.17/letsketch' into for-linus
- new driver to support for LetSketch device (Hans de Goede)
Diffstat (limited to 'drivers/pci/controller/pcie-apple.c')
-rw-r--r--drivers/pci/controller/pcie-apple.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/pci/controller/pcie-apple.c b/drivers/pci/controller/pcie-apple.c
index 1bf4d75b61be..b090924b41fe 100644
--- a/drivers/pci/controller/pcie-apple.c
+++ b/drivers/pci/controller/pcie-apple.c
@@ -516,7 +516,7 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
int ret, i;
reset = gpiod_get_from_of_node(np, "reset-gpios", 0,
- GPIOD_OUT_LOW, "#PERST");
+ GPIOD_OUT_LOW, "PERST#");
if (IS_ERR(reset))
return PTR_ERR(reset);
@@ -539,12 +539,22 @@ static int apple_pcie_setup_port(struct apple_pcie *pcie,
rmw_set(PORT_APPCLK_EN, port->base + PORT_APPCLK);
+ /* Assert PERST# before setting up the clock */
+ gpiod_set_value(reset, 1);
+
ret = apple_pcie_setup_refclk(pcie, port);
if (ret < 0)
return ret;
+ /* The minimal Tperst-clk value is 100us (PCIe CEM r5.0, 2.9.2) */
+ usleep_range(100, 200);
+
+ /* Deassert PERST# */
rmw_set(PORT_PERST_OFF, port->base + PORT_PERST);
- gpiod_set_value(reset, 1);
+ gpiod_set_value(reset, 0);
+
+ /* Wait for 100ms after PERST# deassertion (PCIe r5.0, 6.6.1) */
+ msleep(100);
ret = readl_relaxed_poll_timeout(port->base + PORT_STATUS, stat,
stat & PORT_STATUS_READY, 100, 250000);