]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
usb: dwc2: detect device speed correctly
authorStephen Warren <swarren@wwwdotorg.org>
Sat, 28 Mar 2015 03:55:38 +0000 (21:55 -0600)
committerMarek Vasut <marex@denx.de>
Tue, 14 Apr 2015 03:47:59 +0000 (05:47 +0200)
This doesn't make my LS keyboard work any better, but it does at least
report the correct speed in "usb tree".

Signed-off-by: Stephen Warren <swarren@wwwdotorg.org>
drivers/usb/host/dwc2.c
drivers/usb/host/dwc2.h

index 8f7c269dd1a5f5085278f232beb797a52be116de..b506ff23ed387837a92ed909b13d5db06bb2181f 100644 (file)
@@ -463,7 +463,11 @@ static int dwc_otg_submit_rh_msg_in_status(struct usb_device *dev, void *buffer,
                if (hprt0 & DWC2_HPRT0_PRTPWR)
                        port_status |= USB_PORT_STAT_POWER;
 
-               port_status |= USB_PORT_STAT_HIGH_SPEED;
+               if ((hprt0 & DWC2_HPRT0_PRTSPD_MASK) == DWC2_HPRT0_PRTSPD_LOW)
+                       port_status |= USB_PORT_STAT_LOW_SPEED;
+               else if ((hprt0 & DWC2_HPRT0_PRTSPD_MASK) ==
+                        DWC2_HPRT0_PRTSPD_HIGH)
+                       port_status |= USB_PORT_STAT_HIGH_SPEED;
 
                if (hprt0 & DWC2_HPRT0_PRTENCHNG)
                        port_change |= USB_PORT_STAT_C_ENABLE;
index ba08fd554f17f523c5241f557f899f2e3589f3a7..45408c6f5cc19946fb66c27b9ca190ab6012f103 100644 (file)
@@ -536,6 +536,9 @@ struct dwc2_core_regs {
 #define DWC2_HPRT0_PRTPWR_OFFSET                       12
 #define DWC2_HPRT0_PRTTSTCTL_MASK                      (0xF << 13)
 #define DWC2_HPRT0_PRTTSTCTL_OFFSET                    13
+#define DWC2_HPRT0_PRTSPD_HIGH                         (0 << 17)
+#define DWC2_HPRT0_PRTSPD_FULL                         (1 << 17)
+#define DWC2_HPRT0_PRTSPD_LOW                          (2 << 17)
 #define DWC2_HPRT0_PRTSPD_MASK                         (0x3 << 17)
 #define DWC2_HPRT0_PRTSPD_OFFSET                       17
 #define DWC2_HAINT_CH0                                 (1 << 0)