usb: dwc3: Update speed checks for SuperSpeedPlus
authorJohn Youn <John.Youn@synopsys.com>
Sat, 6 Feb 2016 01:08:45 +0000 (17:08 -0800)
committerFelipe Balbi <balbi@kernel.org>
Fri, 4 Mar 2016 13:14:27 +0000 (15:14 +0200)
Update various places where the speed is checked so that it takes into
account SuperSpeedPlus properly.

Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/dwc3/ep0.c
drivers/usb/dwc3/gadget.c

index 8d6b75c2f53b2e0d0991ca3dddc784f6dccecadb..eca2e6d8e0411b2d36e90c3c6e265cf6051ad6c0 100644 (file)
@@ -356,7 +356,8 @@ static int dwc3_ep0_handle_status(struct dwc3 *dwc,
                 */
                usb_status |= dwc->gadget.is_selfpowered;
 
-               if (dwc->speed == DWC3_DSTS_SUPERSPEED) {
+               if ((dwc->speed == DWC3_DSTS_SUPERSPEED) ||
+                   (dwc->speed == DWC3_DSTS_SUPERSPEED_PLUS)) {
                        reg = dwc3_readl(dwc->regs, DWC3_DCTL);
                        if (reg & DWC3_DCTL_INITU1ENA)
                                usb_status |= 1 << USB_DEV_STAT_U1_ENABLED;
@@ -426,7 +427,8 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
                case USB_DEVICE_U1_ENABLE:
                        if (state != USB_STATE_CONFIGURED)
                                return -EINVAL;
-                       if (dwc->speed != DWC3_DSTS_SUPERSPEED)
+                       if ((dwc->speed != DWC3_DSTS_SUPERSPEED) &&
+                           (dwc->speed != DWC3_DSTS_SUPERSPEED_PLUS))
                                return -EINVAL;
 
                        reg = dwc3_readl(dwc->regs, DWC3_DCTL);
@@ -440,7 +442,8 @@ static int dwc3_ep0_handle_feature(struct dwc3 *dwc,
                case USB_DEVICE_U2_ENABLE:
                        if (state != USB_STATE_CONFIGURED)
                                return -EINVAL;
-                       if (dwc->speed != DWC3_DSTS_SUPERSPEED)
+                       if ((dwc->speed != DWC3_DSTS_SUPERSPEED) &&
+                           (dwc->speed != DWC3_DSTS_SUPERSPEED_PLUS))
                                return -EINVAL;
 
                        reg = dwc3_readl(dwc->regs, DWC3_DCTL);
index 2363bad45af865dd2e7ee0c28e009fff1ae7a7d5..3ad7ac6aadf875156141bb727fcca8e5531ded18 100644 (file)
@@ -463,7 +463,7 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
                | DWC3_DEPCFG_MAX_PACKET_SIZE(usb_endpoint_maxp(desc));
 
        /* Burst size is only needed in SuperSpeed mode */
-       if (dwc->gadget.speed == USB_SPEED_SUPER) {
+       if (dwc->gadget.speed >= USB_SPEED_SUPER) {
                u32 burst = dep->endpoint.maxburst - 1;
 
                params.param0 |= DWC3_DEPCFG_BURST_SIZE(burst);
@@ -1441,7 +1441,8 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g)
        reg = dwc3_readl(dwc->regs, DWC3_DSTS);
 
        speed = reg & DWC3_DSTS_CONNECTSPD;
-       if (speed == DWC3_DSTS_SUPERSPEED) {
+       if ((speed == DWC3_DSTS_SUPERSPEED) ||
+           (speed == DWC3_DSTS_SUPERSPEED_PLUS)) {
                dwc3_trace(trace_dwc3_gadget, "no wakeup on SuperSpeed\n");
                ret = -EINVAL;
                goto out;
@@ -2340,7 +2341,8 @@ static void dwc3_update_ram_clk_sel(struct dwc3 *dwc, u32 speed)
         * this. Maybe it becomes part of the power saving plan.
         */
 
-       if (speed != DWC3_DSTS_SUPERSPEED)
+       if ((speed != DWC3_DSTS_SUPERSPEED) &&
+           (speed != DWC3_DSTS_SUPERSPEED_PLUS))
                return;
 
        /*
@@ -2410,8 +2412,9 @@ static void dwc3_gadget_conndone_interrupt(struct dwc3 *dwc)
 
        /* Enable USB2 LPM Capability */
 
-       if ((dwc->revision > DWC3_REVISION_194A)
-                       && (speed != DWC3_DCFG_SUPERSPEED)) {
+       if ((dwc->revision > DWC3_REVISION_194A) &&
+           (speed != DWC3_DCFG_SUPERSPEED) &&
+           (speed != DWC3_DCFG_SUPERSPEED_PLUS)) {
                reg = dwc3_readl(dwc->regs, DWC3_DCFG);
                reg |= DWC3_DCFG_LPM_CAP;
                dwc3_writel(dwc->regs, DWC3_DCFG, reg);
This page took 0.02973 seconds and 5 git commands to generate.