1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright 2008-2011 Freescale Semiconductor, Inc.
7 #include <linux/libfdt.h>
8 #include <fdt_support.h>
10 #include <asm/processor.h>
13 #include <asm/fsl_portals.h>
14 #include <asm/fsl_liodn.h>
16 /* Update portal containter to match LAW setup of portal in phy map */
17 void fdt_portal(void *blob, const char *compat, const char *container,
22 off = fdt_node_offset_by_compatible(blob, -1, compat);
26 off = fdt_parent_offset(blob, off);
27 /* if non-zero assume we have a container */
35 range = fdt_getprop_w(blob, off, "ranges", &len);
37 printf("ERROR: container for %s has no ranges", compat);
43 range[1] = addr >> 32;
44 range[2] = addr & 0xffffffff;
47 range[1] = addr & 0xffffffff;
50 fdt_setprop_inplace(blob, off, "ranges", range, len);
53 name = fdt_get_name(blob, off, &len);
54 p = memchr(name, '@', len);
59 /* if we are given a container name check it
60 * against what we found, if it doesnt match exit out */
61 if (container && (memcmp(container, name, len))) {
62 printf("WARNING: container names didn't match %s %s\n",
67 memcpy(&buf, name, len);
68 len += sprintf(&buf[len], "@%llx", addr);
69 fdt_set_name(blob, off, buf);
73 printf("ERROR: %s isn't in a container. Not supported\n", compat);