linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: <linux-mips@linux-mips.org>, Ralf Baechle <ralf@linux-mips.org>
Cc: Paul Burton <paul.burton@imgtec.com>,
	Jason Cooper <jason@lakedaemon.net>,
	Thomas Gleixner <tglx@linutronix.de>,
	<linux-kernel@vger.kernel.org>,
	Marc Zyngier <marc.zyngier@arm.com>
Subject: [PATCH v2 02/14] irqchip: i8259: Allow platforms to override poll function
Date: Mon, 19 Sep 2016 22:21:19 +0100	[thread overview]
Message-ID: <20160919212132.28893-3-paul.burton@imgtec.com> (raw)
In-Reply-To: <20160919212132.28893-1-paul.burton@imgtec.com>

The default i8259 polling function (i8259_irq) is nicely generic but is
fairly costly. Platforms often provide an alternative means of polling
for an i8259 interrupt, and when using the i8259 without device tree
have typically just chained its parent interrupt to their own handler
function. In order to allow for platform-specific polling functions to
be used in cases where the driver is probed via device tree, provide an
i8259_set_poll function that accepts a pointer to an alternative poll
function that will override the default.

Signed-off-by: Paul Burton <paul.burton@imgtec.com>
---

Changes in v2: None

 arch/mips/include/asm/i8259.h | 11 +++++++++++
 drivers/irqchip/irq-i8259.c   |  8 +++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/arch/mips/include/asm/i8259.h b/arch/mips/include/asm/i8259.h
index a7fbcd6..b27fcc4 100644
--- a/arch/mips/include/asm/i8259.h
+++ b/arch/mips/include/asm/i8259.h
@@ -43,6 +43,17 @@ extern void make_8259A_irq(unsigned int irq);
 extern void init_i8259_irqs(void);
 extern int i8259_of_init(struct device_node *node, struct device_node *parent);
 
+/**
+ * i8159_set_poll() - Override the i8259 polling function
+ * @poll: pointer to platform-specific polling function
+ *
+ * Call this to override the generic i8259 polling function, which directly
+ * accesses i8259 registers, with a platform specific one which may be faster
+ * in cases where hardware provides a more optimal means of polling for an
+ * interrupt.
+ */
+extern void i8259_set_poll(int (*poll)(void));
+
 /*
  * Do the traditional i8259 interrupt polling thing.  This is for the few
  * cases where no better interrupt acknowledge method is available and we
diff --git a/drivers/irqchip/irq-i8259.c b/drivers/irqchip/irq-i8259.c
index 85897fd..1f4a344 100644
--- a/drivers/irqchip/irq-i8259.c
+++ b/drivers/irqchip/irq-i8259.c
@@ -38,6 +38,7 @@ static void disable_8259A_irq(struct irq_data *d);
 static void enable_8259A_irq(struct irq_data *d);
 static void mask_and_ack_8259A(struct irq_data *d);
 static void init_8259A(int auto_eoi);
+static int (*i8259_poll)(void) = i8259_irq;
 
 static struct irq_chip i8259A_chip = {
 	.name			= "XT-PIC",
@@ -51,6 +52,11 @@ static struct irq_chip i8259A_chip = {
  * 8259A PIC functions to handle ISA devices:
  */
 
+void i8259_set_poll(int (*poll)(void))
+{
+	i8259_poll = poll;
+}
+
 /*
  * This contains the irq mask for both 8259A irq controllers,
  */
@@ -355,7 +361,7 @@ void __init init_i8259_irqs(void)
 static void i8259_irq_dispatch(struct irq_desc *desc)
 {
 	struct irq_domain *domain = irq_desc_get_handler_data(desc);
-	int hwirq = i8259_irq();
+	int hwirq = i8259_poll();
 	unsigned int irq;
 
 	if (hwirq < 0)
-- 
2.9.3

  parent reply	other threads:[~2016-09-19 21:22 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-19 21:21 [PATCH v2 00/14] Partial MIPS Malta DT conversion Paul Burton
2016-09-19 21:21 ` [PATCH v2 01/14] irqchip: i8259: Add domain before mapping parent irq Paul Burton
2016-09-30 14:40   ` Paul Burton
2016-09-30 18:41     ` Thomas Gleixner
2016-09-19 21:21 ` Paul Burton [this message]
2016-09-19 21:21 ` [PATCH v2 03/14] irqchip: i8259: Remove unused i8259A_irq_pending Paul Burton
2016-09-19 21:21 ` [PATCH v2 04/14] MIPS: Malta: Allow PCI devices DMA to lower 2GB physical Paul Burton
2016-09-19 21:21 ` [PATCH v2 05/14] MIPS: Malta: Use all available DDR by default Paul Burton
2016-09-19 21:21 ` [PATCH v2 06/14] MIPS: Malta: Probe interrupt controllers via DT Paul Burton
2016-09-19 21:21 ` [PATCH v2 07/14] of/platform: Probe "isa" busses by default Paul Burton
2016-09-23 12:42   ` Rob Herring
2016-09-19 21:21 ` [PATCH v2 08/14] MIPS: Malta: Remove custom DT match table Paul Burton
2016-09-19 21:21 ` [PATCH v2 09/14] MIPS: Malta: Probe RTC via DT Paul Burton
2016-09-20 10:21   ` Sergei Shtylyov
2016-09-20 10:34     ` Paul Burton
2016-09-20 10:55       ` Sergei Shtylyov
2016-09-19 21:21 ` [PATCH v2 10/14] MIPS: Malta: Probe pflash " Paul Burton
2016-09-19 21:21 ` [PATCH v2 11/14] MIPS: Malta: Use syscon-reboot driver to reboot Paul Burton
2016-10-22  9:08   ` Maciej W. Rozycki
2016-10-24 13:42     ` Paul Burton
2016-10-25 10:55       ` Maciej W. Rozycki
2016-09-19 21:21 ` [PATCH v2 12/14] MIPS: Malta: Remove custom halt implementation Paul Burton
2016-09-19 21:21 ` [PATCH v2 13/14] power: reset: Add Intel PIIX4 poweroff driver Paul Burton
2016-09-19 23:42   ` Sebastian Reichel
2016-09-19 21:21 ` [PATCH v2 14/14] MIPS: Malta: Use PIIX4 poweroff driver to power down Paul Burton

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=20160919212132.28893-3-paul.burton@imgtec.com \
    --to=paul.burton@imgtec.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=marc.zyngier@arm.com \
    --cc=ralf@linux-mips.org \
    --cc=tglx@linutronix.de \
    /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).