Where do p1011 interrupts show up on Linux?

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

Where do p1011 interrupts show up on Linux?

跳至解决方案
4,066 次查看
calpage
Contributor I

Our hardware connects to pin N25 / IRQ[3] on a P1011 processor chip.

How do I register for this interrupt under linux 2.6?

The code ends up a request_threaded_irq ( 3, ... )

but trips up here:

if (desc->status & IRQ_NOREQUEST) {

      printk("CP #3 fail -EINVAL, desc->status = 0x%08x, IRQ_NOREQUEST = 0x%08x, name = <%s>\n",

     desc->status,
     IRQ_NOREQUEST,
     desc->name);

      return -EINVAL;

    }

Cal Page

标记 (1)
0 项奖励
回复
1 解答
3,233 次查看
scottwood
NXP Employee
NXP Employee

request_irq() takes a Linux virtual IRQ number, not an MPIC IRQ number.  The best way to deal with this is to describe your device in the device tree, and use irq_of_parse_and_map() to get the corresponding Linux virtual IRQ number.  Otherwise, you can use irq_create_mapping().

在原帖中查看解决方案

0 项奖励
回复
3 回复数
3,234 次查看
scottwood
NXP Employee
NXP Employee

request_irq() takes a Linux virtual IRQ number, not an MPIC IRQ number.  The best way to deal with this is to describe your device in the device tree, and use irq_of_parse_and_map() to get the corresponding Linux virtual IRQ number.  Otherwise, you can use irq_create_mapping().

0 项奖励
回复
3,233 次查看
calpage
Contributor I

Ah, irq_create_mapping() !

I am presuming that it's second argument is the interrupt number corresponds to the ones on the p1011 chip. I am trying to pick up interrupt 3, labeled N25 on the chip, so I pass in the three.

Here's a trace of my actions:

arch/powerpc/kernel/irq.c:irq_create_mapping:717:irq: irq_create_mapping(0x(null), 0x3)

arch/powerpc/kernel/irq.c:irq_create_mapping:728:irq: -> using host @cf408000

arch/powerpc/kernel/irq.c:irq_create_mapping:737:irq: -> existing mapping on virq 16

__uio_register_device: registering for interrupt at irq = 3, linux_irq = 16

request_threaded_irq: entry, irq = 16

__uio_register_device: returning 0 (SUCCESS)

virq 16 registered ok.

Is this correct?


0 项奖励
回复
3,233 次查看
scottwood
NXP Employee
NXP Employee

It looks OK, though again the preferred approach is to use the device tree.

0 项奖励
回复