MLK-21000 imx8: Ignore upstream power-domains of len != 4
authorLeonard Crestez <leonard.crestez@nxp.com>
Fri, 19 Apr 2019 15:05:25 +0000 (18:05 +0300)
committerYe Li <ye.li@nxp.com>
Fri, 24 May 2019 11:28:21 +0000 (04:28 -0700)
In upstream the power-domains for imx8 have different bindings and when
uboot attempts to parse them it ends up disabling everything.

This fix allows running upstream linux on imx8qxp without custom boot
binaries.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit aa9d0414644a3cd9ebfbda9a995163763e8086c2)

arch/arm/mach-imx/imx8/cpu.c

index 51cdb55..ced3f4c 100644 (file)
@@ -612,6 +612,7 @@ static bool check_owned_resources_in_pd_tree(void *blob, int nodeoff,
        unsigned int *unowned_rsrc)
 {
        unsigned int rsrc_id;
+       int phplen;
        const fdt32_t *php;
 
        /* Search the ancestors nodes in current SS power-domain tree,
@@ -620,11 +621,16 @@ static bool check_owned_resources_in_pd_tree(void *blob, int nodeoff,
        */
 
        do {
-               php = fdt_getprop(blob, nodeoff, "power-domains", NULL);
+               php = fdt_getprop(blob, nodeoff, "power-domains", &phplen);
                if (!php) {
                        debug("   - ignoring no power-domains\n");
                        break;
                }
+               if (phplen != 4) {
+                       printf("ignoring %s power-domains of unexpected length %d\n",
+                                       fdt_get_name(blob, nodeoff, NULL), phplen);
+                       break;
+               }
                nodeoff = fdt_node_offset_by_phandle(blob, fdt32_to_cpu(*php));
 
                rsrc_id = fdtdec_get_uint(blob, nodeoff, "reg", 0);