1
0
mirror of https://xff.cz/git/u-boot/ synced 2025-11-02 03:17:29 +01:00

dm: Support parent devices with of-platdata

At present of-platdata does not provide parent information. But this is
useful for I2C devices, for example, since it allows them to determine
which bus they are on.

Add support for setting the parent correctly, by storing the parent
driver_info index in dtoc and reading this in lists_bind_drivers(). This
needs multiple passes since we must process children after their parents
already have been bound.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2020-10-03 11:31:35 -06:00
parent 67507e4aab
commit e41651fffd
5 changed files with 116 additions and 3 deletions

View File

@@ -22,15 +22,23 @@
* @name: Driver name
* @platdata: Driver-specific platform data
* @platdata_size: Size of platform data structure
* @parent_idx: Index of the parent driver_info structure
*/
struct driver_info {
const char *name;
const void *platdata;
#if CONFIG_IS_ENABLED(OF_PLATDATA)
uint platdata_size;
unsigned short platdata_size;
short parent_idx;
#endif
};
#if CONFIG_IS_ENABLED(OF_PLATDATA)
#define driver_info_parent_id(driver_info) driver_info->parent_idx
#else
#define driver_info_parent_id(driver_info) (-1)
#endif
/**
* driver_rt - runtime information set up by U-Boot
*