aboutsummaryrefslogtreecommitdiff
path: root/tools/dtoc
AgeCommit message (Collapse)Author
2023-08-28Revert "binman: Add a temporary hack for duplicate phandles"Simon Glass
The affected boards have been fixed, so drop this hack. This reverts commit 288ae53cb73605500b7fc01e5919753c878466be. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Tim Harvey <tharvey@gateworks.com>
2023-08-02binman: Add a temporary hack for duplicate phandlesSimon Glass
Three boards use a phandle in a FIT generator and the maintainer is away. For now, add a hack to allow this. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02fdt: Allow copying phandles into templatesSimon Glass
Allow phandles to be copied over from a template. This can potentially cause duplicate phandles, so detect this and report an error. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02dtoc: Add some debugging when copying nodesSimon Glass
Show the operations being performed, when debugging is enabled. Convert a mistaken 'print' in test_copy_subnodes_from_phandles() while we are here. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-08-02dtoc: Make properties dirty when purging themSimon Glass
Without the 'dirty' flag properties are not written back to the devicetree when synced. This means that new properties copied over to a node are not always written out. Fix this and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-20dtoc: Allow inserting a list of nodes into anotherSimon Glass
Provide a way to specify a phandle list of nodes which are to be inserted into an existing node. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-07-20dtoc: Support copying the contents of a node into anotherSimon Glass
This permits implementation of a simple templating system, where a node can be reused as a base for others. For now this adds new subnodes after any existing ones. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-05-04tools: fix TestFdtUtil()Heinrich Schuchardt
Variable old_outdir cannot be used before assignment. The assignment must occur before the try block. tools/dtoc/test_fdt.py:796:26: E0601: Using variable 'old_outdir' before assignment (used-before-assignment) Add missing space in assignment. Fixes: a004f29464d1 ("binman: Tidy up _SetupDtb() to use its own temporary file") Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2023-03-08dtoc: Add support for building a dtoc PyPi packageSimon Glass
Create the necessary files to build this new package. This is needed for binman. Move the main program into a function so that it can easily be called by the PyPi-created script. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08dtoc: Use pathlib to find the test directorySimon Glass
Update this so that the directory being used is declared at the top of the file. Use pathlib as it seems to be more modern. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08dtoc: Move the main code into a functionSimon Glass
Put this code into a function so it is easy for it be run when packaged. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08dtoc: Hide the test options unless test code is availableSimon Glass
It doesn't make much sense to expose tests when dtoc is running outside of the U-Boot git checkout. Hide the option in this case. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-03-08patman: Move library functions into a library directorySimon Glass
The patman directory has a number of modules which are used by other tools in U-Boot. This makes it hard to package the tools using pypi since the common files must be copied along with the tool that uses them. To address this, move these files into a new u_boot_pylib library. This can be packaged separately and listed as a dependency of each tool. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14dm: doc: Move to new driver model schemaSimon Glass
Now that Linux has accepted these tags, update the dtoc tool to use them. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-02-14dm: treewide: Complete migration to new driver model schemaSimon Glass
Update various build and test components to use the new schema. Signed-off-by: Simon Glass <sjg@chromium.org>
2023-01-18dtoc: Add a way to read a phandle with paramsSimon Glass
Add a function to read a phandle and associated name and offset. This is useful for binman. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-09-12dtoc: Drop sys.exit() in test_fdtSimon Glass
This breaks using pytest to run the tests. Drop it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-09dtoc: Correct remaining pylint problems in test_fdtSimon Glass
Fix various camel-case and other naming problems. Update the pylint base file to avoid regressions. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-09test_fdt: Convert to use argparseSimon Glass
Drop the deprecated OptionParser. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-09dtoc: Move main program into its own functionSimon Glass
Use a function for the main program so everything there doesn't look like a global variable to pylint. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-09dtoc: Fix fdt test coverageSimon Glass
Fix a bug that the --processes option was ignored, thus resulting in no test coverage information being generated. Signed-off-by: Simon Glass <sjg@chromium.org> Fixes: 42ae363ddd9 ("dtoc: Update fdt tests to use test_util")
2022-08-09dtoc: Tidy up fdt_tests RunTests()Simon Glass
Pass the options args in rather than using the global variables. Use snake case, fix up comments and use a ternary operator to make pylint happy. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-08-09dtoc: Tidy up fdt_tests RunTestCoverage() argsSimon Glass
Pass the options args in rather than using the global various. Use snake case and fix up comments to make pylint happy. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Support accessing core tagsSimon Glass
At present tag numbers are only allocated for non-core data, meaning that the 'core' data, like priv and plat, are accessed through dedicated functions. For debugging and consistency it is convenient to use tags for this 'core' data too. Add support for this, with new tag numbers and functions to access the pointer and size for each. Update one of the test drivers so that the uclass-private data can be tested here. There is some code duplication with functions like device_alloc_priv() but this is not addressed for now. At some point, some rationalisation may help to reduce code size, but more thought it needed on that. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28dm: core: Switch the testbus driver to use a new structSimon Glass
At present this driver uses 'priv' struct to hold 'plat' data, which is confusing. The contents of the strct don't matter, since only dtoc is using it. Create a new struct with the correct name. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-06-28patman: test_util: Use unittest text runner to print test resultsAlper Nebi Yasak
The python tools' test utilities handle printing test results, but the output is quite bare compared to an ordinary unittest run. Delegate printing the results to a unittest text runner, which gives us niceties like clear separation between each test's result and how long it took to run the test suite. Unfortunately it does not print info for skipped tests by default, but this can be handled later by a custom test result subclass. It also does not print the tool name; manually print a heading that includes the toolname so that the outputs of each tool's tests are distinguishable in the CI output. Signed-off-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2022-06-28dtoc: Update fdt tests to use test_utilSimon Glass
Use the common functions to run tests and report results. Ensure that the result code indicates success or failure. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-06-14dtoc: Update test_src_scan.py for new tegra compatiblesTom Rini
This test was written to match up with the list of compatibles in drivers/i2c/tegra_i2c.c so adding another one requires the test to be updated to match. Fixes: 0d2105ae5e32 ("arm: tegra: Update some DT compatibles") Signed-off-by: Tom Rini <trini@konsulko.com>
2022-03-18dtoc: Tidy up implementation of AddStringList()Simon Glass
Refactor this to avoid a loop. Also add a test for an empty string. Signed-off-by: Simon Glass <sjg@chromium.org> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-18dtoc: Make GetArgs() more flexibleSimon Glass
At present it is not possible to have arguments which include spaces. Update the function to only split the args if the property is a single string. This is a bit inconsistent, but might still be useful. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Alper Nebi Yasak <alpernebiyasak@gmail.com> Suggested-by: Alper Nebi Yasak <alpernebiyasak@gmail.com>
2022-03-02dtoc: Correct pylint errorsSimon Glass
Fix pylint errors in this directory. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22dtoc: Support reading a list of argumentsSimon Glass
It is helpful to support a string or stringlist containing a list of space-separated arguments, for example: args = "-n fred", "-a", "123"; This resolves to the list: -n fred -a 123 which can be passed to a program as arguments. Add a helper to do the required processing. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22dtoc: Allow deleting nodes and adding them in the same syncSimon Glass
This does not work at present, since the current algorithm assumes that either there are no nodes or all nodes have an offset. If a node is new, but an old node is still in the tree, then syncing fails due to this assumption. Fix it and add a test. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22dtoc: Support deleting a nodeSimon Glass
Add a function to delete a node. This is synced to the tree when requested. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-22dtoc: Support adding a string list to a device treeSimon Glass
Add a new function to add a string list. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in test_util.pySimon Glass
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in command.pySimon Glass
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-09patman: Convert camel case in tools.pySimon Glass
Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-02-08patman: Update test_util to run doc testsSimon Glass
At present this function does not run the doctests. Allow the caller to pass these modules in as strings. Update patman to use this. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-24tools: Add init files for Python toolsSimon Glass
Add some empty __init__ files for binman, buildman and dtoc so that pylint is able to recognise these as Python modules and produce more useful pylint output. Signed-off-by: Simon Glass <sjg@chromium.org>
2022-01-24dtoc: Fix up a code comment that confuses pylintSimon Glass
This produces a pylint error at present. Fix it. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-05dtoc: Add support for reading string-list propertiesSimon Glass
Add a function to read a list of strings from the devicetree. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02dtoc: Add support for reading fixed-length bytes propertiesSimon Glass
Add functions to read a sequence of bytes from the devicetree. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02dtoc: Add support for reading 64-bit intsSimon Glass
Add functions to read a 64-bit integer property from the devicetree. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-12-02dtoc: Bring in the libfdt module automaticallySimon Glass
Use the same technique as with binman to load this module from the U-Boot tree if available. This allows running tests without having to specify the PYTHONPATH variable. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-09-25irq: Tidy up of-platdata irq supportSimon Glass
This function is available but not exported. More generally it does not really work as intended. Reimplement it and add a sandbox test too. Signed-off-by: Simon Glass <sjg@chromium.org>
2021-08-08dtoc: Correct the intarray-widening test caseSimon Glass
This case was intended to check that widening an int array with an int does nothing. Fix it. Reported-by: Walter Lozano <walter.lozano@collabora.com> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Walter Lozano <walter.lozano@collabora.com>
2021-08-01dtoc: Support widening a bool valueSimon Glass
At present if we see 'ranges' property (with no value) we assume it is a boolean, as per the devicetree spec. But another node may define 'ranges' with a value, forcing us to widen it to an int array. At present this is not supported and causes an error. Fix this and add some test cases. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com>
2021-08-01dtoc: Fix widening an int array to an intSimon Glass
An int array can hold a single int so we should not need to do anything in the widening operation. However due to a quirk in the code, an int[3] widened with an int produced an int[4]. Fix this and add a test. Fix a comment typo while we are here. Signed-off-by: Simon Glass <sjg@chromium.org> Reported-by: Tom Rini <trini@konsulko.com>
2021-08-01dtoc: Rename is_wider_than() to reduce confusionSimon Glass
The current name is confusing because the logic is actually backwards from what you might expect. Rename it to needs_widening() and update the comments. Signed-off-by: Simon Glass <sjg@chromium.org>