aboutsummaryrefslogtreecommitdiff
path: root/tools/dtoc/fdt_util.py
AgeCommit message (Collapse)AuthorFilesLines
2018-01-15dtoc: Allow DTC environment variable to provide path to dtcSimon Glass1-1/+2
The system device-tree compiler may not be new enough to run the tests we use in U-Boot (e.g. with binman). Allow use of a DTC environment variable to point to the correct dtc. If not defined, the dtc on the default PATH is used. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-11-22binman: Disable the no-unit_address_vs_reg warningsSimon Glass1-1/+2
These warnings are not useful for binman tests. Disable them. Signed-off-by: Simon Glass <sjg@chromium.org>
2017-09-15dtoc: Add support for 32 or 64-bit addressesSimon Glass1-0/+2
When using 32-bit addresses dtoc works correctly. For 64-bit addresses it does not since it ignores the #address-cells and #size-cells properties. Update the tool to use fdt64_t as the element type for reg properties when either the address or size is larger than one cell. Use the correct value so that C code can obtain the information from the device tree easily. Alos create a new type, fdt_val_t, which is defined to either fdt32_t or fdt64_t depending on the word size of the machine. This type corresponds to fdt_addr_t and fdt_size_t. Unfortunately we cannot just use those types since they are defined to phys_addr_t and phys_size_t which use 'unsigned long' in the 32-bit case, rather than 'unsigned int'. Add tests for the four combinations of address and size values (32/32, 64/64, 32/64, 64/32). Also update existing uses for rk3399 and rk3368 which now need to use the new fdt_val_t type. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Heiko Stuebner <heiko@sntech.de> Reported-by: Kever Yang <kever.yang@rock-chips.com> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Kever Yang <kever.yang@rock-chips.com>
2017-09-15dtoc: Add a 64-bit type and a way to convert cells into 64 bitsSimon Glass1-0/+14
When dealing with multi-cell values we need a type that can hold this value. Add this and a function to process it from a list of cell values. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Philipp Tomsich <philipp.tomsich@theobroma-systems.com> Tested-by: Kever Yang <kever.yang@rock-chips.com>
2017-04-13dtoc: Decode val if it's a byte stringGeorge McCollister1-0/+2
With Python 3.5.2 encode will throw an exception if val is a byte array. Decode it to a string first. This assumes it's utf-8, if it's not valid utf-8 it will throw an exception. Signed-off-by: George McCollister <george.mccollister@gmail.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-10-09dtoc: Decode strings for struct.unpack on python 3.xPaul Burton1-0/+3
On python 3.x struct.unpack will complain if we provide it with a string since it expects to operate on a bytes object. In order to satisfy this requirement, encode the string to a bytes object when running on python 3.x. Signed-off-by: Paul Burton <paul.burton@imgtec.com> Acked-by: Simon Glass <sjg@chromium.org>
2016-09-18dtoc: Add methods for reading data from propertiesSimon Glass1-0/+25
Provide easy helpers for reading integer, string and boolean values from device-tree properties. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18dtoc: Correct quotes in fdt_utilSimon Glass1-1/+1
The style is to use single quotes for strings where possible. Adjust this function. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18dtoc: Allow the device tree to be compiled from sourceSimon Glass1-0/+41
If a source device tree is provide to the Fdt() constructors, compile it automatically. This will be used in tests, where we want to build a particular test .dts file and check that it works correctly in binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-09-18dtoc: Move BytesToValue() and GetEmpty() into PropBaseSimon Glass1-66/+0
These functions are currently in a separate fdt_util file. Since they are only used from PropBase and subclasses, it makes sense for them to be in the PropBase class. Move these functions into fdt.py along with the list of types. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-07-14dm: Add a library to provide simple device-tree accessSimon Glass1-0/+86
This Python library provides a way to access the contents of the device tree. It uses fdtget, so is inefficient for larger device tree files. Signed-off-by: Simon Glass <sjg@chromium.org>