mt7688 openwrt dts 文件解释

42 篇文章 2 订阅
4 篇文章 0 订阅

/dts-v1/;

/include/ "mt7628an.dtsi"

/ {                                                                                      //根节点
    compatible = "widora", "mediatek,mt7628an-soc";       //板子
    model = "WIDORA-NEO";                                            //

    chosen {                                                                      //通过dts 内核传给uboot的bootargs参数
        bootargs = "console=ttyS0,115200";                       // 控制台 uart0
    };

    memory@0 {                                                               //memory 节点
        device_type = "memory";                                        //
        reg = <0x0 0x8000000>;                                         //Memory 起始地址 0x00,长度0x8000000
    };

#arch/mips/ralink/mt7620.c

static struct rt2880_pmx_group mt7628an_pinmux_data[]  

    pinctrl {                                                                        //管脚配置,mt7620.c
        state_default: pinctrl0 {                                           //
            gpio {                                                                   //
                ralink,group = "gpio";                                     //
                ralink,function = "gpio";                                  //
            };
            perst {                                                                //
                ralink,group = "perst";                                    //
                ralink,function = "gpio";                                  //
            };
            refclk {                                                               //
                ralink,group = "refclk";                                   //
                ralink,function = "gpio";                                //
            };
            i2s {                                                                 //
                ralink,group = "i2s";                                    //
                ralink,function = "i2s";                                 //
            };
            spis {                                                              //
                ralink,group = "spis";                                 //
                ralink,function = "gpio";                             //
            };
            wled_an {
                ralink,group = "wled_an";
                ralink,function = "wled_an";
            };
            ephy_p1 {
                ralink,group = "ephy_p1";
                ralink,function = "gpio";
            };
            ephy_p2 {
                ralink,group = "ephy_p2";
                ralink,function = "gpio";
            };
            ephy_p3 {
                ralink,group = "ephy_p3";
                ralink,function = "gpio";
            };
            ephy_p4 {
                ralink,group = "ephy_p4";
                ralink,function = "gpio";
            };
            wdt {
                ralink,group = "wdt";
                ralink,function = "gpio";
            };
        };
    };

    palmbus@10000000 {                                          //片内总线,类似arm的amba,0x10000000---0x100000ff  sysctl
        spi@b00 {                                                         //
            status = "okay";                                            //

            pinctrl-names = "default";                             //
            pinctrl-0 = <&spi_pins>, <&spi_cs1_pins>;  //

            m25p80@0 {                                                //0x10000B00--0x10000BFF SPI master
                #address-cells = <1>;                              //
                #size-cells = <1>;                                    //
                compatible = "w25q256";                        //
                reg = <0 0>;                                            //
                linux,modalias = "m25p80", "w25q256"; //
                spi-max-frequency = <40000000>;         //
                m25p,chunked-io = <31>;                       //

                partition@0 {                                           //u-boot分区,第一个分区,偏移地址 0x0
                    label = "u-boot";                                  //u-boot分区
                    reg = <0x0 0x30000>;                        //起始地址0x0,长度 0x30000
                    read-only;                                           //属性,只读
                };

                partition@30000 {                                  //第二分区,u-boot-env 环境变量
                    label = "u-boot-env";                          //u-boot-env 环境变量
                    reg = <0x30000 0x10000>;               //起始地址0x30000,长度 0x10000
                };

                factory: partition@40000 {                     //第三分区,偏移地址 0x40000
                    label = "factory";                                //wifi校准参数
                    reg = <0x40000 0x10000>;               //起始地址0x40000,长度 0x10000
                };

                partition@50000 {                                //第四分区,偏移地址 0x50000
                    label = "firmware";                           //固件程序
                    reg = <0x50000 0x1fb0000>;          //起始地址0x50000,长度 0x1fb0000
                };
            };

            spidev@1 {                                            //第二个spi设备
                #address-cells = <1>;                        //表示地址空间的个数
                #size-cells = <1>;                              //表示地址空间所需的字节数
                compatible = "spidev";                       //static struct platform_driverXXXX_driver 匹配
                reg = <1 0>;                                      //
                spi-max-frequency = <40000000>;   //spi 频率是400K
            };
        };

        i2c@900 {                                                //I2C 寄存器地址范围0x10000900-0x100009FF,看编程手册
            status = "okay";                                   //okay 编译进内核
        };

        uart1@d00 {                                          //UART1=UARTLITE2 寄存器地址范围0x10000d00-0x10000dFF,看编程手册
            status = "okay";                                 //okay 编译进内核
        };

        uart2@e00 {                                         //UART2=UARTLITE3 寄存器地址范围0x10000E00-0x10000EFF,看编程手册
            status = "okay";                                //okay 编译进内核
        };

        pwm@5000 {                                       // PWM 寄存器地址范围0x10005000-0x10005FFF,看编程手册 
            status = "okay";                               //okay 编译进内核
        };
    };

    ethernet@10100000 {                              //ethernet寄存器地址范围0x10100000-0x1010FFFF,看编程手册
        mtd-mac-address = <&factory 0x28>;  //在factory分区的偏移地址0x28 对应是lan mac 地址
    };

    sdhci@10130000 {                                  //SDXC/eMMC 寄存器范围0x10130000-0x10137FFF
        status = "okay";                                   //okay 编译进内核
        mediatek,cd-low;                                 //
    };
        gpio-keys-polled {                                  //

#在目录 /package/kernel/gpio-button-hotplug/src/gpio-button-hotplug.c 匹配platform_xxx结构体的 .name 字段
                compatible = "gpio-keys-polled";   //static struct platform_driverXXXX_driver 匹配
                #address-cells = <1>;                    //
                #size-cells = <0>;                          //
                poll-interval = <20>;                      //查询间隔 20ms
                wps {                                             //wps健
                        label = "reset";                      //
                        gpios = <&gpio1 6 1>;          // gpio1 is GPIO32--GPIO63,WPS=GPIO38 is gpio1 +6,平时为高,即低电平有效
                        linux,code = <0x211>;          //
                };
        };
};

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值