aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorMarek BehĂșn <marek.behun@nic.cz>2021-11-26 14:57:15 +0100
committerStefan Roese <sr@denx.de>2021-12-19 09:50:47 +0100
commit574506c327318e82095122470d258da0be21b294 (patch)
tree31a670c9ae985d180e019af4ce97c59f81028935 /common
parent08370038df6c92a1bfe1aede55545a505e268305 (diff)
downloadu-boot-574506c327318e82095122470d258da0be21b294.zip
u-boot-574506c327318e82095122470d258da0be21b294.tar.gz
u-boot-574506c327318e82095122470d258da0be21b294.tar.bz2
fdt_support: Add fdt_delete_disabled_nodes() and use in Turris MOX
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>
Diffstat (limited to 'common')
-rw-r--r--common/fdt_support.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c
index c2e1672..b2ba082 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -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