I am trying to build yocto project on beaglebone black. I would like to enable I2C2 port on beagle bone. I am newbie in yocto project. Any pointer or reference document would be helpful.
here is the original file am335x-boneblack-common.dtsi and I would like to modify that file with following content
i2c2_pins: pinmux_i2c2_pins {
pinctrl-single,pins = <0x178 0x73 0x17c 0x73>;
};
user_leds_pins: pinmux_user_leds {
pinctrl-single,pins = < AM33XX_IOPAD(0x848, PIN_OUTPUT | MUX_MODE7) >; /* P9.14, gpio1[18] */
};
and
leds {
compatible = "gpio-leds";
pinctrl-names = "default";
pinctrl-0 = <&user_leds_pins>;
i2c2-live {
gpios = <&gpio1 18 GPIO_ACTIVE_HIGH>;
default-state = "on";
};
};
&i2c2: i2c@4819c000 {
pinctrl-names = "default";
pinctrl-0 = <&i2c2_pins>;
status = "okay";
clock-frequency = <100000>;
tmp75@4d {
compatible = "national,lm75";
reg = <0x4d>;
};
};
Kindly suggest how to create patch for above code.
Thanks in Advance
Regards, Nikhil
At first you need to understand how to deal with your dts
file.
You need to decide whether you want to work with the official dts
file that is provided by your linux kernel and patch it. Or, create your own dts
file and use it instead.
To understand how to patch the dts
or how to add custom one, I have 2 stackoverflow answers for that, here and here.
After you understand that, now lets talk about adding your I2C node.
First, you need to search if your sensor has an official kernel driver.
If it has a driver, then, it has a compatible
name that is defined in it.
You take that name with the sensor address in that I2C bus and:
For example, adding the sensor of address 0x01 to I2C 1 bus:
&i2c1 {
// ...
sensor_name: sensor_name@0x01 {
compatible = "compatible_name";
reg = "0x01";
}
}
Now, you need to activate the flag of the driver in the kernel defconfig
bitbake linux-XXX -c menuconfig
Activate the flag, and:
bitbake linux-XXX -c diffconfig
it will generate .cfg
file containing only the difference.
Take that and add it to your linux recipe:
SRC_URI_append = " file://sensor.cfg"