文章目录
VIC domain 与 gpio domain 的硬件拓扑图描述 linux cascaded irq domain linux irq domain 实例 VIC domain 与 gpio domain 的硬件拓扑语言描述 VIC 与 INT_EINTx 的关系 INT_EINTx 与 GPIO的关系 INT_EINT0 INT_EINT1 INT_EINT2 INT_EINT3 INT_EINT4 INT_EINT4 与 External interrupt Group1-9 的关系 External interrupt Group1 External interrupt Group2 External interrupt Group3 External interrupt Group4 External interrupt Group5 External interrupt Group6 External interrupt Group7 External interrupt Group8 External interrupt Group9
VIC domain 与 gpio domain 的硬件拓扑图描述
以下是 s3c6410a 的 irq domain 描述, 着重凸显了 gpio irq domain
以下 每个颜色 是一个irq domain , 共 8 个irq domain
linux cascaded irq domain
irq domain & 级联(cascaded)irq domain
if ( parent_irq) {
irq_set_chained_handler ( parent_irq, gpio_handle_irq_cascaded, v) ;
}
一旦发生硬件中断,经过CPU architecture相关的中断代码之后,会调用irq handler,该函数的一般过程如下:
(1 )首先找到root interrupt controller对应的irq domain。
(2 )根据HW 寄存器信息和irq domain信息获取HW interrupt ID
(3 )调用irq_find_mapping找到HW interrupt ID对应的irq number
(4 )调用handle_IRQ(对于ARM平台)来处理该irq number
按照当前 gpio 级联到 vic
假设 vic0 是 A, GPN0- 3 的domain 是 B
假设 GPN0 发生了中断
A. 1 首先找到root interrupt controller ( 在这里是vic) 对应的irq domain
A. 2 根据VIC HW 寄存器信息和irq domain信息获取HW interrupt ID
A. 3 调用irq_find_mapping找到HW interrupt ID ( 在这里是0 ) 对应的irq number
A. 4 调用irq domain B 注册 的 handler ( irq_set_chained_handler 设定的gpio_handle_irq_cascaded)
B. 1 gpio_handle_irq_cascaded找到gpio对应的irq domain
B. 2 根据GPIO HW 寄存器信息和irq domain信息获取HW interrupt ID
B. 3 调用irq_find_mapping找到HW interrupt ID对应的irq number
B. 4 调用 驱动 注册 的 handler ( request_irq 设定的)
linux irq domain 实例
irq: Added domain : soc: interrupt- controller@71200000
irq: Added domain : soc: interrupt- controller@71300000
irq: Added domain : soc: pinctrl@7f 008000 : gpa
irq: Added domain : soc: pinctrl@7f 008000 : gpb
irq: Added domain : soc: pinctrl@7f 008000 : gpc
irq: Added domain : soc: pinctrl@7f 008000 : gpd
irq: Added domain : soc: pinctrl@7f 008000 : gpf
irq: Added domain : soc: pinctrl@7f 008000 : gpg
irq: Added domain : soc: pinctrl@7f 008000 : gph
irq: Added domain : soc: pinctrl@7f 008000 : gpo
irq: Added domain : soc: pinctrl@7f 008000 : gpp
irq: Added domain : soc: pinctrl@7f 008000 : gpq
irq: Added domain : soc: pinctrl@7f 008000 : gpl
irq: Added domain : soc: pinctrl@7f 008000 : gpm
irq: Added domain : soc: pinctrl@7f 008000 : gpn
irq: Added domain : soc: pinctrl@7f 008000 : gpn
irq: -> using domain @c0889d80
SUD File: kernel/ irq/ irqdomain. c, Line: 00557 : irq_domain_associate, domain: c0889d80, virq: 33 , hwirq: 7
SUD File: kernel/ irq/ irqdomain. c, Line: 00559 : irq_domain_associate, c024afa8
SUD File: kernel/ irq/ irqdomain. c, Line: 00499 : irq_domain_set_mapping, 7 , 16
irq: irq 7 on domain gpn mapped to virtual irq 33
s3c64xx_eint_eint0_init
for ( i = 0 ; i < NUM_EINT0_IRQ; ++ i) {
irq = irq_of_parse_and_map ( eint0_np, i) ;
irq_set_chained_handler_and_data ( irq, s3c64xx_eint0_handlers[ i] , data) ;
}
for ( i = 0 ; i < d-> nr_banks; ++ i, ++ bank) {
bank-> irq_domain = irq_domain_add_linear ( bank-> of_node, nr_eints, & s3c64xx_eint0_irqd_ops, ddata) ;
}
使用domain 映射号码
irq_create_mapping
VIC domain 与 gpio domain 的硬件拓扑语言描述
VIC 与 INT_EINTx 的关系
Int. No. Sources Description Group 53 INT_EINT4 External interrupt Group 1 ~ Group 9 VIC1 33 INT_EINT3 External interrupt Group 0 20 ~ 27 VIC1 32 INT_EINT2 External interrupt Group 0 12 ~ 19 VIC1 1 INT_EINT1 External interrupt Group 0 4 ~ 11 VIC0 0 INT_EINT0 External interrupt Group 0 0 ~ 3 VIC0
INT_EINTx 与 GPIO的关系
INT_EINT0
External interrupt Group 0 0 - 15 <= == > GPN0- GPN15
GPN0- 3 : 0
GPN4- 11 : 1
GPN12- 15 & GPL8- GPL11 : 32
External interrupt Group 0 16 - 22 <= == > GPL8- GPL14
GPL12- GPL14 & GPM0- GPM4 : 33
External interrupt Group 0 23 - 27 <= == > GPM0- GPM4
INT_EINT1
External interrupt Group 0 0 - 15 <= == > GPN0- GPN15
External interrupt Group 0 16 - 22 <= == > GPL8- GPL14
External interrupt Group 0 23 - 27 <= == > GPM0- GPM4
INT_EINT2
External interrupt Group 0 0 - 15 <= == > GPN0- GPN15
External interrupt Group 0 16 - 22 <= == > GPL8- GPL14
External interrupt Group 0 23 - 27 <= == > GPM0- GPM4
INT_EINT3
External interrupt Group 0 0 - 15 <= == > GPN0- GPN15
External interrupt Group 0 16 - 22 <= == > GPL8- GPL14
External interrupt Group 0 23 - 27 <= == > GPM0- GPM4
INT_EINT4
INT_EINT4 与 External interrupt Group1-9 的关系
External interrupt Group1
EINT1 0 - 7 <= == > GPA 0 - 7
EINT1 8 - 14 <= == > GPB 0 - 6
External interrupt Group2
EINT2 0 - 7 <= == > GPC 0 - 7
External interrupt Group3
EINT3 0 - 4 <= == > GPD 0 - 4
External interrupt Group4
EINT4 0 - 13 <= == > GPF 0 - 13
External interrupt Group5
EINT5 0 - 6 <= == > GPG 0 - 6
External interrupt Group6
EINT6 0 - 9 <= == > GPH 0 - 9
External interrupt Group7
EINT7 0 - 15 <= == > GPO 0 - 7
External interrupt Group8
EINT8 0 - 14 <= == > GPP 0 - 7
External interrupt Group9
EINT9 0 - 8 <= == > GPQ 0 - 8