summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-07-23 15:56:06 -0400
committerTom Rini <trini@konsulko.com>2020-07-23 15:56:06 -0400
commit5d3a21df6694ebd66d5c34c9d62a26edc7456fc7 (patch)
tree5de77f2861f6856866c5bf4ffa7cab22d371ccf3 /common
parent56d37f1c564107e27d873181d838571b7d7860e7 (diff)
parent60e7fa8b3b8538aae1e644dac61d5e4076901edb (diff)
Merge tag 'dm-pull-20jul20' of git://git.denx.de/u-boot-dm
binman support for FIT new UCLASS_SOC patman switch 'test' command minor fdt fixes patman usability improvements
Diffstat (limited to 'common')
-rw-r--r--common/fdt_region.c2
-rw-r--r--common/fdt_support.c32
2 files changed, 22 insertions, 12 deletions
diff --git a/common/fdt_region.c b/common/fdt_region.c
index 667659054a..ff12c518e9 100644
--- a/common/fdt_region.c
+++ b/common/fdt_region.c
@@ -65,6 +65,8 @@ int fdt_find_regions(const void *fdt, char * const inc[], int inc_count,
stop_at = offset;
prop = fdt_get_property_by_offset(fdt, offset, NULL);
str = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
+ if (!str)
+ return -FDT_ERR_BADSTRUCTURE;
if (str_in_list(str, exc_prop, exc_prop_count))
include = 0;
break;
diff --git a/common/fdt_support.c b/common/fdt_support.c
index 3778de5368..a565b470f8 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -816,8 +816,8 @@ static int fdt_del_partitions(void *blob, int parent_offset)
return 0;
}
-int fdt_node_set_part_info(void *blob, int parent_offset,
- struct mtd_device *dev)
+static int fdt_node_set_part_info(void *blob, int parent_offset,
+ struct mtd_device *dev)
{
struct list_head *pentry;
struct part_info *part;
@@ -951,27 +951,35 @@ void fdt_fixup_mtdparts(void *blob, const struct node_info *node_info,
struct mtd_device *dev;
int i, idx;
int noff;
-
- if (mtdparts_init() != 0)
- return;
+ bool inited = false;
for (i = 0; i < node_info_size; i++) {
idx = 0;
- noff = fdt_node_offset_by_compatible(blob, -1,
- node_info[i].compat);
- while (noff != -FDT_ERR_NOTFOUND) {
+ noff = -1;
+
+ while ((noff = fdt_node_offset_by_compatible(blob, noff,
+ node_info[i].compat)) >= 0) {
+ const char *prop;
+
+ prop = fdt_getprop(blob, noff, "status", NULL);
+ if (prop && !strcmp(prop, "disabled"))
+ continue;
+
debug("%s: %s, mtd dev type %d\n",
fdt_get_name(blob, noff, 0),
node_info[i].compat, node_info[i].type);
+
+ if (!inited) {
+ if (mtdparts_init() != 0)
+ return;
+ inited = true;
+ }
+
dev = device_find(node_info[i].type, idx++);
if (dev) {
if (fdt_node_set_part_info(blob, noff, dev))
return; /* return on error */
}
-
- /* Jump to next flash node */
- noff = fdt_node_offset_by_compatible(blob, noff,
- node_info[i].compat);
}
}
}