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>
19 #include <dm/uclass.h>
21 #include <linux/list.h>
23 DECLARE_GLOBAL_DATA_PTR;
25 static const struct driver_info root_info = {
26 .name = "root_driver",
29 struct udevice *dm_root(void)
32 dm_warn("Virtual root driver does not exist!\n");
44 dm_warn("Virtual root driver already exists!\n");
47 INIT_LIST_HEAD(&DM_UCLASS_ROOT_NON_CONST);
49 ret = device_bind_by_name(NULL, &root_info, &DM_ROOT_NON_CONST);
52 ret = device_probe(DM_ROOT_NON_CONST);
61 device_remove(dm_root());
62 device_unbind(dm_root());
67 int dm_scan_platdata(void)
71 ret = lists_bind_drivers(DM_ROOT_NON_CONST);
73 dm_warn("Some drivers were not found\n");
82 #ifdef CONFIG_OF_CONTROL
83 int dm_scan_fdt(const void *blob)
90 offset = fdt_next_node(blob, offset, &depth);
91 if (offset > 0 && depth == 1) {
92 err = lists_bind_fdt(gd->dm_root, blob, offset);
99 dm_warn("Some drivers failed to bind\n");
105 /* This is the root driver - all drivers are children of this */
106 U_BOOT_DRIVER(root_driver) = {
107 .name = "root_driver",
111 /* This is the root uclass */
112 UCLASS_DRIVER(root) = {