dtoc: Order the structures internally by name
authorSimon Glass <sjg@chromium.org>
Sat, 3 Oct 2020 17:31:25 +0000 (11:31 -0600)
committerSimon Glass <sjg@chromium.org>
Thu, 29 Oct 2020 20:42:17 +0000 (14:42 -0600)
commit1b27273e090590e7944a3f7a3b33ac9f90aae765
treea93247e2c9fb196d57a2b705f3fec4d3440d7fc6
parente4fb5faa044ffc66170f8776794386e5e11e13a2
dtoc: Order the structures internally by name

At present the structures are written in name order, but parents have to
be written before their children, so the file does not end up being in
order. The order of nodes in _valid_nodes matches the order of the
devicetree.

Update the code so that _valid_nodes is in sorted order, by C name of
the structure. This allows us to assign a sequential ordering to each
U_BOOT_DEVICE() declaration.

U-Boot's linker lists are also ordered alphabetically, which means that
the order in the driver_info list will match the order used by dtoc. This
defines an index ('idx') for the U_BOOT_DEVICE declarations. They appear
in alphabetical order, numbered from 0 in _valid_nodes and in the
driver_info linker list.

Add a comment against each declaration, showing the idx value.

Signed-off-by: Simon Glass <sjg@chromium.org>
tools/dtoc/dtb_platdata.py
tools/dtoc/test_dtoc.py