All of lore.kernel.org
 help / color / mirror / Atom feed
* MPC85xx - accessing external interrupt
@ 2010-08-30  6:02 deebul nair
  2010-08-30  7:36 ` tiejun.chen
  0 siblings, 1 reply; 2+ messages in thread
From: deebul nair @ 2010-08-30  6:02 UTC (permalink / raw)
  To: linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

Hi all

I am trying to use the external interrupts on the Powerpc architecture
MPC8542 .

My  problem is that my driver is trying to request the external
interrupt IRQ1, and I dont know what number use in INTR_NUM:

request_irq(INTR_NUM, , , , )

As per the MPC85xx documentation
Documentation/powerpc/dts-bindings/fsl/mpic.txt
about the implementation of interrupts virtual numbers
the external interrupt virtual irq number for IRQ1 should be 1

but when i try to give INTR_NUM ins request_irq as 1 it gives error .

When i use irq_create_mapping() it gives me output as 16.. and it registers
.. but the problem is it is not fixed
neither it gives interrupts .
when i remove and add it registers to some other addresses

i even tried irq_of_parse_map()

for_each_node_by_type(np,"interrupt-controller"){
    if(of_device_is_compatible(np,"chrp,open-pic")){
           found=np;
           break;
}
}

virq = irq_of_parse_and_map(found, irq);

this always returns 0
whatever may be the irq value..
as a result the driver gives error for irq 0



-- 
Cheeers

Deebul !!!!!!

[-- Attachment #2: Type: text/html, Size: 1532 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: MPC85xx - accessing external interrupt
  2010-08-30  6:02 MPC85xx - accessing external interrupt deebul nair
@ 2010-08-30  7:36 ` tiejun.chen
  0 siblings, 0 replies; 2+ messages in thread
From: tiejun.chen @ 2010-08-30  7:36 UTC (permalink / raw)
  To: deebul nair; +Cc: linuxppc-dev

deebul nair wrote:
> Hi all
> 
> I am trying to use the external interrupts on the Powerpc architecture
> MPC8542 .
> 
> My  problem is that my driver is trying to request the external
> interrupt IRQ1, and I dont know what number use in INTR_NUM:
> 
> request_irq(INTR_NUM, , , , )
> 
> As per the MPC85xx documentation
> Documentation/powerpc/dts-bindings/fsl/mpic.txt
> about the implementation of interrupts virtual numbers
> the external interrupt virtual irq number for IRQ1 should be 1
> 
> but when i try to give INTR_NUM ins request_irq as 1 it gives error .
> 
> When i use irq_create_mapping() it gives me output as 16.. and it registers
> .. but the problem is it is not fixed
> neither it gives interrupts .
> when i remove and add it registers to some other addresses
> 
> i even tried irq_of_parse_map()
> 
> for_each_node_by_type(np,"interrupt-controller"){
>     if(of_device_is_compatible(np,"chrp,open-pic")){
>            found=np;
>            break;
> }
> }
> 
> virq = irq_of_parse_and_map(found, irq);
> 
> this always returns 0
> whatever may be the irq value..
> as a result the driver gives error for irq 0

Anyway the following path should be the correct path:

request_irq(virq)
	      |
	      + virq = irq_of_parse_and_map(hw_irq)
					      |
					      + We get this from the dts file.

So you should define the appropriate node for your device. Then convert your
hw_irq to vir_irq via irq_of_parse_and_map() to pass that to reuest_irq() on
your device driver. Sometime this process is wrapped by some functions so I
recommend you refer to the files on the directory, arch/powerpc/sysdev/.

But I think the root cause to your problem is that you cannot pass the proper
arguments to irq_of_parse_and_map().
------
unsigned int irq_of_parse_and_map(struct device_node *dev, int index)

You should do this like the following:
------
	struct device_node *np;
	unsigned int virq;

	np = of_find_compatible_node(NULL, NULL, "<the compatible property of your
device node on dts>");
	if (np) {
		irq_of_parse_and_map(np, 0);
	}

	request_irq(virq,......);

Here I assume you have only one irq property so set 'index' as '0' on the
function, irq_of_parse_and_map().

Cheers
Tiejun
		
> 
> 
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-30 11:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-30  6:02 MPC85xx - accessing external interrupt deebul nair
2010-08-30  7:36 ` tiejun.chen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.