MIPS: of: Introduce helper function to get DTB

Selection of the DTB to be used was burried in more or less readable
code in head.S. Move this code into a inline helper function and
use it.

Signed-off-by: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
This commit is contained in:
Thomas Bogendoerfer
2021-01-27 14:24:30 +01:00
parent a056aacd2d
commit b83ba0b9df
10 changed files with 39 additions and 77 deletions

View File

@ -39,14 +39,13 @@ void __init *plat_get_fdt(void)
/* Already set up */
return (void *)fdt;
if (fw_passed_dtb && !fdt_check_header((void *)fw_passed_dtb)) {
fdt = (void *)get_fdt();
if (fdt && !fdt_check_header(fdt)) {
/*
* We have been provided with the appropriate device tree for
* the board. Make use of it & search for any machine struct
* based upon the root compatible string.
*/
fdt = (void *)fw_passed_dtb;
for_each_mips_machine(check_mach) {
match = mips_machine_is_compatible(check_mach, fdt);
if (match) {