How to fix i2c dev/node name mapping


I am working on OpenEmbedded Linux project (Yocto BSP). I am using Apalis iMX8QXP 2GB WB IT - V1.1B.

I am facing an issue regarding I2C dev-node name mapping, please refer to image at below:


I realized that mapping of left and right may not be the same again after re-imaging.

For example, i2c-20 map with 58226000.i2c, and after re-image (via recover mode), and the mapping is different, (i2c-20 map with 56246000.i2c).

I wish to fix the mapping for my image, is it need to do something in device tree ?
Please teach me the method in details. Thanks.

Or any workaround, for example , do mapping manually during my application start ?

Hello @gustavo.tx , @alex.tx ,
Do you have any idea regarding this ?
Or you know anyone good in this ?
Thank you.


Are your I2C’s listed in DT aliases section?
ls /sys/firmware/devicetree/base/aliases

If not then try enumerating them there.


Hi @Edward

Thanks for your reply.
Please refer to below:
these are the result after typing :

i2cdetect -l
ls /sys/firmware/devicetree/base/aliases

The reason why I wish to make the mapping of dev/node name as a constant, is because during C/C++ coding implementation :

We use “/dev/i2c-%d” to identify the i2c pin, for example “dev/i2c-20”.

And “dev/i2c-20” is not always map with i258226000.i2c after reimaging, and this cause some problem to me. Please teach me how should I handle this in details, thank you very much !

Devices listed in DT aliases section usually match with /dev/xxxN device numbers. They same with i2cdetect or devices listed in /sys/bus/i2c/devices/.

In device tree imx8qxp.dtsi has this
i2c1 = &i2c_rpbus_1;
i2c5 = &i2c_rpbus_5;
i2c12 = &i2c_rpbus_12;
i2c13 = &i2c_rpbus_13;
i2c14 = &i2c_rpbus_14;
i2c15 = &i2c_rpbus_15;

and your listed devices, which seem to be defined in imx8-ss-dma.dtsi as i2c0, i2c1, i2c2, etc are not referenced from aliases section. That’s why it could be random.


You are likely looking for something like the following already implemented in BSP 5.x: