How do I set-up i2c node in dts file?


#1

Hi,
I’m using Hikey board.

How do I set-up i2c in dts?
I’d like use I2C0 and connect slave device.
Please some one explain in dts, it is correct under the text?

arch/arm64/boot/dts/hisilicon/hi6220-hikey.dts

soc {
i2c0: i2c@f7100000 {
#address-cells = <0x1>;
#size-cells = <0x0>;
status = “ok”;
touch@27{
compatible = "hisilicon,touch
reg = <0x27>;
touch,ven-gpio = <&gpio2 0 0>
touch,firm-gpio = <&gpio2 2 0
touch,irq-gpio = <&gpio2 4 0>
};
};


#2

You can use whatever i2c you want to use based on the connection that u have.

Just add your slave node under the i2c(whatever the i2c that u want).

it will work.


#3

You can use i2c0 or i2c1 as they are exposed in the low-speed expansion header.

Just add your node under one of them.

The node that you specified in your question seems ok to me


#4

Problem was dtb file.
I’m using kernel 4.9 but I used kernel 4.4 format. Becasuse of that i2c node wasn’t created.
After modified to 4.9 format, I2c node was created.
Thank you very much.