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=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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 3BA27C433EF for ; Fri, 3 Sep 2021 13:17:54 +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 B865060FC0 for ; Fri, 3 Sep 2021 13:17:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org B865060FC0 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.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 9F42783577; Fri, 3 Sep 2021 15:17:17 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.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=gmail.com header.i=@gmail.com header.b="Ca/W3N4M"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 15C5D8358B; Fri, 3 Sep 2021 15:17:03 +0200 (CEST) Received: from mail-wr1-x431.google.com (mail-wr1-x431.google.com [IPv6:2a00:1450:4864:20::431]) (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 65DBB83583 for ; Fri, 3 Sep 2021 15:16:53 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=thierry.reding@gmail.com Received: by mail-wr1-x431.google.com with SMTP id v10so8207316wrd.4 for ; Fri, 03 Sep 2021 06:16:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PwB7nalDaqUrlBZ88LKOtE0aBhWttoq6uqij8pSzvD4=; b=Ca/W3N4Mj4j9g3EasKrRsbDJckRsLGGOgXKHwSOKvpjfjqU3eil379YEYWOiXx6aDm aPS/iYHtwfj9xasEaIUxwY96G8fAMvYHiPvs17bvPJx8sPV7W1tCmAkS29Ztwe+AFulI clTTr+QJbxkwRpw9NNbHgVckvHrKj9S02SSQblB98lC2KlEmILDMonl1KK83LWCC5QR2 zEZmaXX4zskOngjyPzJu0nGNfYnUjo0rntTW9mrt5SaXfriUV/cTMXzmi1uomMhEPCxU 6lgRDKQUB3CEalmRLH1nzAV8MIUY3XS2yAwxOXmS/pkI5BSO0Jmq/BiBDLOi3FrEnIPE jc/A== 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=PwB7nalDaqUrlBZ88LKOtE0aBhWttoq6uqij8pSzvD4=; b=f8JEOAPNLG3VEY0QknI3BYvA/jV+GhJJ7XLlTALXfshLBY9p5l9OEWC6YPzhxecSes W3x5BGZnfiyIgJzEJ4Qbc/MxEDefGFzxdYe+t2gDxITIqO4U//xmp35roigCAv+/1QFD iuf7/OKs83Kq+AI38Thor1O9SOM7B5YOj3SM767i9AGP1ZYRAzHTnYcoz/bsP+brQERV oA3GNpncDtmkDaROGGMd2SEjlRwHMuNnVbNrG3JiVt62YMp8gSRMlcLFodbcIWteT+0E 31RqVcuK409Sh+DsuzSPksvPVUCCl+q3u08zuig1iDeeuIzbPNS05OI8dVikIQ5gra1w 9bJg== X-Gm-Message-State: AOAM530CYZWVe8FCepewrqSNlNozxv1cniUJE0xKFL25SHnloh8h4YL4 mRrK40BKp3AErUdzsFbBLGaoy9D/D6I= X-Google-Smtp-Source: ABdhPJxIDQszTpa4MpJ257k6cgVwAo6ikwzgOII0tiF56094cKElrpW9zJATUdNnmQTbmTBA9J5yug== X-Received: by 2002:adf:80eb:: with SMTP id 98mr4058426wrl.370.1630675012930; Fri, 03 Sep 2021 06:16:52 -0700 (PDT) Received: from localhost ([217.111.27.204]) by smtp.gmail.com with ESMTPSA id k14sm4670785wri.46.2021.09.03.06.16.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Sep 2021 06:16:51 -0700 (PDT) From: Thierry Reding To: Tom Warren Cc: Simon Glass , u-boot@lists.denx.de Subject: [PATCH 9/9] ARM: tegra: Copy memory-region-names property Date: Fri, 3 Sep 2021 15:16:25 +0200 Message-Id: <20210903131625.2153838-10-thierry.reding@gmail.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210903131625.2153838-1-thierry.reding@gmail.com> References: <20210903131625.2153838-1-thierry.reding@gmail.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 From: Thierry Reding If multiple entries are present in the memory-region property, this new memory-region-names property can be used to specify names for each of them so that they can be more easily distinguished. Signed-off-by: Thierry Reding --- arch/arm/mach-tegra/dt-setup.c | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/arch/arm/mach-tegra/dt-setup.c b/arch/arm/mach-tegra/dt-setup.c index 894a6358a2c4..c11494722bc7 100644 --- a/arch/arm/mach-tegra/dt-setup.c +++ b/arch/arm/mach-tegra/dt-setup.c @@ -78,9 +78,11 @@ void ft_mac_address_setup(void *fdt) static int ft_copy_carveout(void *dst, const void *src, const char *node) { + const char *names = "memory-region-names"; struct fdt_memory carveout; unsigned int index = 0; - int err; + int err, offset, len; + const void *prop; while (true) { const char **compatibles = NULL; @@ -96,6 +98,8 @@ static int ft_copy_carveout(void *dst, const void *src, const char *node) if (err != -FDT_ERR_NOTFOUND) printf("failed to get carveout for %s: %d\n", node, err); + else + break; return err; } @@ -126,6 +130,31 @@ static int ft_copy_carveout(void *dst, const void *src, const char *node) index++; } + offset = fdt_path_offset(src, node); + if (offset < 0) { + debug("failed to find source offset for %s: %s\n", node, + fdt_strerror(err)); + return err; + } + + prop = fdt_getprop(src, offset, names, &len); + if (prop) { + offset = fdt_path_offset(dst, node); + if (offset < 0) { + debug("failed to find destination offset for %s: %s\n", + node, fdt_strerror(err)); + return err; + } + + err = fdt_setprop(dst, offset, "memory-region-names", prop, + len); + if (err < 0) { + debug("failed to copy \"%s\" property: %s\n", names, + fdt_strerror(err)); + return err; + } + } + return 0; } -- 2.33.0