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