MT7621 and I2C kmod- package

Hello !

I using custom board based on Hilink HLK-7621A (HiLink HLK-7621A evaluation board) module.

I build OpenWrt (OpenWrt SNAPSHOT r18810-923cc869a6).
I change mt7621_hilink_hlk-7621a-evb.dts file and add to end:

&i2c {
    status = "okay";
    clock-frequency = <100000>;
};

Image boot and works fine.
But, i cannot find I2C driver kernel module package - kmod-i2c-? (what package name ?).
In make menuconfig ( Kernel modules -> I2C support ) i can't find menu item with this driver.

In make kernel_menuconfig i check Device drivers -> I2C support -> I2C Hardware Bus support -> MT7621/MT7628 I2C Controller
Module i2c-mt7621.ko is created. I manually copy it to working board, i may modprobe it, and it works fine.

But, kmod-i2c- for 7621 SoC is not created and not present in resulting image.

My questons:
1. What name of package with i2c driver ?
2. What select in make [kernel_]menuconfig ?

If you added the &i2c "status = okay" like you did, it will load automatically during boot.
The I2C driver is selected by default (see the config-5.10 or 5.15 files in openwrt/target/linux/ramips/mt7621). CONFIG_I2C=y and CONFIG_I2C_MT7621=y

I added the exact lines to my own dts file (xiaomi 4a gigabit edition) which is pointless but should load the driver anyway and it does.

root@Xiaomi:~# dmesg | grep "i2c"
[    1.638281] i2c_dev: i2c /dev entries driver
[    1.643427] i2c-mt7621 1e000900.i2c: clock 100 kHz
root@Xiaomi:~# 

I compiled my own image
I can't find driver in image and after reboot ( i test it with tftpboot / bootm ):

root@OpenWrt:/ #ls -l /lib/modules/5.10.100/i2c*
-rw-r--r--    1 root     root         12148 Feb 16  2022 /lib/modules/5.10.100/i2c-algo-bit.ko
-rw-r--r--    1 root     root         49536 Feb 16  2022 /lib/modules/5.10.100/i2c-core.ko
-rw-r--r--    1 root     root         10564 Feb 16  2022 /lib/modules/5.10.100/i2c-dev.ko
-rw-r--r--    1 root     root          4320 Feb 16  2022 /lib/modules/5.10.100/i2c-smbus.ko
sadmitry@infinity:~/openwrt/hlk_7621_latest$ grep I2C target/linux/ramips/mt7621/config-5.10 
CONFIG_I2C=m
CONFIG_I2C_ALGOBIT=m
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_CHARDEV=m
CONFIG_I2C_DEBUG_ALGO=y
CONFIG_I2C_DEBUG_BUS=y
CONFIG_I2C_DEBUG_CORE=y
CONFIG_I2C_MT7621=m
CONFIG_I2C_SMBUS=m
CONFIG_I2C_STUB=m
CONFIG_REGMAP_I2C=m
CONFIG_RTC_I2C_AND_SPI=m

In OpenWrt root:

sadmitry@infinity:~/openwrt/hlk_7621_latest$ grep -i i2c .config | grep -v '^#'
CONFIG_DEFAULT_kmod-i2c-mt7628=y
CONFIG_PACKAGE_kmod-i2c-algo-bit=y
CONFIG_PACKAGE_kmod-i2c-core=y
CONFIG_PACKAGE_kmod-i2c-smbus=y
CONFIG_PACKAGE_kmod-regmap-i2c=y
CONFIG_PACKAGE_libi2c=y
CONFIG_PACKAGE_i2c-tools=y

I can't find kmod-i2c-mt7621 in make menuconfig.
but i find kmod-i2c-mt7628.
I add it in file: target/linux/ramips/image/mt7621.mk
DEVICE_PACKAGES += kmod-mt76x2 kmod-usb3 kmod-i2c-mt7628

And it doesn't show up in the boot log? That seems very strange to me.

Edit:

I tried building it like a module and it doesn't load and/or doesn't show up under modules. Building it "build-in" works just fine.

Is there any reason why you need it as a module? For testing you need to be able to unload it? In that case, adding it manually as .ko file during the testing should not be such a big deal, right?

I compiled in driver in kernel and it works fine.

Is there any reason why you need it as a module? For testing you need to be able to unload it?
Yes.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.