[PATCH 1/2] fdtget: Add documentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



This is missing at present and the fdtget tool is no-longer trivial. Add
a little bit of information.

This might be useful for distributions which want to provide a man page.

Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx>
---

 Documentation/manual.txt | 67 ++++++++++++++++++++++++++++++++++++++++
 1 file changed, 67 insertions(+)

diff --git a/Documentation/manual.txt b/Documentation/manual.txt
index 72403ac..dd4d888 100644
--- a/Documentation/manual.txt
+++ b/Documentation/manual.txt
@@ -693,3 +693,70 @@ Where options are:
     -i, --input         Input base DT blob
     -o, --output        Output DT blob
     -v, --verbose       Verbose message output
+
+4 ) fdtget -- Read properties from device tree
+
+This command can be used to obtain individual values from the device tree in a
+nicely formatted way. You can specify multiple nodes to display (when using -p)
+or multiple node/property pairs (when not using -p). For the latter, each
+property is displayed on its own line, with a space between each cell within
+the property.
+
+The syntax of the fdtget command is:
+
+    fdtget <options> <dt file> [<node> <property>]...
+    fdtget -p <options> <dt file> [<node> ]...
+
+where options are:
+
+    <type>    s=string, i=int, u=unsigned, x=hex
+        Optional modifier prefix:
+            hh or b=byte, h=2 byte, l=4 byte (default)
+
+    -t, --type <arg>      Type of data
+    -p, --properties      List properties for each node
+    -l, --list            List subnodes for each node
+    -d, --default <arg>   Default value to display when the property is missing
+    -P, --decode-phandles Decode phandles to show the target node and (with -c) args (this only supports some common cases)
+    -c, --cells <arg>     Cells property in phandle target (e.g. 'gpio' for '#gpio-cells')
+    -h, --help            Print this help and exit
+    -V, --version         Print version and exit
+
+If -t is not provided, fdtget will try to figure out the type, trying to detect
+strings, string lists and the size of each value in the property. This is
+similar to how fdtdump works, and uses the same heuristics.
+
+The phandle feature (-P) provides a way to decode and display phandles. It
+should only be used on properties which use a particular (fairly common)
+phandle format:
+
+   <phandle> <n cells of stuff> <phandle> <m cells of stuff>
+
+For example, consider this device-tree fragment:
+
+    pinctrl {
+        gpio0: gpio0@ff750000 {
+            #gpio-cells = <2>;
+        };
+    };
+
+    gpio-keys {
+        button@0 {
+            gpios = <&gpio0 5 GPIO_ACTIVE_LOW>;
+        };
+    };
+
+
+Normally fdtget weil display the 'gpios' property like this:
+
+    $ fdtget firefly-rk3288/u-boot.dtb /gpio-keys/button@0 gpios
+    112 5 1
+
+but with -P was can request that the phandle be decoded and shown as a part:
+
+    $ fdtget firefly-rk3288/u-boot.dtb -P -c gpio /gpio-keys/button@0 gpios
+    /pinctrl/gpio0@ff750000 5 1
+
+Note that '-c gpio' is needed to tell fdtget to use the #gpio-cells property
+to figure out the number of arguments for each phandle. Without that it cannot
+display the arguments correctly.
-- 
2.17.0.441.gb46fe60e1d-goog

--
To unsubscribe from this list: send the line "unsubscribe devicetree-compiler" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Device Tree]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux