@@ -389,4 +389,18 @@ int fdtdec_get_byte_array(const void *blob, int node, const char *prop_name,
*/
const u8 *fdtdec_locate_byte_array(const void *blob, int node,
const char *prop_name, int count);
+
+/**
+ * Find the compatible ID for a given node.
+ *
+ * Generally each node has at least one compatible string attached to it.
+ * This function looks through our list of known compatible strings and
+ * returns the corresponding ID which matches the compatible string.
+ *
+ * @param blob FDT blob to use
+ * @param node Node containing compatible string to find
+ * @return compatible ID, or COMPAT_UNKNOWN if we cannot find a match
+ */
+enum fdt_compat_id fdtdec_lookup(const void *blob, int node);
+
#endif
@@ -516,3 +516,15 @@ const u8 *fdtdec_locate_byte_array(const void *blob, int node,
return NULL;
return cell;
}
+
+enum fdt_compat_id fdtdec_lookup(const void *blob, int node)
+{
+ enum fdt_compat_id id;
+
+ /* Search our drivers */
+ for (id = COMPAT_UNKNOWN; id < COMPAT_COUNT; id++)
+ if (0 == fdt_node_check_compatible(blob, node,
+ compat_names[id]))
+ return id;
+ return COMPAT_UNKNOWN;
+}
This patch adds api to find compatible id for a given FDT node Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com> --- include/fdtdec.h | 14 ++++++++++++++ lib/fdtdec.c | 12 ++++++++++++ 2 files changed, 26 insertions(+), 0 deletions(-)