Jump to content

Setting i2c speed - dtc error


chowderhead

Recommended Posts

4.14.65-sunxi on an Orange Pi Zero. Trying to set the i2c bus speed to 400kHz using the following dts:

 

/dts-v1/;
/plugin/;

/ {
        compatible = "allwinner,sun8i-h3";

        fragment@0 {
                target = <&i2c0>;
                __overlay__ {
                        clock-frequency = <400000>;
                };
        };
};

Which produces:

 

Error: dtc does not support compiling overlays
Please try to install matching kernel headers

Installed linux-headers-next-sunxi and still getting the same thing. Device tree compiler version: DTC 1.4.2.

 

What am I doing wrong?

Spoiler

 

 

Link to comment
Share on other sites

Thanks ag123 - the link to the other post did the trick. Didn't need to try the other dtc compiler.

 

In case someone else is doing the same thing:

 

Decompile the dtb in /boot/dtb. In the case of the Orange Pi Zero, it's sun8i-h2-plus-orangepi-zero.dtb:

dtc -I dtb -O dts sun8i-h2-plus-orangepi-zero.dtb -o sun8i-h2-plus-orangepi-zero.dts

The original dtb had no clock frequency entries for any of the i2c buses: i2c0 (i2c@01c2ac00), i2c1 (i2c@01c2b000) and i2c2 (i2c@01c2b400). Add a line to the i2c@01c2b000 (i2c) section (or whichever bus you're wishing to change):

 clock-frequency = <0x61A80>; 

Recompile the dts:

dtc -I dts -O dtb sun8i-h2-plus-orangepi-zero.dts -o sun8i-h2-plus-orangepi-zero.dtb

Reboot.

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines