ARM: tegra: Copy memory-region-names property
If multiple entries are present in the memory-region property, this new memory-region-names property can be used to specify names for each of them so that they can be more easily distinguished. Signed-off-by: Thierry Reding <treding@nvidia.com> Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Warren <twarren@nvidia.com>
This commit is contained in:
committed by
Tom Warren
parent
77409c7f83
commit
a0ba216ed4
@@ -78,9 +78,11 @@ void ft_mac_address_setup(void *fdt)
|
||||
|
||||
static int ft_copy_carveout(void *dst, const void *src, const char *node)
|
||||
{
|
||||
const char *names = "memory-region-names";
|
||||
struct fdt_memory carveout;
|
||||
unsigned int index = 0;
|
||||
int err;
|
||||
int err, offset, len;
|
||||
const void *prop;
|
||||
|
||||
while (true) {
|
||||
const char **compatibles = NULL;
|
||||
@@ -96,6 +98,8 @@ static int ft_copy_carveout(void *dst, const void *src, const char *node)
|
||||
if (err != -FDT_ERR_NOTFOUND)
|
||||
printf("failed to get carveout for %s: %d\n",
|
||||
node, err);
|
||||
else
|
||||
break;
|
||||
|
||||
return err;
|
||||
}
|
||||
@@ -126,6 +130,31 @@ static int ft_copy_carveout(void *dst, const void *src, const char *node)
|
||||
index++;
|
||||
}
|
||||
|
||||
offset = fdt_path_offset(src, node);
|
||||
if (offset < 0) {
|
||||
debug("failed to find source offset for %s: %s\n", node,
|
||||
fdt_strerror(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
prop = fdt_getprop(src, offset, names, &len);
|
||||
if (prop) {
|
||||
offset = fdt_path_offset(dst, node);
|
||||
if (offset < 0) {
|
||||
debug("failed to find destination offset for %s: %s\n",
|
||||
node, fdt_strerror(err));
|
||||
return err;
|
||||
}
|
||||
|
||||
err = fdt_setprop(dst, offset, "memory-region-names", prop,
|
||||
len);
|
||||
if (err < 0) {
|
||||
debug("failed to copy \"%s\" property: %s\n", names,
|
||||
fdt_strerror(err));
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user