- for (entry = driver; entry != driver + n_ents; entry++) {
- ret = driver_check_compatible(blob, offset, entry->of_match,
- &id);
- name = fdt_get_name(blob, offset, NULL);
- if (ret == -ENOENT) {
+ name = ofnode_get_name(node);
+ pr_debug("bind node %s\n", name);
+
+ compat_list = ofnode_get_property(node, "compatible", &compat_length);
+ if (!compat_list) {
+ if (compat_length == -FDT_ERR_NOTFOUND) {
+ pr_debug("Device '%s' has no compatible string\n",
+ name);
+ return 0;
+ }
+
+ dm_warn("Device tree error at node '%s'\n", name);
+ return compat_length;
+ }
+
+ /*
+ * Walk through the compatible string list, attempting to match each
+ * compatible string in order such that we match in order of priority
+ * from the first string to the last.
+ */
+ for (i = 0; i < compat_length; i += strlen(compat) + 1) {
+ compat = compat_list + i;
+ pr_debug(" - attempt to match compatible string '%s'\n",
+ compat);
+
+ for (entry = driver; entry != driver + n_ents; entry++) {
+ ret = driver_check_compatible(entry->of_match, &id,
+ compat);
+ if (!ret)
+ break;
+ }
+ if (entry == driver + n_ents)