Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5E1C0EB64DD for ; Fri, 21 Jul 2023 16:08:14 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9EBC6867CC; Fri, 21 Jul 2023 18:07:38 +0200 (CEST) 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="LU9qgKMF"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8CC00867D1; Fri, 21 Jul 2023 18:07:33 +0200 (CEST) Received: from mail-io1-xd2b.google.com (mail-io1-xd2b.google.com [IPv6:2607:f8b0:4864:20::d2b]) (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 5DBA2867CC for ; Fri, 21 Jul 2023 18:07:30 +0200 (CEST) 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-io1-xd2b.google.com with SMTP id ca18e2360f4ac-78363cc070aso91421839f.1 for ; Fri, 21 Jul 2023 09:07:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1689955649; x=1690560449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=BzomB5JkMJ/Mw8gPnJKkW9o8Ga8ArmlaolzcWNxTu8g=; b=LU9qgKMFkt7eKsMUW7h8ylu/CvvC5A1gFu8tWWSb5uxfOUSFZX8K1LLaRvLkxyk1Im SzAo5t9u5CAiS8XZUoHrU+bqE5Y7kUWRPjxEmeqW5Sg36LseI8t7gu3NZgA5+2FZN9Vs mk1UodrpWNZoxu761qdlCy0GnOK8TT3SX4Orw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689955649; x=1690560449; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=BzomB5JkMJ/Mw8gPnJKkW9o8Ga8ArmlaolzcWNxTu8g=; b=OGkWueas/e/mCjcuTmHPyER/KwQ6cPhet9Wyc+M3+mOigbl6TKOg7bUm2moE4PhYKR dz1yupVT6faLA8xV4YnsmrqikhkLV2FrurpInJwI9KSA0VV/wE2AF4xdI7emUXOB8KNJ 5jbgCrr3g1+UNbCqK7m/tNEWHy0eE6/P2FIviDApzWdqqtodth+w4n/XgCmSEI1qbcWc Ay3MrIZVICInh02dbXuJnvKrTTYrrG90BQQyYIRe01vVK3B2AnCcDe8Q8tRBlv5De7md A/X9X5Je0sIBb6r+yIUQC34oP776v4QYCSKxQuxoM0mvzEuqFg01tyJbMwyWX3pm+y0Y bxpw== X-Gm-Message-State: ABy/qLZRHv68L+N3ZiGIPzJoqSQCiXO1cdlTdEQMpD42+ublHbjMCxUz 4N/5i9eleYj1OOXM+RvOt8eeWBMHbkwTBUIXC64= X-Google-Smtp-Source: APBJJlF+S/aYonGuWjdm0qKYEdF6EhkF/auE9IKEKfxQadYGstPJHpLkmKvrP9MiKBZclVt7LCKLtA== X-Received: by 2002:a6b:4f03:0:b0:783:6361:17ea with SMTP id d3-20020a6b4f03000000b00783636117eamr386927iob.8.1689955648901; Fri, 21 Jul 2023 09:07:28 -0700 (PDT) Received: from sjg1.lan (c-73-14-173-85.hsd1.co.comcast.net. [73.14.173.85]) by smtp.gmail.com with ESMTPSA id r17-20020a6bd911000000b0078680780694sm1158685ioc.34.2023.07.21.09.07.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Jul 2023 09:07:28 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Alper Nebi Yasak , Neha Malcom Francis , Stefan Herbrechtsmeier , Philippe Reynes , Peng Fan , Simon Glass , Heinrich Schuchardt , Jerry Van Baren Subject: [PATCH 4/6] fdt: Allow copying phandles into templates Date: Fri, 21 Jul 2023 10:07:04 -0600 Message-ID: <20230721160710.968748-5-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog In-Reply-To: <20230721160710.968748-1-sjg@chromium.org> References: <20230721160710.968748-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 Allow phandles to be copied over from a template. This can potentially cause duplicate phandles, but we can deal with that later. Signed-off-by: Simon Glass --- tools/dtoc/fdt.py | 2 +- tools/dtoc/test_fdt.py | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/dtoc/fdt.py b/tools/dtoc/fdt.py index a0b92d43e8a1..917088041cc4 100644 --- a/tools/dtoc/fdt.py +++ b/tools/dtoc/fdt.py @@ -719,7 +719,7 @@ class Node: """ tout.debug(f'copy to {self.path}: {src.path}') for name, src_prop in src.props.items(): - if name != 'phandle' and name not in self.props: + if name not in self.props: self.props[name] = Prop(self, None, name, src_prop.bytes) tout.debug(f' {name}') else: diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index f77e48b54eaf..4772071d59dd 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -317,7 +317,8 @@ class TestNode(unittest.TestCase): chk = dtb.GetNode('/dest/base') self.assertTrue(chk) self.assertEqual( - {'compatible', 'bootph-all', '#address-cells', '#size-cells'}, + {'compatible', 'bootph-all', '#address-cells', '#size-cells', + 'phandle'}, chk.props.keys()) # Check the first property @@ -340,8 +341,8 @@ class TestNode(unittest.TestCase): over = dtb.GetNode('/dest/base/over') self.assertTrue(over) - # Make sure that the phandle for 'over' is not copied - self.assertNotIn('phandle', over.props.keys()) + # Make sure that the phandle for 'over' is copied + self.assertIn('phandle', over.props.keys()) second = dtb.GetNode('/dest/base/second') self.assertTrue(second) @@ -349,7 +350,7 @@ class TestNode(unittest.TestCase): [n.name for n in chk.subnodes]) self.assertEqual(chk, over.parent) self.assertEqual( - {'bootph-all', 'compatible', 'reg', 'low-power'}, + {'bootph-all', 'compatible', 'reg', 'low-power', 'phandle'}, over.props.keys()) if expect_none: @@ -413,14 +414,14 @@ class TestNode(unittest.TestCase): '/dest/second', '/dest/existing', '/dest/base'], [n.path for n in dst.subnodes]) - # Make sure that the phandle for 'over' is not copied + # Make sure that the phandle for 'over' is copied over = dst.FindNode('over') tout.debug(f'keys: {over.props.keys()}') - self.assertNotIn('phandle', over.props.keys()) + self.assertIn('phandle', over.props.keys()) # Check the merged properties, first the base ones in '/dest' expect = {'bootph-all', 'compatible', 'stringarray', 'longbytearray', - 'maybe-empty-int'} + 'maybe-empty-int', 'phandle'} # Properties from 'base' expect.update({'#address-cells', '#size-cells'}) -- 2.41.0.487.g6d72f3e995-goog