From: Anirudha Sarangi <anirudha.sarangi@xilinx.com>
To: Marc Zyngier <maz@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>,
Michal Simek <michal.simek@xilinx.com>,
Valentin Schneider <valentin.schneider@arm.com>,
Douglas Anderson <dianders@chromium.org>,
Hans de Goede <hdegoede@redhat.com>,
Maulik Shah <mkshah@codeaurora.org>,
Zhen Lei <thunder.leizhen@huawei.com>,
<linux-kernel@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>,
Rob Herring <robh+dt@kernel.org>,
Frank Rowand <frowand.list@gmail.com>,
<devicetree@vger.kernel.org>, <git@xilinx.com>,
Anirudha Sarangi <anirudha.sarangi@xilinx.com>
Subject: [PATCH 3/3] irqchip: xilinx: Add support to remove the Xilinx INTC driver module.
Date: Tue, 27 Apr 2021 17:01:36 +0530 [thread overview]
Message-ID: <20210427113136.12469-4-anirudha.sarangi@xilinx.com> (raw)
In-Reply-To: <20210427113136.12469-1-anirudha.sarangi@xilinx.com>
The existing Xilinx INTC driver does not have mechanism to remove the
driver when it is being used as a module. For example, if the Xilinx
INTC IP is part of a removable fpga partition and a user intends to
replace the removable partition with a new one, the existing
implementation will not support the same.
The enhancement is done by adding a new remove API and making other
necessary changes.
Signed-off-by: Anirudha Sarangi <anirudha.sarangi@xilinx.com>
---
drivers/irqchip/irq-xilinx-intc.c | 49 +++++++++++++++++++++++++++++--
1 file changed, 47 insertions(+), 2 deletions(-)
diff --git a/drivers/irqchip/irq-xilinx-intc.c b/drivers/irqchip/irq-xilinx-intc.c
index 642733a6cbdf..2c5b76efabf6 100644
--- a/drivers/irqchip/irq-xilinx-intc.c
+++ b/drivers/irqchip/irq-xilinx-intc.c
@@ -39,6 +39,7 @@ struct xintc_irq_chip {
struct irq_domain *root_domain;
u32 intr_mask;
u32 nr_irq;
+ int irq;
};
static struct xintc_irq_chip *primary_intc;
@@ -234,6 +235,8 @@ static int xilinx_intc_of_init(struct device_node *intc,
if (parent) {
irq = irq_of_parse_and_map(intc, 0);
+ irqc->irq = irq;
+ intc->data = irqc;
if (irq) {
irq_set_chained_handler_and_data(irq,
xil_intc_irq_handler,
@@ -257,5 +260,47 @@ static int xilinx_intc_of_init(struct device_node *intc,
}
-IRQCHIP_DECLARE(xilinx_intc_xps, "xlnx,xps-intc-1.00.a", xilinx_intc_of_init);
-IRQCHIP_DECLARE(xilinx_intc_opb, "xlnx,opb-intc-1.00.c", xilinx_intc_of_init);
+static int xilinx_intc_of_remove(struct device_node *intc,
+ struct device_node *parent)
+{
+ int irq;
+ struct xintc_irq_chip *irqc;
+
+ if (!parent)
+ return 0;
+
+ irqc = intc->data;
+ irq = irqc->irq;
+ irq_set_chained_handler_and_data(irq, NULL, NULL);
+ if (irqc->domain) {
+ irq_dispose_mapping(irq);
+ irq_domain_remove(irqc->domain);
+ }
+ /*
+ * Disable all external interrupts until they are
+ * explicity requested.
+ */
+ xintc_write(irqc, IER, 0);
+ /* Acknowledge any pending interrupts just in case. */
+ xintc_write(irqc, IAR, 0xffffffff);
+ /* Turn off the Master Enable. */
+ xintc_write(irqc, MER, 0x0);
+
+ iounmap(irqc->base);
+ kfree(irqc);
+
+ return 0;
+}
+
+static struct irqc_init_remove_funps intc_funps = {
+ .irqchip_initp = xilinx_intc_of_init,
+ .irqchip_removep = xilinx_intc_of_remove,
+};
+
+IRQCHIP_PLATFORM_DRIVER_BEGIN(xilinx_intc_xps)
+IRQCHIP_MATCH("xlnx,xps-intc-1.00.a", &intc_funps)
+IRQCHIP_PLATFORM_DRIVER_END(xilinx_intc_xps)
+
+IRQCHIP_PLATFORM_DRIVER_BEGIN(xilinx_intc_opb)
+IRQCHIP_MATCH("xlnx,opb-intc-1.00.c", &intc_funps)
+IRQCHIP_PLATFORM_DRIVER_END(xilinx_intc_opb)
--
2.17.1
prev parent reply other threads:[~2021-04-27 11:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 11:31 [PATCH 0/3] Updates in irqchip framework to remove irqchip Anirudha Sarangi
2021-04-27 11:31 ` [PATCH 1/3] irqchip: xilinx: Avoid __init macro usage for xilinx_intc_of_init Anirudha Sarangi
2021-04-27 12:17 ` Marc Zyngier
2021-04-27 11:31 ` [PATCH 2/3] irqchip: Add support to remove irqchip driver modules Anirudha Sarangi
2021-04-27 12:35 ` Marc Zyngier
2021-04-27 11:31 ` Anirudha Sarangi [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210427113136.12469-4-anirudha.sarangi@xilinx.com \
--to=anirudha.sarangi@xilinx.com \
--cc=devicetree@vger.kernel.org \
--cc=dianders@chromium.org \
--cc=frowand.list@gmail.com \
--cc=git@xilinx.com \
--cc=hdegoede@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=michal.simek@xilinx.com \
--cc=mkshah@codeaurora.org \
--cc=robh+dt@kernel.org \
--cc=tglx@linutronix.de \
--cc=thunder.leizhen@huawei.com \
--cc=valentin.schneider@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).