diff options
author | 2017-06-02 12:29:54 -0700 | |
---|---|---|
committer | 2017-06-28 12:22:41 +0200 | |
commit | e889dfca12ce95cdeaa50f66d1f33ad8fed4ca58 (patch) | |
tree | 6ec1327b675ad657ca051cd327e0be4a30bff5f7 /arch/mips/generic/board-sead3.c | |
parent | MIPS: generic/yamon-dt: Use serial* rather than uart* aliases (diff) | |
download | linux-e889dfca12ce95cdeaa50f66d1f33ad8fed4ca58.tar.gz linux-e889dfca12ce95cdeaa50f66d1f33ad8fed4ca58.tar.bz2 linux-e889dfca12ce95cdeaa50f66d1f33ad8fed4ca58.zip |
MIPS: generic: Abstract FDT fixup application
Introduce an apply_mips_fdt_fixups() function which can apply fixups to
an FDT based upon an array of fixup descriptions. This abstracts that
functionality such that legacy board code can apply FDT fixups without
requiring lots of duplication.
Signed-off-by: Paul Burton <paul.burton@imgtec.com>
Cc: linux-mips@linux-mips.org
Patchwork: https://patchwork.linux-mips.org/patch/16184/
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/generic/board-sead3.c')
-rw-r--r-- | arch/mips/generic/board-sead3.c | 33 |
1 files changed, 11 insertions, 22 deletions
diff --git a/arch/mips/generic/board-sead3.c b/arch/mips/generic/board-sead3.c index 97186a3a5d21..39e11bd249cf 100644 --- a/arch/mips/generic/board-sead3.c +++ b/arch/mips/generic/board-sead3.c @@ -138,6 +138,14 @@ static __init int remove_gic(void *fdt) return 0; } +static const struct mips_fdt_fixup sead3_fdt_fixups[] __initconst = { + { yamon_dt_append_cmdline, "append command line" }, + { append_memory, "append memory" }, + { remove_gic, "remove GIC when not present" }, + { yamon_dt_serial_config, "append serial configuration" }, + { }, +}; + static __init const void *sead3_fixup_fdt(const void *fdt, const void *match_data) { @@ -152,29 +160,10 @@ static __init const void *sead3_fixup_fdt(const void *fdt, fw_init_cmdline(); - err = fdt_open_into(fdt, fdt_buf, sizeof(fdt_buf)); - if (err) - panic("Unable to open FDT: %d", err); - - err = yamon_dt_append_cmdline(fdt_buf); - if (err) - panic("Unable to patch FDT: %d", err); - - err = append_memory(fdt_buf); - if (err) - panic("Unable to patch FDT: %d", err); - - err = remove_gic(fdt_buf); - if (err) - panic("Unable to patch FDT: %d", err); - - err = yamon_dt_serial_config(fdt_buf); - if (err) - panic("Unable to patch FDT: %d", err); - - err = fdt_pack(fdt_buf); + err = apply_mips_fdt_fixups(fdt_buf, sizeof(fdt_buf), + fdt, sead3_fdt_fixups); if (err) - panic("Unable to pack FDT: %d\n", err); + panic("Unable to fixup FDT: %d", err); return fdt_buf; } |