Re: patching of device tree from layer
Rudolf J Streif
On 10/26/22 17:59, ron.eggler@... wrote:
Welcome. When asking a question on a mailing list it is always advisable to put all relevant information pertaining to the question into the email and be specific about what you think the problem is. It alleviates people from having to collect additional data to understand the problem.
Not necessarily. There are so many different devices and there's probably nobody who knows them all. :)
It is good practice to override definitions from a dtsi in a dts. That is the entire idea of the device tree include file which is what the 'i' suggests. The idea is to use dtsi to define device nodes that are shared between different platforms. Some of them are always enabled since all platforms use them. Others, like the i2c bus in question, may only be used on some devices and hence they are disabled. Some nodes might only be templates and the platform's dts needs to complete them if they are used.
In this particular case it would have been better to simply add
status = "ok";
to the dts as the other definitions were already present as such in the dtsi stm32mp15xx-dkx.dtsi
Would it not be better, to patch the node in the dtsi file and add the required changes there instead of adding them to the dts file essentially overwriting what was set previously? I imagine this will essentially lead to two nodes being defined with the same name, the latter just overwriting the former, is that so?Nope, that is the idea of using the & before the device node name. All of the &'s and the node's root definition will be merged by the device tree compiler into the resulting device node definition. In this case the i2c5 node's root definition is in stm32mp151.dtsi which is included by stm32mp153.dts which is in turn included by stm32mp157.dtsi which is included by stm32157d-dk1.dts. (I might be wrong with the details of the chain as just browsed through it quickly but you get the idea.)
I don't recommend doing this but the example explains how to patch the dts file. It works the same way for the dtsi.
Rudolf J Streif