diff options
author | Rob Herring <rob.herring@calxeda.com> | 2013-08-26 10:47:40 -0400 |
---|---|---|
committer | Rob Herring <rob.herring@calxeda.com> | 2013-10-09 12:38:07 -0400 |
commit | 0288ffcbfdf9b8656e7320c24caa1e4c1d498287 (patch) | |
tree | a519e3005e4987b91227546c6e1b46ab1845532d /drivers/of/fdt.c | |
parent | 08854f41809293b283b96c642562cd4119d6b5db (diff) |
of: Introduce common early_init_dt_scan
Most architectures scan the all the same items early in the FDT and none
are really architecture specific. Create a common early_init_dt_scan to
unify the early scan of root, memory, and chosen nodes in the flattened
DT.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Acked-by: Grant Likely <grant.likely@linaro.org>
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 51776166d2b0..bfbfda543768 100644 --- a/drivers/of/fdt.c +++ b/drivers/of/fdt.c | |||
@@ -785,6 +785,32 @@ void * __init __weak early_init_dt_alloc_memory_arch(u64 size, u64 align) | |||
785 | } | 785 | } |
786 | #endif | 786 | #endif |
787 | 787 | ||
788 | bool __init early_init_dt_scan(void *params) | ||
789 | { | ||
790 | if (!params) | ||
791 | return false; | ||
792 | |||
793 | /* Setup flat device-tree pointer */ | ||
794 | initial_boot_params = params; | ||
795 | |||
796 | /* check device tree validity */ | ||
797 | if (be32_to_cpu(initial_boot_params->magic) != OF_DT_HEADER) { | ||
798 | initial_boot_params = NULL; | ||
799 | return false; | ||
800 | } | ||
801 | |||
802 | /* Retrieve various information from the /chosen node */ | ||
803 | of_scan_flat_dt(early_init_dt_scan_chosen, boot_command_line); | ||
804 | |||
805 | /* Initialize {size,address}-cells info */ | ||
806 | of_scan_flat_dt(early_init_dt_scan_root, NULL); | ||
807 | |||
808 | /* Setup memory, calling early_init_dt_add_memory_arch */ | ||
809 | of_scan_flat_dt(early_init_dt_scan_memory, NULL); | ||
810 | |||
811 | return true; | ||
812 | } | ||
813 | |||
788 | /** | 814 | /** |
789 | * unflatten_device_tree - create tree of device_nodes from flat blob | 815 | * unflatten_device_tree - create tree of device_nodes from flat blob |
790 | * | 816 | * |