summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dm/device.h20
-rw-r--r--include/dm/test.h9
2 files changed, 29 insertions, 0 deletions
diff --git a/include/dm/device.h b/include/dm/device.h
index 3f0f711..20207ce 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -51,6 +51,7 @@ struct driver_info;
* @priv: Private data for this device
* @uclass: Pointer to uclass for this device
* @uclass_priv: The uclass's private data for this device
+ * @parent_priv: The parent's private data for this device
* @uclass_node: Used by uclass to link its devices
* @child_head: List of children of this device
* @sibling_node: Next device in list of all devices
@@ -67,6 +68,7 @@ struct udevice {
void *priv;
struct uclass *uclass;
void *uclass_priv;
+ void *parent_priv;
struct list_head uclass_node;
struct list_head child_head;
struct list_head sibling_node;
@@ -124,6 +126,9 @@ struct udevice_id {
* This is typically only useful for device-tree-aware drivers (those with
* an of_match), since drivers which use platdata will have the data
* provided in the U_BOOT_DEVICE() instantiation.
+ * @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.
* @ops: Driver-specific operations. This is typically a list of function
* pointers defined by the driver, to implement driver functions required by
* the uclass.
@@ -140,6 +145,7 @@ struct driver {
int (*ofdata_to_platdata)(struct udevice *dev);
int priv_auto_alloc_size;
int platdata_auto_alloc_size;
+ int per_child_auto_alloc_size;
const void *ops; /* driver-specific operations */
uint32_t flags;
};
@@ -159,6 +165,20 @@ struct driver {
void *dev_get_platdata(struct udevice *dev);
/**
+ * dev_get_parentdata() - Get the parent data for a device
+ *
+ * The parent data is data stored in the device but owned by the parent.
+ * For example, a USB device may have parent data which contains information
+ * about how to talk to the device over USB.
+ *
+ * This checks that dev is not NULL, but no other checks for now
+ *
+ * @dev Device to check
+ * @return parent data, or NULL if none
+ */
+void *dev_get_parentdata(struct udevice *dev);
+
+/**
* dev_get_priv() - Get the private data for a device
*
* This checks that dev is not NULL, but no other checks for now
diff --git a/include/dm/test.h b/include/dm/test.h
index e8e1c0b..7b04850 100644
--- a/include/dm/test.h
+++ b/include/dm/test.h
@@ -82,6 +82,15 @@ struct dm_test_uclass_priv {
int total_add;
};
+/**
+ * struct dm_test_parent_data - parent's information on each child
+ *
+ * @sum: Test value used to check parent data works correctly
+ */
+struct dm_test_parent_data {
+ int sum;
+};
+
/*
* Operation counts for the test driver, used to check that each method is
* called correctly