Commit 642e6e5c authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab Committed by Rob Herring

docs: dt: convert overlay-notes.txt to ReST format

- Add a SPDX header;
- Adjust document title;
- Some whitespace fixes and new line breaks;
- Mark literal blocks as such;
- Add it to devicetree/index.rst.
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Signed-off-by: default avatarRob Herring <robh@kernel.org>
parent 218e1b3d
...@@ -12,3 +12,4 @@ Open Firmware and Device Tree ...@@ -12,3 +12,4 @@ Open Firmware and Device Tree
changesets changesets
dynamic-resolution-notes dynamic-resolution-notes
of_unittest of_unittest
overlay-notes
.. SPDX-License-Identifier: GPL-2.0
=========================
Device Tree Overlay Notes Device Tree Overlay Notes
------------------------- =========================
This document describes the implementation of the in-kernel This document describes the implementation of the in-kernel
device tree overlay functionality residing in drivers/of/overlay.c and is a device tree overlay functionality residing in drivers/of/overlay.c and is a
...@@ -15,9 +18,9 @@ Since the kernel mainly deals with devices, any new device node that result ...@@ -15,9 +18,9 @@ Since the kernel mainly deals with devices, any new device node that result
in an active device should have it created while if the device node is either in an active device should have it created while if the device node is either
disabled or removed all together, the affected device should be deregistered. disabled or removed all together, the affected device should be deregistered.
Lets take an example where we have a foo board with the following base tree: Lets take an example where we have a foo board with the following base tree::
---- foo.dts ----------------------------------------------------------------- ---- foo.dts ---------------------------------------------------------------
/* FOO platform */ /* FOO platform */
/dts-v1/; /dts-v1/;
/ { / {
...@@ -33,11 +36,12 @@ Lets take an example where we have a foo board with the following base tree: ...@@ -33,11 +36,12 @@ Lets take an example where we have a foo board with the following base tree:
peripheral1 { ... }; peripheral1 { ... };
}; };
}; };
---- foo.dts ----------------------------------------------------------------- ---- foo.dts ---------------------------------------------------------------
The overlay bar.dts, The overlay bar.dts,
::
---- bar.dts - overlay target location by label ------------------------------ ---- bar.dts - overlay target location by label ----------------------------
/dts-v1/; /dts-v1/;
/plugin/; /plugin/;
&ocp { &ocp {
...@@ -47,11 +51,11 @@ The overlay bar.dts, ...@@ -47,11 +51,11 @@ The overlay bar.dts,
... /* various properties and child nodes */ ... /* various properties and child nodes */
}; };
}; };
---- bar.dts ----------------------------------------------------------------- ---- bar.dts ---------------------------------------------------------------
when loaded (and resolved as described in [1]) should result in foo+bar.dts when loaded (and resolved as described in [1]) should result in foo+bar.dts::
---- foo+bar.dts ------------------------------------------------------------- ---- foo+bar.dts -----------------------------------------------------------
/* FOO platform + bar peripheral */ /* FOO platform + bar peripheral */
/ { / {
compatible = "corp,foo"; compatible = "corp,foo";
...@@ -72,7 +76,7 @@ when loaded (and resolved as described in [1]) should result in foo+bar.dts ...@@ -72,7 +76,7 @@ when loaded (and resolved as described in [1]) should result in foo+bar.dts
}; };
}; };
}; };
---- foo+bar.dts ------------------------------------------------------------- ---- foo+bar.dts -----------------------------------------------------------
As a result of the overlay, a new device node (bar) has been created As a result of the overlay, a new device node (bar) has been created
so a bar platform device will be registered and if a matching device driver so a bar platform device will be registered and if a matching device driver
...@@ -84,9 +88,9 @@ in the base DT. In this case, the target path can be provided. The target ...@@ -84,9 +88,9 @@ in the base DT. In this case, the target path can be provided. The target
location by label syntax is preferred because the overlay can be applied to location by label syntax is preferred because the overlay can be applied to
any base DT containing the label, no matter where the label occurs in the DT. any base DT containing the label, no matter where the label occurs in the DT.
The above bar.dts example modified to use target path syntax is: The above bar.dts example modified to use target path syntax is::
---- bar.dts - overlay target location by explicit path ---------------------- ---- bar.dts - overlay target location by explicit path --------------------
/dts-v1/; /dts-v1/;
/plugin/; /plugin/;
&{/ocp} { &{/ocp} {
...@@ -96,7 +100,7 @@ The above bar.dts example modified to use target path syntax is: ...@@ -96,7 +100,7 @@ The above bar.dts example modified to use target path syntax is:
... /* various properties and child nodes */ ... /* various properties and child nodes */
} }
}; };
---- bar.dts ----------------------------------------------------------------- ---- bar.dts ---------------------------------------------------------------
Overlay in-kernel API Overlay in-kernel API
...@@ -104,12 +108,12 @@ Overlay in-kernel API ...@@ -104,12 +108,12 @@ Overlay in-kernel API
The API is quite easy to use. The API is quite easy to use.
1. Call of_overlay_fdt_apply() to create and apply an overlay changeset. The 1) Call of_overlay_fdt_apply() to create and apply an overlay changeset. The
return value is an error or a cookie identifying this overlay. return value is an error or a cookie identifying this overlay.
2. Call of_overlay_remove() to remove and cleanup the overlay changeset 2) Call of_overlay_remove() to remove and cleanup the overlay changeset
previously created via the call to of_overlay_fdt_apply(). Removal of an previously created via the call to of_overlay_fdt_apply(). Removal of an
overlay changeset that is stacked by another will not be permitted. overlay changeset that is stacked by another will not be permitted.
Finally, if you need to remove all overlays in one-go, just call Finally, if you need to remove all overlays in one-go, just call
of_overlay_remove_all() which will remove every single one in the correct of_overlay_remove_all() which will remove every single one in the correct
......
...@@ -12536,7 +12536,7 @@ M: Frank Rowand <frowand.list@gmail.com> ...@@ -12536,7 +12536,7 @@ M: Frank Rowand <frowand.list@gmail.com>
L: devicetree@vger.kernel.org L: devicetree@vger.kernel.org
S: Maintained S: Maintained
F: Documentation/devicetree/dynamic-resolution-notes.rst F: Documentation/devicetree/dynamic-resolution-notes.rst
F: Documentation/devicetree/overlay-notes.txt F: Documentation/devicetree/overlay-notes.rst
F: drivers/of/overlay.c F: drivers/of/overlay.c
F: drivers/of/resolver.c F: drivers/of/resolver.c
K: of_overlay_notifier_ K: of_overlay_notifier_
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment