8b7682c34e281076021c43a2719bc85f5de3f070
[openwrt/staging/jogo.git] /
1 From 759dec2e3dfdbd261c41d2279f04f2351c971a49 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:12 +0100
4 Subject: [PATCH] PCI: aardvark: Disable link training when unbinding driver
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Disable link training circuit in driver unbind sequence. We want to
10 leave link training in the same state as it was before the driver was
11 probed.
12
13 Link: https://lore.kernel.org/r/20211130172913.9727-11-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>
17 ---
18 drivers/pci/controller/pci-aardvark.c | 5 +++++
19 1 file changed, 5 insertions(+)
20
21 diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
22 index 271ebecee965..e5c88f1c177b 100644
23 --- a/drivers/pci/controller/pci-aardvark.c
24 +++ b/drivers/pci/controller/pci-aardvark.c
25 @@ -1741,6 +1741,11 @@ static int advk_pcie_remove(struct platform_device *pdev)
26 if (pcie->reset_gpio)
27 gpiod_set_value_cansleep(pcie->reset_gpio, 1);
28
29 + /* Disable link training */
30 + val = advk_readl(pcie, PCIE_CORE_CTRL0_REG);
31 + val &= ~LINK_TRAINING_EN;
32 + advk_writel(pcie, val, PCIE_CORE_CTRL0_REG);
33 +
34 /* Disable outbound address windows mapping */
35 for (i = 0; i < OB_WIN_COUNT; i++)
36 advk_pcie_disable_ob_win(pcie, i);
37 --
38 2.34.1
39