e330d3f2a14c2b631959c8a9c3473cfd9a56879c
[openwrt/staging/aparcar.git] /
1 From 13bcdf07cb2ecff5d45d2c141df2539b15211448 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:09 +0100
4 Subject: [PATCH] PCI: aardvark: Mask all interrupts when unbinding driver
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Ensure that no interrupt can be triggered after driver unbind.
10
11 Link: https://lore.kernel.org/r/20211130172913.9727-8-kabel@kernel.org
12 Signed-off-by: Pali Rohár <pali@kernel.org>
13 Signed-off-by: Marek Behún <kabel@kernel.org>
14 Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
15 ---
16 drivers/pci/controller/pci-aardvark.c | 21 +++++++++++++++++++++
17 1 file changed, 21 insertions(+)
18
19 diff --git a/drivers/pci/controller/pci-aardvark.c b/drivers/pci/controller/pci-aardvark.c
20 index 12eae05f3d10..08b34accfe2f 100644
21 --- a/drivers/pci/controller/pci-aardvark.c
22 +++ b/drivers/pci/controller/pci-aardvark.c
23 @@ -1709,6 +1709,27 @@ static int advk_pcie_remove(struct platform_device *pdev)
24 val &= ~(PCI_COMMAND_IO | PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER);
25 advk_writel(pcie, val, PCIE_CORE_CMD_STATUS_REG);
26
27 + /* Disable MSI */
28 + val = advk_readl(pcie, PCIE_CORE_CTRL2_REG);
29 + val &= ~PCIE_CORE_CTRL2_MSI_ENABLE;
30 + advk_writel(pcie, val, PCIE_CORE_CTRL2_REG);
31 +
32 + /* Clear MSI address */
33 + advk_writel(pcie, 0, PCIE_MSI_ADDR_LOW_REG);
34 + advk_writel(pcie, 0, PCIE_MSI_ADDR_HIGH_REG);
35 +
36 + /* Mask all interrupts */
37 + advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_MASK_REG);
38 + advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_MASK_REG);
39 + advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_MASK_REG);
40 + advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_MASK_REG);
41 +
42 + /* Clear all interrupts */
43 + advk_writel(pcie, PCIE_MSI_ALL_MASK, PCIE_MSI_STATUS_REG);
44 + advk_writel(pcie, PCIE_ISR0_ALL_MASK, PCIE_ISR0_REG);
45 + advk_writel(pcie, PCIE_ISR1_ALL_MASK, PCIE_ISR1_REG);
46 + advk_writel(pcie, PCIE_IRQ_ALL_MASK, HOST_CTRL_INT_STATUS_REG);
47 +
48 /* Remove IRQ domains */
49 advk_pcie_remove_msi_irq_domain(pcie);
50 advk_pcie_remove_irq_domain(pcie);
51 --
52 2.34.1
53