Repository navigation
lopper: assists: resolve /chosen overlay labels for Zephyr - #878
Open
dbingi-amd wants to merge 2 commits into
Open
dbingi-amd wants to merge 2 commits into
dbingi-amd wants to merge 2 commits into
Conversation
A Zephyr board overlay can point a /chosen property at a label that
already exists on the domain tree, for example:
/ {
chosen {
zephyr,entropy = &pmcbridge_0_pmcl_trng_0;
};
};
Two things stop that from reaching Zephyr.
dtc treats a bare &label as a path reference. The standalone overlay
compile has no base tree, so the label is reported as missing and the
merge stops.
After a phandle form (<&label>) does merge, lopper keeps the value as a
phandle and the board DTS prints <&label>. Zephyr's DT_CHOSEN() only
accepts a node path, so the entropy sample fails with
DT_CHOSEN(zephyr_entropy) undeclared.
Before the overlay is compiled, rewrite a /chosen "name = &label;" to
"<&label>" when that label is on the domain tree. A label that is not
on the domain tree is left as written, so the compile still fails.
After the overlay is merged, write each /chosen property that holds one
node phandle as that node's path. /amba_pl/ is rewritten to /soc/, the
same mapping zephyr_domain_dts already uses when it fills an empty
zephyr,entropy.
zephyr_domain_dts calls this after the board overlay merge.
Signed-off-by: Bingi Dinesh kumar <[email protected]>
The Zephyr assist now turns a /chosen label into the node path that DT_CHOSEN() reads. Cover both spellings a board overlay can use. Add a test that merges zephyr,entropy = &trng_0 and zephyr,entropy = <&trng_0> onto a domain tree that has trng_0. After chosen_phandles_to_paths(), /chosen/zephyr,entropy is the path /soc/trng@f1240000. Signed-off-by: Bingi Dinesh kumar <[email protected]>
Contributor
Author
|
@kedareswararao please review the changes |
This branch has not been deployed
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Follow up to #873
A Zephyr board overlay can set a /chosen property to a label on the domain tree, such as
zephyr,entropy = &pmcbridge_0_pmcl_trng_0 in scu200.dts. Zephyr needs that property as a node path so DT_CHOSEN(zephyr_entropy) resolves. dtc rejects the bare &label during the standalone overlay compile, because the label is not in the overlay. After the phandle form merges, lopper keeps a phandle and the board DTS prints <&label>, which DT_CHOSEN() does not accept. The entropy sample then fails to build.
This series fixes that in the Zephyr assist, on top of current master (including bb6de63).
compile when the label is on the domain tree, and after the merge write
single-phandle /chosen properties as node paths (/amba_pl/ becomes
/soc/).
merge.
becomes /soc/trng@f1240000.
Testing:
zephyr,entropy = "/soc/pmcbridge-0-pmcl-trng-0@4120000" and keeps
eeprom-0 = "/soc/i2c@40800000/eeprom@50".