From f11f138ebfeac8271ad5e6faed2265a9585b97fc Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 13 Apr 2020 09:38:30 +0800 Subject: [PATCH 1/4] rockchip: rv1108: use correct API for board callback Use board_early_init_f() instead of mach_cpu_init() for board, the board_early_init_f() is used for board init and after dm_initf, while the mach_cpu_init() is used for CPU/SOC and before dm_initf()(not able to use syscon API). Fixes: 9cec336708 ("rockchip: evb-rv1108: Use syscon API to get grf base") Fixes: 4aa33690fc {"rockchip: elgin-rv1108: Use syscon API to get grf base") Signed-off-by: Kever Yang --- board/elgin/elgin_rv1108/elgin_rv1108.c | 2 +- board/rockchip/evb_rv1108/evb_rv1108.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/board/elgin/elgin_rv1108/elgin_rv1108.c b/board/elgin/elgin_rv1108/elgin_rv1108.c index 5d8f62244b0..245e5abcaeb 100644 --- a/board/elgin/elgin_rv1108/elgin_rv1108.c +++ b/board/elgin/elgin_rv1108/elgin_rv1108.c @@ -15,7 +15,7 @@ DECLARE_GLOBAL_DATA_PTR; -int mach_cpu_init(void) +int board_early_init_f(void) { struct rv1108_grf *grf; enum { diff --git a/board/rockchip/evb_rv1108/evb_rv1108.c b/board/rockchip/evb_rv1108/evb_rv1108.c index c57913828d7..fc31c493116 100644 --- a/board/rockchip/evb_rv1108/evb_rv1108.c +++ b/board/rockchip/evb_rv1108/evb_rv1108.c @@ -14,7 +14,7 @@ DECLARE_GLOBAL_DATA_PTR; -int mach_cpu_init(void) +int board_early_init_f(void) { struct rv1108_grf *grf; enum { From fe4931c09ac77c775786c12148e8fd47ce4bb833 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 13 Apr 2020 09:38:31 +0800 Subject: [PATCH 2/4] rockchip: rv1108: Enable grf as pre-reloc node The grf node will be used before relocate, enable it in dts. Signed-off-by: Kever Yang --- arch/arm/dts/rv1108-u-boot.dtsi | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/dts/rv1108-u-boot.dtsi b/arch/arm/dts/rv1108-u-boot.dtsi index 41ac054b81e..6a2098b8d41 100644 --- a/arch/arm/dts/rv1108-u-boot.dtsi +++ b/arch/arm/dts/rv1108-u-boot.dtsi @@ -4,3 +4,7 @@ */ #include "rockchip-u-boot.dtsi" + +&grf { + u-boot,dm-pre-reloc; +}; From 454b792afeeca1294a780590199e9250b5c9aa64 Mon Sep 17 00:00:00 2001 From: Kever Yang Date: Mon, 13 Apr 2020 09:38:32 +0800 Subject: [PATCH 3/4] rockchip: rv1108: enable board early init Enable board early init callback to init board specific hardware. Signed-off-by: Kever Yang --- configs/elgin-rv1108_defconfig | 1 + configs/evb-rv1108_defconfig | 1 + 2 files changed, 2 insertions(+) diff --git a/configs/elgin-rv1108_defconfig b/configs/elgin-rv1108_defconfig index 54d1c29072f..5d98f1913fb 100644 --- a/configs/elgin-rv1108_defconfig +++ b/configs/elgin-rv1108_defconfig @@ -15,6 +15,7 @@ CONFIG_DEFAULT_FDT_FILE="rv1108-elgin-r1.dtb" CONFIG_BOARD_LATE_INIT=y # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_EARLY_INIT_F=y CONFIG_CMD_GPIO=y CONFIG_RANDOM_UUID=y CONFIG_CMD_MMC=y diff --git a/configs/evb-rv1108_defconfig b/configs/evb-rv1108_defconfig index ba6396af3ab..c9cbf046860 100644 --- a/configs/evb-rv1108_defconfig +++ b/configs/evb-rv1108_defconfig @@ -11,6 +11,7 @@ CONFIG_DEBUG_UART=y CONFIG_DEFAULT_FDT_FILE="rv1108-evb.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y +CONFIG_BOARD_EARLY_INIT_F=y CONFIG_RANDOM_UUID=y CONFIG_CMD_USB=y # CONFIG_CMD_SETEXPR is not set From 5b861eea7927da63f016b75265e454a19ab19d0b Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Tue, 15 Sep 2020 03:43:29 +0200 Subject: [PATCH 4/4] rockchip: make_fit_atf: ignore empty PT_LOAD segment The linker sometimes creates PT_LOAD segments with length (p_filesz) zero as described in https://man7.org/linux/man-pages/man5/elf.5.html. This leads to build failures. We should ignore empty segments. Signed-off-by: Heinrich Schuchardt Tested-by: Tom Rini Reviewed-by: Kever Yang --- arch/arm/mach-rockchip/make_fit_atf.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/arm/mach-rockchip/make_fit_atf.py b/arch/arm/mach-rockchip/make_fit_atf.py index d15c32b3032..f3224d25552 100755 --- a/arch/arm/mach-rockchip/make_fit_atf.py +++ b/arch/arm/mach-rockchip/make_fit_atf.py @@ -189,8 +189,9 @@ def unpack_elf(filename): p_type, p_flags, p_offset = struct.unpack_from(' 0: + p_data = elf[p_offset:p_offset + p_filesz] + segments.append((index, e_entry, p_paddr, p_data)) return segments def main():