u-boot-2016/drivers
Masahiro Yamada 608f26c51b 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>
2015-08-06 07:44:29 -06:00
..
bios_emulator biosemu: Do not free vga_info->BIOSImage when it is 0xc0000 2015-04-29 18:51:49 -06:00
block arm: mvebu: add Armada XP SATA support 2015-07-23 08:30:58 +02:00
bootcount qe: move immap_qe.h from arch directory into common directory 2014-07-22 16:25:54 -07:00
clk dm: test: Add tests for the clk uclass 2015-07-21 17:39:30 -06:00
core devres: introduce Devres (Managed Device Resource) framework 2015-08-06 07:44:29 -06:00
cpu x86: Move MP initialization codes into a common place 2015-07-14 18:03:16 -06:00
crypto drivers/crypto/fsl: clean-up - use fdt_setprop_u32 helper 2015-08-03 12:06:38 -07:00
ddr drivers/ddr/fsl: Adjust bstopre value 2015-08-03 12:06:38 -07:00
demo common: Make sure arch-specific map_sysmem() is defined 2015-04-18 11:11:09 -06:00
dfu dfu: fix 64-bit compile warnings 2015-07-27 15:53:52 -07:00
dma dma: keystone_nav: remove spurious qm_cfg verification 2014-11-06 11:04:39 -05:00
fpga fpga: xilinx: Show fpga info if defined 2015-01-21 10:25:43 +01:00
gpio dm: gpio: Check a GPIO is valid before using it 2015-08-05 21:06:14 -06:00
hwmon dtt: add ds620 support 2015-04-10 14:23:23 +02:00
i2c cros_ec: Support the LDO access method used by spring 2015-08-05 21:06:11 -06:00
input i8042: Add keyboard enable logic in kbd_reset() 2015-04-18 11:11:16 -06:00
led dm: test: Add a test for the LED uclass 2015-07-21 17:39:32 -06:00
memory ARM: keystone: aemif: move aemif driver to drivers/memory/ti-aemif.c 2014-06-19 17:53:58 -04:00
misc cros_ec: Remove the old tunnel code 2015-08-05 21:06:16 -06:00
mmc exynos: Correct return value in exynos_mmc_init() 2015-08-05 21:06:14 -06:00
mtd sf: kconfig: add kconfig options for spi flashes 2015-08-02 10:51:39 +02:00
net drivers/fsl-mc: flib changes for mc 8.0.0 2015-08-03 12:06:37 -07:00
pci lib/fdtdec: Fix compiling warning caused by changing fdt_addr_t type 2015-08-06 07:31:13 -06:00
pcmcia powerpc: mpc824x: remove MPC824X cpu support 2015-01-05 12:08:55 -05:00
power power: Remove old TPS65090 drivers 2015-08-05 21:06:16 -06:00
pwm pwm: imx: Remove unreachable code 2015-05-26 14:13:12 +02:00
qe driver/qe: use strncpy instead of strcpy 2015-08-03 12:06:36 -07:00
ram dm: test: Add a test for the ram uclass 2015-07-21 17:39:32 -06:00
rtc dm: rtc: Support mc146818 driver in driver model 2015-07-14 18:03:16 -06:00
serial exynos: Enable the debug UART in SPL 2015-08-05 21:06:11 -06:00
soc soc: keystone_serdes: generalize configuration mechanism 2014-10-23 11:27:28 -04:00
sound sandbox: exynos: Move CONFIG_SOUND_SANDBOX to Kconfig 2015-04-18 11:11:39 -06:00
spi lib/fdtdec: Fix compiling warning caused by changing fdt_addr_t type 2015-08-06 07:31:13 -06:00
thermal thermal: imx_thermal: fix busywait if IMX6 temp <0C 2015-07-10 10:15:19 +02:00
tpm tpm: Support using driver model with I2C 2015-05-14 18:49:33 -06:00
twserial drivers: convert makefiles to Kbuild style 2013-10-31 13:26:01 -04:00
usb net: smsc95xx: Add driver-model support 2015-08-06 07:44:28 -06:00
video lib/fdtdec: Fix compiling warning caused by changing fdt_addr_t type 2015-08-06 07:31:13 -06:00
watchdog watchdog/imx_watchdog: do not set WCR_WDW 2015-03-25 16:52:16 +01:00
Kconfig dm: Add a clock uclass 2015-07-21 17:39:29 -06:00
Makefile dm: Add a clock uclass 2015-07-21 17:39:29 -06:00