Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 265055
b: refs/heads/master
c: 879631a
h: refs/heads/master
i:
  265053: 1f066bd
  265051: 2a05733
  265047: 77dd117
  265039: d1a7f69
  265023: 1677786
v: v3
  • Loading branch information
Felipe Balbi authored and Greg Kroah-Hartman committed Oct 4, 2011
1 parent 0d0ebb8 commit a6cacfe
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a4af9008bb69f49df3abf816d48e224aca810af4
refs/heads/master: 879631aa658be2c1307758223b6d15236f9f6335
8 changes: 0 additions & 8 deletions trunk/Documentation/usb/dwc3.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
~~~~~~
Please pick something while reading :)

- Implement streaming support for BULK endpoints
Tatyana's patch "usb: Add streams support to the gadget framework"
introduces streaming support for the gadget driver.
Every usb_request has new field called stream_id which holds its id.
Every usb_ep has a field num_supported_strms which describes the max
number of streams supported (for this ep).
UAS is AFAIK the only gadget with streaming support.

- Convert interrupt handler to per-ep-thread-irq

As it turns out some DWC3-commands ~1ms to complete. Currently we spin
Expand Down
6 changes: 6 additions & 0 deletions trunk/drivers/usb/dwc3/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@ struct dwc3_event_buffer {
* @interval: the intervall on which the ISOC transfer is started
* @name: a human readable name e.g. ep1out-bulk
* @direction: true for TX, false for RX
* @stream_capable: true when streams are enabled
*/
struct dwc3_ep {
struct usb_ep endpoint;
Expand Down Expand Up @@ -362,6 +363,7 @@ struct dwc3_ep {
char name[20];

unsigned direction:1;
unsigned stream_capable:1;
};

enum dwc3_phy {
Expand Down Expand Up @@ -650,6 +652,10 @@ struct dwc3_event_depevt {
#define DEPEVT_STATUS_IOC (1 << 2)
#define DEPEVT_STATUS_LST (1 << 3)

/* Stream event only */
#define DEPEVT_STREAMEVT_FOUND 1
#define DEPEVT_STREAMEVT_NOTFOUND 2

/* Control-only Status */
#define DEPEVT_STATUS_CONTROL_SETUP 0
#define DEPEVT_STATUS_CONTROL_DATA 1
Expand Down
34 changes: 30 additions & 4 deletions trunk/drivers/usb/dwc3/gadget.c
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
params.param1.depcfg.xfer_complete_enable = true;
params.param1.depcfg.xfer_not_ready_enable = true;

if (usb_endpoint_xfer_bulk(desc) && dep->endpoint.max_streams) {
params.param1.depcfg.stream_capable = true;
params.param1.depcfg.stream_event_enable = true;
dep->stream_capable = true;
}

if (usb_endpoint_xfer_isoc(desc))
params.param1.depcfg.xfer_in_progress_enable = true;

Expand Down Expand Up @@ -391,15 +397,16 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
struct dwc3 *dwc = dep->dwc;
u32 reg;

dep->flags &= ~DWC3_EP_ENABLED;
dwc3_remove_requests(dwc, dep);

reg = dwc3_readl(dwc->regs, DWC3_DALEPENA);
reg &= ~DWC3_DALEPENA_EP(dep->number);
dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);

dep->stream_capable = false;
dep->desc = NULL;
dep->type = 0;
dep->flags = 0;

return 0;
}
Expand Down Expand Up @@ -633,6 +640,9 @@ static struct dwc3_request *dwc3_prepare_trbs(struct dwc3_ep *dep,
trb.lst = last_one;
}

if (usb_endpoint_xfer_bulk(dep->desc) && dep->stream_capable)
trb.sid_sofn = req->request.stream_id;

switch (usb_endpoint_type(dep->desc)) {
case USB_ENDPOINT_XFER_CONTROL:
trb.trbctl = DWC3_TRBCTL_CONTROL_SETUP;
Expand Down Expand Up @@ -1504,13 +1514,29 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
dep->name);
}

break;
case DWC3_DEPEVT_STREAMEVT:
if (!usb_endpoint_xfer_bulk(dep->desc)) {
dev_err(dwc->dev, "Stream event for non-Bulk %s\n",
dep->name);
return;
}

switch (event->status) {
case DEPEVT_STREAMEVT_FOUND:
dev_vdbg(dwc->dev, "Stream %d found and started\n",
event->parameters);

break;
case DEPEVT_STREAMEVT_NOTFOUND:
/* FALLTHROUGH */
default:
dev_dbg(dwc->dev, "Couldn't find suitable stream\n");
}
break;
case DWC3_DEPEVT_RXTXFIFOEVT:
dev_dbg(dwc->dev, "%s FIFO Overrun\n", dep->name);
break;
case DWC3_DEPEVT_STREAMEVT:
dev_dbg(dwc->dev, "%s Stream Event\n", dep->name);
break;
case DWC3_DEPEVT_EPCMDCMPLT:
dwc3_ep_cmd_compl(dep, event);
break;
Expand Down

0 comments on commit a6cacfe

Please sign in to comment.