lib: utils: Add a general device tree fix-up helper

This adds a general device tree fix-up helper to do all required
device tree fix-ups for a typical platform.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Anup Patel <anup.patel@wdc.com>
This commit is contained in:
Bin Meng
2020-03-17 07:59:50 -07:00
committed by Anup Patel
parent 3f1c847d1f
commit db6a2b5c68
2 changed files with 20 additions and 0 deletions

View File

@@ -47,4 +47,17 @@ void fdt_plic_fixup(void *fdt, const char *compat);
*/
int fdt_reserved_memory_fixup(void *fdt);
/**
* General device tree fix-up
*
* This routine do all required device tree fix-ups for a typical platform.
* It fixes up the PLIC node and the reserved memory node in the device tree
* by calling the corresponding helper routines to accomplish the task.
*
* It is recommended that platform codes call this helper in their final_init()
*
* @param fdt: device tree blob
*/
void fdt_fixups(void *fdt);
#endif /* __FDT_HELPER_H__ */

View File

@@ -191,3 +191,10 @@ int fdt_reserved_memory_fixup(void *fdt)
return 0;
}
void fdt_fixups(void *fdt)
{
fdt_plic_fixup(fdt, "riscv,plic0");
fdt_reserved_memory_fixup(fdt);
}