|
@@ -151,7 +151,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
|
|
struct dwc3 *dwc = dep->dwc;
|
|
struct dwc3 *dwc = dep->dwc;
|
|
int i;
|
|
int i;
|
|
|
|
|
|
- if (req->queued) {
|
|
|
|
|
|
+ if (req->started) {
|
|
i = 0;
|
|
i = 0;
|
|
do {
|
|
do {
|
|
dep->busy_slot++;
|
|
dep->busy_slot++;
|
|
@@ -165,7 +165,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct dwc3_request *req,
|
|
usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
|
usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
|
dep->busy_slot++;
|
|
dep->busy_slot++;
|
|
} while(++i < req->request.num_mapped_sgs);
|
|
} while(++i < req->request.num_mapped_sgs);
|
|
- req->queued = false;
|
|
|
|
|
|
+ req->started = false;
|
|
}
|
|
}
|
|
list_del(&req->list);
|
|
list_del(&req->list);
|
|
req->trb = NULL;
|
|
req->trb = NULL;
|
|
@@ -522,19 +522,19 @@ static void dwc3_remove_requests(struct dwc3 *dwc, struct dwc3_ep *dep)
|
|
{
|
|
{
|
|
struct dwc3_request *req;
|
|
struct dwc3_request *req;
|
|
|
|
|
|
- if (!list_empty(&dep->req_queued)) {
|
|
|
|
|
|
+ if (!list_empty(&dep->started_list)) {
|
|
dwc3_stop_active_transfer(dwc, dep->number, true);
|
|
dwc3_stop_active_transfer(dwc, dep->number, true);
|
|
|
|
|
|
/* - giveback all requests to gadget driver */
|
|
/* - giveback all requests to gadget driver */
|
|
- while (!list_empty(&dep->req_queued)) {
|
|
|
|
- req = next_request(&dep->req_queued);
|
|
|
|
|
|
+ while (!list_empty(&dep->started_list)) {
|
|
|
|
+ req = next_request(&dep->started_list);
|
|
|
|
|
|
dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
|
|
dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- while (!list_empty(&dep->request_list)) {
|
|
|
|
- req = next_request(&dep->request_list);
|
|
|
|
|
|
+ while (!list_empty(&dep->pending_list)) {
|
|
|
|
+ req = next_request(&dep->pending_list);
|
|
|
|
|
|
dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
|
|
dwc3_gadget_giveback(dep, req, -ESHUTDOWN);
|
|
}
|
|
}
|
|
@@ -700,7 +700,7 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
|
|
trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK];
|
|
trb = &dep->trb_pool[dep->free_slot & DWC3_TRB_MASK];
|
|
|
|
|
|
if (!req->trb) {
|
|
if (!req->trb) {
|
|
- dwc3_gadget_move_request_queued(req);
|
|
|
|
|
|
+ dwc3_gadget_move_started_request(req);
|
|
req->trb = trb;
|
|
req->trb = trb;
|
|
req->trb_dma = dwc3_trb_dma_offset(dep, trb);
|
|
req->trb_dma = dwc3_trb_dma_offset(dep, trb);
|
|
req->start_slot = dep->free_slot & DWC3_TRB_MASK;
|
|
req->start_slot = dep->free_slot & DWC3_TRB_MASK;
|
|
@@ -824,7 +824,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
|
|
if ((trbs_left <= 1) && usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
|
if ((trbs_left <= 1) && usb_endpoint_xfer_isoc(dep->endpoint.desc))
|
|
return;
|
|
return;
|
|
|
|
|
|
- list_for_each_entry_safe(req, n, &dep->request_list, list) {
|
|
|
|
|
|
+ list_for_each_entry_safe(req, n, &dep->pending_list, list) {
|
|
unsigned length;
|
|
unsigned length;
|
|
dma_addr_t dma;
|
|
dma_addr_t dma;
|
|
last_one = false;
|
|
last_one = false;
|
|
@@ -843,7 +843,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
|
|
|
|
|
|
if (i == (request->num_mapped_sgs - 1) ||
|
|
if (i == (request->num_mapped_sgs - 1) ||
|
|
sg_is_last(s)) {
|
|
sg_is_last(s)) {
|
|
- if (list_empty(&dep->request_list))
|
|
|
|
|
|
+ if (list_empty(&dep->pending_list))
|
|
last_one = true;
|
|
last_one = true;
|
|
chain = false;
|
|
chain = false;
|
|
}
|
|
}
|
|
@@ -873,7 +873,7 @@ static void dwc3_prepare_trbs(struct dwc3_ep *dep, bool starting)
|
|
last_one = 1;
|
|
last_one = 1;
|
|
|
|
|
|
/* Is this the last request? */
|
|
/* Is this the last request? */
|
|
- if (list_is_last(&req->list, &dep->request_list))
|
|
|
|
|
|
+ if (list_is_last(&req->list, &dep->pending_list))
|
|
last_one = 1;
|
|
last_one = 1;
|
|
|
|
|
|
dwc3_prepare_one_trb(dep, req, dma, length,
|
|
dwc3_prepare_one_trb(dep, req, dma, length,
|
|
@@ -904,18 +904,18 @@ static int __dwc3_gadget_kick_transfer(struct dwc3_ep *dep, u16 cmd_param,
|
|
* new requests as we try to set the IOC bit only on the last request.
|
|
* new requests as we try to set the IOC bit only on the last request.
|
|
*/
|
|
*/
|
|
if (start_new) {
|
|
if (start_new) {
|
|
- if (list_empty(&dep->req_queued))
|
|
|
|
|
|
+ if (list_empty(&dep->started_list))
|
|
dwc3_prepare_trbs(dep, start_new);
|
|
dwc3_prepare_trbs(dep, start_new);
|
|
|
|
|
|
/* req points to the first request which will be sent */
|
|
/* req points to the first request which will be sent */
|
|
- req = next_request(&dep->req_queued);
|
|
|
|
|
|
+ req = next_request(&dep->started_list);
|
|
} else {
|
|
} else {
|
|
dwc3_prepare_trbs(dep, start_new);
|
|
dwc3_prepare_trbs(dep, start_new);
|
|
|
|
|
|
/*
|
|
/*
|
|
* req points to the first request where HWO changed from 0 to 1
|
|
* req points to the first request where HWO changed from 0 to 1
|
|
*/
|
|
*/
|
|
- req = next_request(&dep->req_queued);
|
|
|
|
|
|
+ req = next_request(&dep->started_list);
|
|
}
|
|
}
|
|
if (!req) {
|
|
if (!req) {
|
|
dep->flags |= DWC3_EP_PENDING_REQUEST;
|
|
dep->flags |= DWC3_EP_PENDING_REQUEST;
|
|
@@ -962,7 +962,7 @@ static void __dwc3_gadget_start_isoc(struct dwc3 *dwc,
|
|
{
|
|
{
|
|
u32 uf;
|
|
u32 uf;
|
|
|
|
|
|
- if (list_empty(&dep->request_list)) {
|
|
|
|
|
|
+ if (list_empty(&dep->pending_list)) {
|
|
dwc3_trace(trace_dwc3_gadget,
|
|
dwc3_trace(trace_dwc3_gadget,
|
|
"ISOC ep %s run out for requests",
|
|
"ISOC ep %s run out for requests",
|
|
dep->name);
|
|
dep->name);
|
|
@@ -1030,7 +1030,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
|
|
if (ret)
|
|
if (ret)
|
|
return ret;
|
|
return ret;
|
|
|
|
|
|
- list_add_tail(&req->list, &dep->request_list);
|
|
|
|
|
|
+ list_add_tail(&req->list, &dep->pending_list);
|
|
|
|
|
|
/*
|
|
/*
|
|
* If there are no pending requests and the endpoint isn't already
|
|
* If there are no pending requests and the endpoint isn't already
|
|
@@ -1065,7 +1065,7 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req)
|
|
* notion of current microframe.
|
|
* notion of current microframe.
|
|
*/
|
|
*/
|
|
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
|
|
if (usb_endpoint_xfer_isoc(dep->endpoint.desc)) {
|
|
- if (list_empty(&dep->req_queued)) {
|
|
|
|
|
|
+ if (list_empty(&dep->started_list)) {
|
|
dwc3_stop_active_transfer(dwc, dep->number, true);
|
|
dwc3_stop_active_transfer(dwc, dep->number, true);
|
|
dep->flags = DWC3_EP_ENABLED;
|
|
dep->flags = DWC3_EP_ENABLED;
|
|
}
|
|
}
|
|
@@ -1183,13 +1183,13 @@ static int dwc3_gadget_ep_dequeue(struct usb_ep *ep,
|
|
|
|
|
|
spin_lock_irqsave(&dwc->lock, flags);
|
|
spin_lock_irqsave(&dwc->lock, flags);
|
|
|
|
|
|
- list_for_each_entry(r, &dep->request_list, list) {
|
|
|
|
|
|
+ list_for_each_entry(r, &dep->pending_list, list) {
|
|
if (r == req)
|
|
if (r == req)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
if (r != req) {
|
|
if (r != req) {
|
|
- list_for_each_entry(r, &dep->req_queued, list) {
|
|
|
|
|
|
+ list_for_each_entry(r, &dep->started_list, list) {
|
|
if (r == req)
|
|
if (r == req)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1229,8 +1229,8 @@ int __dwc3_gadget_ep_set_halt(struct dwc3_ep *dep, int value, int protocol)
|
|
|
|
|
|
if (value) {
|
|
if (value) {
|
|
if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) ||
|
|
if (!protocol && ((dep->direction && dep->flags & DWC3_EP_BUSY) ||
|
|
- (!list_empty(&dep->req_queued) ||
|
|
|
|
- !list_empty(&dep->request_list)))) {
|
|
|
|
|
|
+ (!list_empty(&dep->started_list) ||
|
|
|
|
+ !list_empty(&dep->pending_list)))) {
|
|
dwc3_trace(trace_dwc3_gadget,
|
|
dwc3_trace(trace_dwc3_gadget,
|
|
"%s: pending request, cannot halt\n",
|
|
"%s: pending request, cannot halt\n",
|
|
dep->name);
|
|
dep->name);
|
|
@@ -1731,8 +1731,8 @@ static int dwc3_gadget_init_hw_endpoints(struct dwc3 *dwc,
|
|
dep->endpoint.caps.dir_in = !!direction;
|
|
dep->endpoint.caps.dir_in = !!direction;
|
|
dep->endpoint.caps.dir_out = !direction;
|
|
dep->endpoint.caps.dir_out = !direction;
|
|
|
|
|
|
- INIT_LIST_HEAD(&dep->request_list);
|
|
|
|
- INIT_LIST_HEAD(&dep->req_queued);
|
|
|
|
|
|
+ INIT_LIST_HEAD(&dep->pending_list);
|
|
|
|
+ INIT_LIST_HEAD(&dep->started_list);
|
|
}
|
|
}
|
|
|
|
|
|
return 0;
|
|
return 0;
|
|
@@ -1829,11 +1829,11 @@ static int __dwc3_cleanup_done_trbs(struct dwc3 *dwc, struct dwc3_ep *dep,
|
|
* If there are still queued request
|
|
* If there are still queued request
|
|
* then wait, do not issue either END
|
|
* then wait, do not issue either END
|
|
* or UPDATE TRANSFER, just attach next
|
|
* or UPDATE TRANSFER, just attach next
|
|
- * request in request_list during
|
|
|
|
|
|
+ * request in pending_list during
|
|
* giveback.If any future queued request
|
|
* giveback.If any future queued request
|
|
* is successfully transferred then we
|
|
* is successfully transferred then we
|
|
* will issue UPDATE TRANSFER for all
|
|
* will issue UPDATE TRANSFER for all
|
|
- * request in the request_list.
|
|
|
|
|
|
+ * request in the pending_list.
|
|
*/
|
|
*/
|
|
dep->flags |= DWC3_EP_MISSED_ISOC;
|
|
dep->flags |= DWC3_EP_MISSED_ISOC;
|
|
} else {
|
|
} else {
|
|
@@ -1879,7 +1879,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
|
|
int ret;
|
|
int ret;
|
|
|
|
|
|
do {
|
|
do {
|
|
- req = next_request(&dep->req_queued);
|
|
|
|
|
|
+ req = next_request(&dep->started_list);
|
|
if (WARN_ON_ONCE(!req))
|
|
if (WARN_ON_ONCE(!req))
|
|
return 1;
|
|
return 1;
|
|
|
|
|
|
@@ -1905,8 +1905,8 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, struct dwc3_ep *dep,
|
|
} while (1);
|
|
} while (1);
|
|
|
|
|
|
if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
|
|
if (usb_endpoint_xfer_isoc(dep->endpoint.desc) &&
|
|
- list_empty(&dep->req_queued)) {
|
|
|
|
- if (list_empty(&dep->request_list)) {
|
|
|
|
|
|
+ list_empty(&dep->started_list)) {
|
|
|
|
+ if (list_empty(&dep->pending_list)) {
|
|
/*
|
|
/*
|
|
* If there is no entry in request list then do
|
|
* If there is no entry in request list then do
|
|
* not issue END TRANSFER now. Just set PENDING
|
|
* not issue END TRANSFER now. Just set PENDING
|
|
@@ -1955,7 +1955,7 @@ static void dwc3_endpoint_transfer_complete(struct dwc3 *dwc,
|
|
if (!(dep->flags & DWC3_EP_ENABLED))
|
|
if (!(dep->flags & DWC3_EP_ENABLED))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- if (!list_empty(&dep->req_queued))
|
|
|
|
|
|
+ if (!list_empty(&dep->started_list))
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
|
|
|