-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[microTVM][Zephyr] Fix PLL freq. in overlay for nucleo_l4r5zi board #12756
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Note: To save power, you can just remove these if these PLL outputs are not required.
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.
@erwango Thanks a lot for the reivew!
Interesting, it's good to keep in mind so that using the
PLL48M1CLKandPLLSAI3CLKclocks can effect the power consumption. Since microTVM is not using any SAI (although we can use it in future for some voice recognition model), SMMDC, or USB OTG subsystem I think we can turn off these clocks, yep. But I'm scratching my head because I understand that even if propertiesdiv-panddiv-qare removed from the overlay the dtc compiler will anyway "merge" the overlay properties for nodepllwith the values for these properties found in https://github.com/zephyrproject-rtos/zephyr/blob/main/boards/arm/nucleo_l4r5zi/nucleo_l4r5zi.dts#L76-L77 which are the same as the ones found in the overlay. But I thought also that even if these tuning values are set in theRCC_PLLCFGRit would be necessary to actually enable them explicitly by setting bitsPLLQEN-- bit 20 -- andPLLPEN-- bit 16 -- in that register to effectively enable the clocks. Is my assumption wrong? Or even should we disable explicitly these clocks to save power? I haven't check what's the state for these bits because I don't have that board on hands ...Now, re-reading my comments about
Qparam/property in the patch I think it's wrong.div-q = 2 => Q = 6looks wrong to me because the value for the property in the .dts/overlay file should be6, not the value for bit field (2), according to the semantics in https://github.com/zephyrproject-rtos/zephyr/blob/main/dts/bindings/clock/st%2Cstm32l4-pll-clock.yaml#L68 . So actually it seemsdiv-q = 2implies Q = 0 (bit field in register equal to zero), so actually by settingdiv-q = 2we havePLL48M1CLK freq = 240 / 2 = 120 Mhz, not240 / 6 = 40 MHzas in my comment. The Reference manual saysCaution: The software has to set these bits correctly not to exceed 120 MHz on this domain.and withdiv-q=2we don't violate this (we have it as 120 MHz), but I wonder if we should actually usediv-q=6to "honor" the clock signal name which implies it's a 48 MHz or so clock?Since @mehrdadh plans to squash this patch with #12741 and contribute back to Zephyr I also I'd like to know if this comment #12741 should be update to
120 MHzaccordingly.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 oversaw this indeed. Prop values are the values to be used in the computation and driver makes the translation in register space.
Regarding the need for a 48MHz this depends on your needs. If required this can impose the use of a 96MHz Max freq on core. But note that USB, entropy and sdmmc are the only consumer of 48MHz clock available today in main zephyr tree.