From patchwork Tue Feb 18 16:02:36 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1240154 X-Patchwork-Delegate: monstr@monstr.eu Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.a=rsa-sha256 header.s=20150623 header.b=B4pwr8F6; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 48MQcW4rXzz9sRh for ; Wed, 19 Feb 2020 03:03:07 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D8FD813C4; Tue, 18 Feb 2020 17:02:52 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=monstr-eu.20150623.gappssmtp.com header.i=@monstr-eu.20150623.gappssmtp.com header.b="B4pwr8F6"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E6D5E81258; Tue, 18 Feb 2020 17:02:44 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x444.google.com (mail-wr1-x444.google.com [IPv6:2a00:1450:4864:20::444]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id DCCEE81243 for ; Tue, 18 Feb 2020 17:02:41 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=xilinx.com Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-wr1-x444.google.com with SMTP id n10so22658467wrm.1 for ; Tue, 18 Feb 2020 08:02:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20150623.gappssmtp.com; s=20150623; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3kcjPjGE+ZttBCyV68ruNwcj74mssT/MTvpAyAVvr1M=; b=B4pwr8F6U+wRN7w50fBYZpcMJJsYONICLCul3PwrSO/RSMkZjjLbyCqurxaprVUDS7 P13IYxLU5K0VSErRUOWJHcerCACzEb4OCFJIP1/GgNSBPMecx8NhaILZ3Pnl9MNJnVug Vqrv+j8BY55XyaVsBhaWM7NFhwOhBJCKbQ/rkOBI2YEvcAyYj6hF84fn2qkN9ARWgHQk F87pm+Lu9talIVsTkfIjKnR2F31RjPQCoxTd5QlnpFu3iYQ1KctKHxnTiPwJAV4OCdaK MvOF1HJnbh/OTrV3zWQWTJupjfylVh0n8n7CmGAb0HzV5+UyBw4E2thW1ugoYZhoUF3M Uchw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=3kcjPjGE+ZttBCyV68ruNwcj74mssT/MTvpAyAVvr1M=; b=RfSdcsdeR0vXGxJ9hQ6YvfMm/7zlxQQ4FU/9Aa83gLLv+Eekx1OCuRO/oNr+8Emsq6 gf+uBZk6CCF6LcrRkH9JtBNMmOKjYGNqtueIrf9iDljBgyQD6Gwl8ROEAu6F+qgDwUla ONpmOEDWqklG9l7yXMJZJJMcg+NlTU66K3vwqVpl5izhAavowDA2DKB/LADCNY18Jj/9 xLcoK8XXqYT177dJbrj34NmTiZmzePD6T40+sYYIouJmggI+BT8sraUkMjCdqSamOX92 j4jNiAEf+I5YYTNGC5nx85+xJ3V7RFiydWFM/GRCUMLN8rugY+ranDZf61V0eJJt7Ycb mv0g== X-Gm-Message-State: APjAAAVggOPmPoYSDYOzJIrgPE7nW77YkHOKPBAX9Q8lpZfmaVOzyHoR 9Kf8fcAGLpENXkHinC+JtLM5E9+Zv3gwLw== X-Google-Smtp-Source: APXvYqzWimc3JIUTnj0lA1/CJLFfxlD/iazNZznQaqPRb1LKYb1Fwm1xL1qeAWeqP92YQboVaF/gKg== X-Received: by 2002:a5d:5152:: with SMTP id u18mr29408283wrt.214.1582041761166; Tue, 18 Feb 2020 08:02:41 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id h71sm4074049wme.26.2020.02.18.08.02.40 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 18 Feb 2020 08:02:40 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com, Tom Rini Cc: Bin Meng , Fabio Estevam , Heinrich Schuchardt , Jagan Teki , Kever Yang , Marek Vasut , Michal Simek , Simon Glass Subject: [PATCH 1/2] Makefile: Add environment variable DEVICE_TREE to header Date: Tue, 18 Feb 2020 17:02:36 +0100 Message-Id: <65fe3fb4b7f682b4a292b261f0140b1f89f4610e.1582041753.git.michal.simek@xilinx.com> X-Mailer: git-send-email 2.25.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.30rc1 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.1 at phobos.denx.de X-Virus-Status: Clean Users have option to overwrite default device tree (CONFIG_DEFAULT_DEVICE_TREE) via environment variable DEVICE_TREE. Feature has been added long time ago by commit 74de8c9a1672 ("dts/Makefile: Build the user specified dts") for a little bit different reason. But this variable can be also used for different purpose like choosing proper configuration from FIT image in SPL. And this is the functionality I would like to use on Xilinx Zynq devices that current u-boot.img can be composed in the same way based on OF_LIST and different configuration is taken based on platform specific SPL. SPL requires low level ps7_init_gpl configuration that's why different boards require different SPL with fixed board_fit_config_name_match(). Signed-off-by: Michal Simek Reviewed-by: Tom Rini Reviewed-by: Simon Glass --- I have done it in this way but maybe there is any smarter way how this can be done. Also macro name can change if you want. --- Makefile | 14 +++++++++++++- arch/arm/mach-zynq/spl.c | 8 ++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 0af89e0a7881..15f7cce445f6 100644 --- a/Makefile +++ b/Makefile @@ -483,6 +483,7 @@ endif version_h := include/generated/version_autogenerated.h timestamp_h := include/generated/timestamp_autogenerated.h defaultenv_h := include/generated/defaultenv_autogenerated.h +dt_h := include/generated/dt.h no-dot-config-targets := clean clobber mrproper distclean \ help %docs check% coccicheck \ @@ -1768,7 +1769,7 @@ endif # prepare2 creates a makefile if using a separate output directory prepare2: prepare3 outputmakefile cfg -prepare1: prepare2 $(version_h) $(timestamp_h) \ +prepare1: prepare2 $(version_h) $(timestamp_h) $(dt_h) \ include/config/auto.conf ifeq ($(wildcard $(LDSCRIPT)),) @echo >&2 " Could not find linker script." @@ -1834,12 +1835,23 @@ define filechk_defaultenv.h xxd -i ; echo ", 0x00" ; ) endef +define filechk_dt.h + (if test -n "$${DEVICE_TREE}"; then \ + echo \#define DEVICE_TREE \"$(DEVICE_TREE)\"; \ + else \ + echo \#define DEVICE_TREE CONFIG_DEFAULT_DEVICE_TREE; \ + fi) +endef + $(version_h): include/config/uboot.release FORCE $(call filechk,version.h) $(timestamp_h): $(srctree)/Makefile FORCE $(call filechk,timestamp.h) +$(dt_h): $(srctree)/Makefile FORCE + $(call filechk,dt.h) + $(defaultenv_h): $(CONFIG_DEFAULT_ENV_FILE:"%"=%) FORCE $(call filechk,defaultenv.h) diff --git a/arch/arm/mach-zynq/spl.c b/arch/arm/mach-zynq/spl.c index 96ba90fb7a76..e89e46c1038d 100644 --- a/arch/arm/mach-zynq/spl.c +++ b/arch/arm/mach-zynq/spl.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include @@ -89,8 +90,11 @@ void spl_board_prepare_for_boot(void) int board_fit_config_name_match(const char *name) { /* Just empty function now - can't decide what to choose */ - debug("%s: %s\n", __func__, name); + debug("%s: Check %s, default %s\n", __func__, name, DEVICE_TREE); - return 0; + if (!strcmp(name, DEVICE_TREE)) + return 0; + + return -1; } #endif