test: dm: fix broken dm_test_ofnode_phandle_ot and get_by_phandle_ot
Fix broken dm_test_ofnode_phandle_ot test. They never actually worked
and were passing test by pure luck by having the same phandle index of
test.dts that coincicentally had #gpio-cells in the same index node.
It was sufficient to add a phandle to test.dts to make the test fail.
To correctly test these feature, make use oif the new OPs oftree to
parse phandle.
For consistency with the dm_test_ofnode_phandle, rework the test and
other.dts to use the same property with the other- prefix to every
node.
Also fix dm_test_ofnode_get_by_phandle_ot by making it more robust and
renaming the phandle property to other-phandle.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
diff --git a/arch/sandbox/dts/other.dts b/arch/sandbox/dts/other.dts
index 395a792..b32158c 100644
--- a/arch/sandbox/dts/other.dts
+++ b/arch/sandbox/dts/other.dts
@@ -8,13 +8,15 @@
/dts-v1/;
+#include <dt-bindings/gpio/gpio.h>
+
/ {
compatible = "sandbox-other";
#address-cells = <1>;
#size-cells = <1>;
node {
- target = <&target 3 4>;
+ other-phandle = <&target>;
subnode {
compatible = "sandbox-other2";
@@ -25,9 +27,27 @@
};
};
+ other-a-test {
+ other-test-gpios = <&other_gpio_a 1>, <&other_gpio_a 4>,
+ <&other_gpio_b 5 GPIO_ACTIVE_HIGH 3 2 1>,
+ <0>, <&other_gpio_a 12>;
+ other-phandle-value = <&other_gpio_c 10>, <0xFFFFFFFF 20>, <&other_gpio_a 30>;
+ };
+
+ other_gpio_a: other-gpio-a {
+ #gpio-cells = <1>;
+ };
+
+ other_gpio_b: other-gpio-b {
+ #gpio-cells = <5>;
+ };
+
+ other_gpio_c: other-gpio-c {
+ #gpio-cells = <2>;
+ };
+
target: target {
compatible = "sandbox-other2";
- #gpio-cells = <2>;
str-prop = "other";
reg = <0x8000 0x100>;
status = "disabled";