-
Notifications
You must be signed in to change notification settings - Fork 8.2k
[RFC] DT: emit ordinals #22292
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
[RFC] DT: emit ordinals #22292
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -484,9 +484,9 @@ def _check_binding(self, binding, binding_path): | |
| _err("malformed or empty '{}' in {}" | ||
| .format(prop, binding_path)) | ||
|
|
||
| ok_top = {"title", "description", "compatible", "properties", "#cells", | ||
| "bus", "on-bus", "parent-bus", "child-bus", "parent", "child", | ||
| "child-binding", "sub-node"} | ||
| ok_top = {"title", "description", "compatible", "is-device", | ||
| "properties", "#cells", "bus", "on-bus", "parent-bus", | ||
| "child-bus", "parent", "child", "child-binding", "sub-node"} | ||
|
|
||
| for prop in binding: | ||
| if prop not in ok_top and not prop.endswith("-cells"): | ||
|
|
@@ -645,6 +645,10 @@ class Node: | |
| name: | ||
| The name of the node | ||
|
|
||
| is_device: | ||
| True if the node's binding signals that it corresponds to a Zephyr | ||
| device model struct device. False otherwise. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
|
||
| unit_addr: | ||
| An integer with the ...@<unit-address> portion of the node name, | ||
| translated through any 'ranges' properties on parent nodes, or None if | ||
|
|
@@ -755,6 +759,11 @@ def name(self): | |
| "See the class docstring" | ||
| return self._node.name | ||
|
|
||
| @property | ||
| def is_device(self): | ||
| "See the class docstring" | ||
| return self._binding and self._binding.get('is-device', False) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe this should default to True. As long as we have a matching-compat, we're likely to be a struct device.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Noted.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a personal quirk, but make it |
||
|
|
||
| @property | ||
| def unit_addr(self): | ||
| "See the class docstring" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,6 +52,7 @@ def main(): | |
| continue | ||
|
|
||
| write_node_comment(node) | ||
| write_deps(node) | ||
| write_regs(node) | ||
| write_irqs(node) | ||
| write_props(node) | ||
|
|
@@ -166,6 +167,21 @@ def relativize(path): | |
| return path | ||
|
|
||
|
|
||
| def write_deps(node): | ||
| # Writes dependency ordinal information for the node. | ||
|
|
||
| def dep_ords(nodes): | ||
| return [node.dep_ordinal for node in nodes] | ||
|
|
||
| out_node(node, 'ORDINAL', node.dep_ordinal) | ||
| out_node_init(node, 'REQUIRES_NODES', dep_ords(node.depends_on)) | ||
| out_node_init(node, 'REQUIRES_DEVS', | ||
| dep_ords([n for n in node.depends_on if n.is_device])) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On second thought, this isn't enough to capture parameterized dependencies; I'll rethink this. I guess we'll need to special-case by type of dependency (clock subsystem, interrupt controller, GPIO spec, etc.) |
||
| out_node_init(node, 'SUPPORTS_NODES', dep_ords(node.required_by)) | ||
| out_node_init(node, 'SUPPORTS_DEVS', | ||
| dep_ords([n for n in node.required_by if n.is_device])) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use double quotes for strings here too, for consistency. |
||
|
|
||
|
|
||
| def write_regs(node): | ||
| # Writes address/size output for the registers in the node's 'reg' property | ||
|
|
||
|
|
||
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.
Could make it "... has a 'struct device' representation ..."
Was wondering what kind of device a "struct device" is.