target: socfpga: Add Altera SoCFPGA support
[openwrt.git] / target / linux / socfpga / patches-4.4 / 0002-usb-dwc2-gadget-Repair-DSTS-register-decoding.patch
1 From e5cbd23e4f40181c907a1abc136b17de8cb86809 Mon Sep 17 00:00:00 2001
2 From: Marek Vasut <marex@denx.de>
3 Date: Thu, 17 Dec 2015 23:42:35 +0100
4 Subject: [PATCH 2/5] usb: dwc2: gadget: Repair DSTS register decoding
5
6 The "enumspd" field is located in register DSTS[2:1], but the code
7 which checks the bitfield does not shift the value accordingly. This
8 in turn causes incorrect detection of gadget link partner speed in
9 dwc2_hsotg_irq_enumdone() .
10
11 Shift the value accordingly to fix the problem with speed detection.
12
13 Signed-off-by: Marek Vasut <marex@denx.de>
14 Cc: Felipe Balbi <balbi@ti.com>
15 Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16 Cc: John Youn <johnyoun@synopsys.com>
17 ---
18  drivers/usb/dwc2/gadget.c | 2 +-
19  1 file changed, 1 insertion(+), 1 deletion(-)
20
21 diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
22 index 0abf73c..48e47c1 100644
23 --- a/drivers/usb/dwc2/gadget.c
24 +++ b/drivers/usb/dwc2/gadget.c
25 @@ -2095,7 +2095,7 @@ static void dwc2_hsotg_irq_enumdone(struct dwc2_hsotg *hsotg)
26          */
27  
28         /* catch both EnumSpd_FS and EnumSpd_FS48 */
29 -       switch (dsts & DSTS_ENUMSPD_MASK) {
30 +       switch ((dsts & DSTS_ENUMSPD_MASK) >> DSTS_ENUMSPD_SHIFT) {
31         case DSTS_ENUMSPD_FS:
32         case DSTS_ENUMSPD_FS48:
33                 hsotg->gadget.speed = USB_SPEED_FULL;
34 -- 
35 2.7.0
36