2 * Copyright (c) 2013 Google, Inc
5 * Pavel Herrmann <morpheus.ibis@gmail.com>
7 * SPDX-License-Identifier: GPL-2.0+
14 #include <dm/device.h>
15 #include <dm/device-internal.h>
17 #include <dm/platdata.h>
18 #include <dm/uclass.h>
20 #include <linux/list.h>
22 DECLARE_GLOBAL_DATA_PTR;
24 static const struct driver_info root_info = {
25 .name = "root_driver",
28 struct udevice *dm_root(void)
31 dm_warn("Virtual root driver does not exist!\n");
43 dm_warn("Virtual root driver already exists!\n");
46 INIT_LIST_HEAD(&DM_UCLASS_ROOT_NON_CONST);
48 ret = device_bind_by_name(NULL, &root_info, &DM_ROOT_NON_CONST);
55 int dm_scan_platdata(void)
59 ret = lists_bind_drivers(DM_ROOT_NON_CONST);
61 dm_warn("Some drivers were not found\n");
70 #ifdef CONFIG_OF_CONTROL
71 int dm_scan_fdt(const void *blob)
78 offset = fdt_next_node(blob, offset, &depth);
79 if (offset > 0 && depth == 1) {
80 err = lists_bind_fdt(gd->dm_root, blob, offset);
87 dm_warn("Some drivers failed to bind\n");
93 /* This is the root driver - all drivers are children of this */
94 U_BOOT_DRIVER(root_driver) = {
95 .name = "root_driver",
99 /* This is the root uclass */
100 UCLASS_DRIVER(root) = {