]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: rockchip-host: Wait 100ms after reset before starting configuration
authorDamien Le Moal <dlemoal@kernel.org>
Sat, 13 Apr 2024 00:41:20 +0000 (09:41 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 9 Jul 2024 23:28:31 +0000 (18:28 -0500)
PCIe r6.0, sec 6.6.1, states that the host should wait for at least 100
msec from the end of a conventional reset (PERST# is de-asserted) before
sending a configuration request to ensure that the device is able to
respond with a "Request Retry Status" completion.

Add the PCIE_T_RRS_READY_MS macro to define this wait time and modify
rockchip_pcie_host_init_port() to add this 100ms sleep after deasserting
PERST# using the ep_gpio GPIO.

Link: https://lore.kernel.org/linux-pci/20240413004120.1099089-3-dlemoal@kernel.org
Suggested-by: Bjorn Helgaas <helgaas@kernel.org>
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/controller/pcie-rockchip-host.c
drivers/pci/pci.h

index fc868251e5704612692cded7c1b5e938c3d89557..cbec711148253a00a0a61edf1d882552d514d3a8 100644 (file)
@@ -325,6 +325,8 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip)
        msleep(PCIE_T_PVPERL_MS);
        gpiod_set_value_cansleep(rockchip->ep_gpio, 1);
 
+       msleep(PCIE_T_RRS_READY_MS);
+
        /* 500ms timeout value should be enough for Gen1/2 training */
        err = readl_poll_timeout(rockchip->apb_base + PCIE_CLIENT_BASIC_STATUS1,
                                 status, PCIE_LINK_UP(status), 20,
index 84b711cad26777e5712a88abe0ab8e61861beac0..b2865fb5a70d60a8d7614007fb3177b026286af6 100644 (file)
 /* Power stable to PERST# inactive from PCIe card Electromechanical Spec */
 #define PCIE_T_PVPERL_MS               100
 
+/*
+ * End of conventional reset (PERST# de-asserted) to first configuration
+ * request (device able to respond with a "Request Retry Status" completion),
+ * from PCIe r6.0, sec 6.6.1.
+ */
+#define PCIE_T_RRS_READY_MS    100
+
 /*
  * PCIe r6.0, sec 5.3.3.2.1 <PME Synchronization>
  * Recommends 1ms to 10ms timeout to check L2 ready.