MLK-16974 imx8m: Modify kernel DTB to limit USB to high-speed for mfgtool
authorYe Li <ye.li@nxp.com>
Fri, 24 Nov 2017 07:33:21 +0000 (01:33 -0600)
committerYe Li <ye.li@nxp.com>
Fri, 24 Nov 2017 08:49:30 +0000 (02:49 -0600)
We found USB issue when using super-speed for mfgtool, temporally work around
the problem to use high-speed only.

Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Li Jun <jun.li@nxp.com>
arch/arm/cpu/armv8/imx8m/soc.c

index a644e37..79cf1ea 100644 (file)
@@ -476,6 +476,31 @@ add_status:
                                        nodes_path[i], "status");
                        }
                }
+
+               const char *usb_dwc3_path = "/usb@38100000/dwc3";
+               nodeoff = fdt_path_offset(blob, usb_dwc3_path);
+               if (nodeoff >= 0) {
+                       const char *speed = "high-speed";
+                       printf("Found %s node\n", usb_dwc3_path);
+
+usb_modify_speed:
+
+                       rc = fdt_setprop(blob, nodeoff, "maximum-speed", speed, strlen(speed) + 1);
+                       if (rc) {
+                               if (rc == -FDT_ERR_NOSPACE) {
+                                       rc = fdt_increase_size(blob, 512);
+                                       if (!rc)
+                                               goto usb_modify_speed;
+                               }
+                               printf("Unable to set property %s:%s, err=%s\n",
+                                       usb_dwc3_path, "maximum-speed", fdt_strerror(rc));
+                       } else {
+                               printf("Modify %s:%s = %s\n",
+                                       usb_dwc3_path, "maximum-speed", speed);
+                       }
+               }else {
+                       printf("Can't found %s node\n", usb_dwc3_path);
+               }
        }
 
        /* Disable the CPU idle for A0 chip since the HW does not support it */