简体   繁体   中英

linux kernel-device tree-pass data from parent to child

I am interested in passing some data (dynamically created at run time) from a parent node to a child node in the device tree. For instance, I have the following entry in the device tree:

parent_node {
    a-string-property = "A string";
    a-string-list-property = "first string", "second string";
    a-byte-data-property = [0x01 0x23 0x34 0x56];
    child-node1 {
        first-child-property;
        second-child-property = <1>;
        a-string-property = "Hello, world";
    };
    child-node2 {
      some_data ;
    };
};

As far as I know, you cannot create/update properties of a device tree node at runtime (correct?).

So is there any kind of mechanism to pass data between parent node and child node (maybe through struct bus_type , struct device or struct device_driver )?

The final purpose of this data passing is to provide an offset for address translation of devices' memory mappings (child nodes).

you cannot create/update properties of device tree node at runtime (correct?).

On some platforms, the device tree can be manipulated at runtime. See the CONFIG_OF_DYNAMIC configuration item.

Here is a presentation about dynamic dt.

The platforms sparc and powerpc seem to have the following function for this purpose:

int of_set_property(struct device_node *dp, const char *name, void *val, int len)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM