* Configuration-Problem ext-interrupt on mpc52xx
@ 2007-09-19 11:59 S. Fricke
2007-09-19 14:54 ` Juergen Beisert
2007-09-19 15:09 ` Grant Likely
0 siblings, 2 replies; 6+ messages in thread
From: S. Fricke @ 2007-09-19 11:59 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 655 bytes --]
Hi,
how can i configure an "ext interrupt" to high-level? I want a interruption on
IRQ2, but I checked with an oscilloscope that the pin has a low state and I
needs a high state.
I have tried, after I got the irq (with irq_of_parse_and_map), set it with
set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
But I think it is a system-configuration (irq_desc) and no
device-configuration.
Mit freundlichen Gruessen
Silvio Fricke
--
-- S. Fricke ----------------------------- MAILTO:silvio.fricke@gmail.com --
Diplom-Informatiker (FH)
Linux-Entwicklung
----------------------------------------------------------------------------
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Configuration-Problem ext-interrupt on mpc52xx
2007-09-19 11:59 Configuration-Problem ext-interrupt on mpc52xx S. Fricke
@ 2007-09-19 14:54 ` Juergen Beisert
2007-09-19 15:09 ` Grant Likely
1 sibling, 0 replies; 6+ messages in thread
From: Juergen Beisert @ 2007-09-19 14:54 UTC (permalink / raw)
To: linuxppc-dev, S. Fricke
[-- Attachment #1: Type: text/plain, Size: 798 bytes --]
Silvio,
On Wednesday 19 September 2007 13:59, S. Fricke wrote:
> how can i configure an "ext interrupt" to high-level? I want a interruption
> on IRQ2, but I checked with an oscilloscope that the pin has a low state
> and I needs a high state.
>
> I have tried, after I got the irq (with irq_of_parse_and_map), set it with
>
> set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
>
> But I think it is a system-configuration (irq_desc) and no
> device-configuration.
Try with the attached patch.
Regards,
Juergen
--
Dipl.-Ing. Juergen Beisert | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Vertretung Sued/Muenchen, Germany
Phone: +49-8766-939 228 | Fax: +49-5121-206917-9
[-- Attachment #2: mpc52xx_extirq_set_type.diff --]
[-- Type: text/x-diff, Size: 1586 bytes --]
---
arch/powerpc/platforms/52xx/mpc52xx_pic.c | 38 ++++++++++++++++++++++++++++++
1 file changed, 38 insertions(+)
Index: arch/powerpc/platforms/52xx/mpc52xx_pic.c
===================================================================
--- arch/powerpc/platforms/52xx/mpc52xx_pic.c.orig
+++ arch/powerpc/platforms/52xx/mpc52xx_pic.c
@@ -25,6 +25,7 @@
#include <linux/stddef.h>
#include <linux/delay.h>
#include <linux/irq.h>
+#include <linux/interrupt.h>
#include <linux/hardirq.h>
#include <asm/io.h>
@@ -107,11 +108,48 @@ static void mpc52xx_extirq_ack(unsigned
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] 6+ messages in thread
* Re: Configuration-Problem ext-interrupt on mpc52xx
2007-09-19 11:59 Configuration-Problem ext-interrupt on mpc52xx S. Fricke
2007-09-19 14:54 ` Juergen Beisert
@ 2007-09-19 15:09 ` Grant Likely
2007-09-19 19:01 ` S. Fricke
1 sibling, 1 reply; 6+ messages in thread
From: Grant Likely @ 2007-09-19 15:09 UTC (permalink / raw)
To: S. Fricke; +Cc: linuxppc-dev
On 9/19/07, S. Fricke <silvio.fricke@googlemail.com> wrote:
> Hi,
>
> how can i configure an "ext interrupt" to high-level? I want a interruption on
> IRQ2, but I checked with an oscilloscope that the pin has a low state and I
> needs a high state.
>
> I have tried, after I got the irq (with irq_of_parse_and_map), set it with
>
> set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
>
> But I think it is a system-configuration (irq_desc) and no
> device-configuration.
You shouldn't need to do this. You set your sense level in the device tree.
>From your previous email, your device node looks like this:
> intpin@0 {
> interrupt-parent = <500>;
> interrupts = <1 2 2>;
> };
Which is IRQ2, EDGE_FALLING.
If you change your interrupts property to <1 2 0>, then your sense is
set to LEVEL_HIGH. (Seriously, you need to read the interrupts
section of Documentation/powerpc/mpc52xx-device-tree-bindings.txt.)
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
grant.likely@secretlab.ca
(403) 399-0195
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Configuration-Problem ext-interrupt on mpc52xx
2007-09-19 15:09 ` Grant Likely
@ 2007-09-19 19:01 ` S. Fricke
2007-09-19 23:40 ` David Gibson
0 siblings, 1 reply; 6+ messages in thread
From: S. Fricke @ 2007-09-19 19:01 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1493 bytes --]
Hello,
> On 9/19/07, S. Fricke <silvio.fricke@googlemail.com> wrote:
> > Hi,
> >
> > how can i configure an "ext interrupt" to high-level? I want a interruption on
> > IRQ2, but I checked with an oscilloscope that the pin has a low state and I
> > needs a high state.
> >
> > I have tried, after I got the irq (with irq_of_parse_and_map), set it with
> >
> > set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
> >
> > But I think it is a system-configuration (irq_desc) and no
> > device-configuration.
>
> You shouldn't need to do this. You set your sense level in the device tree.
>
> From your previous email, your device node looks like this:
> > intpin@0 {
> > interrupt-parent = <500>;
> > interrupts = <1 2 2>;
> > };
>
> Which is IRQ2, EDGE_FALLING.
>
> If you change your interrupts property to <1 2 0>, then your sense is
> set to LEVEL_HIGH. (Seriously, you need to read the interrupts
> section of Documentation/powerpc/mpc52xx-device-tree-bindings.txt.)
I have read it! But another driver on Boot-time pulled my interrupt to low, I
can't do anything except for looking at the oscilloscope
I'm going to disable all unneeded drivers tomorrow morning.
TIA:
Silvio Fricke
--
-- S. Fricke ----------------------------- MAILTO:silvio.fricke@gmail.com --
Diplom-Informatiker (FH)
Linux-Entwicklung
----------------------------------------------------------------------------
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Configuration-Problem ext-interrupt on mpc52xx
2007-09-19 19:01 ` S. Fricke
@ 2007-09-19 23:40 ` David Gibson
2007-09-20 8:37 ` S. Fricke
0 siblings, 1 reply; 6+ messages in thread
From: David Gibson @ 2007-09-19 23:40 UTC (permalink / raw)
To: S. Fricke; +Cc: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 1906 bytes --]
On Wed, Sep 19, 2007 at 09:01:46PM +0200, S. Fricke wrote:
> Hello,
>
> > On 9/19/07, S. Fricke <silvio.fricke@googlemail.com> wrote:
> > > Hi,
> > >
> > > how can i configure an "ext interrupt" to high-level? I want a interruption on
> > > IRQ2, but I checked with an oscilloscope that the pin has a low state and I
> > > needs a high state.
> > >
> > > I have tried, after I got the irq (with irq_of_parse_and_map), set it with
> > >
> > > set_irq_type(irq, IRQ_TYPE_LEVEL_HIGH);
> > >
> > > But I think it is a system-configuration (irq_desc) and no
> > > device-configuration.
> >
> > You shouldn't need to do this. You set your sense level in the device tree.
> >
> > From your previous email, your device node looks like this:
> > > intpin@0 {
> > > interrupt-parent = <500>;
> > > interrupts = <1 2 2>;
> > > };
> >
> > Which is IRQ2, EDGE_FALLING.
> >
> > If you change your interrupts property to <1 2 0>, then your sense is
> > set to LEVEL_HIGH. (Seriously, you need to read the interrupts
> > section of Documentation/powerpc/mpc52xx-device-tree-bindings.txt.)
>
> I have read it! But another driver on Boot-time pulled my interrupt
Erm.. if the interrupt is shared with something else which expects a
different trigger/polarity, you're kind of stuffed....
> to low, I can't do anything except for looking at the oscilloscope
>
> I'm going to disable all unneeded drivers tomorrow morning.
>
> TIA:
> Silvio Fricke
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-dev
--
David Gibson | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_
| _way_ _around_!
http://www.ozlabs.org/~dgibson
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Configuration-Problem ext-interrupt on mpc52xx
2007-09-19 23:40 ` David Gibson
@ 2007-09-20 8:37 ` S. Fricke
0 siblings, 0 replies; 6+ messages in thread
From: S. Fricke @ 2007-09-20 8:37 UTC (permalink / raw)
To: linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 748 bytes --]
Hello,
> > I have read it! But another driver on Boot-time pulled my interrupt
>
> Erm.. if the interrupt is shared with something else which expects a
> different trigger/polarity, you're kind of stuffed....
YEEeess! An incomplete documentation is suboptimal! In german, we would
say: "[...] Das es die Sau krausst [...]"
I have now used an another Interrupt and it works.
Mit freundlichen Gruessen
Silvio Fricke
--
-- S. Fricke ----------------------------- MAILTO:silvio.fricke@gmail.com --
Diplom-Informatiker (FH) TEL: (+49)8330-911278
Linux-Entwicklung JABBER: fricke@jabber.org
-- Steinbacher Strasse 18, D-87764 Legau -----------------------------------
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2007-09-20 8:37 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-19 11:59 Configuration-Problem ext-interrupt on mpc52xx S. Fricke
2007-09-19 14:54 ` Juergen Beisert
2007-09-19 15:09 ` Grant Likely
2007-09-19 19:01 ` S. Fricke
2007-09-19 23:40 ` David Gibson
2007-09-20 8:37 ` S. Fricke
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).