系统相关
首页 > 系统相关> > Hamster Linux I2C总线适配

Hamster Linux I2C总线适配

作者:互联网

Hamster Linux I2C总线适配

适配过程如下

修改 arch/arm/boot/dts/suniv-f1c100s.dtsi

1. 添加ccu头文件
#include <dt-bindings/clock/suniv-ccu-f1c100s.h>
#include <dt-bindings/reset/suniv-ccu-f1c100s.h>
2. 在soc节点下添加如下节点
                i2c0: i2c@1c27000 {
                        compatible = "allwinner,sun4i-a10-i2c";
                        reg = <0x01C27000 0x1000>;
                        interrupts  = <7>;
                        clocks = <&ccu CLK_BUS_I2C0>, <&ccu CLK_BUS_I2C0>;
                        clock-names = "ahb", "mod";
                        resets = <&ccu RST_BUS_I2C0>;
                        status = "disabled";
                        #address-cells = <1>;
                        #size-cells = <0>;
                };
3. 在pio节点下添加如下引脚组
                        i2c0_pe_pins: i2c0-pe-pins {
                                pins = "PE11", "PE12";
                                function = "i2c0";
                        };

修改 arch/arm/boot/dts/suniv-f1c100s-licheepi-nano.dts

  1. 修改aliases节点,添加i2c节点别名
        aliases {
                serial0 = &uart0;
                //serial1 = &uart1;
                i2c0 = &i2c0;
                spi0 = &spi0;
                spi1 = &spi1;
        };
  1. 引用i2c节点
&i2c0 {
        pinctl-names = "default";
        pinctrl-0 = <&i2c0_pe_pins>;
        status = "okay";
        i2c-max-frequency = <400000>;
};

确认内核开启i2c支持

重新编译后,设备节点 /dev/i2c-0 已经注册

标签:i2c,适配,dts,Hamster,pins,I2C,i2c0,节点
来源: https://www.cnblogs.com/hfwz/p/16069992.html