Skip to content

Conversation

@sebhub
Copy link
Contributor

@sebhub sebhub commented Jun 26, 2025

Use a mutex to protect the I2C bus from concurrent access. Replace busy waiting with a binary semaphore. Process the messages in the interrupt handler state machine to generate a single transaction. In the interrupt handler, process the states until nothing more is to do. This prevents superfluous interrupt entry/exit pairs. Return error conditions to the caller. Check the messages for consistency and return an error for unsupported message lists.

The driver was tested using an Icicle development board connected to another board with an I2C target.

@sebhub
Copy link
Contributor Author

sebhub commented Jun 26, 2025

@con-pax Would you mind reviewing this MR?

@con-pax
Copy link
Contributor

con-pax commented Jun 26, 2025

@con-pax Would you mind reviewing this MR?

Hey @sebhub,
Absolutely! thanks for this, I will test this out

@sebhub sebhub force-pushed the i2c-mchp-mss-rework branch from d040c43 to 66072fb Compare June 26, 2025 11:02
Copy link
Contributor

@teburd teburd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks pretty good to me, I've not looked in great depth at the changes in the flow using an ISR state machine as I'm not familiar with this hardware, but looked for common things across i2c drivers.

A small nit using k_sem_reset like other drivers rather than a take with no wait.

@sebhub sebhub force-pushed the i2c-mchp-mss-rework branch from 66072fb to 6dfc2ad Compare June 26, 2025 13:03
teburd
teburd previously approved these changes Jun 26, 2025
sebhub added 2 commits June 27, 2025 17:12
Clear the clock bits before setting new ones. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Use a mutex to protect the I2C bus from concurrent access. Replace busy waiting with a binary semaphore. Process the messages in the interrupt handler state machine to generate a single transaction. In the interrupt handler, process the states until nothing more is to do. This prevents superfluous interrupt entry/exit pairs. Return error conditions to the caller. Check the messages for consistency and return an error for unsupported message lists. Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Copy link
Contributor

@con-pax con-pax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested this out, works as expected. LGTM

@dkalowsk dkalowsk added this to the v4.3.0 milestone Jul 8, 2025
@albertofloyd albertofloyd removed their request for review August 4, 2025 20:44
@nandojve nandojve self-assigned this Aug 14, 2025
@cfriedt cfriedt merged commit 4d34bee into zephyrproject-rtos:main Aug 15, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

7 participants