All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rajeshwari Shinde <rajeshwari.s@samsung.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node
Date: Wed, 14 Nov 2012 14:41:17 +0530	[thread overview]
Message-ID: <1352884279-24067-5-git-send-email-rajeshwari.s@samsung.com> (raw)
In-Reply-To: <1352884279-24067-1-git-send-email-rajeshwari.s@samsung.com>

This patch adds api to find compatible id for a given
FDT node

Signed-off-by: Rajeshwari Shinde <rajeshwari.s@samsung.com>
Acked-by: Simon Glass <sjg@chromium.org>
---
Changes in V2:
	- None
 include/fdtdec.h |   14 ++++++++++++++
 lib/fdtdec.c     |   12 ++++++++++++
 2 files changed, 26 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index f9aac31..d501d7e 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -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
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 6e8c24c..dbfca1a 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -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;
+}
-- 
1.7.4.4

  parent reply	other threads:[~2012-11-14  9:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-14  9:11 [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Rajeshwari Shinde
2012-11-14  9:11 ` [U-Boot] [PATCH 1/6 V2] EXYNOS5: FDT: Add I2C device node data Rajeshwari Shinde
2012-11-15  6:56   ` Heiko Schocher
2012-11-15 10:58     ` Rajeshwari Birje
2012-11-15 12:14       ` Minkyu Kang
2012-11-19  8:54   ` Heiko Schocher
2012-11-19 16:42     ` Simon Glass
2012-11-20  1:36       ` Minkyu Kang
2012-11-14  9:11 ` [U-Boot] [PATCH 2/6 V2] EXYNOS5 : FDT: Add Aliases for I2C device Rajeshwari Shinde
2012-11-19  8:54   ` Heiko Schocher
2012-11-14  9:11 ` [U-Boot] [PATCH 3/6 V2] EXYNOS5: FDT: Add compatible string for I2C Rajeshwari Shinde
2012-11-19  8:54   ` Heiko Schocher
2012-11-14  9:11 ` Rajeshwari Shinde [this message]
2012-11-19  8:54   ` [U-Boot] [PATCH 4/6 V2] FDT: Api to find compatible id for a given node Heiko Schocher
2012-11-14  9:11 ` [U-Boot] [PATCH 5/6 V2] I2C: Driver changes for FDT support Rajeshwari Shinde
2012-11-14 18:45   ` Simon Glass
2012-11-15  6:59   ` Heiko Schocher
2012-11-15 11:00     ` Rajeshwari Birje
2012-11-19  8:54   ` Heiko Schocher
2012-11-14  9:11 ` [U-Boot] [PATCH 6/6 V2] SMDK5250: Initialise I2C using FDT Rajeshwari Shinde
2012-11-14 18:46   ` Simon Glass
2012-11-19  8:54   ` Heiko Schocher
2012-11-14 18:48 ` [U-Boot] [PATCH 0/6 V2] EXYNOS5: FDT Support for I2C Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1352884279-24067-5-git-send-email-rajeshwari.s@samsung.com \
    --to=rajeshwari.s@samsung.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.