cancel
Showing results for 
Search instead for 
Did you mean: 

Enable I2C on STM32MP257f-dk

BarthYer
Associate

Hello,

I'm working with the STM32MP257F-DK using the Yocto Project, and I'm trying to enable I2C in my custom Device Tree.
However, I’m facing an issue where the I2C controllers remain stuck because of power-domain pending states.

Here is the relevant dmesg output showing the problem:

BarthYer_0-1763338932999.png

It looks like the D1 power domain never reaches sync_state(), which prevents the I2C drivers from probing correctly.
I suspect a configuration issue in the power-domain hierarchy or in my SoC/board Device Tree, but I haven’t found the root cause yet.

Could someone help me understand what is missing to properly enable the I2C controllers and bring the D1 power domain out of the pending state?

Thanks in advance for your support.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Duc
Senior

Hi @BarthYer ,

Enabling I2C in the device tree (dts) is correct, but that alone isn’t sufficient. You also need to enable the I2C driver in the .config file, since it is disabled by default.

Specifically, set:

CONFIG_I2C_STM32F7=y

Even though you’re working with STM32MP2, the configuration option is labeled STM32F7. This is still the right choice. If you check the source at linux/drivers/i2c/busses/i2c-stm32f7.c in the v6.6-stm32mp branch of STMicroelectronics’ Linux repository, you’ll see:

static const struct of_device_id stm32f7_i2c_match[] = {
    { .compatible = "st,stm32f7-i2c",   .data = &stm32f7_setup },
    { .compatible = "st,stm32mp15-i2c", .data = &stm32mp15_setup },
    { .compatible = "st,stm32mp13-i2c", .data = &stm32mp13_setup },
    { .compatible = "st,stm32mp25-i2c", .data = &stm32mp25_setup },
    {},};

This confirms that using CONFIG_I2C_STM32F7=y is the correct way to enable I2C support on STM32MP2.

 

View solution in original post

3 REPLIES 3
Duc
Senior

Hi @BarthYer ,

Enabling I2C in the device tree (dts) is correct, but that alone isn’t sufficient. You also need to enable the I2C driver in the .config file, since it is disabled by default.

Specifically, set:

CONFIG_I2C_STM32F7=y

Even though you’re working with STM32MP2, the configuration option is labeled STM32F7. This is still the right choice. If you check the source at linux/drivers/i2c/busses/i2c-stm32f7.c in the v6.6-stm32mp branch of STMicroelectronics’ Linux repository, you’ll see:

static const struct of_device_id stm32f7_i2c_match[] = {
    { .compatible = "st,stm32f7-i2c",   .data = &stm32f7_setup },
    { .compatible = "st,stm32mp15-i2c", .data = &stm32mp15_setup },
    { .compatible = "st,stm32mp13-i2c", .data = &stm32mp13_setup },
    { .compatible = "st,stm32mp25-i2c", .data = &stm32mp25_setup },
    {},};

This confirms that using CONFIG_I2C_STM32F7=y is the correct way to enable I2C support on STM32MP2.

 

Hello @Duc ,

Thank you for your response.

I tried enabling it in the configuration file, but it still doesn’t work. I would like to enable it using my custom Device Tree instead.

Here is the relevant dmesg output showing the power-domain pending states.

root@stm32mp2:~# dmesg | grep i2c
[ 0.281228] /soc@0/bus@42080000/audio-controller@400b0000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 0.298683] /soc@0/bus@42080000/i2c@40130000/camera@1a: Fixed dependency cycle(s) with /soc@0/bus@42080000/csi@48020000
[ 0.309435] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/audio-controller@400b0000
[ 0.321240] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/dsi@48000000
[ 0.364726] /soc@0/bus@42080000/csi@48020000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/camera@1a
[ 0.386389] /soc@0/bus@42080000/dsi@48000000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 0.429089] /soc@0/bus@42080000/audio-controller@400b0000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 0.450863] /soc@0/bus@42080000/i2c@40130000/camera@1a: Fixed dependency cycle(s) with /soc@0/bus@42080000/csi@48020000
[ 0.461610] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/audio-controller@400b0000
[ 0.473417] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/dsi@48000000
[ 0.516910] /soc@0/bus@42080000/csi@48020000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/camera@1a
[ 0.538549] /soc@0/bus@42080000/dsi@48000000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 0.570608] /soc@0/bus@42080000/audio-controller@400b0000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 0.593522] /soc@0/bus@42080000/i2c@40130000: Fixed dependency cycle(s) with /soc@0/clock-controller@44200000
[ 0.602962] /soc@0/bus@42080000/i2c@40130000/camera@1a: Fixed dependency cycle(s) with /soc@0/bus@42080000/csi@48020000
[ 0.613774] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/audio-controller@400b0000
[ 0.625640] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/dsi@48000000
[ 0.659052] /soc@0/bus@42080000/i2c@40130000/camera@1a: Fixed dependency cycle(s) with /soc@0/bus@42080000/csi@48020000
[ 0.679986] /soc@0/bus@42080000/csi@48020000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/camera@1a
[ 0.722688] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /soc@0/bus@42080000/dsi@48000000
[ 0.733389] /soc@0/bus@42080000/dsi@48000000: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 0.787003] /soc@0/bus@42080000/i2c@40130000: Fixed dependency cycle(s) with /soc@0/clock-controller@44200000
[ 0.821260] /ahb@1/i2c@2/typec@35/connector: Fixed dependency cycle(s) with /soc@0/bus@42080000/usb@48300000/usb@48300000
[ 0.829353] /ahb@1/i2c@2/typec@35/connector: Fixed dependency cycle(s) with /soc@0/bus@42080000/usb@48300000/usb@48300000
[ 0.878013] /soc@0/bus@42080000/i2c@40130000/hdmi@3d: Fixed dependency cycle(s) with /connector
[ 0.886332] /connector: Fixed dependency cycle(s) with /soc@0/bus@42080000/i2c@40130000/hdmi@3d
[ 1.469779] i2c_dev: i2c /dev entries driver
[ 12.254738] stm32mp_pm_domain power-domain-d1: sync_state() pending due to 40130000.i2c
root@stm32mp2:~#

Thanks in advance for your support.

Hi @BarthYer ,

I’m not entirely sure whether your current approach is correct. However, as someone who also uses the STM32MP257F-DK, works with the Yocto Project, and deals with I²C and who has encountered the power-domain pending warnings before I can confirm that after enabling the driver I shared, I was able to bring up I²C successfully. It now works perfectly with my MPU6050. If you still believe the issue is related to the power-domain pending states, feel free to continue investigating along that path.