-
Notifications
You must be signed in to change notification settings - Fork 0
PoC: STM32 global clocks manager #1
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
Introduce new SoC-specific framework to manage global peripheral clocks. Update all STM32 code to make use of the framework when accessing one of the global peripherals: PWR/SYSCFG. Signed-off-by: Mathieu Choplain <[email protected]>
allow indicating which clocks are always-on such that the calls to refer/release for thes clocks turn into no-ops which reduces footprint and speeds up runtime Signed-off-by: Mathieu Choplain <[email protected]>
|
|
||
| /* Enable PWR */ | ||
| LL_AHB4_GRP1_EnableClock(LL_AHB4_GRP1_PERIPH_PWR); | ||
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR); |
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.
I'm not fond of this name.
1- Can we find an alternative to refer/release that already exist in tree ? (eg get/put even if I don't think this one is quite clear)
2- Alternative to stm32_global_periph:
- stm32_soc_device
- stm32_device
- ...
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.
refer was inspired by net_buf_ref/net_buf_unref (that's why I have a comment somewhere suggesting to rename stm32_global_periph_release to _unref). In tree, we have net_buf_{ref,unref}, bt_conn_{ref,unref} and z_fd_{ref,unref}, all explicitly described as "inc/dec a refcount" which is what we're doing here, hence why I picked this name. On the other hand, get/put seems to only be used by the PM subsystem (pm_policy_state_lock_put, pm_device_runtime_put, ...) and refers to a lock-with-counter rather than a refcount.
I don't have any strong opinion on the name stm32_global_periph, that's just what I came up with. Fine with changing it.
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR); | ||
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_SYSCFG); |
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.
What about having it as a field (with maybe shorter names, then) ?
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR); | |
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_SYSCFG); | |
| stm32_global_periph_refer(STM32_GLOBAL_PERIPH_PWR|STM32_GLOBAL_PERIPH_SYSCFG); |
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.
This could definitely be done, I'd just need to change logic a bit. (it would add a tiny additional overhead too)
No description provided.