linux-stable/drivers/pci
Wilfred Mallawa ebe5861050 PCI: dw-rockchip: Delay link training after hot reset in EP mode
[ Upstream commit c0b9375454 ]

RK3588 TRM, section "11.6.1.3.3 Hot Reset and Link-Down Reset" states that:

  If you want to delay link re-establishment (after reset) so that you can
  reprogram some registers through DBI, you must set app_ltssm_enable =0
  immediately after core_rst_n as shown in above. This can be achieved by
  enable the app_dly2_en, and end-up the delay by assert app_dly2_done.

I.e. setting app_dly2_en will automatically deassert app_ltssm_enable on
a hot reset, and setting app_dly2_done will re-assert app_ltssm_enable,
re-enabling link training.

When receiving a hot reset/link-down IRQ when running in EP mode, we will
call dw_pcie_ep_linkdown(), which may update registers through DBI. Unless
link training is inhibited, these register updates race with the link
training.

To avoid the race, set PCIE_LTSSM_APP_DLY2_EN so the controller never
automatically trains the link after a link-down or hot reset interrupt.
That way any DBI updates done in the dw_pcie_ep_linkdown() path will happen
while the link is still down.  Then allow link training by setting
PCIE_LTSSM_APP_DLY2_DONE

Co-developed-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Wilfred Mallawa <wilfred.mallawa@wdc.com>
Signed-off-by: Niklas Cassel <cassel@kernel.org>
Signed-off-by: Manivannan Sadhasivam <mani@kernel.org>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Link: https://patch.msgid.link/20250613101908.2182053-2-cassel@kernel.org
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-08-20 18:41:26 +02:00
..
controller PCI: dw-rockchip: Delay link training after hot reset in EP mode 2025-08-20 18:41:26 +02:00
endpoint PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute 2025-08-15 16:39:10 +02:00
hotplug PCI: pnv_php: Fix surprise plug detection and recovery 2025-08-15 16:39:22 +02:00
msi
pcie
pwrctrl
switch
access.c
ats.c
bus.c
devres.c
doe.c
ecam.c
host-bridge.c
iomap.c
iov.c
irq.c
Kconfig
Makefile
mmap.c
npem.c
of_property.c
of.c
p2pdma.c
pci-acpi.c PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports 2025-08-20 18:40:48 +02:00
pci-bridge-emul.c
pci-bridge-emul.h
pci-driver.c PCI: Fix driver_managed_dma check 2025-08-15 16:39:08 +02:00
pci-label.c
pci-mid.c
pci-pf-stub.c
pci-stub.c
pci-sysfs.c
pci.c PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports 2025-08-20 18:40:48 +02:00
pci.h PCI: Rename PCIE_RESET_CONFIG_DEVICE_WAIT_MS to PCIE_RESET_CONFIG_WAIT_MS 2025-08-15 16:39:01 +02:00
probe.c PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports 2025-08-20 18:40:48 +02:00
proc.c
quirks.c PCI: Adjust the position of reading the Link Control 2 register 2025-08-15 16:39:01 +02:00
remove.c
rom.c
search.c
setup-bus.c
setup-res.c
slot.c
syscall.c
tph.c
vc.c
vgaarb.c
vpd.c
xen-pcifront.c