Hello Guys,
I want to enable I2C Module for Unielec - u7621-06 development kit for RTC communication.
My kernel version is 4.4.198.
In mt7621.dtsi file I see below code,
i2c@0 {
compatible = "i2c-gpio";
gpios = <&gpio0 3 1>, <&gpio0 4 1>;
i2c-gpio,delay-us = <3>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c_pins>;
};
and in my device specific dts file below code is available..
&pinctrl {
state_default: pinctrl0 {
gpio {
mtk,group = "i2c";
mtk,function = "gpio";
};
uart2 {
mtk,group = "uart2";
mtk,function = "uart2";
};
uart3 {
mtk,group = "uart3";
mtk,function = "uart3";
};
};
};
When I build above kernel, I cannot see i2c driver in the kernel boot log.
I also tried by adding below code in device specific dts, but I received device tree error during building
&i2c {
status = "okay";
};
I also check in kernel config file...
CONFIG_I2C=y and CONFIG_I2C_MT7621=y
Can you guys help me to sort out this problem?
Thanks,
Hello,
I enable below in menu config then I will see below kernel log. I see some error in that.
Kernel log..
root@LEDE:/# dmesg | grep i2c
[ 30.670378] i2c /dev entries driver
[ 30.676775] mtkmips-pinmux pinctrl: pin io3 already requested by pinctrl; cannot claim for 1e000000.palmbus:i2c@0
[ 30.687102] mtkmips-pinmux pinctrl: pin-3 (1e000000.palmbus:i2c@0) status -22
[ 30.694423] mtkmips-pinmux pinctrl: could not request pin 3 (io3) from group i2c on device rt2880-pinmux
[ 30.704173] i2c-gpio 1e000000.palmbus:i2c@0: Error applying setting, reverse things back
[ 30.712939] i2c-gpio 1e000000.palmbus:i2c@0: using pins 3 (SDA) and 4 (SCL)
Can you guys please tell me is I2C Configure correctly or not?
Thanks
Please consider switching to the current OpenWrt version first.
1 Like
Hello @AndrewZ
Thank you for your response.
I should develop all logic in the same above version.
Can you please help me out on this error?
Thank You
I have no experience with the version you're using.
If you use the hardware i2c engine, that is on pins 3 and 4, then you must not configure your pins as GPIO but as i2c. Since this is the default, remove the lines:
gpio {
mtk,group = "i2c";
mtk,function = "gpio";
};
from your DTS.
NB: This is for the current version of OpenWrt, I have absolutely no idea about your fork or ancient release.
1 Like
Dear @andyboeh
Thank you for your response.
I convert it to i2c as show in below.
Still, I get below log.
root@LEDE:~# dmesg | grep i2c
[ 28.678392] i2c /dev entries driver
[ 28.687026] mtkmips-pinmux pinctrl: pin io3 already requested by pinctrl; cannot claim for 1e000000.palmbus:i2c@0
[ 28.697452] mtkmips-pinmux pinctrl: pin-3 (1e000000.palmbus:i2c@0) status -22
[ 28.704709] mtkmips-pinmux pinctrl: could not request pin 3 (io3) from group i2c on device rt2880-pinmux
[ 28.714335] i2c-gpio 1e000000.palmbus:i2c@0: Error applying setting, reverse things back
[ 28.723407] i2c-gpio 1e000000.palmbus:i2c@0: using pins 3 (SDA) and 4 (SCL)
Moreover, I also enable below config. is there any problem of below config?
Waiting for your helpful response.
Thank You
milavsoni:
Still, I get below log.
Something else has already requested io3, so it's not available for the i2c driver.
I repeat myself and @AndrewZ here: Upgrade to the current codebase, I have zero knowledge about your version.
1 Like
I think that something wrong here:
milavsoni:
i2c@0 {
compatible = "i2c-gpio";
gpios = <&gpio0 3 1>, <&gpio0 4 1>;
i2c-gpio,delay-us = <3>;
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
pinctrl-names = "default";
pinctrl-0 = <&i2c_pins>;
};
If you want to use software i2c-gpio
driver (instead of mediatek i2c-driver) you must remove these lines:
pinctrl-names = "default";
pinctrl-0 = <&i2c_pins>;
which implicitly request i2c
mode for i2c_pins
group and conflict with your explicit request for the same group to gpio
mode:
gpio {
mtk,group = "i2c";
mtk,function = "gpio";
};
1 Like
system
Closed
August 11, 2023, 10:20am
10
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.