2 * Copyright 2008-2011 Freescale Semiconductor, Inc.
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <linux/libfdt.h>
9 #include <fdt_support.h>
11 #include <asm/processor.h>
14 #include <asm/fsl_portals.h>
15 #include <asm/fsl_liodn.h>
17 /* Update portal containter to match LAW setup of portal in phy map */
18 void fdt_portal(void *blob, const char *compat, const char *container,
23 off = fdt_node_offset_by_compatible(blob, -1, compat);
27 off = fdt_parent_offset(blob, off);
28 /* if non-zero assume we have a container */
36 range = fdt_getprop_w(blob, off, "ranges", &len);
38 printf("ERROR: container for %s has no ranges", compat);
44 range[1] = addr >> 32;
45 range[2] = addr & 0xffffffff;
48 range[1] = addr & 0xffffffff;
51 fdt_setprop_inplace(blob, off, "ranges", range, len);
54 name = fdt_get_name(blob, off, &len);
55 p = memchr(name, '@', len);
60 /* if we are given a container name check it
61 * against what we found, if it doesnt match exit out */
62 if (container && (memcmp(container, name, len))) {
63 printf("WARNING: container names didn't match %s %s\n",
68 memcpy(&buf, name, len);
69 len += sprintf(&buf[len], "@%llx", addr);
70 fdt_set_name(blob, off, buf);
74 printf("ERROR: %s isn't in a container. Not supported\n", compat);