1 /* SPDX-License-Identifier: GPL-2.0+ */
3 * Copyright (c) 2013 Google, Inc
12 #include <dm/ofnode.h>
13 #include <dm/uclass-id.h>
16 * lists_driver_lookup_name() - Return u_boot_driver corresponding to name
18 * This function returns a pointer to a driver given its name. This is used
19 * for binding a driver given its name and plat.
21 * @name: Name of driver to look up
22 * Return: pointer to driver, or NULL if not found
24 struct driver *lists_driver_lookup_name(const char *name);
27 * lists_uclass_lookup() - Return uclass_driver based on ID of the class
29 * @id: ID of the class
31 * This function returns the pointer to uclass_driver, which is the class's
32 * base structure based on the ID of the class. Returns NULL on error.
34 struct uclass_driver *lists_uclass_lookup(enum uclass_id id);
37 * lists_bind_drivers() - search for and bind all drivers to parent
39 * This searches the U_BOOT_DRVINFO() structures and creates new devices for
40 * each one. The devices will have @parent as their parent.
42 * @parent: parent device (root)
43 * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC flag.
44 * If false bind all drivers.
46 int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only);
49 * lists_bind_fdt() - bind a device tree node
51 * This creates a new device bound to the given device tree node, with
52 * @parent as its parent.
54 * @parent: parent device (root)
55 * @node: device tree node to bind
56 * @devp: if non-NULL, returns a pointer to the bound device
57 * @drv: if non-NULL, force this driver to be bound
58 * @pre_reloc_only: If true, bind only nodes with special devicetree properties,
59 * or drivers with the DM_FLAG_PRE_RELOC flag. If false bind all drivers.
61 * Return: 0 if device was bound, -EINVAL if the device tree is invalid,
62 * other -ve value on error
64 int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp,
65 struct driver *drv, bool pre_reloc_only);
68 * device_bind_driver() - bind a device to a driver
70 * This binds a new device to a driver.
72 * @parent: Parent device
73 * @drv_name: Name of driver to attach to this parent
74 * @dev_name: Name of the new device thus created
75 * @devp: If non-NULL, returns the newly bound device
76 * Return: 0 if OK, -ve on error
78 int device_bind_driver(struct udevice *parent, const char *drv_name,
79 const char *dev_name, struct udevice **devp);
82 * device_bind_driver_to_node() - bind a device to a driver for a node
84 * This binds a new device to a driver for a given device tree node. This
85 * should only be needed if the node lacks a compatible strings.
87 * @parent: Parent device
88 * @drv_name: Name of driver to attach to this parent
89 * @dev_name: Name of the new device thus created
90 * @node: Device tree node
91 * @devp: If non-NULL, returns the newly bound device
92 * Return: 0 if OK, -ve on error
94 int device_bind_driver_to_node(struct udevice *parent, const char *drv_name,
95 const char *dev_name, ofnode node,
96 struct udevice **devp);