From patchwork Fri Dec 17 03:59:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1569728 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: bilbo.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=NtPyu1zZ; dkim-atps=neutral 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=) 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 bilbo.ozlabs.org (Postfix) with ESMTPS id 4JFb2m3xd1z9t6S for ; Fri, 17 Dec 2021 15:04:16 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id A21D88371F; Fri, 17 Dec 2021 05:02:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="NtPyu1zZ"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id BBB358314C; Fri, 17 Dec 2021 05:00:53 +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=-2.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-oi1-x231.google.com (mail-oi1-x231.google.com [IPv6:2607:f8b0:4864:20::231]) (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 DADD68306E for ; Fri, 17 Dec 2021 05:00:24 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-oi1-x231.google.com with SMTP id s139so1778850oie.13 for ; Thu, 16 Dec 2021 20:00:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=3Ig/qzVRlUCFCk9vDY78IRd37ZHqelBchLL1FA+GjCw=; b=NtPyu1zZa6kdT6mmCIdaeceKxPQjNB9b0Ds6Khl7EuTbFaZFycQW1HvXD7lertF27q feTuJA0iDOK6sDNyC7DSuYFrI84VnVPENFIh72b/ZDS8oJB59bvL5PeNmhKSJizYx4Dt UlseH24dHgvWqx9ms4te7kG06z0Z76IxErY+w= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3Ig/qzVRlUCFCk9vDY78IRd37ZHqelBchLL1FA+GjCw=; b=xERPEuozG26jO+eLlLXN6Rf+LFBMgS33hEAtVXEP6mj5QwvS9sxC07FrTD4yBO3FuG F1Y4Y1EZqlEOvEUcLrb/N/ZcSKryEN5qwYqxjGfiwsGubt0N2fa+twDZV+5AfyNuSqLz 9zFlEUEk9nB9Et/NN0H69d8GYx2p5IeAdYXaqABP+2bTKr++VQGPIh0Pt0wTla0Polz3 WLVe5vYnbH8GHRJ0e/VG7NJwbAkFuGWDl/XGKcmsGB7TcKy9Y1iLIKhs0zgLOoxTp1Wf EBVXX7/tAVmkTlwveHvRjlatME70wjHY1pVNkMcG0AD1TXSL0SVuSFlrNmgt3Tl1xM1x 4l2g== X-Gm-Message-State: AOAM532cNf81iK2jI/X1pUHRExlHZ2LQvl6+09kzGJMuv4x1rHoXYH9O QxyMkdQmSXyXyFWel/PnunE45GJjgicYFw== X-Google-Smtp-Source: ABdhPJzyqh1LGKJJayP3uBk7iWklVn4yzqRL+XHlZ6wJp9gn6lWWdxn/gso6SbgD1k2TeADb/d5Frw== X-Received: by 2002:a05:6808:1597:: with SMTP id t23mr743151oiw.24.1639713623442; Thu, 16 Dec 2021 20:00:23 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id h14sm1431249ots.22.2021.12.16.20.00.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 16 Dec 2021 20:00:23 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Ilias Apalodimas , Sean Anderson , Heinrich Schuchardt , Tom Rini , Mark Kettenis , =?utf-8?q?Fran=C3=A7ois_Ozog?= , Simon Glass , Jerry Van Baren Subject: [PATCH v8 23/32] fdt: Drop remaining preprocessor macros in fdtdec_setup() Date: Thu, 16 Dec 2021 20:59:30 -0700 Message-Id: <20211217035939.670884-24-sjg@chromium.org> X-Mailer: git-send-email 2.34.1.173.g76aa8bc2d0-goog In-Reply-To: <20211217035939.670884-1-sjg@chromium.org> References: <20211217035939.670884-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.38 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 We only have two choices for obtaining the devicetree. Simplify the code to make that clear. Signed-off-by: Simon Glass --- (no changes since v1) lib/fdtdec.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lib/fdtdec.c b/lib/fdtdec.c index 5b31064cee2..a7f62123a94 100644 --- a/lib/fdtdec.c +++ b/lib/fdtdec.c @@ -1624,15 +1624,17 @@ static void setup_multi_dtb_fit(void) int fdtdec_setup(void) { int ret; -#ifdef CONFIG_OF_EMBED - /* Get a pointer to the FDT */ - gd->fdt_blob = dtb_dt_embedded(); -#elif defined(CONFIG_OF_BOARD) || defined(CONFIG_OF_SEPARATE) - /* Allow the board to override the fdt address. */ - gd->fdt_blob = board_fdt_blob_setup(&ret); - if (ret) - return ret; -#endif + + /* The devicetree is typically appended to U-Boot */ + if (IS_ENABLED(CONFIG_OF_SEPARATE) || IS_ENABLED(CONFIG_OF_BOARD)) { + /* Allow the board to override the fdt address. */ + gd->fdt_blob = board_fdt_blob_setup(&ret); + if (ret) + return ret; + } else { /* embed dtb in ELF file for testing / development */ + gd->fdt_blob = dtb_dt_embedded(); + } + if (!IS_ENABLED(CONFIG_SPL_BUILD)) { /* Allow the early environment to override the fdt address */ gd->fdt_blob = map_sysmem(env_get_ulong("fdtcontroladdr", 16,