usb: dwc2: gadget: Repair DSTS register decoding
authorMarek Vasut <marex@denx.de>
Fri, 18 Dec 2015 02:26:17 +0000 (03:26 +0100)
committerFelipe Balbi <balbi@ti.com>
Tue, 22 Dec 2015 18:03:05 +0000 (12:03 -0600)
The "enumspd" field is located in register DSTS[2:1], but the code
which checks the bitfield does not shift the value accordingly. This
in turn causes incorrect detection of gadget link partner speed in
dwc2_hsotg_irq_enumdone() .

Shift the value accordingly to fix the problem with speed detection.

Acked-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/dwc2/gadget.c

index 8ab7a9e0e54751430446b84a30b7816201416b82..422ab7da4eb51b99e238900f413d069d62a468c2 100644 (file)
@@ -2095,7 +2095,7 @@ static void dwc2_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg)
         */
 
        /* catch both EnumSpd_FS and EnumSpd_FS48 */
-       switch (dsts & DSTS_ENUMSPD_MASK) {
+       switch ((dsts & DSTS_ENUMSPD_MASK) >> DSTS_ENUMSPD_SHIFT) {
        case DSTS_ENUMSPD_FS:
        case DSTS_ENUMSPD_FS48:
                hsotg->gadget.speed = USB_SPEED_FULL;