#include <dm/lists.h>
#include <dm/pinctrl.h>
#include <dm/platdata.h>
+#include <dm/read.h>
#include <dm/uclass.h>
#include <dm/uclass-internal.h>
#include <dm/util.h>
*/
if (uc->uc_drv->flags & DM_UC_FLAG_SEQ_ALIAS) {
if (uc->uc_drv->name && ofnode_valid(node)) {
- fdtdec_get_alias_seq(gd->fdt_blob,
- uc->uc_drv->name,
- ofnode_to_offset(node),
- &dev->req_seq);
+ dev_read_alias_seq(dev, &dev->req_seq);
}
}
}
int device_bind_with_driver_data(struct udevice *parent,
const struct driver *drv, const char *name,
- ulong driver_data, int of_offset,
+ ulong driver_data, ofnode node,
struct udevice **devp)
{
- return device_bind_common(parent, drv, name, NULL, driver_data,
- offset_to_ofnode(of_offset), 0, devp);
+ return device_bind_common(parent, drv, name, NULL, driver_data, node,
+ 0, devp);
}
int device_bind(struct udevice *parent, const struct driver *drv,
platdata_size = info->platdata_size;
#endif
return device_bind_common(parent, drv, info->name,
- (void *)info->platdata, 0, offset_to_ofnode(-1),
- platdata_size, devp);
+ (void *)info->platdata, 0, ofnode_null(), platdata_size,
+ devp);
}
static void *alloc_priv(int size, uint flags)
goto fail;
}
- if (drv->ofdata_to_platdata && dev_of_offset(dev) >= 0) {
+ if (drv->ofdata_to_platdata && dev_has_of_node(dev)) {
ret = drv->ofdata_to_platdata(dev);
if (ret)
goto fail;
dm_dbg(" - found match at '%s'\n", entry->name);
ret = device_bind_with_driver_data(parent, entry, name,
- id->data, offset, &dev);
+ id->data, offset_to_ofnode(offset), &dev);
if (ret == -ENODEV) {
dm_dbg("Driver '%s' refuses to bind\n", entry->name);
continue;
#ifndef _DM_DEVICE_INTERNAL_H
#define _DM_DEVICE_INTERNAL_H
+#include <dm/ofnode.h>
+
+struct device_node;
struct udevice;
/**
* @drv: Device's driver
* @name: Name of device (e.g. device tree node name)
* @driver_data: The driver_data field from the driver's match table.
- * @of_offset: Offset of device tree node for this device. This is -1 for
- * devices which don't use device tree.
+ * @node: Device tree node for this device. This is invalid for devices which
+ * don't use device tree.
* @devp: if non-NULL, returns a pointer to the bound device
* @return 0 if OK, -ve on error
*/
int device_bind_with_driver_data(struct udevice *parent,
const struct driver *drv, const char *name,
- ulong driver_data, int of_offset,
+ ulong driver_data, ofnode node,
struct udevice **devp);
-
/**
* device_bind_by_name: Create a device and bind it to a driver
*