23346a9284a9c0b6837e40502ee2bf64be55a767
[openwrt/staging/svanheule.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 --- a/drivers/pci/controller/pci-aardvark.c
22 +++ b/drivers/pci/controller/pci-aardvark.c
23 @@ -1740,6 +1740,11 @@ static int advk_pcie_remove(struct platf
24 if (pcie->reset_gpio)
25 gpiod_set_value_cansleep(pcie->reset_gpio, 1);
26
27 + /* Disable link training */
28 + val = advk_readl(pcie, PCIE_CORE_CTRL0_REG);
29 + val &= ~LINK_TRAINING_EN;
30 + advk_writel(pcie, val, PCIE_CORE_CTRL0_REG);
31 +
32 /* Disable outbound address windows mapping */
33 for (i = 0; i < OB_WIN_COUNT; i++)
34 advk_pcie_disable_ob_win(pcie, i);