中断理解1

dts的配置

429                         i2c1: i2c@17030000 {                                    
430                                 status = "okay";                                
431                                 pinctrl-names = "default";                      
432                                 pinctrl-0 = <&i2c1_pmx>;                        
433                                 clock-frequency = <400000>;                     
434                                                                                 
435                         /* NOTE: if TP communicate via FPDlinkIII, comment  "atmel_mxt_ts@4a" part
436                         * and uncomment "disp_ser:serializer@0c" part.          
437                         */                                                      
438                         atmel_mxt_ts@4a{                                        
439                                         compatible = "atmel,atmel_mxt_ts";      
440                                         touch-rst-gpios = <&gpio_1 115 1>;      
441                                         interrupt-parent = <&gpio_1>;           
442                                         interrupts = <116 0x02>;                
443                                         reg = <0x4a>;                           
444                                 };  

说明:关于中断的是interrupt-parent和interrupts。
domain=atlas7-gpio-irq

流程

1)of_i2c_register_devices
这是个i2c设备,在i2c控制器进行设备轮询。
2)info.irq = irq_of_parse_and_map
解析这个i2c节点的中断信息。

 37 unsigned int irq_of_parse_and_map(struct device_node *dev, int index)           
 38 {                                                                               
 39         struct of_phandle_args oirq;                                            
 40                                                                                 
 41         /*printk(KERN_ERR "tom %s %s %d \n",__FILE__,__FUNCTION__,__LINE__);*/  
 42         if (of_irq_parse_one(dev, index, &oirq))                                
 43                 return 0;                                                       
 44                                                                                 
 45         /*printk(KERN_ERR "tom %s %s %d \n",__FILE__,__FUNCTION__,__LINE__);*/  
 46         return irq_create_of_mapping(&oirq);                                    
 47 }

3)of_irq_parse_one

290 int of_irq_parse_one(struct device_node *device, int index, struct of_phandle_args *out_irq)                                                                                                             
291 {                                                                               
292         struct device_node *p;                                                  
293         const __be32 *intspec, *tmp, *addr;                                     
294         u32 intsize, intlen;                                                    
295         int i, res;                                                             
296         int len;                                                                
297         int intspec_tmp;                                                        
298                                                                                 
299         pr_debug("of_irq_parse_one: dev=%s, index=%d\n", of_node_full_name(device), index);
300                                                                                 
301         /* OldWorld mac stuff is "special", handle out of line */               
302         if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)                          
303                 return of_irq_parse_oldworld(device, index, out_irq);           
304                                                                                 
305         /* Get the reg property (if any) */                                     
306         addr = of_get_property(device, "reg", NULL);                            
307                                                                                 
308                                                                                 
309         /* Try the new-style interrupts-extended first */                       
310         res = of_parse_phandle_with_args(device, "interrupts-extended",         
311                                         "#interrupt-cells", index, out_irq);    
312         if (!res)                                                               
313                 return of_irq_parse_raw(addr, out_irq);                         
314                                                                                 
315         /* Get the interrupts property */                                       
316         intspec = of_get_property(device, "interrupts", &intlen);               
317         if (intspec == NULL)                                                    
318                 return -EINVAL;                                                 
319                                                                                 
320         intlen /= sizeof(*intspec);                                             
321                                                                                 
322         intspec_tmp=be32_to_cpup(intspec);                                      
323                                                                                 
324         pr_debug(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen);     
325                                                                                 
326                                                                                 
327                                                                                 
328         /* Look for the interrupt parent. */                                    
329         p = of_irq_find_parent(device);                                         
330         if (p == NULL)                                                          
331                 return -EINVAL;                                                 

说明:
提取hw interrupt id,就是116。
parent= gpio_vdifm就是dts.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值