return -ENOENT;
}
-int lists_bind_fdt(struct udevice *parent, const void *blob, int offset,
- struct udevice **devp)
+int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp)
{
struct driver *driver = ll_entry_start(struct driver, driver);
const int n_ents = ll_entry_count(struct driver, driver);
if (devp)
*devp = NULL;
- name = fdt_get_name(blob, offset, NULL);
+ name = ofnode_get_name(node);
dm_dbg("bind node %s\n", name);
- compat_list = fdt_getprop(blob, offset, "compatible", &compat_length);
+ compat_list = (const char *)ofnode_read_prop(node, "compatible",
+ &compat_length);
if (!compat_list) {
if (compat_length == -FDT_ERR_NOTFOUND) {
dm_dbg("Device '%s' has no compatible string\n", name);
return 0;
}
- dm_warn("Device tree error at offset %d\n", offset);
+ dm_warn("Device tree error at node '%s'\n", name);
return compat_length;
}
dm_dbg(" - found match at '%s'\n", entry->name);
ret = device_bind_with_driver_data(parent, entry, name,
- id->data, offset_to_ofnode(offset), &dev);
+ id->data, node, &dev);
if (ret == -ENODEV) {
dm_dbg("Driver '%s' refuses to bind\n", entry->name);
continue;
dm_dbg(" - ignoring disabled device\n");
continue;
}
- err = lists_bind_fdt(parent, blob, offset, NULL);
+ err = lists_bind_fdt(parent, offset_to_ofnode(offset), NULL);
if (err && !ret) {
ret = err;
debug("%s: ret=%d\n", fdt_get_name(blob, offset, NULL),
* bind it anyway.
*/
if (node > 0 &&
- !lists_bind_fdt(gd->dm_root, blob, node, &dev)) {
+ !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
+ &dev)) {
if (!device_probe(dev)) {
gd->cur_serial_dev = dev;
return;
* relocation, bind it anyway.
*/
if (node > 0 &&
- !lists_bind_fdt(gd->dm_root, blob, node, &dev)) {
+ !lists_bind_fdt(gd->dm_root, offset_to_ofnode(node),
+ &dev)) {
ret = device_probe(dev);
if (ret)
return ret;
#ifndef _DM_LISTS_H_
#define _DM_LISTS_H_
+#include <dm/ofnode.h>
#include <dm/uclass-id.h>
/**
* @parent as its parent.
*
* @parent: parent device (root)
- * @blob: device tree blob
- * @offset: offset of this device tree node
+ * @node: device tree node to bind
* @devp: if non-NULL, returns a pointer to the bound device
* @return 0 if device was bound, -EINVAL if the device tree is invalid,
* other -ve value on error
*/
-int lists_bind_fdt(struct udevice *parent, const void *blob, int offset,
- struct udevice **devp);
+int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp);
/**
* device_bind_driver() - bind a device to a driver