aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/dwc3/gadget.c
diff options
context:
space:
mode:
authorPaul Zimmerman <Paul.Zimmerman@synopsys.com>2012-02-15 21:56:56 -0500
committerFelipe Balbi <balbi@ti.com>2012-03-02 05:12:01 -0500
commit1d046793958f128dd43d42a4a0dac48bf6914273 (patch)
tree202b0c160c1005e7c1a2733cf39f5762118de7ca /drivers/usb/dwc3/gadget.c
parent2cd0e8512169b125fb0ff1f9ec3f8505eecb3012 (diff)
usb: dwc3: clean up whitespace damage, typos, missing parens, etc.
trivial patch, no functional changes Signed-off-by: Paul Zimmerman <paulz@synopsys.com> Signed-off-by: Felipe Balbi <balbi@ti.com>
Diffstat (limited to 'drivers/usb/dwc3/gadget.c')
-rw-r--r--drivers/usb/dwc3/gadget.c51
1 files changed, 25 insertions, 26 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index eeba2227c28..d121e73d89a 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -548,7 +548,7 @@ static int __dwc3_gadget_ep_enable(struct dwc3_ep *dep,
548 548
549 memset(&trb_link, 0, sizeof(trb_link)); 549 memset(&trb_link, 0, sizeof(trb_link));
550 550
551 /* Link TRB for ISOC. The HWO but is never reset */ 551 /* Link TRB for ISOC. The HWO bit is never reset */
552 trb_st_hw = &dep->trb_pool[0]; 552 trb_st_hw = &dep->trb_pool[0];
553 553
554 trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1]; 554 trb_link = &dep->trb_pool[DWC3_TRB_NUM - 1];
@@ -818,9 +818,9 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
818 * @dep: endpoint for which requests are being prepared 818 * @dep: endpoint for which requests are being prepared
819 * @starting: true if the endpoint is idle and no requests are queued. 819 * @starting: true if the endpoint is idle and no requests are queued.
820 * 820 *
821 * The functions goes through the requests list and setups TRBs for the 821 * The function goes through the requests list and sets up TRBs for the
822 * transfers. The functions returns once there are not more TRBs available or 822 * transfers. The function returns once there are no more TRBs available or
823 * it run out of requests. 823 * it runs out of requests.
824 */ 824 */
825static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting) 825static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
826{ 826{
@@ -834,8 +834,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
834 trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK; 834 trbs_left = (dep->busy_slot - dep->free_slot) & DWC3_TRB_MASK;
835 835
836 /* 836 /*
837 * if busy & slot are equal than it is either full or empty. If we are 837 * If busy & slot are equal than it is either full or empty. If we are
838 * starting to proceed requests then we are empty. Otherwise we ar 838 * starting to process requests then we are empty. Otherwise we are
839 * full and don't do anything 839 * full and don't do anything
840 */ 840 */
841 if (!trbs_left) { 841 if (!trbs_left) {
@@ -846,7 +846,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
846 * In case we start from scratch, we queue the ISOC requests 846 * In case we start from scratch, we queue the ISOC requests
847 * starting from slot 1. This is done because we use ring 847 * starting from slot 1. This is done because we use ring
848 * buffer and have no LST bit to stop us. Instead, we place 848 * buffer and have no LST bit to stop us. Instead, we place
849 * IOC bit TRB_NUM/4. We try to avoid to having an interrupt 849 * IOC bit every TRB_NUM/4. We try to avoid having an interrupt
850 * after the first request so we start at slot 1 and have 850 * after the first request so we start at slot 1 and have
851 * 7 requests proceed before we hit the first IOC. 851 * 7 requests proceed before we hit the first IOC.
852 * Other transfer types don't use the ring buffer and are 852 * Other transfer types don't use the ring buffer and are
@@ -882,8 +882,8 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
882 length = sg_dma_len(s); 882 length = sg_dma_len(s);
883 dma = sg_dma_address(s); 883 dma = sg_dma_address(s);
884 884
885 if (i == (request->num_mapped_sgs - 1) 885 if (i == (request->num_mapped_sgs - 1) ||
886 || sg_is_last(s)) { 886 sg_is_last(s)) {
887 last_one = true; 887 last_one = true;
888 chain = false; 888 chain = false;
889 } 889 }
@@ -951,8 +951,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
951 dwc3_prepare_trbs(dep, start_new); 951 dwc3_prepare_trbs(dep, start_new);
952 952
953 /* 953 /*
954 * req points to the first request where HWO changed 954 * req points to the first request where HWO changed from 0 to 1
955 * from 0 to 1
956 */ 955 */
957 req = next_request(&dep->req_queued); 956 req = next_request(&dep->req_queued);
958 } 957 }
@@ -978,7 +977,7 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
978 /* 977 /*
979 * FIXME we need to iterate over the list of requests 978 * FIXME we need to iterate over the list of requests
980 * here and stop, unmap, free and del each of the linked 979 * here and stop, unmap, free and del each of the linked
981 * requests instead of we do now. 980 * requests instead of what we do now.
982 */ 981 */
983 dwc3_unmap_buffer_from_dma(req); 982 dwc3_unmap_buffer_from_dma(req);
984 list_del(&req->list); 983 list_del(&req->list);
@@ -1011,7 +1010,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
1011 * particular token from the Host side. 1010 * particular token from the Host side.
1012 * 1011 *
1013 * This will also avoid Host cancelling URBs due to too 1012 * This will also avoid Host cancelling URBs due to too
1014 * many NACKs. 1013 * many NAKs.
1015 */ 1014 */
1016 dwc3_map_buffer_to_dma(req); 1015 dwc3_map_buffer_to_dma(req);
1017 list_add_tail(&req->list, &dep->request_list); 1016 list_add_tail(&req->list, &dep->request_list);
@@ -1034,10 +1033,10 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
1034 1033
1035 start_trans = 1; 1034 start_trans = 1;
1036 if (usb_endpoint_xfer_isoc(dep->desc) && 1035 if (usb_endpoint_xfer_isoc(dep->desc) &&
1037 dep->flags & DWC3_EP_BUSY) 1036 (dep->flags & DWC3_EP_BUSY))
1038 start_trans = 0; 1037 start_trans = 0;
1039 1038
1040 ret = __dwc3_gadget_kick_transfer(dep, 0, start_trans); 1039 ret = __dwc3_gadget_kick_transfer(dep, 0, start_trans);
1041 if (ret && ret != -EBUSY) { 1040 if (ret && ret != -EBUSY) {
1042 struct dwc3 *dwc = dep->dwc; 1041 struct dwc3 *dwc = dep->dwc;
1043 1042
@@ -1291,10 +1290,10 @@ static int dwc3_gadget_wakeup(struct usb_gadget *g)
1291 reg &= ~DWC3_DCTL_ULSTCHNGREQ_MASK; 1290 reg &= ~DWC3_DCTL_ULSTCHNGREQ_MASK;
1292 dwc3_writel(dwc->regs, DWC3_DCTL, reg); 1291 dwc3_writel(dwc->regs, DWC3_DCTL, reg);
1293 1292
1294 /* pool until Link State change to ON */ 1293 /* poll until Link State changes to ON */
1295 timeout = jiffies + msecs_to_jiffies(100); 1294 timeout = jiffies + msecs_to_jiffies(100);
1296 1295
1297 while (!(time_after(jiffies, timeout))) { 1296 while (!time_after(jiffies, timeout)) {
1298 reg = dwc3_readl(dwc->regs, DWC3_DSTS); 1297 reg = dwc3_readl(dwc->regs, DWC3_DSTS);
1299 1298
1300 /* in HS, means ON */ 1299 /* in HS, means ON */
@@ -1558,10 +1557,10 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
1558 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN) 1557 if ((trb->ctrl & DWC3_TRB_CTRL_HWO) && status != -ESHUTDOWN)
1559 /* 1558 /*
1560 * We continue despite the error. There is not much we 1559 * We continue despite the error. There is not much we
1561 * can do. If we don't clean in up we loop for ever. If 1560 * can do. If we don't clean it up we loop forever. If
1562 * we skip the TRB than it gets overwritten reused after 1561 * we skip the TRB then it gets overwritten after a
1563 * a while since we use them in a ring buffer. a BUG() 1562 * while since we use them in a ring buffer. A BUG()
1564 * would help. Lets hope that if this occures, someone 1563 * would help. Lets hope that if this occurs, someone
1565 * fixes the root cause instead of looking away :) 1564 * fixes the root cause instead of looking away :)
1566 */ 1565 */
1567 dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n", 1566 dev_err(dwc->dev, "%s's TRB (%p) still owned by HW\n",
@@ -1614,7 +1613,7 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc,
1614 if (event->status & DEPEVT_STATUS_BUSERR) 1613 if (event->status & DEPEVT_STATUS_BUSERR)
1615 status = -ECONNRESET; 1614 status = -ECONNRESET;
1616 1615
1617 clean_busy = dwc3_cleanup_done_reqs(dwc, dep, event, status); 1616 clean_busy = dwc3_cleanup_done_reqs(dwc, dep, event, status);
1618 if (clean_busy) { 1617 if (clean_busy) {
1619 dep->flags &= ~DWC3_EP_BUSY; 1618 dep->flags &= ~DWC3_EP_BUSY;
1620 dep->res_trans_idx = 0; 1619 dep->res_trans_idx = 0;
@@ -1678,8 +1677,8 @@ static void dwc3_process_ep_cmd_complete(struct dwc3_ep *dep,
1678 struct dwc3_event_depevt mod_ev = *event; 1677 struct dwc3_event_depevt mod_ev = *event;
1679 1678
1680 /* 1679 /*
1681 * We were asked to remove one requests. It is possible that this 1680 * We were asked to remove one request. It is possible that this
1682 * request and a few other were started together and have the same 1681 * request and a few others were started together and have the same
1683 * transfer index. Since we stopped the complete endpoint we don't 1682 * transfer index. Since we stopped the complete endpoint we don't
1684 * know how many requests were already completed (and not yet) 1683 * know how many requests were already completed (and not yet)
1685 * reported and how could be done (later). We purge them all until 1684 * reported and how could be done (later). We purge them all until
@@ -1688,7 +1687,7 @@ static void dwc3_process_ep_cmd_complete(struct dwc3_ep *dep,
1688 mod_ev.status = DEPEVT_STATUS_LST; 1687 mod_ev.status = DEPEVT_STATUS_LST;
1689 dwc3_cleanup_done_reqs(dwc, dep, &mod_ev, -ESHUTDOWN); 1688 dwc3_cleanup_done_reqs(dwc, dep, &mod_ev, -ESHUTDOWN);
1690 dep->flags &= ~DWC3_EP_BUSY; 1689 dep->flags &= ~DWC3_EP_BUSY;
1691 /* pending requets are ignored and are queued on XferNotReady */ 1690 /* pending requests are ignored and are queued on XferNotReady */
1692} 1691}
1693 1692
1694static void dwc3_ep_cmd_compl(struct dwc3_ep *dep, 1693static void dwc3_ep_cmd_compl(struct dwc3_ep *dep,
@@ -2285,7 +2284,7 @@ static irqreturn_t dwc3_interrupt(int irq, void *_dwc)
2285 2284
2286/** 2285/**
2287 * dwc3_gadget_init - Initializes gadget related registers 2286 * dwc3_gadget_init - Initializes gadget related registers
2288 * @dwc: Pointer to out controller context structure 2287 * @dwc: pointer to our controller context structure
2289 * 2288 *
2290 * Returns 0 on success otherwise negative errno. 2289 * Returns 0 on success otherwise negative errno.
2291 */ 2290 */