On Sun, May 20, 2018 at 01:57:00PM -0600, Simon Glass wrote: > 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> I like the idea of adding documentation. However, I still need to think a bit about the phandle decoding patch. Could you re-order these - documenting fdtget/fdtput as they stand before the phandle decoding and moving the documentation update to the next draft of the phandle decoding patch. Then I can apply the documentation patch while considering the rest. > --- > > 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. -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature