]> git.sur5r.net Git - u-boot/blobdiff - arch/powerpc/cpu/mpc85xx/portals.c
GCC4.6: Squash warnings in denali_spd_ddr2.c
[u-boot] / arch / powerpc / cpu / mpc85xx / portals.c
index e8d53bb2fd0b94a2aaae4a0d0592e351be11c51c..6199633541250e03ce4dd5e6ac1beac3c8f387bf 100644 (file)
@@ -31,6 +31,7 @@
 #include <asm/fsl_liodn.h>
 
 static ccsr_qman_t *qman = (void *)CONFIG_SYS_FSL_QMAN_ADDR;
+static ccsr_bman_t *bman = (void *)CONFIG_SYS_FSL_BMAN_ADDR;
 
 void setup_portals(void)
 {
@@ -150,8 +151,10 @@ static int fdt_qportal(void *blob, int off, int id, char *name,
                        dev_handle = fdt_get_phandle(blob, dev_off);
                        if (dev_handle <= 0) {
                                dev_handle = fdt_alloc_phandle(blob);
-                               fdt_setprop_cell(blob, dev_off,
-                                       "linux,phandle", dev_handle);
+                               ret = fdt_set_phandle(blob, dev_off,
+                                                        dev_handle);
+                               if (ret < 0)
+                                       return ret;
                        }
 
                        ret = fdt_setprop(blob, childoff, "dev-handle",
@@ -195,7 +198,10 @@ void fdt_fixup_qportals(void *blob)
                u32 liodns[2];
 #endif
                const int *ci = fdt_getprop(blob, off, "cell-index", NULL);
-               int j, i = *ci;
+               int i = *ci;
+#ifdef CONFIG_SYS_DPAA_FMAN
+               int j;
+#endif
 
                err = fdt_setprop(blob, off, "compatible", compat, compat_len);
                if (err < 0)
@@ -239,6 +245,12 @@ void fdt_fixup_qportals(void *blob)
                                goto err;
                }
 #endif
+#ifdef CONFIG_SYS_DPAA_RMAN
+               err = fdt_qportal(blob, off, i, "rman@0",
+                                 FSL_HW_PORTAL_RMAN, 1);
+               if (err < 0)
+                       goto err;
+#endif
 
 err:
                if (err < 0) {
@@ -250,3 +262,32 @@ err:
                off = fdt_node_offset_by_compatible(blob, off, "fsl,qman-portal");
        }
 }
+
+void fdt_fixup_bportals(void *blob)
+{
+       int off, err;
+       unsigned int maj, min;
+       u32 rev_1 = in_be32(&bman->ip_rev_1);
+       char compat[64];
+       int compat_len;
+
+       maj = (rev_1 >> 8) & 0xff;
+       min = rev_1 & 0xff;
+
+       compat_len = sprintf(compat, "fsl,bman-portal-%u.%u", maj, min) + 1;
+       compat_len += sprintf(compat + compat_len, "fsl,bman-portal") + 1;
+
+       off = fdt_node_offset_by_compatible(blob, -1, "fsl,bman-portal");
+       while (off != -FDT_ERR_NOTFOUND) {
+               err = fdt_setprop(blob, off, "compatible", compat, compat_len);
+               if (err < 0) {
+                       printf("ERROR: unable to create props for %s: %s\n",
+                               fdt_get_name(blob, off, NULL),
+                                                fdt_strerror(err));
+                       return;
+               }
+
+               off = fdt_node_offset_by_compatible(blob, off, "fsl,bman-portal");
+       }
+
+}