[Buildroot] [PATCH v2 5/6] uboot: zynqmp: allow to use custom psu_init files

Luca Ceresoli luca at lucaceresoli.net
Mon Mar 12 17:44:48 UTC 2018


U-Boot SPL configures pinmuxes, clocks and other low-level devices. On
the Xilinx ZynqMP SoCs the code to do this resides in a file called
psu_init_gpl.c which is initially generated by the Xilinx development
tools. Add an option to pass these files from the outside (e.g. in the
board files).

Signed-off-by: Luca Ceresoli <luca at lucaceresoli.net>

---
Changes v1 -> v2:
 - split from a larger patch doing 2 things
 - document the option of having psu_init_gpl.c without .h
---
 boot/uboot/Config.in | 22 ++++++++++++++++++++++
 boot/uboot/uboot.mk  | 12 ++++++++++++
 2 files changed, 34 insertions(+)

diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in
index a45b4202fe2e..a05b74993f96 100644
--- a/boot/uboot/Config.in
+++ b/boot/uboot/Config.in
@@ -378,6 +378,28 @@ config BR2_TARGET_UBOOT_ZYNQMP
 	  (downloaded by the zynqmp-pmufw-binaries package) formatted
 	  with the Xilinx-specific format.
 
+if BR2_TARGET_UBOOT_ZYNQMP
+config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR
+	string "Custom psu_init_gpl files"
+	help
+	  On ZynqMP the booloader is responsible for some basic
+	  initializations, such as enabling peripherals and configuring
+	  pinmuxes. The psu_init_gpl.c file (and, optionally,
+	  psu_init_gpl.h), generated by the Xilinx development tools,
+	  contains the code for such initializations.
+
+	  Although U-Boot contains psu_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
+	  provide a different file here, and U-Boot will build and link
+	  the user-provided file instead of the built-in one.
+
+	  Set this variable to the path where the psu_init_gpl.c file (and
+	  psu_init_gpl.h if needed) is located. Leave empty to use the
+	  files provided by U-Boot.
+
+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 1890bbfa4405..904985381f8e 100644
--- a/boot/uboot/uboot.mk
+++ b/boot/uboot/uboot.mk
@@ -285,6 +285,18 @@ define UBOOT_ZYNQMP_COPY_PMUFW
 endef
 UBOOT_PRE_CONFIGURE_HOOKS += UBOOT_ZYNQMP_COPY_PMUFW
 
+ifneq ($(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR)),)
+define UBOOT_ZYNQMP_COPY_PSU_INIT
+# In U-Boot's board/xilinx/zynqmp/Makefile the bundled psu_init_gpl.c
+# has precedence over ours if placed in a subdir whose name matches
+# CONFIG_DEFAULT_DEVICE_TREE. Delete them all to be sure we use ours.
+	rm -f $(@D)/board/xilinx/zynqmp/*/psu_init*.[ch]
+	cp $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR))/psu_init_gpl.[ch] \
+	   $(@D)/board/xilinx/zynqmp/
+endef
+UBOOT_PRE_CONFIGURE_HOOKS += UBOOT_ZYNQMP_COPY_PSU_INIT
+endif # BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_DIR
+
 endif # BR2_TARGET_UBOOT_ZYNQMP
 
 define UBOOT_INSTALL_OMAP_IFT_IMAGE
-- 
2.7.4




More information about the buildroot mailing list