850-v5.17-0009-PCI-aardvark-Assert-PERST-when-unbinding-driver.patch 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. From 1f54391be8ce0c981d312cb93acdc5608def576a Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Pali=20Roh=C3=A1r?= <[email protected]>
  3. Date: Tue, 30 Nov 2021 18:29:11 +0100
  4. Subject: [PATCH] PCI: aardvark: Assert PERST# when unbinding driver
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. Put the PCIe card into reset by asserting PERST# signal when unbinding
  9. driver. It doesn't make sense to leave the card working if it can't
  10. communicate with the host. This should also save some power.
  11. Link: https://lore.kernel.org/r/[email protected]
  12. Signed-off-by: Pali Rohár <[email protected]>
  13. Signed-off-by: Marek Behún <[email protected]>
  14. Signed-off-by: Lorenzo Pieralisi <[email protected]>
  15. ---
  16. drivers/pci/controller/pci-aardvark.c | 4 ++++
  17. 1 file changed, 4 insertions(+)
  18. --- a/drivers/pci/controller/pci-aardvark.c
  19. +++ b/drivers/pci/controller/pci-aardvark.c
  20. @@ -1740,6 +1740,10 @@ static int advk_pcie_remove(struct platf
  21. /* Free config space for emulated root bridge */
  22. pci_bridge_emul_cleanup(&pcie->bridge);
  23. + /* Assert PERST# signal which prepares PCIe card for power down */
  24. + if (pcie->reset_gpio)
  25. + gpiod_set_value_cansleep(pcie->reset_gpio, 1);
  26. +
  27. /* Disable outbound address windows mapping */
  28. for (i = 0; i < OB_WIN_COUNT; i++)
  29. advk_pcie_disable_ob_win(pcie, i);