Skip to content
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

i2c: stm32: dma enhancement #81814

Conversation

sgilbert182
Copy link
Contributor

@sgilbert182 sgilbert182 commented Nov 23, 2024

Add DMA enhancement for stm32 i2c_v2 driver

Fix #34354

Copy link

Hello @sgilbert182, and thank you very much for your first pull request to the Zephyr project!
Our Continuous Integration pipeline will execute a series of checks on your Pull Request commit messages and code, and you are expected to address any failures by updating the PR. Please take a look at our commit message guidelines to find out how to format your commit messages, and at our contribution workflow to understand how to update your Pull Request. If you haven't already, please make sure to review the project's Contributor Expectations and update (by amending and force-pushing the commits) your pull request if necessary.
If you are stuck or need help please join us on Discord and ask your question there. Additionally, you can escalate the review when applicable. 😊

@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch from 1adf73d to 601d56f Compare November 23, 2024 18:55
@erwango
Copy link
Member

erwango commented Nov 25, 2024

@sgilbert182 Thanks for this contribution. We'll try to review in best delays. Meanwhile,please have a look at feedback reported by compliance scripts
Also, would you mind providing some details on testing (which platforms, which tests, ..) ?

@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch 2 times, most recently from 357f005 to d465675 Compare November 25, 2024 16:29
@sgilbert182
Copy link
Contributor Author

Hi, no worries. I tested this on a g4

@erwango
Copy link
Member

erwango commented Nov 25, 2024

@sgilbert182 Quick hint: Clang format is not mandatory (and I agree this isn't clear at all, these warning are recent and should be deactivated IMO), if you want to make your life easier, you can drop format related changes.

@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch from d465675 to 57b1147 Compare November 25, 2024 19:18
@erwango
Copy link
Member

erwango commented Nov 26, 2024

To be clear on formatting changes (and hopefully we can focus on the content afterwards):

You should fix those (not fixing will block CI)
Screenshot from 2024-11-26 11-05-31

You are not requested to fix those (and even sometimes, it is better not to apply):
Screenshot from 2024-11-26 11-05-44

@sgilbert182
Copy link
Contributor Author

To be clear on formatting changes (and hopefully we can focus on the content afterwards):

You should fix those (not fixing will block CI) Screenshot from 2024-11-26 11-05-31

You are not requested to fix those (and even sometimes, it is better not to apply): Screenshot from 2024-11-26 11-05-44

I seem to have some issues with Clang Format, I run it locally and it produces results that fail CI. Looks like I need to make the changes manually

@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch from 57b1147 to 057bc2b Compare November 26, 2024 10:37
Copy link
Member

@erwango erwango left a comment

Choose a reason for hiding this comment

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

Initial review attempt:

Mains request before going further:
Did you consider implementing I2C_CALLBACK which is supposed to be the async version of I2C API while you're at?
If adding DMA support it would be more logical to make use of this API which allows truly async transfers rather than adding DMA support on a blocking API.
Reason I ask is to avoid current state of STM32 SPI driver which is in a similar state today with a sync API allowing use of DMA and ASYNC API effectively blocking.

(Note also that driver is supposed to get further changes to support RTIO API, so let's limit the changes to where it makes real sense)

Then let's club all DMA related additions to the driver in a single commit to make it easier to review.

Finally, if possible, let's rebase on top of #82015 (once merged) in order to get rid of clang-format suggestions.

@sgilbert182
Copy link
Contributor Author

Mains request before going further: Did you consider implementing I2C_CALLBACK which is supposed to be the async version of I2C API while you're at? If adding DMA support it would be more logical to make use of this API which allows truly async transfers rather than adding DMA support on a blocking API. Reason I ask is to avoid current state of STM32 SPI driver which is in a similar state today with a sync API allowing use of DMA and ASYNC API effectively blocking.

I did not, I was porting over changes I was using for a project but I can take a look at this when I have time.

(Note also that driver is supposed to get further changes to support RTIO API, so let's limit the changes to where it makes real sense)

I will revert this

Then let's club all DMA related additions to the driver in a single commit to make it easier to review.

Finally, if possible, let's rebase on top of #82015 (once merged) in order to get rid of clang-format suggestions.

should I close this MR until this can be rebased and I've had a chance to look at the callback mechanism?

@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch from 057bc2b to 94c6e1d Compare November 26, 2024 12:29
@erwango
Copy link
Member

erwango commented Nov 26, 2024

I did not, I was porting over changes I was using for a project but I can take a look at this when I have time.

Would be great. Thanks

should I close this MR until this can be rebased and I've had a chance to look at the callback mechanism?

Not required. But for clarity, you can move it to draft.

@sgilbert182 sgilbert182 marked this pull request as draft November 26, 2024 13:43
@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch 3 times, most recently from cfd0b0a to 8c030ea Compare November 27, 2024 09:27
@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch 3 times, most recently from d9dfabf to f31a764 Compare February 26, 2025 14:41
Add initial DMA settings structs to stm32 i2c config and data structs

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
Add macrobatics to pull DMA settings from device tree

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
Add DMA options (phandle-array and names) to yaml file

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
Tidy up of i2c_stm32_transfer and added TX and RX semaphore inits

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
Added stop DMA fot transmit complete or other master end conditions

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch from f31a764 to 3de249d Compare February 26, 2025 14:50
@erwango erwango added this to the v4.2.0 milestone Feb 26, 2025
@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch 4 times, most recently from 1f02218 to 731423c Compare February 26, 2025 15:56
Add basic cache memory support

Signed-off-by: Simon Gilbert <srdgilbert@gmail.com>
@sgilbert182 sgilbert182 force-pushed the feature/stm32-i2c-dma-enhancement branch from 731423c to 7b5ca2a Compare February 27, 2025 10:52
@erwango
Copy link
Member

erwango commented Mar 5, 2025

@JarmouniA PTAL

@erwango
Copy link
Member

erwango commented Mar 18, 2025

@JarmouniA Do you think you'll be able to have a new look soon ? Your comments have been addressed as far as I can tell.

@erwango erwango dismissed JarmouniA’s stale review March 20, 2025 09:05

Comments addressed.

@carlescufi carlescufi merged commit 42c3a78 into zephyrproject-rtos:main Mar 20, 2025
21 checks passed
Copy link

Hi @sgilbert182!
Congratulations on getting your very first Zephyr pull request merged 🎉🥳. This is a fantastic achievement, and we're thrilled to have you as part of our community!

To celebrate this milestone and showcase your contribution, we'd love to award you the Zephyr Technical Contributor badge. If you're interested, please claim your badge by filling out this form: Claim Your Zephyr Badge.

Thank you for your valuable input, and we look forward to seeing more of your contributions in the future! 🪁

@JarmouniA
Copy link
Collaborator

@JarmouniA Do you think you'll be able to have a new look soon ? Your comments have been addressed as far as I can tell.

Sorry I missed the notif, yes they have been addressed.

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

Successfully merging this pull request may close these issues.

Please investigate adding DMA support to STM32 I2C!
9 participants