From patchwork Thu Jun 25 19:29:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1317162 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=busybox.net (client-ip=140.211.166.133; helo=hemlock.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=rockwellcollins.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=rockwellcollins.com header.i=@rockwellcollins.com header.a=rsa-sha256 header.s=hrcrc2020 header.b=VOLg9V94; dkim-atps=neutral Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49t9875Q2fz9sQx for ; Fri, 26 Jun 2020 05:29:59 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 08CBE88AA9; Thu, 25 Jun 2020 19:29:54 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2GWeA8oyet59; Thu, 25 Jun 2020 19:29:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 3BC0E88A06; Thu, 25 Jun 2020 19:29:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by ash.osuosl.org (Postfix) with ESMTP id 226481BF3D4 for ; Thu, 25 Jun 2020 19:29:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 133B223543 for ; Thu, 25 Jun 2020 19:29:51 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fT2vpfPkD7Q5 for ; Thu, 25 Jun 2020 19:29:49 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from ch3vs02.rockwellcollins.com (ch3vs02.rockwellcollins.com [205.175.226.29]) by silver.osuosl.org (Postfix) with ESMTPS id 80F18226E9 for ; Thu, 25 Jun 2020 19:29:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rockwellcollins.com; s=hrcrc2020; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=TKhkkL48SK9947C5a0mUWQLasjK3Yv88MgUOkwwrFQI=; b=VOLg9V94uyZACL/Sbwx1b+/RgsijZ8X/Xkx78lRq8AbKCKLRbpe+V9R+ KtAjC4ytgLY4b6A/1B+GYeeSvWF3Pvhk6EvZEuYYdXzLAtgLMBpMBz9Hr vD4FOIA2J1YCcHfy/Ot2j6EzClzgDBwHGPv3CVb5t6JfJDUrF1JRPSjF6 W9gb+Ql6X229p3P91hH0WyZGBo09LqTqZr8LOxr33rD8L661xsYBwOTBh lt7vOOUD7pcMIp6xDL0ey0pQbvkjPS++82jQAhCQ6mAgmorf13lJ9gh1X f6tY2yR0BCAxswn0VwSp2bDJBpcoqt5j2MFjYQU3BIWMFMcfUg4aDug3K A==; IronPort-SDR: SVyOr2nFDsisSsChSmeOSbXRGAyTGb0KiTaXek4bVrSfAA7hMFcTCQcBF3d9xt4DVsX1SEphyW A7mcv6O0FXz8aCSdgw41VWzYj60q2CgdqcuN1XuP5WRMohysSTTxCxRnwOEMj/c07yIyStM0Kj 1YAYINhvguK132S4z0BHtI6DN6m4e7ScRTsPfwT2p8iaMZqU/eUvAVuvIWh9jFD76igGzfve3k i2Gi99RmdDjbdq1v75LlBxD7TUfxGQ6AFtQcfoHOKQ4mJ4wT/fKIcb71/VRwTDlwqBAt78sGT+ vQ8= Received: from ofwch3n02.rockwellcollins.com (HELO dtulimr01.rockwellcollins.com) ([205.175.226.14]) by ch3vs02.rockwellcollins.com with ESMTP; 25 Jun 2020 14:29:48 -0500 X-Received: from righttwix.rockwellcollins.com (righttwix.rockwellcollins.com [192.168.141.218]) by dtulimr01.rockwellcollins.com (Postfix) with ESMTP id F1063600B8; Thu, 25 Jun 2020 14:29:47 -0500 (CDT) From: Brandon Maier To: buildroot@buildroot.org Date: Thu, 25 Jun 2020 14:29:25 -0500 Message-Id: <20200625192925.182477-1-brandon.maier@rockwellcollins.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH 1/1] uboot: zynqmp: Support loading a PMU config X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: luca@lucaceresoli.net, Brandon Maier , michal.simek@xilinx.com, thomas.petazzoni@bootlin.com Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" Before now, U-Boot SPL could only load the Platform Management Unit (PMU) by patching the board-specific pm_cfg_obj.c file into the generic PMU firmware, but that then requires generating a new PMU firmware for every board configuration. To fix that, Luca Ceresoli added support to U-Boot to load the pm_cfg_obj[1]. Like the PMU firmware, we need a way to pass the PMU cfg to U-Boot during build. U-Boot only accepts the binary format of the cfg, so we must convert the source file with the tool provided with U-Boot. [1] https://lucaceresoli.net/zynqmp-uboot-spl-pmufw-cfg-load/ Signed-off-by: Brandon Maier --- boot/uboot/Config.in | 22 ++++++++++++++++++++++ boot/uboot/uboot.mk | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) diff --git a/boot/uboot/Config.in b/boot/uboot/Config.in index 8cce9b1bae..5fa3b5942e 100644 --- a/boot/uboot/Config.in +++ b/boot/uboot/Config.in @@ -458,6 +458,28 @@ config BR2_TARGET_UBOOT_ZYNQMP_PMUFW This feature requires U-Boot >= 2018.07. +config BR2_TARGET_UBOOT_ZYNQMP_PM_CFG + string "PMU configuration location" + depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG + help + Location of a PMU configuration file. + + If not empty, Buildroot will convert the PMU configuration + file into a loadable blob and pass it to U-Boot. The blob gets + embedded into the U-Boot SPL and is used to configure the PMU + during board initialization. + + Unlike the PMU firmware, the PMU configuration file is unique + to each board configuration. A PMU configuration file can be + generated by building your Xilinx SDK BSP. It can be found in + the BSP source, for example at + > ./psu_cortexa53_0/libsrc/xilpm_v2_4/src/pm_cfg_obj.c + + Leave this option empty if your PMU firmware has a hard-coded + configuration object or you are loading it by any other means. + + This feature requires U-Boot >= v2019.10. + config BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE string "Custom psu_init_gpl file" depends on BR2_TARGET_UBOOT_BUILD_SYSTEM_KCONFIG diff --git a/boot/uboot/uboot.mk b/boot/uboot/uboot.mk index 71689207e3..67d153189d 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -293,6 +293,11 @@ define UBOOT_BUILD_CMDS $(if $(UBOOT_CUSTOM_DTS_PATH), cp -f $(UBOOT_CUSTOM_DTS_PATH) $(@D)/arch/$(UBOOT_ARCH)/dts/ ) + $(if $(UBOOT_ZYNQMP_PM_CFG_PATH), + $(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py \ + "$(UBOOT_ZYNQMP_PM_CFG_PATH)" \ + "$(UBOOT_ZYNQMP_PM_CFG_BIN)" + ) $(TARGET_CONFIGURE_OPTS) \ $(BR2_MAKE) -C $(@D) $(UBOOT_MAKE_OPTS) \ $(UBOOT_MAKE_TARGET) @@ -360,6 +365,17 @@ define UBOOT_ZYNQMP_KCONFIG_PMUFW $(call KCONFIG_SET_OPT,CONFIG_PMUFW_INIT_FILE,"$(UBOOT_ZYNQMP_PMUFW_PATH)") endef +UBOOT_ZYNQMP_PM_CFG = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PM_CFG)) +UBOOT_ZYNQMP_PM_CFG_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PM_CFG)) + +ifneq ($(UBOOT_ZYNQMP_PM_CFG_PATH),) +UBOOT_ZYNQMP_PM_CFG_BIN = $(UBOOT_DIR)/pm_cfg_obj.bin +define UBOOT_ZYNQMP_KCONFIG_PM_CFG + $(call KCONFIG_SET_OPT,CONFIG_ZYNQMP_SPL_PM_CFG_OBJ_FILE,"$(UBOOT_ZYNQMP_PM_CFG_BIN)", \ + $(@D)/.config) +endef +endif + UBOOT_ZYNQMP_PSU_INIT = $(call qstrip,$(BR2_TARGET_UBOOT_ZYNQMP_PSU_INIT_FILE)) UBOOT_ZYNQMP_PSU_INIT_PATH = $(shell readlink -f $(UBOOT_ZYNQMP_PSU_INIT)) @@ -422,6 +438,7 @@ endif define UBOOT_KCONFIG_FIXUP_CMDS $(UBOOT_ZYNQMP_KCONFIG_PMUFW) + $(UBOOT_ZYNQMP_KCONFIG_PM_CFG) $(UBOOT_ZYNQMP_KCONFIG_PSU_INIT) endef