summaryrefslogtreecommitdiff
path: root/tools/dtoc/test/dtoc_test_single_reg.dts
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-03-26 06:17:27 +0300
committerSimon Glass <sjg@chromium.org>2021-04-06 07:33:19 +0300
commitda393412234a37af68188e7490eba136c832a275 (patch)
tree637eaafb06d762d0a850504a3f5e0b8042022bcd /tools/dtoc/test/dtoc_test_single_reg.dts
parent3e200caff05bccc86392ba531770ebb0879ef93e (diff)
downloadu-boot-da393412234a37af68188e7490eba136c832a275.tar.xz
dtoc: Improve handling of reg properties
This existing code assumes that a reg property is larger than one cell, but this is not always the case. Fix this assumption. Also if a node's parent is missing the #address-cells and #size-cells properties we use 2 as a default for each. But this should not happen in practice. More likely the properties were removed for SPL due to there being no 'u-boot,dm-pre-reloc' property, or similar. Add a warning for this as the failure can be very confusing. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools/dtoc/test/dtoc_test_single_reg.dts')
-rw-r--r--tools/dtoc/test/dtoc_test_single_reg.dts30
1 files changed, 30 insertions, 0 deletions
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 0000000000..804b67855b
--- /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";
+ u-boot,dm-pre-reloc;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ pmic@9 {
+ compatible = "sandbox,pmic";
+ u-boot,dm-pre-reloc;
+ reg = <9>;
+ low-power;
+
+ gpio {
+ compatible = "sandbox,gpio";
+ };
+ };
+ };
+};