* mpc5200: add interrupt type function
@ 2008-04-15 15:29 Robert Schwebel
2008-04-17 6:00 ` Robert Schwebel
0 siblings, 1 reply; 4+ messages in thread
From: Robert Schwebel @ 2008-04-15 15:29 UTC (permalink / raw)
To: linuxppc-dev
From: Sascha Hauer <s.hauer@pengutronix.de>
Add a set_type function for external (GPIO) interrupts.
Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/powerpc/platforms/52xx/mpc52xx_pic.c | 38 ++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
Index: arch/powerpc/platforms/52xx/mpc52xx_pic.c
===================================================================
--- a/arch/powerpc/platforms/52xx/mpc52xx_pic.c.orig 2008-04-15 11:25:29.000000000 +0200
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pic.c 2008-04-15 11:25:39.000000000 +0200
@@ -18,6 +18,7 @@
#undef DEBUG
+#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/of.h>
#include <asm/io.h>
@@ -109,11 +110,48 @@
io_be_setbit(&intr->ctrl, 27-l2irq);
}
+static int mpc52xx_extirq_set_type(unsigned int virq, unsigned int flow_type)
+{
+ u32 ctrl_reg, type;
+ int irq;
+ int l2irq;
+
+ irq = irq_map[virq].hwirq;
+ l2irq = (irq & MPC52xx_IRQ_L2_MASK) >> MPC52xx_IRQ_L2_OFFSET;
+
+ pr_debug("%s: irq=%x. l2=%d flow_type=%d\n", __func__, irq, l2irq, flow_type);
+
+ switch (flow_type) {
+ case IRQF_TRIGGER_HIGH:
+ type = 0;
+ break;
+ case IRQF_TRIGGER_RISING:
+ type = 1;
+ break;
+ case IRQF_TRIGGER_FALLING:
+ type = 2;
+ break;
+ case IRQF_TRIGGER_LOW:
+ type = 3;
+ break;
+ default:
+ type = 0;
+ }
+
+ ctrl_reg = in_be32(&intr->ctrl);
+ ctrl_reg &= ~(0x3 << (22 - (l2irq * 2)));
+ ctrl_reg |= (type << (22 - (l2irq * 2)));
+ out_be32(&intr->ctrl, ctrl_reg);
+
+ return 0;
+}
+
static struct irq_chip mpc52xx_extirq_irqchip = {
.typename = " MPC52xx IRQ[0-3] ",
.mask = mpc52xx_extirq_mask,
.unmask = mpc52xx_extirq_unmask,
.ack = mpc52xx_extirq_ack,
+ .set_type = mpc52xx_extirq_set_type,
};
/*
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mpc5200: add interrupt type function
2008-04-15 15:29 mpc5200: add interrupt type function Robert Schwebel
@ 2008-04-17 6:00 ` Robert Schwebel
2008-04-17 6:41 ` Grant Likely
0 siblings, 1 reply; 4+ messages in thread
From: Robert Schwebel @ 2008-04-17 6:00 UTC (permalink / raw)
To: tnt, grant.likely; +Cc: linuxppc-dev
On Tue, Apr 15, 2008 at 05:29:54PM +0200, Robert Schwebel wrote:
> From: Sascha Hauer <s.hauer@pengutronix.de>
>
> Add a set_type function for external (GPIO) interrupts.
>
> Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
As we didn't get negative feedback yet, could this go into the 2.6.26
merge window?
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Hannoversche Str. 2, 31134 Hildesheim, Germany
Phone: +49-5121-206917-0 | Fax: +49-5121-206917-9
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mpc5200: add interrupt type function
2008-04-17 6:00 ` Robert Schwebel
@ 2008-04-17 6:41 ` Grant Likely
2008-04-18 8:19 ` Sascha Hauer
0 siblings, 1 reply; 4+ messages in thread
From: Grant Likely @ 2008-04-17 6:41 UTC (permalink / raw)
To: Robert Schwebel; +Cc: linuxppc-dev
On Wed, Apr 16, 2008 at 11:00 PM, Robert Schwebel
<r.schwebel@pengutronix.de> wrote:
> On Tue, Apr 15, 2008 at 05:29:54PM +0200, Robert Schwebel wrote:
> > From: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > Add a set_type function for external (GPIO) interrupts.
> >
> > Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
> > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
>
> As we didn't get negative feedback yet, could this go into the 2.6.26
> merge window?
I didn't see this the first time (didn't get cc'd).
It looks mostly okay, but in doesn't have any mutual exclusion which
it probably should have. What are the users of this?
Cheers,
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: mpc5200: add interrupt type function
2008-04-17 6:41 ` Grant Likely
@ 2008-04-18 8:19 ` Sascha Hauer
0 siblings, 0 replies; 4+ messages in thread
From: Sascha Hauer @ 2008-04-18 8:19 UTC (permalink / raw)
To: Grant Likely; +Cc: linuxppc-dev
On Wed, Apr 16, 2008 at 11:41:08PM -0700, Grant Likely wrote:
> On Wed, Apr 16, 2008 at 11:00 PM, Robert Schwebel
> <r.schwebel@pengutronix.de> wrote:
> > On Tue, Apr 15, 2008 at 05:29:54PM +0200, Robert Schwebel wrote:
> > > From: Sascha Hauer <s.hauer@pengutronix.de>
> > >
> > > Add a set_type function for external (GPIO) interrupts.
> > >
> > > Signed-off-by: Juergen Beisert <j.beisert@pengutronix.de>
> > > Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
> >
> > As we didn't get negative feedback yet, could this go into the 2.6.26
> > merge window?
>
> I didn't see this the first time (didn't get cc'd).
>
> It looks mostly okay, but in doesn't have any mutual exclusion which
> it probably should have. What are the users of this?
No, it is used in kernel/irq/chip.c and kernel/irq/manage.c. Both
callers already hold the mpc52xx_extirq_irqchip.lock spinlock.
Sascha
--
Pengutronix e.K. - Linux Solutions for Science and Industry
-----------------------------------------------------------
Kontakt-Informationen finden Sie im Header dieser Mail oder
auf der Webseite -> http://www.pengutronix.de/impressum/ <-
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-04-18 8:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-04-15 15:29 mpc5200: add interrupt type function Robert Schwebel
2008-04-17 6:00 ` Robert Schwebel
2008-04-17 6:41 ` Grant Likely
2008-04-18 8:19 ` Sascha Hauer
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).