-
Notifications
You must be signed in to change notification settings - Fork 8.4k
drivers: dp: add STM32 support #89207
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
drivers: dp: add STM32 support #89207
Conversation
eaadfcf to
29881b6
Compare
|
Okay did a bit of refactoring, platforms have specific headers now, only one guard in the main file. |
006d110 to
df8bff6
Compare
Move the nrf specific functions to a separate file so that every soc has a dedicated header. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
Add support for direct control of STM32 gpios to the DP driver. Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
|
Added hsem locking, for multi-core devices, same as |
|
| z_stm32_hsem_lock(CFG_HW_GPIO_SEMID, HSEM_LOCK_DEFAULT_RETRY); | ||
|
|
||
| val = LL_GPIO_ReadOutputPort(gpio); | ||
| val |= BIT(pin); | ||
| LL_GPIO_WriteOutputPort(gpio, val); | ||
|
|
||
| z_stm32_hsem_unlock(CFG_HW_GPIO_SEMID); |
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.
Is it significantly faster than just GPIO API? I guess z_stm32_hsem_lock/unlock will be optimized away on single core?
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.
Yes and yes, I think about 250khz vs 550khz on the C0, something like 800 on the H7 can't remember right now but yeah decent boost, I can take a trace if you want me to. Lock and lock are indeed no-ops on single cores, and those are all fast parts, otherwise it would have killed the poor C0.
jfischer-no
left a comment
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.
Thanks
mathieuchopstm
left a comment
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.
FYI @fabiobaltieri
| val = LL_GPIO_ReadOutputPort(gpio); | ||
| val |= BIT(pin); | ||
| LL_GPIO_WriteOutputPort(gpio, val); |
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.
LL_GPIO_SetOutputPin is a single write and performs RMW atomically in hardware. Am I missing some context, or couldn't it be used here?
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.
Oh, brilliant, so no lock needed. Thanks for pointing that out I'll send a followup to use that instead and drop the locks.
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.
Nothing is ever easy #90211 (comment)
| val = LL_GPIO_ReadOutputPort(gpio); | ||
| val &= ~BIT(pin); | ||
| LL_GPIO_WriteOutputPort(gpio, val); |
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.
Ditto but with LL_GPIO_ResetOutputPin instead.



Add support for direct control of STM32 gpios to the DP driver.
Tested on an F3 and on an H7, should work on all of them.