usb: gadget: net2280: check interrupts for all endpoints
authorMian Yousaf Kaukab <yousaf.kaukab@intel.com>
Sat, 16 May 2015 20:33:35 +0000 (22:33 +0200)
committerFelipe Balbi <balbi@ti.com>
Tue, 26 May 2015 15:40:11 +0000 (10:40 -0500)
USB3380 in enhanced mode has 4 IN and 4 OUT endpoints. Check
interrupts for all of them.

Tested-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@intel.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc/net2280.c
include/linux/usb/net2280.h

index 878a98ed84f58432816b55661132f493ab0be6cc..a78a9c048b87267ab88e23fe75eda0e011950bee 100644 (file)
@@ -2883,6 +2883,26 @@ next_endpoints3:
        return;
 }
 
+static void usb338x_handle_ep_intr(struct net2280 *dev, u32 stat0)
+{
+       u32 index;
+       u32 bit;
+
+       for (index = 0; index < ARRAY_SIZE(ep_bit); index++) {
+               bit = BIT(ep_bit[index]);
+
+               if (!stat0)
+                       break;
+
+               if (!(stat0 & bit))
+                       continue;
+
+               stat0 &= ~bit;
+
+               handle_ep_small(&dev->ep[index]);
+       }
+}
+
 static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
 {
        struct net2280_ep       *ep;
@@ -3107,20 +3127,31 @@ do_stall:
 #undef w_length
 
 next_endpoints:
-       /* endpoint data irq ? */
-       scratch = stat & 0x7f;
-       stat &= ~0x7f;
-       for (num = 0; scratch; num++) {
-               u32             t;
-
-               /* do this endpoint's FIFO and queue need tending? */
-               t = BIT(num);
-               if ((scratch & t) == 0)
-                       continue;
-               scratch ^= t;
+       if ((dev->quirks & PLX_SUPERSPEED) && dev->enhanced_mode) {
+               u32 mask = (BIT(ENDPOINT_0_INTERRUPT) |
+                       USB3380_IRQSTAT0_EP_INTR_MASK_IN |
+                       USB3380_IRQSTAT0_EP_INTR_MASK_OUT);
+
+               if (stat & mask) {
+                       usb338x_handle_ep_intr(dev, stat & mask);
+                       stat &= ~mask;
+               }
+       } else {
+               /* endpoint data irq ? */
+               scratch = stat & 0x7f;
+               stat &= ~0x7f;
+               for (num = 0; scratch; num++) {
+                       u32             t;
+
+                       /* do this endpoint's FIFO and queue need tending? */
+                       t = BIT(num);
+                       if ((scratch & t) == 0)
+                               continue;
+                       scratch ^= t;
 
-               ep = &dev->ep[num];
-               handle_ep_small(ep);
+                       ep = &dev->ep[num];
+                       handle_ep_small(ep);
+               }
        }
 
        if (stat)
index 148b8fa5b1a2be5295fe487b365676dba9f1d371..725120224472a94bfa05ba62b3362f3a7f25d896 100644 (file)
@@ -168,6 +168,9 @@ struct net2280_regs {
 #define     ENDPOINT_B_INTERRUPT                                2
 #define     ENDPOINT_A_INTERRUPT                                1
 #define     ENDPOINT_0_INTERRUPT                                0
+#define     USB3380_IRQSTAT0_EP_INTR_MASK_IN (0xF << 17)
+#define     USB3380_IRQSTAT0_EP_INTR_MASK_OUT (0xF << 1)
+
        u32             irqstat1;
 #define     POWER_STATE_CHANGE_INTERRUPT                        27
 #define     PCI_ARBITER_TIMEOUT_INTERRUPT                       26
This page took 0.027714 seconds and 5 git commands to generate.