【问题标题】:Getting information from the device tree and requesting irq从设备树中获取信息并请求 irq
【发布时间】:2018-07-17 20:32:50
【问题描述】:

上下文

在我使用的设备树中,在它的一个节点中,interrupts 是:

interrupts = <0x0 0x1d 0x4>;

(来自 Pynq 板的设备树,配备具有双核 ARM A9 的 ZYnq 设备)

现在,在设备树.probe 函数中,我使用Linux 内核API:

irq_line = platform_get_irq(pdev, 0);

为了让 irq 用于函数 request_irq(在 ldd3 第 10 章中描述)。

执行irq_line = platform_get_irq(pdev, 0); 时,我得到的值0x2e 与设备树的interrupts 的字段不匹配。

问题

  1. &lt;0x0 0x1d 0x4&gt; 数字到底是什么?我知道,根据elinux.org,:

interrupts - 设备节点的属性,包含一系列中断说明符,设备上的每个中断输出信号对应一个。

  1. 我怎样才能使用 irq 行(可能从这些数字开始)? irq line是否与设备树相关?

  2. 为什么我得到的值与 interrupts 的任何字段都不匹配?

我确定我误解了一些重要的话题,对不起。感谢您阅读问题并分享您的知识。

【问题讨论】:

    标签: linux-kernel kernel linux-device-driver platform device-tree


    【解决方案1】:

    数字究竟是什么?我知道,根据 到 elinux.org,(中断 = ;)

    首先你需要查看设备节点的interrupt-parent,这个父节点将#interrupt-cells属性specifies number of bits needed to encode a interrupt source,所以从你的入口处中断= ;意思如下:

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

    我怎样才能使用 irq 行(可能从这些数字开始)? irq线和设备树有关系吗?

    为什么我得到的值与任何一个字段都不匹配 中断次数?

    答案很好here 也可以参考this

    【讨论】:

    • 感谢您的回答!你知道为什么我得到 0x2e 而不是 0x1d 吗?
    • 这是因为 platform_get_irq() 返回 Linux IRQ 编号,而不是实际的硬件编号。当您有两个可用的中断控制器(即两个 irq_chip )(例如 GIC 和 GPIO IC)时,需要进行映射。为了解决这个问题,Linux 内核提出了 IRQ 域的概念,它是硬件 IRQ 编号和内核内部使用的 IRQ 编号之间定义明确的转换接口。因此,GIC 驱动程序会在 init 上创建其 IRQ 域及其翻译。 kernel.org/doc/Documentation/IRQ-domain.txt
    • 添加到答案中!!这个周末我去看看
    猜你喜欢
    • 2016-01-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-23
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多