summaryrefslogtreecommitdiff
path: root/tools/dtoc/fdt_normal.py
Commit message (Collapse)AuthorAgeLines
* dtoc: Adjust GetProps() in fdt_normal to use the node pathSimon Glass2016-10-09-6/+3
| | | | | | | There is no need to pass a node path separately. Instead we should use the path for the node provided. Correct this. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support finding the offset of a propertySimon Glass2016-09-18-0/+18
| | | | | | | | Add a way to find the byte offset of a property within the device tree. This is only supported with the normal libfdt implementation since fdtget does not provide this information. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support packing the device treeSimon Glass2016-09-18-0/+11
| | | | | | | | | | After any node/property deletion the device tree can be packed to remove spare space. Add a way to perform this operation. Note that for fdt_fallback, fdtput automatically packs the device tree after deletion, so no action is required here. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Support deleting device tree propertiesSimon Glass2016-09-18-0/+20
| | | | | | | | Add support for deleting a device tree property. With the fallback implementation this uses fdtput. With libfdt it uses the API call and updates the offsets afterwards. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Move to using bytearraySimon Glass2016-09-18-1/+1
| | | | | | | | Since we want to be able to change the in-memory device tree using libfdt, use a bytearray instead of a string. This makes interfacing from Python easier. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Prepare for supporting changing of device treesSimon Glass2016-09-18-4/+42
| | | | | | | | For binman we need to support deleting properties in the device tree. This will change the offsets of nodes after the deletion. In preparation, add code to keep track of when the offsets are invalid, and regenerate them. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Allow the device tree to be compiled from sourceSimon Glass2016-09-18-2/+5
| | | | | | | | 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>
* dtoc: Move a few more common functions into fdt.pySimon Glass2016-09-18-16/+0
| | | | | | | Some functions have the same code in the subclasses. Move these into the superclass to avoid duplication. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Move Widen() and GetPhandle() into the base classSimon Glass2016-09-18-42/+0
| | | | | | | | | | | These functions are identical in both subclasses. Move them into the base class. Note: In fact there is a bug in one version, which was fixed by this patch: https://patchwork.ozlabs.org/patch/651697/ Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Move BytesToValue() and GetEmpty() into PropBaseSimon Glass2016-09-18-3/+3
| | | | | | | | | | 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>
* dtoc: Create a base class for FdtSimon Glass2016-09-18-21/+37
| | | | | | | | | | | | | | At present we have two separate implementations of the Fdt library, one which uses fdtget/fdtput and one which uses libfdt (via swig). Before adding more functionality it makes sense to create a base class for these. This will allow common functions to be shared, and make the Fdt API a little clearer. Create a new fdt.py file with the base class, and adjust fdt_normal.py and fdt_fallback.py to use it. Signed-off-by: Simon Glass <sjg@chromium.org>
* dtoc: Rename fdt.py to fdt_normal.pySimon Glass2016-09-18-0/+180
In preparation for creating an Fdt base class, rename this file to indicate it is the normal Fdt implementation. Signed-off-by: Simon Glass <sjg@chromium.org>