summaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorMugunthan V N <mugunthanvnm@ti.com>2016-04-28 15:36:02 +0530
committerJoe Hershberger <joe.hershberger@ni.com>2016-05-24 11:42:02 -0500
commit73443b9e4c451b17d1e08164ea933ee6a849b2b3 (patch)
tree0fc80ed0bc6b1ef1d928aa61f55650a0658e9d82 /include/dm
parent24ae3961f811ee79e6c98474e21e07f8ce222dfc (diff)
downloadu-boot-imx-73443b9e4c451b17d1e08164ea933ee6a849b2b3.zip
u-boot-imx-73443b9e4c451b17d1e08164ea933ee6a849b2b3.tar.gz
u-boot-imx-73443b9e4c451b17d1e08164ea933ee6a849b2b3.tar.bz2
drivers: core: device: add support to check dt compatible for a device/machine
Provide an api to check whether the given device or machine is compatible with the given compat string which helps in making decisions in drivers based on device or machine compatible. Idea taken from Linux. Signed-off-by: Mugunthan V N <mugunthanvnm@ti.com> Reviewed-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/device.h23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index e9a8ec7..f03bcd3 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -548,6 +548,29 @@ int device_set_name(struct udevice *dev, const char *name);
void device_set_name_alloced(struct udevice *dev);
/**
+ * of_device_is_compatible() - check if the device is compatible with the compat
+ *
+ * This allows to check whether the device is comaptible with the compat.
+ *
+ * @dev: udevice pointer for which compatible needs to be verified.
+ * @compat: Compatible string which needs to verified in the given
+ * device
+ * @return true if OK, false if the compatible is not found
+ */
+bool of_device_is_compatible(struct udevice *dev, const char *compat);
+
+/**
+ * of_machine_is_compatible() - check if the machine is compatible with
+ * the compat
+ *
+ * This allows to check whether the machine is comaptible with the compat.
+ *
+ * @compat: Compatible string which needs to verified
+ * @return true if OK, false if the compatible is not found
+ */
+bool of_machine_is_compatible(const char *compat);
+
+/**
* device_is_on_pci_bus - Test if a device is on a PCI bus
*
* @dev: device to test