(B)具体各个HW block的interrupt source是若何物理的连接到interruptcontroller的呢?在dts文件中是用interrupt-parent这个属性来标识的。且慢,这里定义interrupt-parent属性的是root node,难道root node会产生中断到interrupt controller吗?当然不会,只不过如不雅一个可以或许产生中断的device node没有定义interrupt-parent的话,其interrupt-parent属性就是跟随parent node。是以,与其在所有的下流设备中定义interrupt-parent,不如同一在root node中定义了。
intc是一个lable,标识了一个device node(在本例中是标识了interrupt-controller@4a000000 这个device node)。实际上,interrupt-parent属性值应当是是一个u32的┞符数值(这个整数值袈溱Device Tree典范围内独一辨认了一个device node,也就是phandle),不过,在dts文件中中,可以应用类似c说话的Labels and References机制。定义一个lable,独一标识一个node或者property,后续可以应用&来引用这个lable。DTC会将lable转换成u32的┞符数值放入到DTB中,用户层面就不再关怀具体转换的┞符数值了。

体系中有一个interrrupt tree的根节点,device1、device2以及PCI host bridge的interrupt line都是连接到root interrupt controller的。PCI host bridge设备中有一些下流的设备,也会产生中断,然则他们的中断都是连接到PCI host bridge上的interrupt controller(术语叫做interrupt nexus),然后申报到root interrupt controller的。每个能产生中断的设备都可以产生一个或者多个interrupt,每个interrupt source(别的一个术语叫做interrupt specifier,描述了interrupt source的信息)都是限制在其所属的interrupt domain中。
在懂得了上述的概念后,我们可以回头再看看interrupt-parent这个属性。其拭魅这个属性是建立interrupt tree的关键属性。它指清楚明了设备树中的各个device node若何路由interrupt event。别的,须要提示的是interrupt controller也是可以级联的,上图中没有表示出来。那么在这种情况下若何定义interrupt tree的root呢?那个没有定义interrupt-parent的interrupt controller就是root。
(C)pinctrl0是一个缩写,他是/pinctrl@56000000的别号。这里同样也是应用了Labels and References机制。
(D)intc(node name是interrupt-controller@4a000000 ,我这里直接应用lable)是描述interrupt controller的device node。根据S3C24xx的datasheet,我们知道interrupt controller的存放器地址大年夜0x4a000000开端,长度为0x100(实际2451的interrupt的存放器地址空间没有那么长,0x4a000074是最后一个存放器),也就是reg属性定义的内容。interrupt-controller属性为空,只是用来标识该node是一个interrupt controller而不是interrupt nexus(interrupt nexus须要在不合的interrupt domains之间进行翻译,须要定义interrupt-map的属性,本文不涉及这部分的内容)。#interrupt-cells 和#address-cells概念是类似的,也就是说,用若干个u32来标识一个interrupt source。我们可以看到,在具体HW block的interrupt定义中都是用了4个u32来表示,例如串口的中断是如许定义的:
- interrupts = <1 0 4 28>, <1 1 4 28>;
“[]”表示option,是以可以定义一个只有node name的空节点。label便利在dts文件中引用,具体后面会描述。child node的格局和node是完全一样的,是以,一个dts文件中就是若干嵌套构成的node,property以及child note、child note property描述。
(E) 大年夜reg属性可以serial controller存放器地址大年夜0x50000000 开端,长度为0x4000。对于一个能产生中断的设备,必须定义interrupts这个属性。也可以定义interrupt-parent这个属性,如不雅不定义,则持续其parent node的interrupt-parent属性。 对于interrupt属性值,各个interrupt controller定义是不一样的,有的用3个u32表示,有的用4个。具体膳绫擎的各个数字的解释权归相干的interrupt controller所有。对于中断属性的具体值的描述我们会在device tree的第三份文档-代码分析中描述。
(F)这个node是描述GPIO控制的。这个节点定义了一个wakeup-interrupt-controller 的子节点,用来描述有唤醒功能的中断源。
3、s3c2416.dtsi。位于linux-3.14\arch\arm\boot\dts目次下,具体该文件的内容如下(有些内容省略了,领会精力即可,不须要描述每一个硬件定义的细节):
- #include "s3c24xx.dtsi"
- #include "s3c2416-pinctrl.dtsi"
- / {
- model = "Samsung S3C2416 SoC";
- compatible = "samsung,s3c2416"; ---------------A
- cpus { ----------------------------B
- #address-cells = <1>;
推荐阅读
结语 【技巧沙龙】AI开辟者拭魅战营-7分钟打造1个定制技能。7月22号,我们等你一路! IT审计就像令人不快的麻烦,然则巨大年夜的价值老是降临到那些存眷这些会弗成避免地导致IT审计灾害的>>>详细阅读
本文标题:Linux Device Tree(二):基本概念
地址:http://www.17bianji.com/lsqh/36323.html
1/2 1

网友点评
精彩导读
科技快报
品牌展示