aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorFelipe Balbi <balbi@ti.com>2011-09-30 03:58:47 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-10-04 13:25:54 -0400
commit879631aa658be2c1307758223b6d15236f9f6335 (patch)
tree9ab6eafbe5cee1b6d57492e42ddef317a800c469 /drivers/usb/dwc3/gadget.c
parenta4af9008bb69f49df3abf816d48e224aca810af4 (diff)
usb: dwc3: gadget: implement streams support
The following patch adds support for streams to dwc3 driver. While at that, also fix one small issue on endpoint disable where we should clear all flags not only ENABLED. Reviewied-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 524ff91bf39..8d8502373db 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -264,6 +264,12 @@ static int dwc3_gadget_set_ep_config(struct dwc3 *dwc, struct dwc3_ep *dep,
264 params.param1.depcfg.xfer_complete_enable = true; 264 params.param1.depcfg.xfer_complete_enable = true;
265 params.param1.depcfg.xfer_not_ready_enable = true; 265 params.param1.depcfg.xfer_not_ready_enable = true;
266 266
267 if (usb_endpoint_xfer_bulk(desc) && dep->endpoint.max_streams) {
268 params.param1.depcfg.stream_capable = true;
269 params.param1.depcfg.stream_event_enable = true;
270 dep->stream_capable = true;
271 }
272
267 if (usb_endpoint_xfer_isoc(desc)) 273 if (usb_endpoint_xfer_isoc(desc))
268 params.param1.depcfg.xfer_in_progress_enable = true; 274 params.param1.depcfg.xfer_in_progress_enable = true;
269 275
@@ -391,15 +397,16 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
391 struct dwc3 *dwc = dep->dwc; 397 struct dwc3 *dwc = dep->dwc;
392 u32 reg; 398 u32 reg;
393 399
394 dep->flags &= ~DWC3_EP_ENABLED;
395 dwc3_remove_requests(dwc, dep); 400 dwc3_remove_requests(dwc, dep);
396 401
397 reg = dwc3_readl(dwc->regs, DWC3_DALEPENA); 402 reg = dwc3_readl(dwc->regs, DWC3_DALEPENA);
398 reg &= ~DWC3_DALEPENA_EP(dep->number); 403 reg &= ~DWC3_DALEPENA_EP(dep->number);
399 dwc3_writel(dwc->regs, DWC3_DALEPENA, reg); 404 dwc3_writel(dwc->regs, DWC3_DALEPENA, reg);
400 405
406 dep->stream_capable = false;
401 dep->desc = NULL; 407 dep->desc = NULL;
402 dep->type = 0; 408 dep->type = 0;
409 dep->flags = 0;
403 410
404 return 0; 411 return 0;
405} 412}
@@ -633,6 +640,9 @@ static struct dwc3_request *dwc3_prepare_trbs(struct dwc3_ep *dep,
633 trb.lst = last_one; 640 trb.lst = last_one;
634 } 641 }
635 642
643 if (usb_endpoint_xfer_bulk(dep->desc) && dep->stream_capable)
644 trb.sid_sofn = req->request.stream_id;
645
636 switch (usb_endpoint_type(dep->desc)) { 646 switch (usb_endpoint_type(dep->desc)) {
637 case USB_ENDPOINT_XFER_CONTROL: 647 case USB_ENDPOINT_XFER_CONTROL:
638 trb.trbctl = DWC3_TRBCTL_CONTROL_SETUP; 648 trb.trbctl = DWC3_TRBCTL_CONTROL_SETUP;
@@ -1505,12 +1515,28 @@ static void dwc3_endpoint_interrupt(struct dwc3 *dwc,
1505 } 1515 }
1506 1516
1507 break; 1517 break;
1518 case DWC3_DEPEVT_STREAMEVT:
1519 if (!usb_endpoint_xfer_bulk(dep->desc)) {
1520 dev_err(dwc->dev, "Stream event for non-Bulk %s\n",
1521 dep->name);
1522 return;
1523 }
1524
1525 switch (event->status) {
1526 case DEPEVT_STREAMEVT_FOUND:
1527 dev_vdbg(dwc->dev, "Stream %d found and started\n",
1528 event->parameters);
1529
1530 break;
1531 case DEPEVT_STREAMEVT_NOTFOUND:
1532 /* FALLTHROUGH */
1533 default:
1534 dev_dbg(dwc->dev, "Couldn't find suitable stream\n");
1535 }
1536 break;
1508 case DWC3_DEPEVT_RXTXFIFOEVT: 1537 case DWC3_DEPEVT_RXTXFIFOEVT:
1509 dev_dbg(dwc->dev, "%s FIFO Overrun\n", dep->name); 1538 dev_dbg(dwc->dev, "%s FIFO Overrun\n", dep->name);
1510 break; 1539 break;
1511 case DWC3_DEPEVT_STREAMEVT:
1512 dev_dbg(dwc->dev, "%s Stream Event\n", dep->name);
1513 break;
1514 case DWC3_DEPEVT_EPCMDCMPLT: 1540 case DWC3_DEPEVT_EPCMDCMPLT:
1515 dwc3_ep_cmd_compl(dep, event); 1541 dwc3_ep_cmd_compl(dep, event);
1516 break; 1542 break;