Pruning Device Tree

I am preparing a device tree for my target board, which has a very small set of peripherals (1 UART, 1 I2C, 1 ETH, 2 SPI). I’ve started by copying and renaming vf500-colibri-eval-v3.dts and vf-colibri-eval-v3.dtsi (let’s call this my-target.dtsi). My first goal is to prune my-target.dtsi of everything that’s not needed, and my question follows:

What is the role of the following top level entries in vf500-colibri-eval-v3.dts, and can I safely prune them from my device tree: clk16m, reg_3v3, reg_5v0, reg_usbh_vbus? Similarly, what is the role of pwm0, pwm1, reg_module_3v3, tcon, can these be safely deleted?

I have already successfully pruned a number of other devices, but I’m worrying that these remaining ones are actually talking to module or SoC hardware that I need to leave alone.

Hi @araneidae

Could you provide the version of the Hardware and Software of your module? Please update this Information in the Environment by editing the question.

Thanks and best regards,
Jaski

Hi @araneidae

You can safely delete everything from the devicetree which is not needed. For the entries, you asked, you should look them in the device tree files and check for what these are used. For example clk16m is used for the device mcp2515can, if you don’t need this device then the clk16m can be deleted.

Alternatively you can also disable the devices by setting the status to disabled before just deleting them.
Further as described here, the entries in the device-tree leads through compatible to a kernel driver whose documentation available in the Documenation folder can help you to decide, which entries can be deleted.

Best regards,
Jaski

I hope I have provided the information you wanted.

So I presume that all of these devices are present on the Colibri Evaluation board, and so presumably I can find them documented in https://docs.toradex.com/102284-colibri-evaluation-board-datasheet.pdf? Unfortunately I’m not having a lot of luck with that: the string “regulator” does not appear in that datasheet, nor indeed does “vbus” or “usbh”.

The corresponding documentation for the “fixed-regulator” (Documentation/devicetree/bindings/regulator/fixed-regulator.txt) is … unilluminating.

Alas, I can see that configuring my target device tree is going to be a world of pain :frowning: … I’ve still got the joy to come of configuring the I/O I do need, and the documentation is copious, elliptical, and gappy in the worst places. Ho hum.

Hi @araneidae

Unfortunately I’m not having a lot of luck with that: the string “regulator” does not appear in that datasheet, nor indeed does “vbus” or “usbh”.

This is normal, since this is a hardware datasheet and there is no connection to Software.

The corresponding documentation for the “fixed-regulator” (Documentation/devicetree/bindings/regulator/fixed-regulator.txt) is … unilluminating.

What do you want to know?

Alas, I can see that configuring my target device tree is going to be a world of pain :frowning: … I’ve still got the joy to come of configuring the I/O I do need, and the documentation is copious, elliptical, and gappy in the worst places. Ho hum.

Yes, configuring the device tree is not trivial and needs some time if properly done. I am sure you will manage this.
Regarding Documentation, actually it is quite good. What exactly are you missing?

Best regards,
Jaski

Sorry about the radio silence: took a few days of needed holiday!

Regarding Documentation, actually it is quite good. What exactly are you missing?

Well, the bit about the current documentation that was bothering me was this: all of the components I mentioned in vf-colibri-eval-v3.dtsi (and which I have now deleted from my copy of this) presumably have corresponding hardware instances on the development board (as otherwise why are they in this file). As such, where can I find them described?

As it is, I have no idea what the purpose of the entries I have deleted was, and whether there will be any consequences later on.

Hi

Sorry about the radio silence: took a few days of needed holiday!

There is no issue. I hope you had nice holidays.

Well, the bit about the current documentation that was bothering me was this: all of the components I mentioned in vf-colibri-eval-v3.dtsi (and which I have now deleted from my copy of this) presumably have corresponding hardware instances on the development board (as otherwise why are they in this file). As such, where can I find them described?

I understand what you mean, but a device tree just describes the hardware components in the way operating system can handle it and it is not always possible to make a direct link to the hardware components. Usually most of the components configurable/controllable by Software are described in the devicetree.

As it is, I have no idea what the purpose of the entries I have deleted was, and whether there will be any consequences later on.

This depends on the entries. For example if there was a entry to (re)define some properties of a node to tune a device/interface, then the consequence might not be that big. But if the entry was to set the node to be enabled ( status = okay ), then the consequence will be that the corresponding device/interface won’t work in the software.