0

Context

In the device tree I am using, in one of its node, the filed interrupts is:

interrupts = <0x0 0x1d 0x4>;

(from a device tree of a Pynq board, equipaged with a ZYnq device with a dual-core ARM A9 )

Now, in the device tree .probe function, I use the Linux kernel API:

irq_line = platform_get_irq(pdev, 0);

in order to get the irq to use for the function request_irq (described in ldd3 chapter 10).

Ones the irq_line = platform_get_irq(pdev, 0); is executed, I get the value 0x2e that DOESN'T match with the fields of the interrupts of the device tree.

Questions

  1. What are exactly the <0x0 0x1d 0x4> numbers? I know that, in according to elinux.org,:

interrupts - A property of a device node containing a list of interrupt specifiers, one for each interrupt output signal on the device.

  1. How can I get the irq line to use (maybe starting from these numbers)? Is the irq line related to the device tree?

  2. Why am I getting a value that doesn't match with no one of the fields of interrupts?

I am sure I am misunderstanding some important topics, I am sorry. And thank you for reading the question and sharing your knowledge.

Leos313
  • 5,152
  • 6
  • 40
  • 69

1 Answers1

1

What are exactly the <0x0 0x1d 0x4> numbers? I know that, in according to elinux.org, (interrupts = <0x0 0x1d 0x4>;)

Firstly you need to look at the interrupt-parent of the device node, this parent will #interrupt-cells property which specifies number of bits needed to encode a interrupt source, so from your entry interrupts = <0x0 0x1d 0x4>; means the following:

0x0  = shared processor interrupts
0x1d = interrupt number
0x4  = active high level-sensitive/[IRQ_TYPE_LEVEL_HIGH][2] 

How can I get the irq line to use (maybe starting from these numbers)? Is the irq line related to the device tree?

Why am I getting a value that doesn't match with no one of the fields of interrupts?

Its well answered here also refer this.

Prabhakar Lad
  • 1,248
  • 1
  • 8
  • 12
  • Thank you for answering! Do you have an idea why I am getting 0x2e instead of 0x1d? – Leos313 Feb 08 '18 at 07:13
  • 2
    That is because platform_get_irq() returns Linux IRQ numbers, and not the actual hardware number. A mapping is needed when you have two interrupt controllers, i.e. two irq_chip , are available (e.g. GIC and GPIO IC). To solve this problem, the Linux kernel came up with the notion of an IRQ domain which is a well-defined translation interface between hardware IRQ numbers and the one used internally in the kernel. GIC driver therefore creates its IRQ domain and its translation on init. https://www.kernel.org/doc/Documentation/IRQ-domain.txt – Prabhakar Lad Feb 08 '18 at 09:39
  • Add it on the answer!! I will have a look on it this weekend – Leos313 Feb 08 '18 at 10:24