]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
PCI: rockchip-host: Fix rockchip_pcie_host_init_port() PERST# handling
authorDamien Le Moal <dlemoal@kernel.org>
Sat, 13 Apr 2024 00:41:19 +0000 (09:41 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 9 Jul 2024 23:28:27 +0000 (18:28 -0500)
PCIe CEM r5.1, sec 2.9.2, mandates that the PERST# signal must remain
asserted for at least 100 usec (Tperst-clk) after the PCIe reference clock
becomes stable (if a reference clock is supplied), and for at least 100
msec after the power is stable (Tpvperl, defined by the macro
PCIE_T_PVPERL_MS).

Modify rockchip_pcie_host_init_port() to satisfy these constraints by
adding a sleep period before deasserting PERST# using the ep_gpio GPIO.
Since Tperst-clk is the shorter wait time, add an msleep() call for the
longer PCIE_T_PVPERL_MS milliseconds to handle both timing requirements.

Link: https://lore.kernel.org/linux-pci/20240413004120.1099089-2-dlemoal@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

index 300b9dc85ecc7b02b726d9d929c360926f8d1d7d..fc868251e5704612692cded7c1b5e938c3d89557 100644 (file)
@@ -322,6 +322,7 @@ static int rockchip_pcie_host_init_port(struct rockchip_pcie *rockchip)
        rockchip_pcie_write(rockchip, PCIE_CLIENT_LINK_TRAIN_ENABLE,
                            PCIE_CLIENT_CONFIG);
 
+       msleep(PCIE_T_PVPERL_MS);
        gpiod_set_value_cansleep(rockchip->ep_gpio, 1);
 
        /* 500ms timeout value should be enough for Gen1/2 training */