summaryrefslogtreecommitdiff
path: root/include/dm
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-11-24 12:01:48 -0500
committerTom Rini <trini@ti.com>2014-11-24 12:01:48 -0500
commit1739564e753bc3a8097f8937a3cbe738bdaaed5d (patch)
tree56fe759e62f129dc055b6f6a22f299f6c8b5cdde /include/dm
parent746667f1e56bf08d03e66a178df3c4f4f6c806e1 (diff)
parent17b28edb37a33d0c89089faf36e4edd7084f65fa (diff)
downloadu-boot-imx-1739564e753bc3a8097f8937a3cbe738bdaaed5d.zip
u-boot-imx-1739564e753bc3a8097f8937a3cbe738bdaaed5d.tar.gz
u-boot-imx-1739564e753bc3a8097f8937a3cbe738bdaaed5d.tar.bz2
Merge git://git.denx.de/u-boot-dm
Conflicts: drivers/serial/serial-uclass.c Signed-off-by: Tom Rini <trini@ti.com>
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/device-internal.h10
-rw-r--r--include/dm/device.h19
-rw-r--r--include/dm/lists.h13
-rw-r--r--include/dm/util.h6
4 files changed, 48 insertions, 0 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 44cb7ef..f0cc794 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -87,7 +87,11 @@ int device_probe_child(struct udevice *dev, void *parent_priv);
* @dev: Pointer to device to remove
* @return 0 if OK, -ve on error (an error here is normally a very bad thing)
*/
+#ifdef CONFIG_DM_DEVICE_REMOVE
int device_remove(struct udevice *dev);
+#else
+static inline int device_remove(struct udevice *dev) { return 0; }
+#endif
/**
* device_unbind() - Unbind a device, destroying it
@@ -99,6 +103,12 @@ int device_remove(struct udevice *dev);
*/
int device_unbind(struct udevice *dev);
+#ifdef CONFIG_DM_DEVICE_REMOVE
+void device_free(struct udevice *dev);
+#else
+static inline void device_free(struct udevice *dev) {}
+#endif
+
/* Cast away any volatile pointer */
#define DM_ROOT_NON_CONST (((gd_t *)gd)->dm_root)
#define DM_UCLASS_ROOT_NON_CONST (((gd_t *)gd)->uclass_root)
diff --git a/include/dm/device.h b/include/dm/device.h
index 9ce95a8..13598a1 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -47,6 +47,7 @@ struct driver_info;
* @name: Name of device, typically the FDT node name
* @platdata: Configuration data for this device
* @of_offset: Device tree node offset for this device (- for none)
+ * @of_id: Pointer to the udevice_id structure which created the device
* @parent: Parent of this device, or NULL for the top level device
* @priv: Private data for this device
* @uclass: Pointer to uclass for this device
@@ -65,6 +66,7 @@ struct udevice {
const char *name;
void *platdata;
int of_offset;
+ const struct udevice_id *of_id;
struct udevice *parent;
void *priv;
struct uclass *uclass;
@@ -206,6 +208,23 @@ void *dev_get_parentdata(struct udevice *dev);
void *dev_get_priv(struct udevice *dev);
/**
+ * struct dev_get_parent() - Get the parent of a device
+ *
+ * @child: Child to check
+ * @return parent of child, or NULL if this is the root device
+ */
+struct udevice *dev_get_parent(struct udevice *child);
+
+/**
+ * dev_get_of_data() - get the device tree data used to bind a device
+ *
+ * When a device is bound using a device tree node, it matches a
+ * particular compatible string as in struct udevice_id. This function
+ * returns the associated data value for that compatible string
+ */
+ulong dev_get_of_data(struct udevice *dev);
+
+/**
* device_get_child() - Get the child of a device by index
*
* Returns the numbered child, 0 being the first. This does not use
diff --git a/include/dm/lists.h b/include/dm/lists.h
index 704e33e..1b50af9 100644
--- a/include/dm/lists.h
+++ b/include/dm/lists.h
@@ -60,4 +60,17 @@ int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only);
int lists_bind_fdt(struct udevice *parent, const void *blob, int offset,
struct udevice **devp);
+/**
+ * device_bind_driver() - bind a device to a driver
+ *
+ * This binds a new device to a driver.
+ *
+ * @parent: Parent device
+ * @drv_name: Name of driver to attach to this parent
+ * @dev_name: Name of the new device thus created
+ * @devp: Returns the newly bound device
+ */
+int device_bind_driver(struct udevice *parent, const char *drv_name,
+ const char *dev_name, struct udevice **devp);
+
#endif
diff --git a/include/dm/util.h b/include/dm/util.h
index 6ac3a38..0cec17b 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -7,7 +7,13 @@
#ifndef __DM_UTIL_H
#define __DM_UTIL_H
+#ifdef CONFIG_DM_WARN
void dm_warn(const char *fmt, ...);
+#else
+static inline void dm_warn(const char *fmt, ...)
+{
+}
+#endif
#ifdef DEBUG
void dm_dbg(const char *fmt, ...);