From 00606d7e39da4a8ecfbbc19d5af252bdfdd1fcc9 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 23 Jul 2014 06:55:03 -0600 Subject: dm: Allow drivers to be marked 'before relocation' Driver model currently only operates after relocation is complete. In this state U-Boot typically has a small amount of memory available. In adding support for driver model prior to relocation we must try to use as little memory as possible. In addition, on some machines the memory has not be inited and/or the CPU is not running at full speed or the data cache is off. These can reduce execution performance, so the less initialisation that is done before relocation the better. An immediately-obvious improvement is to only initialise drivers which are actually going to be used before relocation. On many boards the only such driver is a serial UART, so this provides a very large potential benefit. Allow drivers to mark themselves as 'pre-reloc' which means that they will be initialised prior to relocation. This can be done either with a driver flag or with a 'dm,pre-reloc' device tree property. To support this, the various dm scanning function now take a 'pre_reloc_only' parameter which indicates that only drivers marked pre-reloc should be bound. Signed-off-by: Simon Glass --- include/dm/device.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'include/dm/device.h') diff --git a/include/dm/device.h b/include/dm/device.h index ae75a3f54db..46799795e48 100644 --- a/include/dm/device.h +++ b/include/dm/device.h @@ -23,6 +23,9 @@ struct driver_info; /* DM is responsible for allocating and freeing platdata */ #define DM_FLAG_ALLOC_PDATA (1 << 1) +/* DM should init this device prior to relocation */ +#define DM_FLAG_PRE_RELOC (1 << 2) + /** * struct udevice - An instance of a driver * @@ -117,6 +120,7 @@ struct udevice_id { * ops: Driver-specific operations. This is typically a list of function * pointers defined by the driver, to implement driver functions required by * the uclass. + * @flags: driver flags - see DM_FLAGS_... */ struct driver { char *name; @@ -130,6 +134,7 @@ struct driver { int priv_auto_alloc_size; int platdata_auto_alloc_size; const void *ops; /* driver-specific operations */ + uint32_t flags; }; /* Declare a new U-Boot driver */ -- cgit v1.2.3