]> git.baikalelectronics.ru Git - uboot.git/commitdiff
fdt_support: Add fdt_delete_disabled_nodes() and use in Turris MOX
authorMarek Behún <marek.behun@nic.cz>
Fri, 26 Nov 2021 13:57:15 +0000 (14:57 +0100)
committerStefan Roese <sr@denx.de>
Sun, 19 Dec 2021 08:50:47 +0000 (09:50 +0100)
Move Turris MOX specific remove_disabled_nodes() to fdt_support with
name fdt_delete_disabled_nodes(), so that others can potentially use it.

Signed-off-by: Marek Behún <marek.behun@nic.cz>
Reviewed-by: Stefan Roese <sr@denx.de>
board/CZ.NIC/turris_mox/turris_mox.c
common/fdt_support.c
include/fdt_support.h

index 809ce82d2014e9bedf6d3881bfcae156d4b27379..b61c5b1cb61c3358347c6dc2a26d6d2ff9211914 100644 (file)
@@ -749,24 +749,6 @@ static int setup_switch(void *blob, int id)
        return 0;
 }
 
-static int remove_disabled_nodes(void *blob)
-{
-       while (1) {
-               int res, offset;
-
-               offset = fdt_node_offset_by_prop_value(blob, -1, "status",
-                                                      "disabled", 9);
-               if (offset < 0)
-                       break;
-
-               res = fdt_del_node(blob, offset);
-               if (res < 0)
-                       return res;
-       }
-
-       return 0;
-}
-
 int ft_board_setup(void *blob, struct bd_info *bd)
 {
        int res;
@@ -872,7 +854,7 @@ int ft_board_setup(void *blob, struct bd_info *bd)
        fdt_fixup_ethernet(blob);
 
        /* Finally remove disabled nodes, as per Rob Herring's request. */
-       remove_disabled_nodes(blob);
+       fdt_delete_disabled_nodes(blob);
 
        return 0;
 }
index c2e16727e1311ba3ee492d3b4b65bae4280f576b..b2ba0825df3b0a47fcac27b62639f3413abfe254 100644 (file)
@@ -695,6 +695,29 @@ int fdt_shrink_to_minimum(void *blob, uint extrasize)
        return actualsize;
 }
 
+/**
+ * fdt_delete_disabled_nodes: Delete all nodes with status == "disabled"
+ *
+ * @blob: ptr to device tree
+ */
+int fdt_delete_disabled_nodes(void *blob)
+{
+       while (1) {
+               int ret, offset;
+
+               offset = fdt_node_offset_by_prop_value(blob, -1, "status",
+                                                      "disabled", 9);
+               if (offset < 0)
+                       break;
+
+               ret = fdt_del_node(blob, offset);
+               if (ret < 0)
+                       return ret;
+       }
+
+       return 0;
+}
+
 #ifdef CONFIG_PCI
 #define CONFIG_SYS_PCI_NR_INBOUND_WIN 4
 
index d40586725bce9a3f6e6c02ff070e721a1fd0d4fa..8ec461af6c3d74387806c7007703cc1ddf539c0b 100644 (file)
@@ -228,6 +228,8 @@ void set_working_fdt_addr(ulong addr);
 int fdt_shrink_to_minimum(void *blob, uint extrasize);
 int fdt_increase_size(void *fdt, int add_len);
 
+int fdt_delete_disabled_nodes(void *blob);
+
 int fdt_fixup_nor_flash_size(void *blob);
 
 struct node_info;