linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* Interrupt ID number on mpc8347
@ 2009-04-03  7:51 yamazaki seiji
  2009-04-03 10:57 ` Michael Ellerman
  0 siblings, 1 reply; 3+ messages in thread
From: yamazaki seiji @ 2009-04-03  7:51 UTC (permalink / raw)
  To: linuxppc-dev@ozlabs.org

Hi all,

I am running the Linux kernel 2.6.28.7 on my PPC8347 BRD.
I have another problem.

I use many external Interrupts.

one of them ,I setup 
	localbus@f0000000 {	//WDT,SW etc.k
		reg = <0xf0000000 0x20>;
		pci_inta@2{
			interrupt-parent = <&ipic>;
			interrupts = <17 0x8>;
		};
	};
on dts file.

And I programmed
	struct device_node *np;
	struct resource irq_res;
	int ret;
	
	char *irqs[]={
		"pci_inta",
		 NULL};
	for(i=0;;i++){
		if(irqs[i]==NULL){
			break;
		}
		np = of_find_node_by_name(NULL, irqs[i]);
		if (np == NULL) {
			printk("No %s in DTB. Has it been eaten by wild dogs?\n",irqs[i]);
			return -ENODEV;
		}
		if (!of_device_is_available(np)){
			printk("No %s in DTB. of_device_is_availables?\n",irqs[i]);
			return -ENODEV;
		}
		ret = of_irq_to_resource(np, 0, &irq_res);
		if (ret == NO_IRQ)
			irq_res.start = irq_res.end = 0;
		else
			irq_res.flags = 0;
		printk("********************************* %s irq_res.start=%d,irq_res.end=%d\n",irqs[i],irq_res.start,irq_res.end);
	}

printk result is

********************************* pci_inta irq_res.start=19,irq_res.end=19


I set the Interrupt ID number 17.
But kernel gives the Interrupt ID number 19.

I wont to know the reasen.
Please tell me.

-Seiji Yamazaki

-- 
yamazaki seiji <yamazaki.seiji@kk.jp.panasonic.com>

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

* Re: Interrupt ID number on mpc8347
  2009-04-03  7:51 Interrupt ID number on mpc8347 yamazaki seiji
@ 2009-04-03 10:57 ` Michael Ellerman
  2009-04-03 15:00   ` Liu Dave-R63238
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Ellerman @ 2009-04-03 10:57 UTC (permalink / raw)
  To: yamazaki seiji; +Cc: linuxppc-dev@ozlabs.org

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

On Fri, 2009-04-03 at 16:51 +0900, yamazaki seiji wrote:
> I set the Interrupt ID number 17.
> But kernel gives the Interrupt ID number 19.
> 
> I wont to know the reasen.
> Please tell me.

It's because the irqs are remapped by the kernel, the number in the
device tree is a hardware irq number. The number you're printing out is
a virtual irq number.

of_irq_to_resource() is doing the remapping for you.

You can turn on CONFIG_VIRQ_DEBUG and you'll get a file in debugfs that
shows the mapping between hardware numbers and virtual numbers.

cheers

-- 
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

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

* Re: Interrupt ID number on mpc8347
  2009-04-03 10:57 ` Michael Ellerman
@ 2009-04-03 15:00   ` Liu Dave-R63238
  0 siblings, 0 replies; 3+ messages in thread
From: Liu Dave-R63238 @ 2009-04-03 15:00 UTC (permalink / raw)
  To: michael, yamazaki seiji; +Cc: linuxppc-dev

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

> It's because the irqs are remapped by the kernel, the number in the
> device tree is a hardware irq number. The number you're printing out is
> a virtual irq number.

> of_irq_to_resource() is doing the remapping for you.

> You can turn on CONFIG_VIRQ_DEBUG and you'll get a file in debugfs that
> shows the mapping between hardware numbers and virtual numbers.

Guys,

I notice many people happened same issue to use the interrupt in powerpc
with DTS.
Could somebody write one documentation for interrupt system on powerpc arch,
 - how to remap irq
 - what is the virq? h/w irq.
 - show the mapping virt->h/w..
etc..
I think if have this docs, it will be helpful.

Thanks, Dave


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

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

end of thread, other threads:[~2009-04-03 15:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-04-03  7:51 Interrupt ID number on mpc8347 yamazaki seiji
2009-04-03 10:57 ` Michael Ellerman
2009-04-03 15:00   ` Liu Dave-R63238

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).