summaryrefslogtreecommitdiff
path: root/tools/dtoc/test
diff options
context:
space:
mode:
Diffstat (limited to 'tools/dtoc/test')
-rw-r--r--tools/dtoc/test/dtoc_test.dts11
-rw-r--r--tools/dtoc/test/dtoc_test_add_prop.dts24
-rw-r--r--tools/dtoc/test/dtoc_test_addr32.dts26
-rw-r--r--tools/dtoc/test/dtoc_test_addr32_64.dts32
-rw-r--r--tools/dtoc/test/dtoc_test_addr64.dts32
-rw-r--r--tools/dtoc/test/dtoc_test_addr64_32.dts32
-rw-r--r--tools/dtoc/test/dtoc_test_alias_bad.dts58
-rw-r--r--tools/dtoc/test/dtoc_test_alias_bad_path.dts58
-rw-r--r--tools/dtoc/test/dtoc_test_alias_bad_uc.dts58
-rw-r--r--tools/dtoc/test/dtoc_test_aliases.dts22
-rw-r--r--tools/dtoc/test/dtoc_test_bad_reg.dts17
-rw-r--r--tools/dtoc/test/dtoc_test_bad_reg2.dts17
-rw-r--r--tools/dtoc/test/dtoc_test_copy.dts90
-rw-r--r--tools/dtoc/test/dtoc_test_driver_alias.dts20
-rw-r--r--tools/dtoc/test/dtoc_test_empty.dts11
-rw-r--r--tools/dtoc/test/dtoc_test_inst.dts58
-rw-r--r--tools/dtoc/test/dtoc_test_invalid_driver.dts15
-rw-r--r--tools/dtoc/test/dtoc_test_noparent.dts32
-rw-r--r--tools/dtoc/test/dtoc_test_noprops.dts21
-rw-r--r--tools/dtoc/test/dtoc_test_phandle.dts43
-rw-r--r--tools/dtoc/test/dtoc_test_phandle_bad.dts16
-rw-r--r--tools/dtoc/test/dtoc_test_phandle_bad2.dts22
-rw-r--r--tools/dtoc/test/dtoc_test_phandle_cd_gpios.dts42
-rw-r--r--tools/dtoc/test/dtoc_test_phandle_reorder.dts23
-rw-r--r--tools/dtoc/test/dtoc_test_phandle_single.dts23
-rw-r--r--tools/dtoc/test/dtoc_test_scan_drivers.cxx5
-rw-r--r--tools/dtoc/test/dtoc_test_simple.dts69
-rw-r--r--tools/dtoc/test/dtoc_test_single_reg.dts30
28 files changed, 907 insertions, 0 deletions
diff --git a/tools/dtoc/test/dtoc_test.dts b/tools/dtoc/test/dtoc_test.dts
new file mode 100644
index 00000000000..b2259483a6b
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test.dts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+};
diff --git a/tools/dtoc/test/dtoc_test_add_prop.dts b/tools/dtoc/test/dtoc_test_add_prop.dts
new file mode 100644
index 00000000000..8225de36d27
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_add_prop.dts
@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ intval = <1>;
+ };
+
+ spl-test2 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ intarray = <5>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_addr32.dts b/tools/dtoc/test/dtoc_test_addr32.dts
new file mode 100644
index 00000000000..3e7dc567292
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_addr32.dts
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ test1 {
+ bootph-all;
+ compatible = "test1";
+ reg = <0x1234 0x5678>;
+ };
+
+ test2 {
+ bootph-all;
+ compatible = "test2";
+ reg = <0x12345678 0x98765432 2 3>;
+ };
+
+};
diff --git a/tools/dtoc/test/dtoc_test_addr32_64.dts b/tools/dtoc/test/dtoc_test_addr32_64.dts
new file mode 100644
index 00000000000..7ce16feef1a
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_addr32_64.dts
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <2>;
+
+ test1 {
+ bootph-all;
+ compatible = "test1";
+ reg = <0x1234 0x5678 0x0>;
+ };
+
+ test2 {
+ bootph-all;
+ compatible = "test2";
+ reg = <0x12345678 0x98765432 0x10987654>;
+ };
+
+ test3 {
+ bootph-all;
+ compatible = "test3";
+ reg = <0x12345678 0x98765432 0x10987654 2 0 3>;
+ };
+
+};
diff --git a/tools/dtoc/test/dtoc_test_addr64.dts b/tools/dtoc/test/dtoc_test_addr64.dts
new file mode 100644
index 00000000000..5f8c23f04b8
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_addr64.dts
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ #address-cells = <2>;
+ #size-cells = <2>;
+
+ test1 {
+ bootph-all;
+ compatible = "test1";
+ reg = /bits/ 64 <0x1234 0x5678>;
+ };
+
+ test2 {
+ bootph-all;
+ compatible = "test2";
+ reg = /bits/ 64 <0x1234567890123456 0x9876543210987654>;
+ };
+
+ test3 {
+ bootph-all;
+ compatible = "test3";
+ reg = /bits/ 64 <0x1234567890123456 0x9876543210987654 2 3>;
+ };
+
+};
diff --git a/tools/dtoc/test/dtoc_test_addr64_32.dts b/tools/dtoc/test/dtoc_test_addr64_32.dts
new file mode 100644
index 00000000000..bfbfd87b8de
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_addr64_32.dts
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <2>;
+ #size-cells = <1>;
+
+ test1 {
+ bootph-all;
+ compatible = "test1";
+ reg = <0x1234 0x0 0x5678>;
+ };
+
+ test2 {
+ bootph-all;
+ compatible = "test2";
+ reg = <0x12345678 0x90123456 0x98765432>;
+ };
+
+ test3 {
+ bootph-all;
+ compatible = "test3";
+ reg = <0x12345678 0x90123456 0x98765432 0 2 3>;
+ };
+
+};
diff --git a/tools/dtoc/test/dtoc_test_alias_bad.dts b/tools/dtoc/test/dtoc_test_alias_bad.dts
new file mode 100644
index 00000000000..69761f91146
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_alias_bad.dts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ testbus2 = &bus2;
+ testfdt1 = &testfdt_1;
+ i2c4- = &i2c;
+ };
+
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ boolval;
+ intval = <1>;
+ };
+
+ i2c: i2c {
+ bootph-all;
+ compatible = "sandbox,i2c";
+ intval = <3>;
+ };
+
+ spl-test3 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ };
+
+ bus2: some-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "denx,u-boot-test-bus";
+ reg = <3 1>;
+ ping-expect = <4>;
+ ping-add = <4>;
+ testfdt_1: test {
+ compatible = "denx,u-boot-fdt-test", "google,another-fdt-test";
+ reg = <5>;
+ ping-expect = <5>;
+ ping-add = <5>;
+ };
+
+ test0 {
+ compatible = "google,another-fdt-test";
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_alias_bad_path.dts b/tools/dtoc/test/dtoc_test_alias_bad_path.dts
new file mode 100644
index 00000000000..6f566fe4abf
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_alias_bad_path.dts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ testbus2 = &bus2;
+ testfdt1 = &testfdt_1;
+ i2c4 = "/does/not/exist";
+ };
+
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ boolval;
+ intval = <1>;
+ };
+
+ i2c: i2c {
+ bootph-all;
+ compatible = "sandbox,i2c";
+ intval = <3>;
+ };
+
+ spl-test3 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ };
+
+ bus2: some-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "denx,u-boot-test-bus";
+ reg = <3 1>;
+ ping-expect = <4>;
+ ping-add = <4>;
+ testfdt_1: test {
+ compatible = "denx,u-boot-fdt-test", "google,another-fdt-test";
+ reg = <5>;
+ ping-expect = <5>;
+ ping-add = <5>;
+ };
+
+ test0 {
+ compatible = "google,another-fdt-test";
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_alias_bad_uc.dts b/tools/dtoc/test/dtoc_test_alias_bad_uc.dts
new file mode 100644
index 00000000000..5d23c63a630
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_alias_bad_uc.dts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ testbus2 = &bus2;
+ testfdt1 = &testfdt_1;
+ other1 = &testfdt_1;
+ };
+
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ boolval;
+ intval = <1>;
+ };
+
+ i2c: i2c {
+ bootph-all;
+ compatible = "sandbox,i2c";
+ intval = <3>;
+ };
+
+ spl-test3 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ };
+
+ bus2: some-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "denx,u-boot-test-bus";
+ reg = <3 1>;
+ ping-expect = <4>;
+ ping-add = <4>;
+ testfdt_1: test {
+ compatible = "denx,u-boot-fdt-test", "google,another-fdt-test";
+ reg = <5>;
+ ping-expect = <5>;
+ ping-add = <5>;
+ };
+
+ test0 {
+ compatible = "google,another-fdt-test";
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_aliases.dts b/tools/dtoc/test/dtoc_test_aliases.dts
new file mode 100644
index 00000000000..018b834046e
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_aliases.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ spl-test {
+ bootph-all;
+ compatible = "compat1", "compat2.1-fred", "compat3";
+ intval = <1>;
+ };
+
+ spl-test2 {
+ bootph-all;
+ compatible = "compat1", "simple_bus";
+ intval = <1>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_bad_reg.dts b/tools/dtoc/test/dtoc_test_bad_reg.dts
new file mode 100644
index 00000000000..1312acb619b
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_bad_reg.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ compatible = "test";
+ reg = "fre";
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_bad_reg2.dts b/tools/dtoc/test/dtoc_test_bad_reg2.dts
new file mode 100644
index 00000000000..3e9efa43af1
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_bad_reg2.dts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ compatible = "test";
+ reg = <1 2 3>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_copy.dts b/tools/dtoc/test/dtoc_test_copy.dts
new file mode 100644
index 00000000000..8e50c756592
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_copy.dts
@@ -0,0 +1,90 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ reference = <&over>; /* nake sure that the 'over' phandle exists */
+ copy-list = <&another &base>;
+
+ dest {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ maybe-empty-int = <1>;
+
+ first@0 {
+ a-prop = <456>;
+ b-prop = <1>;
+ };
+
+ existing {
+ };
+
+ base {
+ second {
+ second3 {
+ };
+
+ second2 {
+ new-prop;
+ };
+
+ second1: second1 {
+ new-prop;
+ };
+
+ second4 {
+ use_second1 = <&second1>;
+ };
+ };
+ };
+ };
+
+ base: base {
+ compatible = "sandbox,i2c";
+ bootph-all;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ over: over {
+ compatible = "sandbox,pmic";
+ bootph-all;
+ reg = <9>;
+ low-power;
+ };
+
+ first@0 {
+ reg = <0>;
+ a-prop = <123>;
+ };
+
+ second: second {
+ second_1_bad: second1 {
+ some-prop;
+ };
+
+ second2 {
+ some-prop;
+ use_second1_bad = <&second_1_bad>;
+ };
+ };
+ };
+
+ another: another {
+ new-prop = "hello";
+ earlier {
+ wibble = <2>;
+ };
+
+ later {
+ fibble = <3>;
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_driver_alias.dts b/tools/dtoc/test/dtoc_test_driver_alias.dts
new file mode 100644
index 00000000000..22369a44069
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_driver_alias.dts
@@ -0,0 +1,20 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2020 Collabora Ltd.
+ */
+
+/dts-v1/;
+
+/ {
+ gpio_a: gpios@0 {
+ bootph-all;
+ gpio-controller;
+ compatible = "sandbox_gpio_alias";
+ #gpio-cells = <1>;
+ gpio-bank-name = "a";
+ sandbox,gpio-count = <20>;
+ };
+
+};
diff --git a/tools/dtoc/test/dtoc_test_empty.dts b/tools/dtoc/test/dtoc_test_empty.dts
new file mode 100644
index 00000000000..b2259483a6b
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_empty.dts
@@ -0,0 +1,11 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+};
diff --git a/tools/dtoc/test/dtoc_test_inst.dts b/tools/dtoc/test/dtoc_test_inst.dts
new file mode 100644
index 00000000000..9689be391bd
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_inst.dts
@@ -0,0 +1,58 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ aliases {
+ testbus2 = &bus2;
+ testfdt1 = &testfdt_1;
+ i2c4 = &i2c;
+ };
+
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ boolval;
+ intval = <1>;
+ };
+
+ i2c: i2c {
+ bootph-all;
+ compatible = "sandbox,i2c";
+ intval = <3>;
+ };
+
+ spl-test3 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ };
+
+ bus2: some-bus {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ compatible = "denx,u-boot-test-bus";
+ reg = <3 1>;
+ ping-expect = <4>;
+ ping-add = <4>;
+ testfdt_1: test {
+ compatible = "denx,u-boot-fdt-test", "google,another-fdt-test";
+ reg = <5>;
+ ping-expect = <5>;
+ ping-add = <5>;
+ };
+
+ test0 {
+ compatible = "google,another-fdt-test";
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_invalid_driver.dts b/tools/dtoc/test/dtoc_test_invalid_driver.dts
new file mode 100644
index 00000000000..042a325913e
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_invalid_driver.dts
@@ -0,0 +1,15 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ spl-test {
+ bootph-all;
+ compatible = "invalid";
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_noparent.dts b/tools/dtoc/test/dtoc_test_noparent.dts
new file mode 100644
index 00000000000..0efb17e0cbc
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_noparent.dts
@@ -0,0 +1,32 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ i2c@0 {
+ compatible = "sandbox,i2c";
+ bootph-pre-sram;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "disabled";
+ pmic@9 {
+ compatible = "sandbox,pmic";
+ bootph-all;
+ reg = <9>;
+ low-power;
+ };
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_noprops.dts b/tools/dtoc/test/dtoc_test_noprops.dts
new file mode 100644
index 00000000000..75296beb319
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_noprops.dts
@@ -0,0 +1,21 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ i2c@0 {
+ pmic@9 {
+ compatible = "sandbox,pmic";
+ bootph-all;
+ reg = <9>;
+ low-power;
+ };
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_phandle.dts b/tools/dtoc/test/dtoc_test_phandle.dts
new file mode 100644
index 00000000000..74a146b9a3e
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_phandle.dts
@@ -0,0 +1,43 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ bootph-all;
+ compatible = "target";
+ intval = <0>;
+ #clock-cells = <0>;
+ };
+
+ phandle_1: phandle2-target {
+ bootph-all;
+ compatible = "target";
+ intval = <1>;
+ #clock-cells = <1>;
+ };
+ phandle_2: phandle3-target {
+ bootph-all;
+ compatible = "target";
+ intval = <2>;
+ #clock-cells = <2>;
+ };
+
+ phandle-source {
+ bootph-all;
+ compatible = "source";
+ clocks = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;
+ phandle-name-offset = <&phandle_2>, "fred", <123>;
+ };
+
+ phandle-source2 {
+ bootph-all;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_phandle_bad.dts b/tools/dtoc/test/dtoc_test_phandle_bad.dts
new file mode 100644
index 00000000000..94cfada95bb
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_phandle_bad.dts
@@ -0,0 +1,16 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ phandle-source {
+ bootph-all;
+ compatible = "source";
+ clocks = <20>; /* Invalid phandle */
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_phandle_bad2.dts b/tools/dtoc/test/dtoc_test_phandle_bad2.dts
new file mode 100644
index 00000000000..4d24b96ce68
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_phandle_bad2.dts
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ bootph-all;
+ compatible = "target";
+ intval = <0>;
+ };
+
+ phandle-source2 {
+ bootph-all;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_phandle_cd_gpios.dts b/tools/dtoc/test/dtoc_test_phandle_cd_gpios.dts
new file mode 100644
index 00000000000..6ad80062666
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_phandle_cd_gpios.dts
@@ -0,0 +1,42 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2020 Collabora Ltd.
+ */
+
+/dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ bootph-all;
+ compatible = "target";
+ intval = <0>;
+ #gpio-cells = <0>;
+ };
+
+ phandle_1: phandle2-target {
+ bootph-all;
+ compatible = "target";
+ intval = <1>;
+ #gpio-cells = <1>;
+ };
+ phandle_2: phandle3-target {
+ bootph-all;
+ compatible = "target";
+ intval = <2>;
+ #gpio-cells = <2>;
+ };
+
+ phandle-source {
+ bootph-all;
+ compatible = "source";
+ cd-gpios = <&phandle &phandle_1 11 &phandle_2 12 13 &phandle>;
+ };
+
+ phandle-source2 {
+ bootph-all;
+ compatible = "source";
+ cd-gpios = <&phandle>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_phandle_reorder.dts b/tools/dtoc/test/dtoc_test_phandle_reorder.dts
new file mode 100644
index 00000000000..573a4f63965
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_phandle_reorder.dts
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+
+ phandle-source2 {
+ bootph-all;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+
+ phandle: phandle-target {
+ bootph-all;
+ compatible = "target";
+ #clock-cells = <0>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_phandle_single.dts b/tools/dtoc/test/dtoc_test_phandle_single.dts
new file mode 100644
index 00000000000..1b1763932c7
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_phandle_single.dts
@@ -0,0 +1,23 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2018 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ phandle: phandle-target {
+ bootph-all;
+ compatible = "target";
+ intval = <0>;
+ #clock-cells = <0>;
+ };
+
+ phandle-source2 {
+ bootph-all;
+ compatible = "source";
+ clocks = <&phandle>;
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_scan_drivers.cxx b/tools/dtoc/test/dtoc_test_scan_drivers.cxx
new file mode 100644
index 00000000000..f370b8951d0
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_scan_drivers.cxx
@@ -0,0 +1,5 @@
+/* Aliases must be in driver files */
+U_BOOT_DRIVER(sandbox_gpio) {
+};
+
+DM_DRIVER_ALIAS(sandbox_gpio, sandbox_gpio_alias2)
diff --git a/tools/dtoc/test/dtoc_test_simple.dts b/tools/dtoc/test/dtoc_test_simple.dts
new file mode 100644
index 00000000000..08f667ee5a1
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_simple.dts
@@ -0,0 +1,69 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+ /dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ spl-test {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ boolval;
+ maybe-empty-int = <>;
+ intval = <1>;
+ int64val = /bits/ 64 <0x123456789abcdef0>;
+ intarray = <2 3 4>;
+ byteval = [05];
+ bytearray = [06];
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10 11];
+ stringval = "message";
+ stringarray = "multi-word", "message";
+ notstring = [20 21 22 10 00];
+ };
+
+ spl-test2 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ intval = <3>;
+ intarray = <5>;
+ byteval = [08];
+ bytearray = [01 23 34];
+ longbytearray = [09 0a 0b 0c];
+ stringval = "message2";
+ stringarray = "another", "multi-word", "message";
+ acpi-name = "\\_SB.GPO0";
+ };
+
+ spl-test3 {
+ bootph-all;
+ compatible = "sandbox,spl-test";
+ stringarray = "one";
+ longbytearray = [09 0a 0b 0c 0d 0e 0f 10];
+ maybe-empty-int = <1>;
+ };
+
+ i2c@0 {
+ compatible = "sandbox,i2c";
+ bootph-all;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pmic@9 {
+ compatible = "sandbox,pmic";
+ bootph-all;
+ reg = <9>;
+ low-power;
+ };
+ };
+
+ orig-node {
+ orig = <1 23 4>;
+ args = "-n first", "second", "-p", "123,456", "-x";
+ args2 = "a space", "there";
+ args3 = "-n first second -p 123,456 -x";
+ };
+};
diff --git a/tools/dtoc/test/dtoc_test_single_reg.dts b/tools/dtoc/test/dtoc_test_single_reg.dts
new file mode 100644
index 00000000000..035937cfbfa
--- /dev/null
+++ b/tools/dtoc/test/dtoc_test_single_reg.dts
@@ -0,0 +1,30 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * Test device tree file for dtoc
+ *
+ * Copyright 2017 Google, Inc
+ */
+
+/dts-v1/;
+
+/ {
+ #address-cells = <1>;
+ #size-cells = <1>;
+
+ i2c@0 {
+ compatible = "sandbox,i2c";
+ bootph-all;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pmic@9 {
+ compatible = "sandbox,pmic";
+ bootph-all;
+ reg = <9>;
+ low-power;
+
+ gpio {
+ compatible = "sandbox,gpio";
+ };
+ };
+ };
+};