| #
608f26c5 |
| 25-Jul-2015 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
devres: introduce Devres (Managed Device Resource) framework
In U-Boot's driver model, memory is basically allocated and freed in the core framework. So, low level drivers generally only have to sp
devres: introduce Devres (Managed Device Resource) framework
In U-Boot's driver model, memory is basically allocated and freed in the core framework. So, low level drivers generally only have to specify the size of needed memory with .priv_auto_alloc_size, .platdata_auto_alloc_size, etc. Nevertheless, some drivers still need to allocate/free memory on their own in case they cannot statically know the necessary memory size. So, I believe it is reasonable enough to port Devres into U-boot.
Devres, which originates in Linux, manages device resources for each device and automatically releases them on driver detach. With devres, device resources are guaranteed to be freed whether initialization fails half-way or the device gets detached.
The basic idea is totally the same to that of Linux, but I tweaked it a bit so that it fits in U-Boot's driver model.
In U-Boot, drivers are activated in two steps: binding and probing. Binding puts a driver and a device together. It is just data manipulation on the system memory, so nothing has happened on the hardware device at this moment. When the device is really used, it is probed. Probing initializes the real hardware device to make it really ready for use.
So, the resources acquired during the probing process must be freed when the device is removed. Likewise, what has been allocated in binding should be released when the device is unbound. The struct devres has a member "probe" to remember when the resource was allocated.
CONFIG_DEBUG_DEVRES is also supported for easier debugging. If enabled, debug messages are printed each time a resource is allocated/freed.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
aed1a4dd |
| 25-Jul-2015 |
Masahiro Yamada <yamada.masahiro@socionext.com> |
dm: add DM_FLAG_BOUND flag
Currently, we only have DM_FLAG_ACTIVATED to indicate the device status, but we still cannot know in which stage is in progress, binding or probing.
This commit introduce
dm: add DM_FLAG_BOUND flag
Currently, we only have DM_FLAG_ACTIVATED to indicate the device status, but we still cannot know in which stage is in progress, binding or probing.
This commit introduces a new flag, DM_FLAG_BOUND, which is set when the device is really bound, and cleared when it is unbound.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
1a2728ae |
| 05-Aug-2015 |
Tom Rini <trini@konsulko.com> |
Merge git://git.denx.de/u-boot-x86
|
| #
3f416f33 |
| 27-Jul-2015 |
Simon Glass <sjg@chromium.org> |
dm: Add a return value comment to device_get_child()
At present this function does not specify its return value. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.c
dm: Add a return value comment to device_get_child()
At present this function does not specify its return value. Fix it.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
show more ...
|
| #
132f9bfc |
| 23-Jun-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Correct device_get_child_by_of_offset() parameter
This parameter is named 'seq' but should be named 'of_offset'.
Signed-off-by: Simon Glass <sjg@chromium.org>
|
| #
2693047a |
| 23-Jun-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a function to find any device from device tree
In some rare cases it is useful to be able to locate a device given a device tree node offset. An example is when you have an alias that
dm: core: Add a function to find any device from device tree
In some rare cases it is useful to be able to locate a device given a device tree node offset. An example is when you have an alias that points to a node and you want to find the associated device. The device may be SPI, MMC or something else, but you don't need to know the uclass to find it.
Add a function to do a global search for a device, given its device tree offset.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
b939689c |
| 05-May-2015 |
Albert ARIBAUD <albert.u.boot@aribaud.net> |
Merge branch 'u-boot/master' into 'u-boot-arm/master'
|
| #
5f757cdc |
| 23-Apr-2015 |
Tom Rini <trini@konsulko.com> |
Merge branch 'master' of git://git.denx.de/u-boot-dm
|
| #
f9c370dc |
| 15-Apr-2015 |
Przemyslaw Marczak <p.marczak@samsung.com> |
dm: core: device: add function: dev_get_uclass_name()
This commit extends the driver model device's API by function: - dev_get_uclass_name()
And this function returns the device's uclass driver nam
dm: core: device: add function: dev_get_uclass_name()
This commit extends the driver model device's API by function: - dev_get_uclass_name()
And this function returns the device's uclass driver name if: - given dev pointer, is non_NULL otherwise, the NULL pointer is returned.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
cc73d37b |
| 15-Apr-2015 |
Przemyslaw Marczak <p.marczak@samsung.com> |
dm: core: device: add function: dev_get_driver_ops()
This commit extends the driver model device's API by function: - dev_get_driver_ops()
And this function returns the device's driver's operations
dm: core: device: add function: dev_get_driver_ops()
This commit extends the driver model device's API by function: - dev_get_driver_ops()
And this function returns the device's driver's operations if given: - dev pointer, is non-NULL - dev->driver->ops pointer, is non-NULL in other case the, the NULL pointer is returned.
Signed-off-by: Przemyslaw Marczak <p.marczak@samsung.com> Cc: Simon Glass <sjg@chromium.org> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
5eaed880 |
| 15-Apr-2015 |
Przemyslaw Marczak <p.marczak@samsung.com> |
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 define
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>
show more ...
|
| #
c5785673 |
| 25-Mar-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Add device children and sibling functions
Add some utility functions to check for children and for the last sibling in a device's parent.
Signed-off-by: Simon Glass <sjg@chromium.org> Rev
dm: core: Add device children and sibling functions
Add some utility functions to check for children and for the last sibling in a device's parent.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
show more ...
|
| #
39de8433 |
| 25-Mar-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Rename driver data function to dev_get_driver_data()
The existing get_get_of_data() function provides access to both the driver's compatible string and its driver data. However only the la
dm: core: Rename driver data function to dev_get_driver_data()
The existing get_get_of_data() function provides access to both the driver's compatible string and its driver data. However only the latter is actually useful. Update the interface to reflect this and fix up existing users.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
show more ...
|
| #
3479253d |
| 25-Mar-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Convert driver_bind() to use const
The driver is not modified by driver model, so update driver_bind() to recognise that.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek
dm: core: Convert driver_bind() to use const
The driver is not modified by driver model, so update driver_bind() to recognise that.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
show more ...
|
| #
2c03c463 |
| 25-Mar-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Support allocating driver-private data for DMA
Some driver want to put DMA buffers in their private data. Add a flag to tell driver model to align driver-private data to a cache boundary s
dm: core: Support allocating driver-private data for DMA
Some driver want to put DMA buffers in their private data. Add a flag to tell driver model to align driver-private data to a cache boundary so that DMA will work correctly in this case.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Marek Vasut <marex@denx.de>
show more ...
|
| #
e564f054 |
| 05-Mar-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Add dev_get_uclass_priv() to access uclass private data
Add a convenience function to access the private data that a uclass stores for each of its devices. Convert over most existing uses
dm: core: Add dev_get_uclass_priv() to access uclass private data
Add a convenience function to access the private data that a uclass stores for each of its devices. Convert over most existing uses for consistency and to provide an example for others.
Signed-off-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
b9cb6482 |
| 02-Mar-2015 |
Stefano Babic <sbabic@denx.de> |
Merge branch 'master' of git://git.denx.de/u-boot
|
| #
e1cc4d31 |
| 24-Feb-2015 |
Albert ARIBAUD <albert.u.boot@aribaud.net> |
Merge remote-tracking branch 'u-boot/master' into 'u-boot-arm/master'
|
| #
757566d1 |
| 13-Feb-2015 |
Tom Rini <trini@ti.com> |
Merge git://git.denx.de/u-boot-dm
|
| #
e72d3443 |
| 13-Feb-2015 |
Stefano Babic <sbabic@denx.de> |
Merge branch 'master' of git://git.denx.de/u-boot
|
| #
c9cac3f8 |
| 10-Feb-2015 |
Peng Fan <Peng.Fan@freescale.com> |
dm: introduce dev_get_addr interface
Abstracting dev_get_addr can improve drivers that want to get device's address.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Acked-by: Igor Grinberg <grinbe
dm: introduce dev_get_addr interface
Abstracting dev_get_addr can improve drivers that want to get device's address.
Signed-off-by: Peng Fan <Peng.Fan@freescale.com> Acked-by: Igor Grinberg <grinberg@compulab.co.il> Acked-by: Simon Glass <sjg@chromium.org>
show more ...
|
| #
8e3da9dd |
| 30-Jan-2015 |
Tom Rini <trini@ti.com> |
Merge branch 'master' of git://git.denx.de/u-boot-dm
|
| #
b3670531 |
| 25-Jan-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a function to get a device's uclass ID
This is useful to check which uclass a device is in.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.pan
dm: core: Add a function to get a device's uclass ID
This is useful to check which uclass a device is in.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
show more ...
|
| #
0118ce79 |
| 25-Jan-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Add a post_bind method for parents
Allow parent drivers to be called when a new child is bound to them. This allows a bus to set up information it needs for that child.
Signed-off-by: Sim
dm: core: Add a post_bind method for parents
Allow parent drivers to be called when a new child is bound to them. This allows a bus to set up information it needs for that child.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
show more ...
|
| #
cdc133bd |
| 25-Jan-2015 |
Simon Glass <sjg@chromium.org> |
dm: core: Allow parents to have platform data for their children
For buses it is common for parents to need to know the address of the child on the bus, the bus speed to use for that child, and othe
dm: core: Allow parents to have platform data for their children
For buses it is common for parents to need to know the address of the child on the bus, the bus speed to use for that child, and other information. This can be provided in platform data attached to each child.
Add driver model support for this, including auto-allocation which can be requested using a new property to specify the size of the data.
Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
show more ...
|