This is missing at present and the fdtput tool could use a litle more information than just its help text. This might be useful for distributions which want to provide a man page. Signed-off-by: Simon Glass <sjg@xxxxxxxxxxxx> --- Documentation/manual.txt | 132 ++++++++++++++++++++++++--------------- 1 file changed, 82 insertions(+), 50 deletions(-) diff --git a/Documentation/manual.txt b/Documentation/manual.txt index dd4d888..90fb9a7 100644 --- a/Documentation/manual.txt +++ b/Documentation/manual.txt @@ -44,8 +44,8 @@ The gitweb interface for the upstream respository is: 1.1) Submitting Patches Patches should be sent to the maintainers: - David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> - Jon Loeliger <jdl@xxxxxxx> + David Gibson <david@xxxxxxxxxxxxxxxxxxxxx> + Jon Loeliger <jdl@xxxxxxx> and CCed to <devicetree-compiler@xxxxxxxxxxxxxxx>. 2) Description @@ -65,7 +65,7 @@ The currently supported Input Formats are: - "fs" format. A representation equivalent to the output of /proc/device-tree where nodes are directories and - properties are files. + properties are files. The currently supported Output Formats are: @@ -88,62 +88,62 @@ The syntax of the dtc command line is: Options: <input_filename> - The name of the input source file. If no <input_filename> - or "-" is given, stdin is used. + The name of the input source file. If no <input_filename> + or "-" is given, stdin is used. -b <number> - Set the physical boot cpu. + Set the physical boot cpu. -f - Force. Try to produce output even if the input tree has errors. + Force. Try to produce output even if the input tree has errors. -h - Emit a brief usage and help message. + Emit a brief usage and help message. -I <input_format> - The source input format, as listed above. + The source input format, as listed above. -o <output_filename> - The name of the generated output file. Use "-" for stdout. + The name of the generated output file. Use "-" for stdout. -O <output_format> - The generated output format, as listed above. + The generated output format, as listed above. -d <dependency_filename> - Generate a dependency file during compilation. + Generate a dependency file during compilation. -q - Quiet: -q suppress warnings, -qq errors, -qqq all + Quiet: -q suppress warnings, -qq errors, -qqq all -R <number> - Make space for <number> reserve map entries - Relevant for dtb and asm output only. + Make space for <number> reserve map entries + Relevant for dtb and asm output only. -@ - Generates a __symbols__ node at the root node of the resulting blob - for any node labels used, and for any local references using phandles - it also generates a __local_fixups__ node that tracks them. + Generates a __symbols__ node at the root node of the resulting blob + for any node labels used, and for any local references using phandles + it also generates a __local_fixups__ node that tracks them. - When using the /plugin/ tag all unresolved label references to - be tracked in the __fixups__ node, making dynamic resolution possible. + When using the /plugin/ tag all unresolved label references to + be tracked in the __fixups__ node, making dynamic resolution possible. -A - Generate automatically aliases for all node labels. This is similar to - the -@ option (the __symbols__ node contain identical information) but - the semantics are slightly different since no phandles are automatically - generated for labeled nodes. + Generate automatically aliases for all node labels. This is similar to + the -@ option (the __symbols__ node contain identical information) but + the semantics are slightly different since no phandles are automatically + generated for labeled nodes. -S <bytes> - Ensure the blob at least <bytes> long, adding additional - space if needed. + Ensure the blob at least <bytes> long, adding additional + space if needed. -v - Print DTC version and exit. + Print DTC version and exit. -V <output_version> - Generate output conforming to the given <output_version>. - By default the most recent version is generated. - Relevant for dtb and asm output only. + Generate output conforming to the given <output_version>. + By default the most recent version is generated. + Relevant for dtb and asm output only. The <output_version> defines what version of the "blob" format will be @@ -163,7 +163,7 @@ Here is a very rough overview of the layout of a DTS source file: sourcefile: versioninfo plugindecl list_of_memreserve devicetree memreserve: label 'memreserve' ADDR ADDR ';' - | label 'memreserve' ADDR '-' ADDR ';' + | label 'memreserve' ADDR '-' ADDR ';' devicetree: '/' nodedef @@ -177,8 +177,8 @@ Here is a very rough overview of the layout of a DTS source file: property: label PROPNAME '=' propdata ';' propdata: STRING - | '<' list_of_cells '>' - | '[' list_of_bytes ']' + | '<' list_of_cells '>' + | '[' list_of_bytes ']' subnode: label nodename nodedef @@ -209,19 +209,19 @@ Here are some example property definitions: - A property containing a 0 terminated string - property1 = "string_value"; + property1 = "string_value"; - A property containing a numerical 32-bit hexadecimal value - property2 = <1234abcd>; + property2 = <1234abcd>; - A property containing 3 numerical 32-bit hexadecimal values - property3 = <12345678 12345678 deadbeef>; + property3 = <12345678 12345678 deadbeef>; - A property whose content is an arbitrary array of bytes - property4 = [0a 0b 0c 0d de ea ad be ef]; + property4 = [0a 0b 0c 0d de ea ad be ef]; Node may contain sub-nodes to obtain a hierarchical structure. @@ -231,9 +231,9 @@ For example: "childnode at address". It in turn has a string property called "childprop". - childnode@addresss { - childprop = "hello\n"; - }; + childnode@addresss { + childprop = "hello\n"; + }; By default, all numeric values are hexadecimal. Alternate bases @@ -253,19 +253,19 @@ Absolute node path names are also allowed in node references. In this exmaple, a node is labled "mpic" and then referenced: mpic: interrupt-controller@40000 { - ... + ... }; ethernet-phy@3 { - interrupt-parent = <&mpic>; - ... + interrupt-parent = <&mpic>; + ... }; And used in properties, lables may appear before or after any value: randomnode { - prop: string = data: "mystring\n" data_end: ; - ... + prop: string = data: "mystring\n" data_end: ; + ... }; @@ -282,7 +282,7 @@ are described in the kernel documentation in the file You can find example of code manipulating that format within the kernel. For example, the file: - including arch/powerpc/kernel/prom_init.c + including arch/powerpc/kernel/prom_init.c will generate a flattened device-tree from the Open Firmware representation. Other utilities such as fs2dt, which is part of @@ -320,19 +320,19 @@ boot_param_header: u32 size_dt_strings; /* size of the strings block */ /* version 17 fields below */ - u32 size_dt_struct; /* size of the DT structure block */ + u32 size_dt_struct; /* size of the DT structure block */ }; Along with the constants: /* Definitions used by the flattened device tree */ #define OF_DT_HEADER 0xd00dfeed /* 4: version, - 4: total size */ + 4: total size */ #define OF_DT_BEGIN_NODE 0x1 /* Start node: full name - */ + */ #define OF_DT_END_NODE 0x2 /* End node */ #define OF_DT_PROP 0x3 /* Property: name off, - size, content */ + size, content */ #define OF_DT_END 0x9 All values in this header are in big endian format, the various @@ -760,3 +760,35 @@ but with -P was can request that the phandle be decoded and shown as a part: 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. + +5 ) fdtput - Write properties to a device tree + +The syntax of the fdtput command is: + + fdtput <options> <dt file> <node> <property> [<value>...] + fdtput -c <options> <dt file> [<node>...] + fdtput -r <options> <dt file> [<node>...] + fdtput -d <options> <dt file> <node> [<property>...] + +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) + + -c, --create Create nodes if they don't already exist + -r, --remove Delete nodes (and any subnodes) if they already exist + -d, --delete Delete properties if they already exist + -p, --auto-path Automatically create nodes as needed for the node path + -t, --type <arg> Type of data + -v, --verbose Display each value decoded from command line + -h, --help Print this help and exit + -V, --version Print version and exit + +The option determines which usage is selected and therefore the operation that +is performed. The first usage adds or updates properties; the rest are used to +create/delete nodes and delete properties. + +For the first usage, the command line arguments are joined together into a +single value which is written to the property. The -t option is required so +that fdtput knows how to decode its arguments. -- 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