2 * Copyright (c) 2013 Google, Inc
5 * Pavel Herrmann <morpheus.ibis@gmail.com>
7 * SPDX-License-Identifier: GPL-2.0+
13 #include <dm/device.h>
14 #include <dm/device-internal.h>
16 #include <dm/platdata.h>
17 #include <dm/uclass.h>
19 #include <linux/list.h>
21 DECLARE_GLOBAL_DATA_PTR
;
23 static const struct driver_info root_info
= {
24 .name
= "root_driver",
27 struct device
*dm_root(void)
30 dm_warn("Virtual root driver does not exist!\n");
42 dm_warn("Virtual root driver already exists!\n");
45 INIT_LIST_HEAD(&gd
->uclass_root
);
47 ret
= device_bind_by_name(NULL
, &root_info
, &gd
->dm_root
);
54 int dm_scan_platdata(void)
58 ret
= lists_bind_drivers(gd
->dm_root
);
60 dm_warn("Some drivers were not found\n");
69 #ifdef CONFIG_OF_CONTROL
70 int dm_scan_fdt(const void *blob
)
77 offset
= fdt_next_node(blob
, offset
, &depth
);
78 if (offset
> 0 && depth
== 1) {
79 err
= lists_bind_fdt(gd
->dm_root
, blob
, offset
);
86 dm_warn("Some drivers failed to bind\n");
92 /* This is the root driver - all drivers are children of this */
93 U_BOOT_DRIVER(root_driver
) = {
94 .name
= "root_driver",
98 /* This is the root uclass */
99 UCLASS_DRIVER(root
) = {