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);
56 int dm_scan_platdata(void)
60 ret = lists_bind_drivers(DM_ROOT_NON_CONST);
62 dm_warn("Some drivers were not found\n");
71 #ifdef CONFIG_OF_CONTROL
72 int dm_scan_fdt(const void *blob)
79 offset = fdt_next_node(blob, offset, &depth);
80 if (offset > 0 && depth == 1) {
81 err = lists_bind_fdt(gd->dm_root, blob, offset);
88 dm_warn("Some drivers failed to bind\n");
94 /* This is the root driver - all drivers are children of this */
95 U_BOOT_DRIVER(root_driver) = {
96 .name = "root_driver",
100 /* This is the root uclass */
101 UCLASS_DRIVER(root) = {