From 8f5afe21aed8b8ed4d75678a4e8972e7d8a23a6b Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 11 Jan 2023 16:10:18 -0700 Subject: dtoc: Add a way to read a phandle with params Add a function to read a phandle and associated name and offset. This is useful for binman. Signed-off-by: Simon Glass --- tools/dtoc/test_fdt.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'tools/dtoc/test_fdt.py') diff --git a/tools/dtoc/test_fdt.py b/tools/dtoc/test_fdt.py index a3e36ea363..3b8ee00d4e 100755 --- a/tools/dtoc/test_fdt.py +++ b/tools/dtoc/test_fdt.py @@ -795,6 +795,17 @@ class TestFdtUtil(unittest.TestCase): finally: tools.outdir= old_outdir + def test_get_phandle_name_offset(self): + val = fdt_util.GetPhandleNameOffset(self.node, 'missing') + self.assertIsNone(val) + + dtb = fdt.FdtScan(find_dtb_file('dtoc_test_phandle.dts')) + node = dtb.GetNode('/phandle-source') + node, name, offset = fdt_util.GetPhandleNameOffset(node, + 'phandle-name-offset') + self.assertEqual('phandle3-target', node.name) + self.assertEqual('fred', name) + self.assertEqual(123, offset) def run_test_coverage(build_dir): """Run the tests and check that we get 100% coverage -- cgit v1.2.3