<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.6003" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2>Firstly you should make sure which interrupt level is used to
trigger the external interrupt. High level, low level, rising edge or
falling edge? </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2>------</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2> 0 = low to high edge sensitive type enabled<BR> 1 = active low
level sensitive type enabled<BR> 2 = active high level sensitive type
enabled<BR> 3 = high to low edge sensitive type enable</FONT></SPAN><SPAN
class=952431214-22092010><FONT face=Arial
size=2> </FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2>Then set the appropriate sense and level for your external interrupt. And
you have to ensure the FPGA issue the real interrupt. Maybe you can
use the hardware tool to probe if there is a interrupt signal on external
interrupt pin.</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2>Additionally I think your 'reg' property is wrong unless you have
abnormal way to parse that :)</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2></FONT></SPAN> </DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2>Cheers</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2>Tiejun</FONT></SPAN></DIV>
<DIV dir=ltr align=left><SPAN class=952431214-22092010><FONT face=Arial
size=2></FONT></SPAN> </DIV><BR>
<BLOCKQUOTE dir=ltr
style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #0000ff 2px solid; MARGIN-RIGHT: 0px">
<DIV class=OutlookMessageHeader lang=en-us dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B>
linuxppc-dev-bounces+tiejun.chen=windriver.com@lists.ozlabs.org
[mailto:linuxppc-dev-bounces+tiejun.chen=windriver.com@lists.ozlabs.org] <B>On
Behalf Of </B>deebul nair<BR><B>Sent:</B> Wednesday, September 22, 2010 4:15
PM<BR><B>To:</B> linuxppc-dev@lists.ozlabs.org<BR><B>Subject:</B> external
interrupt mapping with FPGA on loacl bus<BR></FONT><BR></DIV>
<DIV></DIV>
<DIV> </DIV>
<DIV>Hi</DIV>
<DIV> </DIV>
<DIV>i have a FPGA called mcmc which is connected to the powerpc mpc8572 on
the local bus. It provides 2 interrupts which are connected to the</DIV>
<DIV>external interupts IRQ1 and IRQ3 of the mpc8572.</DIV>
<DIV>the fpga is memory mapped on the local bus at address <FONT
face="Courier New">0xc0000000 </FONT></DIV>
<DIV>I am able to register the interrupt and obtain virq , but no
interrupts.</DIV>
<DIV>is the modifications made in the dts file enought/right for getting an
external interrupt??</DIV>
<DIV><FONT face=Arial color=#0000ff size=2></FONT> </DIV>
<DIV> </DIV>
<DIV><STRONG>The modified dts file for enrm8572</STRONG></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">localbus@e0005000 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
<DIV><FONT face="courier new,monospace">#address-cells =
<2>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">#size-cells =
<1>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">compatible = "fsl,mpc8572-elbc",
"fsl,elbc", "simple-bus";</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0xe0005000
0x1000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">interrupts = <19
2>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">interrupt-parent =
<&mpic>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">ranges = <0x0 0x0 0xfc000000
0x04000000</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">0x1 0x0 0xc0000000
0x00080000</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">0x2 0x0 0x90100000
0x00008000</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">0x3 0x0 0x90000000
0x00040000</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">0x4 0x0 0x91000000
0x00008000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">nand@3,0 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">#address-cells =
<1>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">#size-cells =
<1>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">compatible =
"fsl,mpc8572-fcm-nand",</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">"fsl,elbc-fcm-nand";</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x3 0x0
0x40000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">u-boot@0 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x0
0x02000000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">read-only;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">jffs2@2000000 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x02000000
0x10000000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">ramdisk@12000000 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x12000000
0x08000000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">read-only;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">kernel@1a000000 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x1a000000
0x04000000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">dtb@1e000000 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x1e000000
0x01000000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">read-only;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">empty@1f000000 {</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">reg = <0x1f000000
0x21000000>;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace">mcmc@1,0 {</FONT></STRONG></DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace"></FONT></STRONG> </DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace">compatible =
"fsl,fpga-pixis";</FONT></STRONG></DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace"></FONT></STRONG> </DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace">reg = <1 0 32>;</FONT></STRONG></DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace"></FONT></STRONG> </DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace">interrupts = <1 1 3
1>;</FONT></STRONG></DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace"></FONT></STRONG> </DIV>
<DIV><STRONG><FONT style="BACKGROUND-COLOR: #ffff33"
face="courier new,monospace">interrupt-parent =
<&mpic>;</FONT></STRONG></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV></BLOCKQUOTE>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">};</FONT></DIV>
<DIV> </DIV>
<DIV><STRONG>code for registering the interrupt :</STRONG></DIV>
<DIV> </DIV>
<DIV><FONT face="courier new,monospace">np = of_find_compatible_node(NULL,
NULL, "fsl,fpga-pixis");</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">mcmc_irq = irq;</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">virq = irq_of_parse_and_map(np,
mcmc_irq);</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">if(virq == NO_IRQ){</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">printk(KERN_ERR "mcmc: failed to map
interrupt");</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">}</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">printk(KERN_INFO "mcmc: interrupt
mapped to virq %d\n", virq);</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">ret = request_irq(virq,
mcmc_interrupt, IRQF_DISABLED,"mcmc", NULL);</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">if(ret){</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">printk(KERN_INFO "mcmc : cant get
assigned irq %i\n errno : <%d>\n",mcmc_irq,ret);</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">}</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">else{</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">printk(KERN_ALERT "Interrupt requested
OK\n");</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">}</FONT></DIV>
<DIV> </DIV>
<DIV>d :</DIV>
<DIV> </DIV>
<DIV><STRONG>when i register the driver the following output is
obtaine</STRONG></DIV>
<DIV> </DIV>
<DIV><STRONG>for irq=1</STRONG></DIV>
<DIV> </DIV>
<DIV><FONT face="courier new,monospace">irq_of_parse_and_map</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq :
irq_create_mapping(0xc0fffb40,0x1)</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq : using host @
c0fffb40</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq : obtained virq 18</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq : virq=12 <6>mcmc :
interrupt mapped to irq 18</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">Interrupt requested OK!</FONT></DIV>
<DIV> </DIV>
<DIV><STRONG>for irq=0</STRONG></DIV>
<DIV> </DIV>
<DIV><FONT face="courier new,monospace">irq_of_parse_and_map</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq :
irq_create_mapping(0xc0fffb40,0x3)</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq : using host @
c0fffb40</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq : obtained virq 20</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">irq : virq=14 <6>mcmc :
interrupt mapped to irq 20</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV><FONT face="courier new,monospace">Interrupt requested OK!</FONT></DIV>
<DIV><FONT face="courier new,monospace"></FONT> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>--</DIV>
<DIV>Cheeers</DIV>
<DIV> </DIV>
<DIV>Deebul !!!!!!</DIV>
<DIV> </DIV>
<DIV> </DIV></BLOCKQUOTE></BODY></HTML>