From patchwork Thu Dec 19 17:00:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Simek X-Patchwork-Id: 1213562 X-Patchwork-Delegate: trini@ti.com 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.b="azdswhgc"; 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)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47dynL1H85z9sPL for ; Fri, 20 Dec 2019 04:00:54 +1100 (AEDT) Received: from phobos.denx.de (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7A6338163A; Thu, 19 Dec 2019 18:00:34 +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="azdswhgc"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 25BA8814F9; Thu, 19 Dec 2019 18:00:28 +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=0.0 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wm1-x341.google.com (mail-wm1-x341.google.com [IPv6:2a00:1450:4864:20::341]) (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 13DA0814D6 for ; Thu, 19 Dec 2019 18:00:22 +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-wm1-x341.google.com with SMTP id b19so6176704wmj.4 for ; Thu, 19 Dec 2019 09:00:22 -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=WNnVPZqTruokeNPnXkq302lfpAHPh76iUyiev7F8fQ4=; b=azdswhgcrF3Hevs4vS6wE9tlwltmb0svTngNVhM3R3gxs1falkFe6W1EYbTrTVTUfk giec/1fliIDZQWLtAw+2q2AWA0LuSvr6QCdFKZfr4j0LLE/0kLNelwBMq9VpabtGqhkQ xmkDtcVeQAqNqmrSGe8GNFKdHjbJOGJUcrZ0AM+5RvYgBumG+sWLWjvxyWvUFnBqm7oZ Fj3NIW/zpCOJ46uoMiiRJ96jU6N09iXBerdxC+gGg3LUOJRSdi5O9iPhhCl43mNm+K70 6DQxQqxJcQNLyIWWFVy5u2+NvPY4weDTFglx+0OTqcC1Og8FSoH4ANGeZEm7w5CyMY9z CZRg== 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=WNnVPZqTruokeNPnXkq302lfpAHPh76iUyiev7F8fQ4=; b=hoS7xaxS2AEkHPZ+NlnTMRkWfUJusf7/qk3pSf0t18YzEd6+Fphw+zE4h8TU+8QV7M 7Tw6jDGyij7WZN6hz3hc39fPEqzWQLgvPD1vfLSuFRwlcn/OqRTA4xoIf7u6hg+20Y0D 0ewlb1eVmtv2OV+x6ULap8ibjykHrn0Lp37sjpiPEC7jUGusichL4MjZm613hT2rkiH/ ikULdFK45JTlm9tHd8nnkIaDGzDy5vMxitaUzpXTFPQZn7zK2GvV+Ojegeo/lVSt6zlW +sJRBFVRXNqUrgFpy4vwC7PK/Ed7lEEGNwoMQSCkSf4e5ZNR0fJJC35FJ0oItz1Kmoay AEvA== X-Gm-Message-State: APjAAAWN9RXJuYepdzYqMiikcxOosErsONLd1/2LFWTz6cNmYdSX9+tg RdY3d7UkIBbZKUjdOBuLLSUakDKIABvSMw== X-Google-Smtp-Source: APXvYqxqKqyqAVxV6Vb6Bbo6sWhfRO36vI7/Gv6C5bBuzIDzQGN+pn2YhdFEalhNipEGRJ7qojNUfw== X-Received: by 2002:a1c:20d3:: with SMTP id g202mr11401600wmg.169.1576774822282; Thu, 19 Dec 2019 09:00:22 -0800 (PST) Received: from localhost (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id f9sm6746568wmb.4.2019.12.19.09.00.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Dec 2019 09:00:21 -0800 (PST) From: Michal Simek To: u-boot@lists.denx.de, git@xilinx.com Subject: [PATCH 2/2] arm64: zynqmp: Add support for OF_SEPARATE with board DTB Date: Thu, 19 Dec 2019 18:00:15 +0100 Message-Id: X-Mailer: git-send-email 2.24.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.26 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ibai Erkiaga , T Karthik Reddy Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.101.4 at phobos.denx.de X-Virus-Status: Clean OF_BOARD and OF_SEPARATE can use board specific board_fdt_blob_setup(). OF_BOARD option is mostly used for picking up DTB from certain location. OF_SEPARATE option is used when DTB is appended after u-boot binary. This board specific function is aligned with current version in lib/fdtdec.c with checking CONFIG_XILINX_OF_BOARD_DTB_ADDR address first. Signed-off-by: Michal Simek --- board/xilinx/Kconfig | 2 +- board/xilinx/common/board.c | 29 +++++++++++++++++++++++------ 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/board/xilinx/Kconfig b/board/xilinx/Kconfig index 7833b11767c4..73fc1be0141e 100644 --- a/board/xilinx/Kconfig +++ b/board/xilinx/Kconfig @@ -44,7 +44,7 @@ config XILINX_OF_BOARD_DTB_ADDR hex default 0x1000 if ARCH_VERSAL default 0x100000 if ARCH_ZYNQ || ARCH_ZYNQMP - depends on OF_BOARD + depends on OF_BOARD || OF_SEPARATE help Offset in the memory where the board configuration DTB is placed. diff --git a/board/xilinx/common/board.c b/board/xilinx/common/board.c index 62dafe0f9058..03d836feff9a 100644 --- a/board/xilinx/common/board.c +++ b/board/xilinx/common/board.c @@ -5,6 +5,7 @@ */ #include +#include #include #include @@ -37,16 +38,32 @@ int zynq_board_read_rom_ethaddr(unsigned char *ethaddr) return ret; } -#if defined(CONFIG_OF_BOARD) +#if defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) void *board_fdt_blob_setup(void) { static void *fdt_blob = (void *)CONFIG_XILINX_OF_BOARD_DTB_ADDR; - if (fdt_magic(fdt_blob) != FDT_MAGIC) { - printf("DTB is not passed via %p\n", fdt_blob); - return NULL; - } + if (fdt_magic(fdt_blob) == FDT_MAGIC) + return fdt_blob; - return fdt_blob; + debug("DTB is not passed via 0x%llx\n", (u64)fdt_blob); + +#ifdef CONFIG_SPL_BUILD + /* FDT is at end of BSS unless it is in a different memory region */ + if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) + fdt_blob = (ulong *)&_image_binary_end; + else + fdt_blob = (ulong *)&__bss_end; +#else + /* FDT is at end of image */ + fdt_blob = (ulong *)&_end; +#endif + + if (fdt_magic(fdt_blob) == FDT_MAGIC) + return fdt_blob; + + debug("DTB is also not passed via 0x%llx\n", (u64)fdt_blob); + + return NULL; } #endif