From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: patches@linaro.org
Subject: [Qemu-devel] [PATCH 4/5] hw/irq: Add qemu_irq_split() so one GPIO output can feed two inputs
Date: Mon, 21 Feb 2011 20:57:52 +0000 [thread overview]
Message-ID: <1298321873-17064-5-git-send-email-peter.maydell@linaro.org> (raw)
In-Reply-To: <1298321873-17064-1-git-send-email-peter.maydell@linaro.org>
Add a qemu_irq_split() function which allows a board to wire a single
GPIO output up to two GPIO inputs. This is needed for realview boards,
where the MMC card status is visible both in a system register and
via a PL061 GPIO module.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/irq.c | 15 +++++++++++++++
hw/irq.h | 3 +++
2 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/hw/irq.c b/hw/irq.c
index 7703f62..4035a8c 100644
--- a/hw/irq.c
+++ b/hw/irq.c
@@ -75,3 +75,18 @@ qemu_irq qemu_irq_invert(qemu_irq irq)
qemu_irq_raise(irq);
return qemu_allocate_irqs(qemu_notirq, irq, 1)[0];
}
+
+static void qemu_splitirq(void *opaque, int line, int level)
+{
+ struct IRQState **irq = opaque;
+ irq[0]->handler(irq[0]->opaque, irq[0]->n, level);
+ irq[1]->handler(irq[1]->opaque, irq[1]->n, level);
+}
+
+qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2)
+{
+ qemu_irq *s = qemu_mallocz(2 * sizeof(qemu_irq));
+ s[0] = irq1;
+ s[1] = irq2;
+ return qemu_allocate_irqs(qemu_splitirq, s, 1)[0];
+}
diff --git a/hw/irq.h b/hw/irq.h
index f7849ed..389ed7a 100644
--- a/hw/irq.h
+++ b/hw/irq.h
@@ -30,4 +30,7 @@ void qemu_free_irqs(qemu_irq *s);
/* Returns a new IRQ with opposite polarity. */
qemu_irq qemu_irq_invert(qemu_irq irq);
+/* Returns a new IRQ which feeds into both the passed IRQs */
+qemu_irq qemu_irq_split(qemu_irq irq1, qemu_irq irq2);
+
#endif
--
1.7.1
next prev parent reply other threads:[~2011-02-21 21:14 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-21 20:57 [Qemu-devel] [PATCH 0/5] Fix MMC card detection for Realview boards Peter Maydell
2011-02-21 20:57 ` [Qemu-devel] [PATCH 1/5] hw/pl181: Implement GPIO output pins for card status Peter Maydell
2011-02-21 20:57 ` [Qemu-devel] [PATCH 2/5] hw/arm_sysctl.c: Wire MCI register MMC card status bits to GPIO inputs Peter Maydell
2011-02-21 20:57 ` [Qemu-devel] [PATCH 3/5] hw/pl061.c: Implement ARM PL061 as well as Luminary one Peter Maydell
2011-02-21 20:57 ` Peter Maydell [this message]
2011-02-21 20:57 ` [Qemu-devel] [PATCH 5/5] hw/realview: Wire up the MMC card status Peter Maydell
2011-03-06 18:04 ` [Qemu-devel] [PATCH 0/5] Fix MMC card detection for Realview boards Aurelien Jarno
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=1298321873-17064-5-git-send-email-peter.maydell@linaro.org \
--to=peter.maydell@linaro.org \
--cc=patches@linaro.org \
--cc=qemu-devel@nongnu.org \
/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).