drivers/core/root.c
int dm_init_and_scan(bool pre_reloc_only) { int ret;
ret = dm_init(); if (ret) { debug("dm_init() failed: %d\n", ret); return ret; } ret = dm_scan_platdata(pre_reloc_only); if (ret) { debug("dm_scan_platdata() failed: %d\n", ret); return ret; }
if (CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)) { ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only); if (ret) { debug("dm_scan_fdt() failed: %d\n", ret); return ret; } }
ret = dm_scan_other(pre_reloc_only); if (ret) return ret;
return 0; }
int dm_init(void) { int ret;
if (gd->dm_root) { dm_warn("Virtual root driver already exists!\n"); return -EINVAL; } INIT_LIST_HEAD(&DM_UCLASS_ROOT_NON_CONST);
#if defined(CONFIG_NEEDS_MANUAL_RELOC) fix_drivers(); fix_uclass(); fix_devices(); #endif
ret = device_bind_by_name(NULL, false, &root_info, &DM_ROOT_NON_CONST); if (ret) return ret; #if CONFIG_IS_ENABLED(OF_CONTROL) DM_ROOT_NON_CONST->of_offset = 0; #endif ret = device_probe(DM_ROOT_NON_CONST); if (ret) return ret;
return 0; }