diff options
Diffstat (limited to 'drivers/of/fdt.c')
| -rw-r--r-- | drivers/of/fdt.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c index 6ad98e85dc93..be200be47269 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
| @@ -15,6 +15,9 @@ | |||
| 15 | #include <linux/of.h> | 15 | #include <linux/of.h> |
| 16 | #include <linux/of_fdt.h> | 16 | #include <linux/of_fdt.h> |
| 17 | 17 | ||
| 18 | int __initdata dt_root_addr_cells; | ||
| 19 | int __initdata dt_root_size_cells; | ||
| 20 | |||
| 18 | struct boot_param_header *initial_boot_params; | 21 | struct boot_param_header *initial_boot_params; |
| 19 | 22 | ||
| 20 | char *find_flat_dt_string(u32 offset) | 23 | char *find_flat_dt_string(u32 offset) |
| @@ -407,6 +410,29 @@ inline void early_init_dt_check_for_initrd(unsigned long node) | |||
| 407 | #endif /* CONFIG_BLK_DEV_INITRD */ | 410 | #endif /* CONFIG_BLK_DEV_INITRD */ |
| 408 | 411 | ||
| 409 | /** | 412 | /** |
| 413 | * early_init_dt_scan_root - fetch the top level address and size cells | ||
| 414 | */ | ||
| 415 | int __init early_init_dt_scan_root(unsigned long node, const char *uname, | ||
| 416 | int depth, void *data) | ||
| 417 | { | ||
| 418 | u32 *prop; | ||
| 419 | |||
| 420 | if (depth != 0) | ||
| 421 | return 0; | ||
| 422 | |||
| 423 | prop = of_get_flat_dt_prop(node, "#size-cells", NULL); | ||
| 424 | dt_root_size_cells = (prop == NULL) ? 1 : *prop; | ||
| 425 | pr_debug("dt_root_size_cells = %x\n", dt_root_size_cells); | ||
| 426 | |||
| 427 | prop = of_get_flat_dt_prop(node, "#address-cells", NULL); | ||
| 428 | dt_root_addr_cells = (prop == NULL) ? 2 : *prop; | ||
| 429 | pr_debug("dt_root_addr_cells = %x\n", dt_root_addr_cells); | ||
| 430 | |||
| 431 | /* break now */ | ||
| 432 | return 1; | ||
| 433 | } | ||
| 434 | |||
| 435 | /** | ||
| 410 | * unflatten_device_tree - create tree of device_nodes from flat blob | 436 | * unflatten_device_tree - create tree of device_nodes from flat blob |
| 411 | * | 437 | * |
| 412 | * unflattens the device-tree passed by the firmware, creating the | 438 | * unflattens the device-tree passed by the firmware, creating the |
