xref: /OK3568_Linux_fs/kernel/Documentation/devicetree/dynamic-resolution-notes.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun.. SPDX-License-Identifier: GPL-2.0
2*4882a593Smuzhiyun
3*4882a593Smuzhiyun==================================
4*4882a593SmuzhiyunDevice Tree Dynamic Resolver Notes
5*4882a593Smuzhiyun==================================
6*4882a593Smuzhiyun
7*4882a593SmuzhiyunThis document describes the implementation of the in-kernel
8*4882a593SmuzhiyunDevice Tree resolver, residing in drivers/of/resolver.c
9*4882a593Smuzhiyun
10*4882a593SmuzhiyunHow the resolver works
11*4882a593Smuzhiyun----------------------
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunThe resolver is given as an input an arbitrary tree compiled with the
14*4882a593Smuzhiyunproper dtc option and having a /plugin/ tag. This generates the
15*4882a593Smuzhiyunappropriate __fixups__ & __local_fixups__ nodes.
16*4882a593Smuzhiyun
17*4882a593SmuzhiyunIn sequence the resolver works by the following steps:
18*4882a593Smuzhiyun
19*4882a593Smuzhiyun1. Get the maximum device tree phandle value from the live tree + 1.
20*4882a593Smuzhiyun2. Adjust all the local phandles of the tree to resolve by that amount.
21*4882a593Smuzhiyun3. Using the __local__fixups__ node information adjust all local references
22*4882a593Smuzhiyun   by the same amount.
23*4882a593Smuzhiyun4. For each property in the __fixups__ node locate the node it references
24*4882a593Smuzhiyun   in the live tree. This is the label used to tag the node.
25*4882a593Smuzhiyun5. Retrieve the phandle of the target of the fixup.
26*4882a593Smuzhiyun6. For each fixup in the property locate the node:property:offset location
27*4882a593Smuzhiyun   and replace it with the phandle value.
28