diff mbox series

[1/1] boot/uboot: allow to use custom ps7_init files for zynq7000 SoC

Message ID 20240311215903.10569-1-zaporozhets.taras@gmail.com
State New
Headers show
Series [1/1] boot/uboot: allow to use custom ps7_init files for zynq7000 SoC | expand

Commit Message

Taras Zaporozhets March 11, 2024, 9:59 p.m. UTC
Similar to zynqmp, add an option to pass init files from the outside.

Signed-off-by: Taras Zaporozhets <zaporozhets.taras@gmail.com>
---
 boot/uboot/Config.in | 37 +++++++++++++++++++++++++++++++++++++
 boot/uboot/uboot.mk  | 14 ++++++++++++++
 2 files changed, 51 insertions(+)
diff mbox series

Patch

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index beafb38930..4eeab458fa 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -512,6 +512,12 @@  config BR2_TARGET_UBOOT_ZYNQMP
 	help
 	  Enable options specific to the Xilinx ZynqMP family of SoCs.
 
+config BR2_TARGET_UBOOT_ZYNQ
+	bool "Boot on the Xilinx Zynq 7000 SoCs"
+	depends on BR2_cortex_a9
+	help
+	  Enable options specific to the Xilinx Zynq 7000 SoCs.
+
 if BR2_TARGET_UBOOT_ZYNQMP
 
 config BR2_TARGET_UBOOT_ZYNQMP_PMUFW
@@ -588,6 +594,37 @@  config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE
 
 endif
 
+if BR2_TARGET_UBOOT_ZYNQ
+
+config BR2_TARGET_UBOOT_ZYNQ_PS7_INIT_FILE
+	string "Custom ps7_init_gpl file"
+	depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG
+	help
+	  On Zynq 7000 the booloader is responsible for some basic
+	  initializations, such as enabling peripherals and
+	  configuring pinmuxes. The ps7_init_gpl.c file (and,
+	  optionally, ps7_init_gpl.h) contains the code for such
+	  initializations.
+
+	  Although U-Boot contains ps7_init_gpl.c files for some
+	  boards, each of them describes only one specific
+	  configuration. Users of a different board, or needing a
+	  different configuration, can generate custom files using the
+	  Xilinx development tools.
+
+	  Set this variable to the path to your ps7_init_gpl.c file
+	  (e.g. "board/myboard/ps7_init_gpl.c"). ps7_init_gpl.h, if
+	  needed, should be in the same directory. U-Boot will build
+	  and link the user-provided file instead of the built-in one.
+
+	  Leave empty to use the files provided by U-Boot.
+
+	  This feature requires commit
+	  6da4f67ad09cd8b311d77b2b04e557b7ef65b56c from upstream
+	  U-Boot, available from versions after 2018.07.
+
+endif
+
 config BR2_TARGET_UBOOT_ALTERA_SOCFPGA_IMAGE_CRC
 	bool "CRC image for Altera SoC FPGA (mkpimage)"
 	depends on BR2_arm
diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk
index dda606a880..b36968c064 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -461,6 +461,19 @@  endif
 
 endif # BR2_TARGET_UBOOT_ZYNQMP
 
+ifeq ($(BR2_TARGET_UBOOT_ZYNQ),y)
+
+UBOOT_ZYNQ_PS7_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQ_PS7_INIT_FILE))
+UBOOT_ZYNQ_PS7_INIT_PATH = $(shell readlink -f $(UBOOT_ZYNQ_PS7_INIT))
+
+ifneq ($(UBOOT_ZYNQ_PS7_INIT),)
+define UBOOT_ZYNQ_KCONFIG_PS7_INIT
+	$(call KCONFIG_SET_OPT,CONFIG_XILINX_PS_INIT_FILE,"$(UBOOT_ZYNQ_PS7_INIT_PATH)")
+endef
+endif
+
+endif # BR2_TARGET_UBOOT_ZYNQ
+
 define UBOOT_INSTALL_OMAP_IFT_IMAGE
 	cp -dpf $(@D)/$(UBOOT_BIN_IFT) $(BINARIES_DIR)/
 endef
@@ -503,6 +516,7 @@  define UBOOT_KCONFIG_FIXUP_CMDS
 	$(UBOOT_ZYNQMP_KCONFIG_PMUFW)
 	$(UBOOT_ZYNQMP_KCONFIG_PM_CFG)
 	$(UBOOT_ZYNQMP_KCONFIG_PSU_INIT)
+	$(UBOOT_ZYNQ_KCONFIG_PS7_INIT)
 endef
 
 ifeq ($(BR2_TARGET_UBOOT)$(BR_BUILDING),yy)