[PATCH 18/20] dm: Use driver_info index instead of pointer
Simon Glass
sjg at chromium.org
Fri Oct 30 04:34:29 CET 2020
At present we use a 'node' pointer in the of-platadata phandle_n_arg
structs. This is a pointer to the struct driver_info for a particular
device, and we can use it to obtain the struct udevice pointer itself.
Since we don't know the struct udevice pointer until it is allocated in
memory, we have to fix up the phandle_n_arg.node at runtime. This is
annoying since it requires that SPL's data is writable and adds a small
amount of extra (generated) code in the dm_populate_phandle_data()
function.
Now that we can find a driver_info by its index, it is easier to put the
index in the phandle_n_arg structures.
Update dtoc to do this, add a new device_get_by_driver_info_idx() to look
up a device by drive_info index and update the tests to match.
Signed-off-by: Simon Glass <sjg at chromium.org>
---
drivers/clk/clk-uclass.c | 3 +--
drivers/core/device.c | 11 +++++++++++
drivers/misc/irq-uclass.c | 2 +-
drivers/mmc/fsl_esdhc_imx.c | 7 ++-----
include/dm/device.h | 14 ++++++++++++++
include/dt-structs.h | 6 +++---
test/dm/of_platdata.c | 10 +++++-----
test/dm/test-main.c | 24 ++++++++++++++++++++----
test/py/tests/test_spl.py | 5 ++---
tools/dtoc/dtb_platdata.py | 20 ++++----------------
tools/dtoc/test_dtoc.py | 33 +++++++++++----------------------
11 files changed, 74 insertions(+), 61 deletions(-)
Applied to u-boot-dm, thanks!
More information about the U-Boot
mailing list