Skip to contentSkip to conversation

usb: dwc2: detect device speed correctly

PATCH New Stephen Warren 2 participants 2 messages Mar 28, 2015 – Apr 2, 2015 USB

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 usb: dwc2: detect device speed correctly

This doesn't make my LS keyboard work any better, but it does at least report the correct speed in "usb tree".

---
 drivers/usb/host/dwc2.c | 6 +++++-
 drivers/usb/host/dwc2.h | 3 +++
 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/usb/host/dwc2.c +5 -1
index 8f7c269dd1a5..b506ff23ed38 100644
@@ -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;
drivers/usb/host/dwc2.h +3 -0
index ba08fd554f17..45408c6f5cc1 100644
@@ -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)
Signature · 1 line
1.9.1
Applied
#1 lore raw

PATCH 1/1 usb: dwc2: detect device speed correctly

Quoted 4 lines · Stephen Warren

This doesn't make my LS keyboard work any better, but it does at least report the correct speed in "usb tree".

Applied to topic/dwc2 , thanks! This will go into next release.

Best regards,
Marek Vasut