Skip to content

Commit a09e23f

Browse files
Mian Yousaf KaukabFelipe Balbi
authored andcommitted
usb: gadget: net2280: check interrupts for all endpoints
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>
1 parent 463e104 commit a09e23f

File tree

2 files changed

+47
-13
lines changed

2 files changed

+47
-13
lines changed

drivers/usb/gadget/udc/net2280.c

Lines changed: 44 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2883,6 +2883,26 @@ static void handle_stat0_irqs_superspeed(struct net2280 *dev,
28832883
return;
28842884
}
28852885

2886+
static void usb338x_handle_ep_intr(struct net2280 *dev, u32 stat0)
2887+
{
2888+
u32 index;
2889+
u32 bit;
2890+
2891+
for (index = 0; index < ARRAY_SIZE(ep_bit); index++) {
2892+
bit = BIT(ep_bit[index]);
2893+
2894+
if (!stat0)
2895+
break;
2896+
2897+
if (!(stat0 & bit))
2898+
continue;
2899+
2900+
stat0 &= ~bit;
2901+
2902+
handle_ep_small(&dev->ep[index]);
2903+
}
2904+
}
2905+
28862906
static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
28872907
{
28882908
struct net2280_ep *ep;
@@ -3107,20 +3127,31 @@ static void handle_stat0_irqs(struct net2280 *dev, u32 stat)
31073127
#undef w_length
31083128

31093129
next_endpoints:
3110-
/* endpoint data irq ? */
3111-
scratch = stat & 0x7f;
3112-
stat &= ~0x7f;
3113-
for (num = 0; scratch; num++) {
3114-
u32 t;
3115-
3116-
/* do this endpoint's FIFO and queue need tending? */
3117-
t = BIT(num);
3118-
if ((scratch & t) == 0)
3119-
continue;
3120-
scratch ^= t;
3130+
if ((dev->quirks & PLX_SUPERSPEED) && dev->enhanced_mode) {
3131+
u32 mask = (BIT(ENDPOINT_0_INTERRUPT) |
3132+
USB3380_IRQSTAT0_EP_INTR_MASK_IN |
3133+
USB3380_IRQSTAT0_EP_INTR_MASK_OUT);
3134+
3135+
if (stat & mask) {
3136+
usb338x_handle_ep_intr(dev, stat & mask);
3137+
stat &= ~mask;
3138+
}
3139+
} else {
3140+
/* endpoint data irq ? */
3141+
scratch = stat & 0x7f;
3142+
stat &= ~0x7f;
3143+
for (num = 0; scratch; num++) {
3144+
u32 t;
3145+
3146+
/* do this endpoint's FIFO and queue need tending? */
3147+
t = BIT(num);
3148+
if ((scratch & t) == 0)
3149+
continue;
3150+
scratch ^= t;
31213151

3122-
ep = &dev->ep[num];
3123-
handle_ep_small(ep);
3152+
ep = &dev->ep[num];
3153+
handle_ep_small(ep);
3154+
}
31243155
}
31253156

31263157
if (stat)

include/linux/usb/net2280.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,9 @@ struct net2280_regs {
168168
#define ENDPOINT_B_INTERRUPT 2
169169
#define ENDPOINT_A_INTERRUPT 1
170170
#define ENDPOINT_0_INTERRUPT 0
171+
#define USB3380_IRQSTAT0_EP_INTR_MASK_IN (0xF << 17)
172+
#define USB3380_IRQSTAT0_EP_INTR_MASK_OUT (0xF << 1)
173+
171174
u32 irqstat1;
172175
#define POWER_STATE_CHANGE_INTERRUPT 27
173176
#define PCI_ARBITER_TIMEOUT_INTERRUPT 26

0 commit comments

Comments
 (0)