Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A25B8C4338F for ; Tue, 27 Jul 2021 09:07:41 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F23CE610CC for ; Tue, 27 Jul 2021 09:07:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org F23CE610CC Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0346C83433; Tue, 27 Jul 2021 11:07:39 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=sifive.com header.i=@sifive.com header.b="Pi5/oZ1e"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 635FD8342E; Tue, 27 Jul 2021 11:07:24 +0200 (CEST) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) (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 A3E0B831A4 for ; Tue, 27 Jul 2021 11:07:08 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=sifive.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=zong.li@sifive.com Received: by mail-pj1-x102e.google.com with SMTP id ds11-20020a17090b08cbb0290172f971883bso3215109pjb.1 for ; Tue, 27 Jul 2021 02:07:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=h1sGBykLPIY3GJ7ZenmYwA2n8UELWV6ruh7/y7nbDEQ=; b=Pi5/oZ1eLaylT+jEv1q6RUWxSEIh3SJmFTEDUZ7ejEKQFAlB/hmCRY/i2bpjk9Aa8b /s15kaEZouLcqTmUgKcl5Keec8TBeTqJR3CtfsA9eIs9AXkkLerwPF/X4wuhGDxtBfcF 0LiPaH+wAgdQy0xyYLzx0FVT/SMAGsfc07dne34vd5hZ2jWvGLPOmELWzzJsF6zgqI+9 VCMYDJlZyHqRS/aLE2u9TefwWimApFft0TKkxQy8Rx7EBd603ZIyQegArmYrpbMw3w4s NynTZwdPhKP2gmk2WSvf5SFK6VcZcEJIOs673OvVD8Rw17dt9DTzqOQ5FHv9/3vA6uUG uIqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=h1sGBykLPIY3GJ7ZenmYwA2n8UELWV6ruh7/y7nbDEQ=; b=UPD/2X4gfqT1u4iipq96/Ot7oHLnbEXCO1z27KINkfB5fY8PmazI9k8PaTVrNqFWf7 tjTAtTu8DgkOdA3KZ/N5S7Ybmu6UbG4wiYlQOu7owV6xOXeLJTOkGUqjeyB83Emc4R6z 2ZsHhtvooEbpkUGysamtrE2b0PlowDNSyuJmyCXXQUySNQQ5domza/O138UQFn04oqA/ cCCLl3rHkd1UNBOEXdUhJYJEd6euQB1cM3ziO/BZnWnJn2HuWauZUMvb3ICyb/8KieP/ j9pIkrH3h2g4PT6949HzdwKHlEGCFgQvAFBhkszg6iPbRBbX36L7ou7XKRIrCunRipDs ljUg== X-Gm-Message-State: AOAM531dv4ubXJsm8yQc1ZJhChkWp9AS4JH65jPWkQ1WBa8/ZgfH41eG 2SNfkLtFWfUZxmY62hd2JU4n+Q== X-Google-Smtp-Source: ABdhPJxy4sIcGgHEfCudJ0PS4v0qtdspxeIZS7XhZmx8Oo9BUg42EoMREnHDq8v3ail+UjdtG45Jwg== X-Received: by 2002:a17:90a:6390:: with SMTP id f16mr3247839pjj.94.1627376827078; Tue, 27 Jul 2021 02:07:07 -0700 (PDT) Received: from hsinchu15.internal.sifive.com (59-124-168-89.HINET-IP.hinet.net. [59.124.168.89]) by smtp.gmail.com with ESMTPSA id p5sm2847870pfn.46.2021.07.27.02.07.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Jul 2021 02:07:06 -0700 (PDT) From: Zong Li To: bmeng.cn@gmail.com, ycliang@andestech.com, paul.walmsley@sifive.com, rick@andestech.com, green.wan@sifive.com, sjg@chromium.org, u-boot@lists.denx.de Cc: Zong Li Subject: [PATCH 2/2] board: sifive: overwrite board_fdt_blob_setup in u-boot proper Date: Tue, 27 Jul 2021 17:06:59 +0800 Message-Id: <20210727090659.7525-2-zong.li@sifive.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210727090659.7525-1-zong.li@sifive.com> References: <20210727090659.7525-1-zong.li@sifive.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.103.2 at phobos.denx.de X-Virus-Status: Clean Add board_fdt_blob_setup to return the device tree location which is passed by prior stage in u-boot proper. The generic board_fdt_blob_setup always returns _end, it mignt be ok because u-boot SPL would currently put the dtb there, but it would be broken if we put the dtb to another place and assigned the location into a1 register for u-boot proper. Use the location passed by prior stage would make more sence, because we actually pass the location to u-boot proper and want to use that one, rather than the dtb which in _end. We can't use CONFIG_OF_PRIOR_STAGE because it doens't distinguish the implementation of u-boot SPL and u-boot proper, so u-boot SPL need to reply on the prior stage to pass device tree location as well, but we don't pass the DT from boot rom now. In addition, when CONFIG_OF_PRIOR_STAGE is enabled, the u-boot-spl.bin and u-boot.itb won't include the device tree. Signed-off-by: Zong Li --- board/sifive/unleashed/unleashed.c | 11 +++++++++++ board/sifive/unmatched/unmatched.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/board/sifive/unleashed/unleashed.c b/board/sifive/unleashed/unleashed.c index a4e78220cb..fa65fcade0 100644 --- a/board/sifive/unleashed/unleashed.c +++ b/board/sifive/unleashed/unleashed.c @@ -16,6 +16,7 @@ #include #include #include +#include /* * This define is a value used for error/unknown serial. @@ -113,6 +114,16 @@ int misc_init_r(void) #endif +void *board_fdt_blob_setup(void) +{ + if (IS_ENABLED(CONFIG_OF_SEPARATE)) { + if (gd->arch.firmware_fdt_addr) + return (ulong *)gd->arch.firmware_fdt_addr; + else + return (ulong *)&_end; + } +} + int board_init(void) { int ret; diff --git a/board/sifive/unmatched/unmatched.c b/board/sifive/unmatched/unmatched.c index 6d60559588..da23a6ce24 100644 --- a/board/sifive/unmatched/unmatched.c +++ b/board/sifive/unmatched/unmatched.c @@ -9,6 +9,17 @@ #include #include #include +#include + +void *board_fdt_blob_setup(void) +{ + if (IS_ENABLED(CONFIG_OF_SEPARATE)) { + if (gd->arch.firmware_fdt_addr) + return (ulong *)gd->arch.firmware_fdt_addr; + else + return (ulong *)&_end; + } +} int board_init(void) { -- 2.32.0