-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Rework the I2C driver for the Microchip Polarfire SoC #92208
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
@con-pax Would you mind reviewing this MR? |
9852ad9
to
d040c43
Compare
d040c43
to
66072fb
Compare
There was a problem hiding this 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.
66072fb
to
6dfc2ad
Compare
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>
6dfc2ad
to
f320651
Compare
|
There was a problem hiding this 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
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.