• 设备树获取地址时碰的钉子


    of_iomap()函数是从设备树获得地址并映射。但我始终获取失败,折腾了两天,终于找到原因,记录下坑位;

    网上说

    #address-cells = <1>;
    #size-cells = <1>;

    是指定其子节点的地址属性,只要子节点用reg =<>,即可。

    但是,这样做并不见得奏效。后来参照了别人的设备树才发现:

    最重要的是:    rangs;   对,是他,少了就不行。

    原设备树:

       leds {
    	#address-cells = <1>;
    	#size-cells = <1>;
            compatible = "pwm-leds";
            led1 {
               	reg = <0x40000320 0x04>;
               	label = "power-led";/*HW control*/
    	   	owner = "hd";
           	 };
           	led2 {
                	reg = <0x40000324 0x04>;
                	label = "sys-led";
    	    	owner = "ps";
            };
           	led3 {
                	reg = <0x40000328 0x04>;
                	label = "link-led";
    	    	owner = "pl";
            };
           	led4 {
                	reg = <0x4000032C 0x04>;
                	label = "act-led";
    	    	owner = "ps";
            };
           	led5 {
                	reg = <0x40000330 0x04>;
                	label = "sync-led";
    	    	owner = "pl";
            };
           	led6 {
                	reg = <0x40000334 0x04>;
                	label = "alarm-led";
    	    	owner = "ps";
            };
    
       };
    



    #address-cells = <1>;
    #size-cells = <1>;
    
    

     

     

     现在正确的设备树:

       leds {
    	#address-cells = <1>;
    	#size-cells = <1>;
            compatible = "pwm-leds";
    	ranges;
            led1 {
               	reg = <0x40000320 0x04>;
               	label = "power-led";/*HW control*/
    	   	owner = "hd";
           	 };
           	led2 {
                	reg = <0x40000324 0x04>;
                	label = "sys-led";
    	    	owner = "ps";
            };
           	led3 {
                	reg = <0x40000328 0x04>;
                	label = "link-led";
    	    	owner = "pl";
            };
           	led4 {
                	reg = <0x4000032C 0x04>;
                	label = "act-led";
    	    	owner = "ps";
            };
           	led5 {
                	reg = <0x40000330 0x04>;
                	label = "sync-led";
    	    	owner = "pl";
            };
           	led6 {
                	reg = <0x40000334 0x04>;
                	label = "alarm-led";
    	    	owner = "ps";
            };
    
       };
    
  • 相关阅读:
    视频播放的基本原理
    MPEG2 PS和TS流格式
    使用java连接hive,并执行hive语句详解
    杭电 3887 Counting Offspring
    java值传递
    android面试题之五
    程序人生:工作、生活、梦想
    HDU4756+Prim
    两分钟让你明白cocos2dx的屏幕适配策略
    Expected authority at index 7: hdfs://
  • 原文地址:https://www.cnblogs.com/xxg1992/p/7444311.html
Copyright © 2020-2023  润新知