Skip to content

Conversation

tremmet
Copy link
Contributor

@tremmet tremmet commented Aug 12, 2024

We are noticing boot lock ups in the past 3 or 4 NXP kernel releases on some of our i.MX8M boards. The hang is always related to our i2c RTC.

We figured out that the lock and mutex handing is done incorrect in the i2c-imx driver.
The issues where already resolved upstream but it seems that due not properly solved rebase conflicts in the past they have been reintroduced again.

Please see the commit messages of the patches for more detailed information. We would appreciate if the issues are being resolved in future so that we do not have to apply the patches for every release.

Like other i2c controllers we see deadlock issues with clock
prepare mutex. I our case this came up with a clock output of a rtc
connected to i2c bus.

This issue has already been fixed upstream by:
(d9a22d7) i2c: imx: avoid taking clk_prepare mutex in PM callbacks

But was reintroduced by a wrongly resolved merge conflict with this commit:
(66c0769) MLK-11403: I2C: imx: restore pin setting for i2c

So again we keep the i2c clock prepared and only enable and disable it for
a transfer.

Signed-off-by: Teresa Remmet <[email protected]>
As clk_get_rate() also keeps the clk prepare lock which
can lead into a deadlock. It was removed upstream with this commit:
(90ad2cb) i2c: imx: use clk notifier for rate changes

But it has been readded again with:
(0e94d44) MLK-20368 i2c-imx: Coverity: fix divide by zero warning

The commit meassage does not explain why it was readded. It is not needed
as the clk notifier is used. Removed it again.

Signed-off-by: Teresa Remmet <[email protected]>
@tapioreijonen
Copy link

We also have detected dedlock during kernel boot when the clk driver start to disable unsed clocks.
The dedlock always seams to be in i2c_imx_start function, where i2c_imx_set_clk(i2c_imx, clk_get_rate(i2c_imx->clk)); was called.
Not yet know the whole call tree of the tasks which cause the problem, but I try ti investigate this more.
When I very fast test modifications of this PR seams to solve the dedlock issue. Going to test more.

Overdr0ne pushed a commit to Overdr0ne/linux-imx that referenced this pull request Jul 28, 2025
* Initial sound card integration

* Added reserved memory space for Cortex-M4

* Added corrections to SAI clock pads and removed unnecessary IO settings

* Override the ALSA slot width. reset it to 32-bit

* Fixed wrong bus clock setting

* Corrected the clock sync setting of SAI 1,3 so that the RX follows the bit clock of the TX

* Reactivated HW Crypto accelerator

* Reactivated CAAM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants