[fdt] Use phandle as device location

Consumption of phandles will be in the form of locating a functional
device (e.g. a GPIO device, or an I2C device, or a reset controller)
by phandle, rather than locating the device tree node to which the
phandle refers.

Repurpose fdt_phandle() to obtain the phandle value (instead of
searching by phandle), and record this value as the bus location
within the generic device structure.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2025-08-04 14:52:00 +01:00
parent f7a1e9ef8e
commit 5f10b74555
4 changed files with 34 additions and 62 deletions

View File

@@ -219,6 +219,7 @@ int dt_probe_node ( struct device *parent, unsigned int offset ) {
dt->name = dt->dev.name;
snprintf ( dt->dev.name, sizeof ( dt->dev.name ), "%s", name );
dt->dev.desc.bus_type = BUS_TYPE_DT;
dt->dev.desc.location = fdt_phandle ( &sysfdt, offset );
dt->dev.parent = parent;
INIT_LIST_HEAD ( &dt->dev.children );
list_add_tail ( &dt->dev.siblings, &parent->children );