dtoc: Adjust GetProps() in fdt_normal to use the node path
[platform/kernel/u-boot.git] / tools / dtoc / fdt_select.py
1 #!/usr/bin/python
2 #
3 # Copyright (C) 2016 Google, Inc
4 # Written by Simon Glass <sjg@chromium.org>
5 #
6 # SPDX-License-Identifier:      GPL-2.0+
7 #
8
9 # Bring in either the normal fdt library (which relies on libfdt) or the
10 # fallback one (which uses fdtget and is slower). Both provide the same
11 # interface for this file to use.
12 try:
13     import fdt_normal
14     have_libfdt = True
15 except ImportError:
16     have_libfdt = False
17     import fdt_fallback
18
19 def FdtScan(fname):
20     """Returns a new Fdt object from the implementation we are using"""
21     if have_libfdt:
22         dtb = fdt_normal.FdtNormal(fname)
23     else:
24         dtb = fdt_fallback.FdtFallback(fname)
25     dtb.Scan()
26     return dtb