[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250903124505.365913-7-s-vadapalli@ti.com>
Date: Wed, 3 Sep 2025 18:14:47 +0530
From: Siddharth Vadapalli <s-vadapalli@...com>
To: <lpieralisi@...nel.org>, <kwilczynski@...nel.org>, <mani@...nel.org>,
<robh@...nel.org>, <bhelgaas@...gle.com>, <jingoohan1@...il.com>,
<fan.ni@...sung.com>, <quic_wenbyao@...cinc.com>,
<namcao@...utronix.de>, <mayank.rana@....qualcomm.com>,
<thippeswamy.havalige@....com>, <quic_schintav@...cinc.com>,
<shradha.t@...sung.com>, <inochiama@...il.com>, <cassel@...nel.org>,
<kishon@...nel.org>, <18255117159@....com>, <rongqianfeng@...o.com>,
<jirislaby@...nel.org>
CC: <linux-pci@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <srk@...com>,
<s-vadapalli@...com>
Subject: [PATCH 06/11] PCI: keystone: Add ks_pcie_free_intx_irq() helper for cleanup
Introduce the helper function ks_pcie_free_intx_irq() which will undo the
configuration performed by the ks_pcie_config_intx_irq() function. This
will be required for implementing a future helper function to undo the
configuration performed by the ks_pcie_host_init() function.
Signed-off-by: Siddharth Vadapalli <s-vadapalli@...com>
---
drivers/pci/controller/dwc/pci-keystone.c | 29 +++++++++++++++++++++++
1 file changed, 29 insertions(+)
diff --git a/drivers/pci/controller/dwc/pci-keystone.c b/drivers/pci/controller/dwc/pci-keystone.c
index 6cedb6dc4650..3afa298e89d1 100644
--- a/drivers/pci/controller/dwc/pci-keystone.c
+++ b/drivers/pci/controller/dwc/pci-keystone.c
@@ -745,6 +745,35 @@ static int ks_pcie_config_msi_irq(struct keystone_pcie *ks_pcie)
return ret;
}
+static void ks_pcie_free_intx_irq(struct keystone_pcie *ks_pcie)
+{
+ struct device_node *np = ks_pcie->np;
+ struct device_node *intc_np;
+ int irq_count, i;
+ u32 val;
+
+ /* Nothing to do if INTx Interrupt Controller does not exist */
+ intc_np = of_get_child_by_name(np, "legacy-interrupt-controller");
+ if (!intc_np)
+ return;
+
+ /* irq_count should be non-zero. Else, ks_pcie_host_init would have failed. */
+ irq_count = of_irq_count(intc_np);
+
+ /* Disable all legacy interrupts */
+ for (i = 0; i < PCI_NUM_INTX; i++) {
+ val = ks_pcie_app_readl(ks_pcie, IRQ_ENABLE_SET(i));
+ val &= ~INTx_EN;
+ ks_pcie_app_writel(ks_pcie, IRQ_ENABLE_SET(i), val);
+ }
+
+ irq_domain_remove(ks_pcie->intx_irq_domain);
+ for (i = 0; i < irq_count; i++)
+ irq_set_chained_handler(ks_pcie->intx_host_irqs[i], NULL);
+
+ of_node_put(intc_np);
+}
+
static int ks_pcie_config_intx_irq(struct keystone_pcie *ks_pcie)
{
struct device *dev = ks_pcie->pci->dev;
--
2.43.0
Powered by blists - more mailing lists