From patchwork Sat Aug 31 16:46:19 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Caleb Connolly X-Patchwork-Id: 824405 Delivered-To: patch@linaro.org Received: by 2002:a5d:48c1:0:b0:367:895a:4699 with SMTP id p1csp1277647wrs; Sat, 31 Aug 2024 09:46:50 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCWKBQCJrIhv7ljnH11EQa233V5YScqMIPLpFFtDECtgtlBRn8oX+TYJnlphshjHReDz5nJiwg==@linaro.org X-Google-Smtp-Source: AGHT+IH8s4lhyZ6HSaT1uXgvVGqXmv3JxC4dDKfMXa0GmSf1P1vb6de4h/Xed8FdwU/R+uDjHXYZ X-Received: by 2002:a05:600c:470f:b0:426:647b:1bfa with SMTP id 5b1f17b1804b1-42bb02443eemr71730355e9.8.1725122809888; Sat, 31 Aug 2024 09:46:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725122809; cv=none; d=google.com; s=arc-20240605; b=YPqfnkKSgp4x0pUdilUZlTMKFXN23MQ5HmXJUbAdYn31hqyKck97N2vovnWQYFnG4R Z4Jpn8ZrzPHgi+0L4ic8by3LMCtOfSQo5nWHd5kA5Ei5w2Kjcxt0IKobAli9AqwqNyHk PQP81xjcSJbke+RYW4APfr7PXnQB+iwZrVdKIw9JXd+Z6TTSjPU7Vv0OPDJ5nH+mmG+v F34Wgva4yUeFGEvoBSkfuwISwd6qq1KFIktnUQyfJEKhHGMqs+e7Rp9xSsADk2dSu5cR QkrZRfnbtLYt8pWSem+TFGiWsMRU/l/86Yiten2wj1byCy/uMh+oDgVz73LSpl28NJXm 89YA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature; bh=LGENyTu3GbLotOQBDDoEgGY32Ki7v8t9jiJTyclBTec=; fh=D6ctYApFkirYNBhUVX+zJ9LKhDm6xq2TJm960z2uIhk=; b=eisgX8TV5pn8+tt7lqHtU4o0ON13cfBHN589M8hL8XOn3f1RLNVSWzcmph1cynYV0j O78MxkUXZeisrB4TSfYdFlXvjqUD0xoz/9O/gEG2rHFE0cPERINsClvoIwo6YeKsFfdK DMfTwoBYOlyRsFhzxluHfDc7UjudS2SxTC2Na+KVmwQ4jKhqXc/q/oGd2ywI1wcreBhl gyaORVZ1jKDGJ3ISVouSPr+uOl1WbF4reQAIe8JQRqbSryZIqbKxBzGzWk1xoSH1wReN F82LKFMTr3lAPF1qgEriyFcXvkAXGNQgr451Z2ukzjQbw01RMS+U9E4S6f0VwsykemQL qFFA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K/Glk+2+"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Return-Path: Received: from phobos.denx.de (phobos.denx.de. [2a01:238:438b:c500:173d:9f52:ddab:ee01]) by mx.google.com with ESMTPS id 5b1f17b1804b1-42bb6e335d2si30194035e9.163.2024.08.31.09.46.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2024 09:46:49 -0700 (PDT) Received-SPF: pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="K/Glk+2+"; spf=pass (google.com: domain of u-boot-bounces@lists.denx.de designates 2a01:238:438b:c500:173d:9f52:ddab:ee01 as permitted sender) smtp.mailfrom=u-boot-bounces@lists.denx.de; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org; dara=neutral header.i=@linaro.org Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6FD6E8871A; Sat, 31 Aug 2024 18:46:48 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org 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=linaro.org header.i=@linaro.org header.b="K/Glk+2+"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 96AF987DC7; Sat, 31 Aug 2024 18:46:47 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) (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 8D5CC8873C for ; Sat, 31 Aug 2024 18:46:45 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=caleb.connolly@linaro.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-3719f0758c6so1971760f8f.1 for ; Sat, 31 Aug 2024 09:46:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1725122805; x=1725727605; darn=lists.denx.de; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=LGENyTu3GbLotOQBDDoEgGY32Ki7v8t9jiJTyclBTec=; b=K/Glk+2+YBXbuU6mdVsRILqybXp1saeujV/tAA33o1T3E6wiuiY1y60gbhN8eeOoyZ X0i2S85Xhfsy+gfYHqrHjTu1hjPCHT1ICVRcjEGyBxTE24bYtaETBRB0AqRxsjNjmn1j 4xh5ydp/a9IxgGYMUYZcgA8b//b/DNjtDnBApm79zFejP1oi/0ZLKzoIjv4g5HEJVu4H FgObsgbfhAT4W6UX4yXxvfNesQB8qefgG1OPMGhtYdGhh/sNEpIYYSArXpHBofK1akkG /5wEY0hJZpuQDCzeGdXA1hB6cnV1IG8veKSqwyXiBJEicu+naKUB/cQplkS/tOhqIRQi FYwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725122805; x=1725727605; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=LGENyTu3GbLotOQBDDoEgGY32Ki7v8t9jiJTyclBTec=; b=Ss6exzQSrrY+Y76IXbpPH7sqQyljanxTFc+Nmp8RI/Gre7NqCIB/R68IXq4++utilv 1cpZlB4QyrOI9ODC/qhIiWsdIawPUTaSx7wqZX3mRkUGqhL9aIEV8E1bzBfBZ4c3HYLt S5S/gfP67YsEw0T1WL7uxAYTAfHbK7i6qwDFjVXb9NHZDRjE/Ij/PiG+NRkNJ4Z4fLLk uEaXLcALsGkzgeb580dyvWIWdli6coPWGylQu/pt368f3XS+1Hlp8ttQqGXvZAFxm3xI OjqELUzZryz5MpNgbfy35IWG9/rCf/15kA0ARnsFnQh7werGBTC5dL8VHIrGN4BuNQAO I/Tg== X-Gm-Message-State: AOJu0YwjOZSs4o3lOyM/TTedwI9wdHtVqS8mB2hJdgXhySdmF6xh2iBO FBm7GHI9KRBqOGEchcyc5jLuitl3yJuGDs1VeNnsKT2luBI3tkcKc1zDz3JOVyc= X-Received: by 2002:a5d:5d86:0:b0:374:b35e:ea6c with SMTP id ffacd0b85a97d-374b35eed0bmr3348912f8f.40.1725122804747; Sat, 31 Aug 2024 09:46:44 -0700 (PDT) Received: from cymric.caleb.rex.connolly.tech (ip-185-104-138-67.ptr.icomera.net. [185.104.138.67]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-374b61494bcsm3965234f8f.95.2024.08.31.09.46.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 31 Aug 2024 09:46:44 -0700 (PDT) From: Caleb Connolly To: Caleb Connolly , Simon Glass , Tom Rini Cc: u-boot@lists.denx.de Subject: [PATCH] cmd: fdt: use U-Boot's FDT by default Date: Sat, 31 Aug 2024 17:46:19 +0100 Message-ID: <20240831164639.2298097-1-caleb.connolly@linaro.org> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.8 at phobos.denx.de X-Virus-Status: Clean When using the FDT command to inspect an arbitrary FDT in memory, it will always be necessary to explicitly set the FDT address. However it is also quite likely that the command is being used to inspect U-Boot's own FDT. Simplify that common workflow of running "fdt addr -c" to get the control address and set it by just making $fdtcontroladdr the default FDT if there isn't one. Signed-off-by: Caleb Connolly --- cmd/fdt.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/fdt.c b/cmd/fdt.c index d16b141ce32d..8909706e2483 100644 --- a/cmd/fdt.c +++ b/cmd/fdt.c @@ -276,8 +276,17 @@ static int do_fdt(struct cmd_tbl *cmdtp, int flag, int argc, char *const argv[]) return CMD_RET_SUCCESS; } + /* Try using U-Boot's FDT by default */ + if (!working_fdt) { + struct fdt_header *addr; + + addr = (void *)env_get_hex("fdtcontroladdr", 0); + if (addr && fdt_check_header(&addr)) + set_working_fdt_addr((phys_addr_t)addr); + } + if (!working_fdt) { puts("No FDT memory address configured. Please configure\n" "the FDT address via \"fdt addr
\" command.\n" "Aborting!\n");