From patchwork Fri Jun 26 15:59:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brandon Maier X-Patchwork-Id: 1317792 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.137; helo=fraxinus.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=H4fNSduO; dkim-atps=neutral Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49thVk2qY5z9sRW for ; Sat, 27 Jun 2020 02:02:54 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id E614986D1E; Fri, 26 Jun 2020 16:02:52 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Og3yJ2P-vWDh; Fri, 26 Jun 2020 16:02:52 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 49CBC85566; Fri, 26 Jun 2020 16:02:52 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id A1D741BF295 for ; Fri, 26 Jun 2020 16:02:29 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 9C43C84D8A for ; Fri, 26 Jun 2020 16:02:29 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id W7En2gpCHTFK for ; Fri, 26 Jun 2020 16:02:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from da1vs02.rockwellcollins.com (da1vs02.rockwellcollins.com [205.175.227.29]) by fraxinus.osuosl.org (Postfix) with ESMTPS id A509584B62 for ; Fri, 26 Jun 2020 16:02:26 +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=jwSsI7Uko5NquVpa8CYF1TpMQn2qWhFT+pCNSplMF4E=; b=H4fNSduOpL1dM8bLHYMdHSD9UkjJ0jG4fFt5eCDZBNH7wZOdXs/P/VWP kKqUDfQpPLxE9nR0Bituv8s9zeCnXjj0/KgC4asZy8n8T3Qpi/Ui35tgJ I/VJnjwQCkN0MziF93x6CQMvYRoiPeXHmoWZQh6HjLgPT1JElyg1kLrlJ 1LMjPIGvYrW53A76PmLYkTjVUHXJa1kTyxjuuTjXfEaoQydhAyZd0CTuI oynuFYO4yn5UsqfI9m1iikCpUO7952lII9FAjZSWpP/YctFK7+fdOSm2l PKXU5km10QZ0qL5QQcXGBEdvi8Cp8tZYTR04p6x+wCm9d0zxOGqTeRWn7 g==; IronPort-SDR: 4Bz33xXHE9cUm1vEfd5NpvMOqlXU+arFzPNCnrVVYticunU574F41EjFYfy0g0bEhhdgTBqg4A 2DhP1H6hZEEw3mCMMPeuX229fjwA9mhnjBH/d72eYaUZFjqtfTmqMsyYEQUW+ltSMMB+9ghSAx y3UTRiPzJDhHKc3Pt26BY1lv5eZgSyXCz4ywLgh1aqJ4kPZzBFpISy0FVDBfdD2btuzSqHMEdk v8XFYiC13EX2VHiKpmO3ed1nWcW6kqyiuP7gNd5ohNFdffHg/+G5IkRkC80IlO5e2mdwDJCAZ/ ygo= Received: from ofwda1n02.rockwellcollins.com (HELO dtulimr02.rockwellcollins.com) ([205.175.227.14]) by da1vs02.rockwellcollins.com with ESMTP; 26 Jun 2020 11:02:25 -0500 X-Received: from righttwix.rockwellcollins.com (righttwix.rockwellcollins.com [192.168.141.218]) by dtulimr02.rockwellcollins.com (Postfix) with ESMTP id A46C12006C; Fri, 26 Jun 2020 11:02:25 -0500 (CDT) From: Brandon Maier To: buildroot@buildroot.org Date: Fri, 26 Jun 2020 10:59:56 -0500 Message-Id: <20200626155955.178306-1-brandon.maier@rockwellcollins.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Subject: [Buildroot] [PATCH v2 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 --- v2: - Move convert command to a pre-build hook - Remove redundant "PATH" variable 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..8a09969de1 100644 --- a/boot/uboot/uboot.mk +++ b/boot/uboot/uboot.mk @@ -360,6 +360,22 @@ 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)) +ifneq ($(UBOOT_ZYNQMP_PM_CFG),) +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 + +define UBOOT_ZYNQMP_PM_CFG_CONVERT + $(UBOOT_DIR)/tools/zynqmp_pm_cfg_obj_convert.py \ + "$(UBOOT_ZYNQMP_PM_CFG)" \ + "$(UBOOT_ZYNQMP_PM_CFG_BIN)" +endef +UBOOT_PRE_BUILD_HOOKS += UBOOT_ZYNQMP_PM_CFG_CONVERT +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