mips: octeon: convert to use unflatten_and_copy_device_tree
The octeon FDT code can be simplified by using unflatten_and_copy_device_tree function. This removes all accesses to FDT header data by the arch code. Signed-off-by: Rob Herring <robh@kernel.org> Cc: Ralf Baechle <ralf@linux-mips.org> Cc: linux-mips@linux-mips.org Tested-by: Grant Likely <grant.likely@linaro.org>
This commit is contained in:
parent
a798c10faf
commit
8c97cec990
|
@ -1053,36 +1053,26 @@ void prom_free_prom_memory(void)
|
||||||
int octeon_prune_device_tree(void);
|
int octeon_prune_device_tree(void);
|
||||||
|
|
||||||
extern const char __dtb_octeon_3xxx_begin;
|
extern const char __dtb_octeon_3xxx_begin;
|
||||||
extern const char __dtb_octeon_3xxx_end;
|
|
||||||
extern const char __dtb_octeon_68xx_begin;
|
extern const char __dtb_octeon_68xx_begin;
|
||||||
extern const char __dtb_octeon_68xx_end;
|
|
||||||
void __init device_tree_init(void)
|
void __init device_tree_init(void)
|
||||||
{
|
{
|
||||||
int dt_size;
|
const void *fdt;
|
||||||
struct boot_param_header *fdt;
|
|
||||||
bool do_prune;
|
bool do_prune;
|
||||||
|
|
||||||
if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
|
if (octeon_bootinfo->minor_version >= 3 && octeon_bootinfo->fdt_addr) {
|
||||||
fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
|
fdt = phys_to_virt(octeon_bootinfo->fdt_addr);
|
||||||
if (fdt_check_header(fdt))
|
if (fdt_check_header(fdt))
|
||||||
panic("Corrupt Device Tree passed to kernel.");
|
panic("Corrupt Device Tree passed to kernel.");
|
||||||
dt_size = be32_to_cpu(fdt->totalsize);
|
|
||||||
do_prune = false;
|
do_prune = false;
|
||||||
} else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
|
} else if (OCTEON_IS_MODEL(OCTEON_CN68XX)) {
|
||||||
fdt = (struct boot_param_header *)&__dtb_octeon_68xx_begin;
|
fdt = &__dtb_octeon_68xx_begin;
|
||||||
dt_size = &__dtb_octeon_68xx_end - &__dtb_octeon_68xx_begin;
|
|
||||||
do_prune = true;
|
do_prune = true;
|
||||||
} else {
|
} else {
|
||||||
fdt = (struct boot_param_header *)&__dtb_octeon_3xxx_begin;
|
fdt = &__dtb_octeon_3xxx_begin;
|
||||||
dt_size = &__dtb_octeon_3xxx_end - &__dtb_octeon_3xxx_begin;
|
|
||||||
do_prune = true;
|
do_prune = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copy the default tree from init memory. */
|
initial_boot_params = (void *)fdt;
|
||||||
initial_boot_params = early_init_dt_alloc_memory_arch(dt_size, 8);
|
|
||||||
if (initial_boot_params == NULL)
|
|
||||||
panic("Could not allocate initial_boot_params");
|
|
||||||
memcpy(initial_boot_params, fdt, dt_size);
|
|
||||||
|
|
||||||
if (do_prune) {
|
if (do_prune) {
|
||||||
octeon_prune_device_tree();
|
octeon_prune_device_tree();
|
||||||
|
@ -1090,7 +1080,7 @@ void __init device_tree_init(void)
|
||||||
} else {
|
} else {
|
||||||
pr_info("Using passed Device Tree.\n");
|
pr_info("Using passed Device Tree.\n");
|
||||||
}
|
}
|
||||||
unflatten_device_tree();
|
unflatten_and_copy_device_tree();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __initdata disable_octeon_edac_p;
|
static int __initdata disable_octeon_edac_p;
|
||||||
|
|
Loading…
Reference in New Issue