From 6bccab870731a74807d6fe69aff78fcb975dfa75 Mon Sep 17 00:00:00 2001 From: Joseph Chen Date: Wed, 31 Jul 2019 22:01:50 +0800 Subject: [PATCH] fdt: fixup: move board_fdt_fixup the earliest than others If we update fdt by create or move operation, the fdt nodes offset are changed, but device node of DM didn't update its offset linking with the fdt node. This makes driver can't parse the right fdt node info. This is a DM framework bug, we need this patch to workarund it. Change-Id: I18ee427fe2457ae42e5c6d1dab3e365fe87e06e4 Signed-off-by: Joseph Chen --- arch/arm/lib/bootm-fdt.c | 8 +++++--- common/image-fdt.c | 11 +++++++---- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/arch/arm/lib/bootm-fdt.c b/arch/arm/lib/bootm-fdt.c index d564746cf2..8b9ef7de3b 100644 --- a/arch/arm/lib/bootm-fdt.c +++ b/arch/arm/lib/bootm-fdt.c @@ -40,6 +40,11 @@ __weak int board_fdt_fixup(void *blob) int arch_fixup_fdt(void *blob) { int ret = 0; + + ret = board_fdt_fixup(blob); + if (ret) + return ret; + #if defined(CONFIG_ARMV7_NONSEC) || defined(CONFIG_OF_LIBFDT) bd_t *bd = gd->bd; int bank; @@ -80,9 +85,6 @@ int arch_fixup_fdt(void *blob) return ret; #endif #endif - ret = board_fdt_fixup(blob); - if (ret) - return ret; #ifdef CONFIG_FMAN_ENET ret = fdt_update_ethernet_dt(blob); diff --git a/common/image-fdt.c b/common/image-fdt.c index 6cabd2eeff..5d01a652a5 100644 --- a/common/image-fdt.c +++ b/common/image-fdt.c @@ -562,6 +562,12 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, ulong *initrd_end = &images->initrd_end; int ret = -EPERM; int fdt_ret; + + if (arch_fixup_fdt(blob) < 0) { + printf("ERROR: arch-specific fdt fixup failed\n"); + goto err; + } + #if defined(CONFIG_PASS_DEVICE_SERIAL_BY_FDT) if (fdt_root(blob) < 0) { printf("ERROR: root node setup failed\n"); @@ -572,10 +578,7 @@ int image_setup_libfdt(bootm_headers_t *images, void *blob, printf("ERROR: /chosen node create failed\n"); goto err; } - if (arch_fixup_fdt(blob) < 0) { - printf("ERROR: arch-specific fdt fixup failed\n"); - goto err; - } + /* Update ethernet nodes */ fdt_fixup_ethernet(blob); if (IMAGE_OF_BOARD_SETUP) {