summaryrefslogtreecommitdiffstats
path: root/include/dm
diff options
context:
space:
mode:
authorTom Rini <trini@ti.com>2014-10-22 13:51:45 -0400
committerTom Rini <trini@ti.com>2014-10-22 13:51:45 -0400
commit68e80fdda1336068f40915388bbdacfd2b75233a (patch)
treedeb28e65fdd601e47bf5564f67da3035a840e284 /include/dm
parent35d4fed320d577a4446531d7b9350ce40065c4b0 (diff)
parent8a9cd5ad6f89ab721a352cbb9264bea5ede68789 (diff)
downloadblackbird-obmc-uboot-68e80fdda1336068f40915388bbdacfd2b75233a.tar.gz
blackbird-obmc-uboot-68e80fdda1336068f40915388bbdacfd2b75233a.zip
Merge git://git.denx.de/u-boot-dm
Diffstat (limited to 'include/dm')
-rw-r--r--include/dm/device-internal.h13
-rw-r--r--include/dm/device.h31
-rw-r--r--include/dm/lists.h4
-rw-r--r--include/dm/platdata.h8
-rw-r--r--include/dm/uclass-id.h6
-rw-r--r--include/dm/uclass.h1
-rw-r--r--include/dm/util.h1
7 files changed, 60 insertions, 4 deletions
diff --git a/include/dm/device-internal.h b/include/dm/device-internal.h
index 7005d03d08..44cb7ef93b 100644
--- a/include/dm/device-internal.h
+++ b/include/dm/device-internal.h
@@ -66,6 +66,19 @@ int device_bind_by_name(struct udevice *parent, bool pre_reloc_only,
int device_probe(struct udevice *dev);
/**
+ * device_probe() - Probe a child device, activating it
+ *
+ * Activate a device so that it is ready for use. All its parents are probed
+ * first. The child is provided with parent data if parent_priv is not NULL.
+ *
+ * @dev: Pointer to device to probe
+ * @parent_priv: Pointer to parent data. If non-NULL then this is provided to
+ * the child.
+ * @return 0 if OK, -ve on error
+ */
+int device_probe_child(struct udevice *dev, void *parent_priv);
+
+/**
* device_remove() - Remove a device, de-activating it
*
* De-activate a device so that it is no longer ready for use. All its
diff --git a/include/dm/device.h b/include/dm/device.h
index c8a4072bcf..9ce95a834e 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -57,7 +57,8 @@ struct driver_info;
* @sibling_node: Next device in list of all devices
* @flags: Flags for this device DM_FLAG_...
* @req_seq: Requested sequence number for this device (-1 = any)
- * @seq: Allocated sequence number for this device (-1 = none)
+ * @seq: Allocated sequence number for this device (-1 = none). This is set up
+ * when the device is probed and will be unique within the device's uclass.
*/
struct udevice {
struct driver *driver;
@@ -96,6 +97,12 @@ struct udevice_id {
ulong data;
};
+#ifdef CONFIG_OF_CONTROL
+#define of_match_ptr(_ptr) (_ptr)
+#else
+#define of_match_ptr(_ptr) NULL
+#endif /* CONFIG_OF_CONTROL */
+
/**
* struct driver - A driver for a feature or peripheral
*
@@ -133,6 +140,10 @@ struct udevice_id {
* @per_child_auto_alloc_size: Each device can hold private data owned by
* its parent. If required this will be automatically allocated if this
* value is non-zero.
+ * TODO(sjg@chromium.org): I'm considering dropping this, and just having
+ * device_probe_child() pass it in. So far the use case for allocating it
+ * is SPI, but I found that unsatisfactory. Since it is here I will leave it
+ * until things are clearer.
* @ops: Driver-specific operations. This is typically a list of function
* pointers defined by the driver, to implement driver functions required by
* the uclass.
@@ -274,4 +285,22 @@ int device_find_child_by_of_offset(struct udevice *parent, int of_offset,
int device_get_child_by_of_offset(struct udevice *parent, int seq,
struct udevice **devp);
+/**
+ * device_find_first_child() - Find the first child of a device
+ *
+ * @parent: Parent device to search
+ * @devp: Returns first child device, or NULL if none
+ * @return 0
+ */
+int device_find_first_child(struct udevice *parent, struct udevice **devp);
+
+/**
+ * device_find_first_child() - Find the first child of a device
+ *
+ * @devp: Pointer to previous child device on entry. Returns pointer to next
+ * child device, or NULL if none
+ * @return 0
+ */
+int device_find_next_child(struct udevice **devp);
+
#endif
diff --git a/include/dm/lists.h b/include/dm/lists.h
index 2356895246..704e33e37f 100644
--- a/include/dm/lists.h
+++ b/include/dm/lists.h
@@ -38,7 +38,7 @@ struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
* This searches the U_BOOT_DEVICE() structures and creates new devices for
* each one. The devices will have @parent as their parent.
*
- * @parent: parent driver (root)
+ * @parent: parent device (root)
* @early_only: If true, bind only drivers with the DM_INIT_F flag. If false
* bind all drivers.
*/
@@ -50,7 +50,7 @@ int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only);
* This creates a new device bound to the given device tree node, with
* @parent as its parent.
*
- * @parent: parent driver (root)
+ * @parent: parent device (root)
* @blob: device tree blob
* @offset: offset of this device tree node
* @devp: if non-NULL, returns a pointer to the bound device
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index 2bc8b147ed..fbc8a6b3ad 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -11,10 +11,12 @@
#ifndef _DM_PLATDATA_H
#define _DM_PLATDATA_H
+#include <linker_lists.h>
+
/**
* struct driver_info - Information required to instantiate a device
*
- * @name: Device name
+ * @name: Driver name
* @platdata: Driver-specific platform data
*/
struct driver_info {
@@ -25,4 +27,8 @@ struct driver_info {
#define U_BOOT_DEVICE(__name) \
ll_entry_declare(struct driver_info, __name, driver_info)
+/* Declare a list of devices. The argument is a driver_info[] array */
+#define U_BOOT_DEVICES(__name) \
+ ll_entry_declare_list(struct driver_info, __name, driver_info)
+
#endif
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index 7f0e37b7b7..a8944c97d0 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -18,10 +18,16 @@ enum uclass_id {
UCLASS_TEST,
UCLASS_TEST_FDT,
UCLASS_TEST_BUS,
+ UCLASS_SPI_EMUL, /* sandbox SPI device emulator */
+ UCLASS_SIMPLE_BUS,
/* U-Boot uclasses start here */
UCLASS_GPIO, /* Bank of general-purpose I/O pins */
UCLASS_SERIAL, /* Serial UART */
+ UCLASS_SPI, /* SPI bus */
+ UCLASS_SPI_GENERIC, /* Generic SPI flash target */
+ UCLASS_SPI_FLASH, /* SPI flash */
+ UCLASS_CROS_EC, /* Chrome OS EC */
UCLASS_COUNT,
UCLASS_INVALID = -1,
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 8d09ecff7b..f6ec6d7e9f 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -11,6 +11,7 @@
#define _DM_UCLASS_H
#include <dm/uclass-id.h>
+#include <linker_lists.h>
#include <linux/list.h>
/**
diff --git a/include/dm/util.h b/include/dm/util.h
index 8be64a921d..6ac3a38ef0 100644
--- a/include/dm/util.h
+++ b/include/dm/util.h
@@ -5,6 +5,7 @@
*/
#ifndef __DM_UTIL_H
+#define __DM_UTIL_H
void dm_warn(const char *fmt, ...);
OpenPOWER on IntegriCloud