usb: musb: dsps: control musb speed based on dts setting
authorBin Liu <b-liu@ti.com>
Wed, 9 Sep 2015 16:56:18 +0000 (11:56 -0500)
committerFelipe Balbi <balbi@ti.com>
Sun, 27 Sep 2015 15:54:31 +0000 (10:54 -0500)
Set musb config->maximum_speed based on the dts setting to control musb
speed.

By default musb works in high-speed mode. Adding

maximum-speed = "full-speed";

to dts usb node will force musb to full-speed mode.

Signed-off-by: Bin Liu <b-liu@ti.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/musb/musb_dsps.c

index 84512d1..c8b2ec9 100644 (file)
@@ -747,6 +747,19 @@ static int dsps_create_musb_pdev(struct dsps_glue *glue,
        if (!ret && val)
                config->multipoint = true;
 
+       config->maximum_speed = of_usb_get_maximum_speed(dn);
+       switch (config->maximum_speed) {
+       case USB_SPEED_LOW:
+       case USB_SPEED_FULL:
+               break;
+       case USB_SPEED_SUPER:
+               dev_warn(dev, "ignore incorrect maximum_speed "
+                               "(super-speed) setting in dts");
+               /* fall through */
+       default:
+               config->maximum_speed = USB_SPEED_HIGH;
+       }
+
        ret = platform_device_add_data(musb, &pdata, sizeof(pdata));
        if (ret) {
                dev_err(dev, "failed to add platform_data\n");