From 80fdef12b22ab70f9d83343016abcd3b50a87d7c Mon Sep 17 00:00:00 2001 From: Michal Simek Date: Tue, 31 Mar 2020 12:39:37 +0200 Subject: [PATCH] xilinx: Introduce board_late_init_xilinx() This function should keep common shared late configurations for Xilinx SoCs. Signed-off-by: Michal Simek --- board/bitmain/antminer_s9/Makefile | 1 + board/topic/zynq/Makefile | 1 + board/xilinx/common/board.c | 8 ++++++++ board/xilinx/common/board.h | 12 ++++++++++++ board/xilinx/versal/board.c | 5 ++--- board/xilinx/zynq/board.c | 5 ++--- board/xilinx/zynqmp/zynqmp.c | 5 ++--- 7 files changed, 28 insertions(+), 9 deletions(-) create mode 100644 board/xilinx/common/board.h diff --git a/board/bitmain/antminer_s9/Makefile b/board/bitmain/antminer_s9/Makefile index 93a1e77f72..1af01d6d80 100644 --- a/board/bitmain/antminer_s9/Makefile +++ b/board/bitmain/antminer_s9/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-y := board.o +obj-y += ../../xilinx/common/board.o # Remove quotes hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) diff --git a/board/topic/zynq/Makefile b/board/topic/zynq/Makefile index becadd2ca7..cc100b0f42 100644 --- a/board/topic/zynq/Makefile +++ b/board/topic/zynq/Makefile @@ -1,6 +1,7 @@ # SPDX-License-Identifier: GPL-2.0+ obj-y := board.o +obj-y += ../../xilinx/common/board.o # Remove quotes hw-platform-y :=$(shell echo $(CONFIG_DEFAULT_DEVICE_TREE)) diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index e83c692f21..7c191e53fb 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -8,6 +8,7 @@ #include #include #include +#include "board.h" int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) { @@ -71,3 +72,10 @@ void *board_fdt_blob_setup(void) return NULL; } #endif + +int board_late_init_xilinx(void) +{ + env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); + + return 0; +} diff --git a/board/xilinx/common/board.h b/board/xilinx/common/board.h new file mode 100644 index 0000000000..180dfbca10 --- /dev/null +++ b/board/xilinx/common/board.h @@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * (C) Copyright 2020 Xilinx, Inc. + * Michal Simek + */ + +#ifndef _BOARD_XILINX_COMMON_BOARD_H +#define _BOARD_XILINX_COMMON_BOARD_H + +int board_late_init_xilinx(void); + +#endif /* BOARD_XILINX_COMMON_BOARD_H */ diff --git a/board/xilinx/versal/board.c b/board/xilinx/versal/board.c index 75aedb0929..908ea87163 100644 --- a/board/xilinx/versal/board.c +++ b/board/xilinx/versal/board.c @@ -17,6 +17,7 @@ #include #include #include +#include "../common/board.h" DECLARE_GLOBAL_DATA_PTR; @@ -204,9 +205,7 @@ int board_late_init(void) initrd_hi = round_down(initrd_hi, SZ_16M); env_set_addr("initrd_high", (void *)initrd_hi); - env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); - - return 0; + return board_late_init_xilinx(); } int dram_init_banksize(void) diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c index 420a5ca663..2164eac8d5 100644 --- a/board/xilinx/zynq/board.c +++ b/board/xilinx/zynq/board.c @@ -17,6 +17,7 @@ #include #include #include +#include "../common/board.h" DECLARE_GLOBAL_DATA_PTR; @@ -76,9 +77,7 @@ int board_late_init(void) env_set("boot_targets", new_targets); - env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); - - return 0; + return board_late_init_xilinx(); } #if !defined(CONFIG_SYS_SDRAM_BASE) && !defined(CONFIG_SYS_SDRAM_SIZE) diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c index 3c92b1a582..b2172356ad 100644 --- a/board/xilinx/zynqmp/zynqmp.c +++ b/board/xilinx/zynqmp/zynqmp.c @@ -27,6 +27,7 @@ #include #include #include +#include "../common/board.h" #include "pm_cfg_obj.h" @@ -695,11 +696,9 @@ int board_late_init(void) initrd_hi = round_down(initrd_hi, SZ_16M); env_set_addr("initrd_high", (void *)initrd_hi); - env_set_hex("script_offset_f", CONFIG_BOOT_SCRIPT_OFFSET); - reset_reason(); - return 0; + return board_late_init_xilinx(); } #endif