devicetree-org / lopper

Other
31 stars 35 forks source link

Nested indirect buses #167

Open mbolivar-nordic opened 1 year ago

mbolivar-nordic commented 1 year ago

Is nesting indirect buses allowed? It seems to introduce a lot of complication if so, and my guess is that it should just be explicitly forbidden in the specification, but I'd like to know.

For example:

/ {
    parent {
        compatible = "indirect-bus";
        child {
            compatible = "indirect-bus";
            peripheral@deadbeef { /* ... */ };
        };
    };
};

If this is allowed, what are the semantics for mapping in peripheral@deadbeef above in the address-map property of a "cpus,cluster" node?

sstabellini commented 1 year ago

I don't think we can or should disallow this. "indirect-bus" is not particularly special, so the same way one can nest simple-buses one should also be able to nest indirect-buses. The mapping would work based on the address-map property as usual.

Yes if you map the parent, including the entire range of the parent that is a superset, then yes the child is also mapped. The address of peripheral@deadbeef would be translated 3 times:

Yes you can map the child and not the parent too. You can generate an equivalent device tree by creating a parent node empty if not for the child node. Yes the device tree hierarchy should be retained. This would be the same without nesting:

amba { peripheral@deadbeef { }; };

in this case if address map is only mapping peripheral@deadbeef and not the whole of amba, should peripheral@deadbeef be moved directly under the root node? The answer is no. The hierarchy should be retained.