checks: add graph binding checks

Add checks for DT graph bindings. These checks check node names,
unit-addresses and link connections on ports, port, and endpoint nodes.

The graph nodes are matched by finding nodes named 'endpoint' or with a
'remote-endpoint' property. We can't match on 'ports' or 'port' nodes
because those names are used for non-graph nodes. While the graph nodes
aren't really buses, using the bus pointer to tag matched nodes is
convenient.

Signed-off-by: Rob Herring <robh@kernel.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Rob Herring 2018-02-13 17:00:59 -06:00 committed by David Gibson
parent 2347c96edc
commit df536831d0
3 changed files with 175 additions and 0 deletions

24
tests/bad-graph.dts Normal file
View file

@ -0,0 +1,24 @@
/dts-v1/;
/ {
ports {
#address-cells = <1>;
#size-cells = <0>;
bad_endpoint: port-a@0 {
reg = <0>;
#address-cells = <1>;
#size-cells = <0>;
endpoint@d0 {
reg = <0>;
remote-endpoint = <0xdeadbeef>;
};
};
port@1 {
reg = <0>;
};
};
};

View file

@ -599,6 +599,9 @@ dtc_tests () {
check_tests unit-addr-unique.dts unique_unit_address
check_tests bad-phandle-cells.dts interrupts_extended_property
check_tests bad-gpio.dts gpios_property
check_tests bad-graph.dts graph_child_address
check_tests bad-graph.dts graph_port
check_tests bad-graph.dts graph_endpoint
run_sh_test dtc-checkfails.sh deprecated_gpio_property -- -Wdeprecated_gpio_property -I dts -O dtb bad-gpio.dts
check_tests bad-interrupt-cells.dts interrupts_property
run_sh_test dtc-checkfails.sh node_name_chars -- -I dtb -O dtb bad_node_char.dtb