]>
Commit | Line | Data |
---|---|---|
83d290c5 | 1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
6494d708 SG |
2 | /* |
3 | * Copyright (c) 2013 Google, Inc | |
4 | * | |
5 | * (C) Copyright 2012 | |
6 | * Pavel Herrmann <[email protected]> | |
6494d708 SG |
7 | */ |
8 | ||
9 | #ifndef _DM_LISTS_H_ | |
10 | #define _DM_LISTS_H_ | |
11 | ||
f5b5719c | 12 | #include <dm/ofnode.h> |
6494d708 SG |
13 | #include <dm/uclass-id.h> |
14 | ||
15 | /** | |
16 | * lists_driver_lookup_name() - Return u_boot_driver corresponding to name | |
17 | * | |
18 | * This function returns a pointer to a driver given its name. This is used | |
19 | * for binding a driver given its name and platdata. | |
20 | * | |
21 | * @name: Name of driver to look up | |
22 | * @return pointer to driver, or NULL if not found | |
23 | */ | |
24 | struct driver *lists_driver_lookup_name(const char *name); | |
25 | ||
26 | /** | |
27 | * lists_uclass_lookup() - Return uclass_driver based on ID of the class | |
28 | * id: ID of the class | |
29 | * | |
30 | * This function returns the pointer to uclass_driver, which is the class's | |
31 | * base structure based on the ID of the class. Returns NULL on error. | |
32 | */ | |
33 | struct uclass_driver *lists_uclass_lookup(enum uclass_id id); | |
34 | ||
f2bc6fc3 SG |
35 | /** |
36 | * lists_bind_drivers() - search for and bind all drivers to parent | |
37 | * | |
38 | * This searches the U_BOOT_DEVICE() structures and creates new devices for | |
39 | * each one. The devices will have @parent as their parent. | |
40 | * | |
81b4e751 | 41 | * @parent: parent device (root) |
f2bc6fc3 SG |
42 | * @early_only: If true, bind only drivers with the DM_INIT_F flag. If false |
43 | * bind all drivers. | |
44 | */ | |
00606d7e | 45 | int lists_bind_drivers(struct udevice *parent, bool pre_reloc_only); |
6494d708 | 46 | |
f2bc6fc3 SG |
47 | /** |
48 | * lists_bind_fdt() - bind a device tree node | |
49 | * | |
50 | * This creates a new device bound to the given device tree node, with | |
51 | * @parent as its parent. | |
52 | * | |
81b4e751 | 53 | * @parent: parent device (root) |
f5b5719c | 54 | * @node: device tree node to bind |
1f359e36 SG |
55 | * @devp: if non-NULL, returns a pointer to the bound device |
56 | * @return 0 if device was bound, -EINVAL if the device tree is invalid, | |
57 | * other -ve value on error | |
f2bc6fc3 | 58 | */ |
f5b5719c | 59 | int lists_bind_fdt(struct udevice *parent, ofnode node, struct udevice **devp); |
6494d708 | 60 | |
e33dc221 SG |
61 | /** |
62 | * device_bind_driver() - bind a device to a driver | |
63 | * | |
64 | * This binds a new device to a driver. | |
65 | * | |
66 | * @parent: Parent device | |
67 | * @drv_name: Name of driver to attach to this parent | |
68 | * @dev_name: Name of the new device thus created | |
e6cabe4a | 69 | * @devp: If non-NULL, returns the newly bound device |
e33dc221 SG |
70 | */ |
71 | int device_bind_driver(struct udevice *parent, const char *drv_name, | |
72 | const char *dev_name, struct udevice **devp); | |
73 | ||
5b9000dd SG |
74 | /** |
75 | * device_bind_driver_to_node() - bind a device to a driver for a node | |
76 | * | |
77 | * This binds a new device to a driver for a given device tree node. This | |
78 | * should only be needed if the node lacks a compatible strings. | |
79 | * | |
80 | * @parent: Parent device | |
81 | * @drv_name: Name of driver to attach to this parent | |
82 | * @dev_name: Name of the new device thus created | |
83 | * @node: Device tree node | |
e6cabe4a | 84 | * @devp: If non-NULL, returns the newly bound device |
5b9000dd SG |
85 | */ |
86 | int device_bind_driver_to_node(struct udevice *parent, const char *drv_name, | |
45a26867 | 87 | const char *dev_name, ofnode node, |
5b9000dd SG |
88 | struct udevice **devp); |
89 | ||
6494d708 | 90 | #endif |