aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Glass2018-09-14 05:57:06 -0500
committerSimon Glass2018-09-28 12:09:01 -0500
commit34967c2618439ef80cc76b4c43c3da4f66f12ffe (patch)
treee9e32cb8fad7a6e0e15d3636e80116f7acbbcf0a /scripts
parentbbef20d479441b01d62252cf127498c58078b2c3 (diff)
downloadu-boot-34967c2618439ef80cc76b4c43c3da4f66f12ffe.tar.gz
u-boot-34967c2618439ef80cc76b4c43c3da4f66f12ffe.tar.xz
u-boot-34967c2618439ef80cc76b4c43c3da4f66f12ffe.zip
fdt: Add Python support for adding/removing nodes
Pull this support from these upstream commits: bfbfab0 pylibfdt: Add a means to add and delete notes 9005f41 pylibfdt: Allow delprop() to return errors Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/dtc/pylibfdt/libfdt.i_shipped34
1 files changed, 28 insertions, 6 deletions
diff --git a/scripts/dtc/pylibfdt/libfdt.i_shipped b/scripts/dtc/pylibfdt/libfdt.i_shipped
index 0f17c5879e..76e61e98bd 100644
--- a/scripts/dtc/pylibfdt/libfdt.i_shipped
+++ b/scripts/dtc/pylibfdt/libfdt.i_shipped
@@ -628,28 +628,50 @@ class Fdt(FdtRo):
628 return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name, 628 return check_err(fdt_setprop(self._fdt, nodeoffset, prop_name,
629 val, len(val)), quiet) 629 val, len(val)), quiet)
630 630
631 def delprop(self, nodeoffset, prop_name): 631 def delprop(self, nodeoffset, prop_name, quiet=()):
632 """Delete a property from a node 632 """Delete a property from a node
633 633
634 Args: 634 Args:
635 nodeoffset: Node offset containing property to delete 635 nodeoffset: Node offset containing property to delete
636 prop_name: Name of property to delete 636 prop_name: Name of property to delete
637 quiet: Errors to ignore (empty to raise on all errors)
638
639 Returns:
640 Error code, or 0 if OK
637 641
638 Raises: 642 Raises:
639 FdtError if the property does not exist, or another error occurs 643 FdtError if the property does not exist, or another error occurs
640 """ 644 """
641 return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name)) 645 return check_err(fdt_delprop(self._fdt, nodeoffset, prop_name), quiet)
646
647 def add_subnode(self, parentoffset, name, quiet=()):
648 """Add a new subnode to a node
642 649
643 def del_node(self, nodeoffset): 650 Args:
651 parentoffset: Parent offset to add the subnode to
652 name: Name of node to add
653
654 Returns:
655 offset of the node created, or negative error code on failure
656
657 Raises:
658 FdtError if there is not enough space, or another error occurs
659 """
660 return check_err(fdt_add_subnode(self._fdt, parentoffset, name), quiet)
661
662 def del_node(self, nodeoffset, quiet=()):
644 """Delete a node 663 """Delete a node
645 664
646 Args: 665 Args:
647 nodeoffset: Node offset containing property to delete 666 nodeoffset: Offset of node to delete
667
668 Returns:
669 Error code, or 0 if OK
648 670
649 Raises: 671 Raises:
650 FdtError if the node does not exist, or another error occurs 672 FdtError if an error occurs
651 """ 673 """
652 return check_err(fdt_del_node(self._fdt, nodeoffset)) 674 return check_err(fdt_del_node(self._fdt, nodeoffset), quiet)
653 675
654 676
655class Property(bytearray): 677class Property(bytearray):