diff options
author | Przemyslaw Marczak <p.marczak@samsung.com> | 2015-04-15 13:07:18 +0200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2015-04-22 11:03:14 -0600 |
commit | 5eaed880282480a5a0a2b555c5f98a11252ed94e (patch) | |
tree | 72f503beff647cf7389f6579add462bf1b5a0727 /include/dm/device.h | |
parent | c1d6f91952d0761f61b0f0f96e4c7aa32eee2788 (diff) |
dm: core: Extend struct udevice by '.uclass_platdata' field.
This commit adds 'uclass_platdata' field to 'struct udevice', which
can be automatically allocated at bind. The allocation size is defined
in 'struct uclass_driver' as 'per_device_platdata_auto_alloc_size'.
New device's flag is added: DM_FLAG_ALLOC_UCLASS_PDATA, which is used
for memory freeing at device unbind method.
As for other udevice's fields, a complementary function is added:
- dev_get_uclass_platdata()
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com>
Cc: Simon Glass <sjg@chromium.org>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/dm/device.h')
-rw-r--r-- | include/dm/device.h | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/include/dm/device.h b/include/dm/device.h index c11342c33b2..ad002feca2f 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -30,8 +30,11 @@ struct driver_info; /* DM is responsible for allocating and freeing parent_platdata */ #define DM_FLAG_ALLOC_PARENT_PDATA (1 << 3) +/* DM is responsible for allocating and freeing uclass_platdata */ +#define DM_FLAG_ALLOC_UCLASS_PDATA (1 << 4) + /* Allocate driver private data on a DMA boundary */ -#define DM_FLAG_ALLOC_PRIV_DMA (1 << 4) +#define DM_FLAG_ALLOC_PRIV_DMA (1 << 5) /** * struct udevice - An instance of a driver @@ -54,6 +57,7 @@ struct driver_info; * @name: Name of device, typically the FDT node name * @platdata: Configuration data for this device * @parent_platdata: The parent bus's configuration data for this device + * @uclass_platdata: The uclass's configuration data for this device * @of_offset: Device tree node offset for this device (- for none) * @driver_data: Driver data word for the entry that matched this device with * its driver @@ -75,6 +79,7 @@ struct udevice { const char *name; void *platdata; void *parent_platdata; + void *uclass_platdata; int of_offset; ulong driver_data; struct udevice *parent; @@ -210,6 +215,16 @@ void *dev_get_platdata(struct udevice *dev); void *dev_get_parent_platdata(struct udevice *dev); /** + * dev_get_uclass_platdata() - Get the uclass platform data for a device + * + * This checks that dev is not NULL, but no other checks for now + * + * @dev Device to check + * @return uclass's platform data, or NULL if none + */ +void *dev_get_uclass_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. |