diff options
| -rw-r--r-- | drivers/of/Kconfig | 1 | ||||
| -rw-r--r-- | drivers/of/selftest.c | 9 | ||||
| -rw-r--r-- | drivers/of/testcase-data/testcases.dts | 35 |
3 files changed, 44 insertions, 1 deletions
diff --git a/drivers/of/Kconfig b/drivers/of/Kconfig index 6b81a36f6420..1a13f5b722c5 100644 --- a/drivers/of/Kconfig +++ b/drivers/of/Kconfig | |||
| @@ -11,6 +11,7 @@ config OF_SELFTEST | |||
| 11 | bool "Device Tree Runtime self tests" | 11 | bool "Device Tree Runtime self tests" |
| 12 | depends on OF_IRQ && OF_EARLY_FLATTREE | 12 | depends on OF_IRQ && OF_EARLY_FLATTREE |
| 13 | select OF_DYNAMIC | 13 | select OF_DYNAMIC |
| 14 | select OF_RESOLVE | ||
| 14 | help | 15 | help |
| 15 | This option builds in test cases for the device tree infrastructure | 16 | This option builds in test cases for the device tree infrastructure |
| 16 | that are executed once at boot time, and the results dumped to the | 17 | that are executed once at boot time, and the results dumped to the |
diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index 4f83e97f8788..4fed34bff5cf 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c | |||
| @@ -25,7 +25,7 @@ static struct selftest_results { | |||
| 25 | int failed; | 25 | int failed; |
| 26 | } selftest_results; | 26 | } selftest_results; |
| 27 | 27 | ||
| 28 | #define NO_OF_NODES 2 | 28 | #define NO_OF_NODES 3 |
| 29 | static struct device_node *nodes[NO_OF_NODES]; | 29 | static struct device_node *nodes[NO_OF_NODES]; |
| 30 | static int last_node_index; | 30 | static int last_node_index; |
| 31 | static bool selftest_live_tree; | 31 | static bool selftest_live_tree; |
| @@ -765,6 +765,7 @@ static int __init selftest_data_add(void) | |||
| 765 | extern uint8_t __dtb_testcases_begin[]; | 765 | extern uint8_t __dtb_testcases_begin[]; |
| 766 | extern uint8_t __dtb_testcases_end[]; | 766 | extern uint8_t __dtb_testcases_end[]; |
| 767 | const int size = __dtb_testcases_end - __dtb_testcases_begin; | 767 | const int size = __dtb_testcases_end - __dtb_testcases_begin; |
| 768 | int rc; | ||
| 768 | 769 | ||
| 769 | if (!size) { | 770 | if (!size) { |
| 770 | pr_warn("%s: No testcase data to attach; not running tests\n", | 771 | pr_warn("%s: No testcase data to attach; not running tests\n", |
| @@ -785,6 +786,12 @@ static int __init selftest_data_add(void) | |||
| 785 | pr_warn("%s: No tree to attach; not running tests\n", __func__); | 786 | pr_warn("%s: No tree to attach; not running tests\n", __func__); |
| 786 | return -ENODATA; | 787 | return -ENODATA; |
| 787 | } | 788 | } |
| 789 | of_node_set_flag(selftest_data_node, OF_DETACHED); | ||
| 790 | rc = of_resolve_phandles(selftest_data_node); | ||
| 791 | if (rc) { | ||
| 792 | pr_err("%s: Failed to resolve phandles (rc=%i)\n", __func__, rc); | ||
| 793 | return -EINVAL; | ||
| 794 | } | ||
| 788 | 795 | ||
| 789 | if (!of_allnodes) { | 796 | if (!of_allnodes) { |
| 790 | /* enabling flag for removing nodes */ | 797 | /* enabling flag for removing nodes */ |
diff --git a/drivers/of/testcase-data/testcases.dts b/drivers/of/testcase-data/testcases.dts index 219ef9324e9c..6994e15c24bf 100644 --- a/drivers/of/testcase-data/testcases.dts +++ b/drivers/of/testcase-data/testcases.dts | |||
| @@ -13,3 +13,38 @@ | |||
| 13 | #include "tests-interrupts.dtsi" | 13 | #include "tests-interrupts.dtsi" |
| 14 | #include "tests-match.dtsi" | 14 | #include "tests-match.dtsi" |
| 15 | #include "tests-platform.dtsi" | 15 | #include "tests-platform.dtsi" |
| 16 | |||
| 17 | /* | ||
| 18 | * phandle fixup data - generated by dtc patches that aren't upstream. | ||
| 19 | * This data must be regenerated whenever phandle references are modified in | ||
| 20 | * the testdata tree. | ||
| 21 | * | ||
| 22 | * The format of this data may be subject to change. For the time being consider | ||
| 23 | * this a kernel-internal data format. | ||
| 24 | */ | ||
| 25 | / { __local_fixups__ { | ||
| 26 | fixup = "/testcase-data/testcase-device2:interrupt-parent:0", | ||
| 27 | "/testcase-data/testcase-device1:interrupt-parent:0", | ||
| 28 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:60", | ||
| 29 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:52", | ||
| 30 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:44", | ||
| 31 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:36", | ||
| 32 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:24", | ||
| 33 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:8", | ||
| 34 | "/testcase-data/interrupts/interrupts-extended0:interrupts-extended:0", | ||
| 35 | "/testcase-data/interrupts/interrupts1:interrupt-parent:0", | ||
| 36 | "/testcase-data/interrupts/interrupts0:interrupt-parent:0", | ||
| 37 | "/testcase-data/interrupts/intmap1:interrupt-map:12", | ||
| 38 | "/testcase-data/interrupts/intmap0:interrupt-map:52", | ||
| 39 | "/testcase-data/interrupts/intmap0:interrupt-map:36", | ||
| 40 | "/testcase-data/interrupts/intmap0:interrupt-map:16", | ||
| 41 | "/testcase-data/interrupts/intmap0:interrupt-map:4", | ||
| 42 | "/testcase-data/phandle-tests/consumer-a:phandle-list-bad-args:12", | ||
| 43 | "/testcase-data/phandle-tests/consumer-a:phandle-list-bad-args:0", | ||
| 44 | "/testcase-data/phandle-tests/consumer-a:phandle-list:56", | ||
| 45 | "/testcase-data/phandle-tests/consumer-a:phandle-list:52", | ||
| 46 | "/testcase-data/phandle-tests/consumer-a:phandle-list:40", | ||
| 47 | "/testcase-data/phandle-tests/consumer-a:phandle-list:24", | ||
| 48 | "/testcase-data/phandle-tests/consumer-a:phandle-list:8", | ||
| 49 | "/testcase-data/phandle-tests/consumer-a:phandle-list:0"; | ||
| 50 | }; }; | ||
