Lines Matching refs:mep

13 void mtu3_req_complete(struct mtu3_ep *mep,  in mtu3_req_complete()  argument
15 __releases(mep->mtu->lock) in mtu3_req_complete()
16 __acquires(mep->mtu->lock) in mtu3_req_complete()
29 if (mep->epnum) in mtu3_req_complete()
30 usb_gadget_unmap_request(&mtu->g, req, mep->is_in); in mtu3_req_complete()
33 mep->name, req, req->status, req->actual, req->length); in mtu3_req_complete()
35 usb_gadget_giveback_request(&mep->ep, req); in mtu3_req_complete()
39 static void nuke(struct mtu3_ep *mep, const int status) in nuke() argument
43 if (list_empty(&mep->req_list)) in nuke()
46 dev_dbg(mep->mtu->dev, "abort %s's req: sts %d\n", mep->name, status); in nuke()
49 if (mep->epnum) in nuke()
50 mtu3_qmu_flush(mep); in nuke()
52 while (!list_empty(&mep->req_list)) { in nuke()
53 mreq = list_first_entry(&mep->req_list, in nuke()
55 mtu3_req_complete(mep, &mreq->request, status); in nuke()
59 static int mtu3_ep_enable(struct mtu3_ep *mep) in mtu3_ep_enable() argument
63 struct mtu3 *mtu = mep->mtu; in mtu3_ep_enable()
69 desc = mep->desc; in mtu3_ep_enable()
70 comp_desc = mep->comp_desc; in mtu3_ep_enable()
71 mep->type = usb_endpoint_type(desc); in mtu3_ep_enable()
72 mep->maxp = usb_endpoint_maxp(desc); in mtu3_ep_enable()
108 __func__, mep->maxp, interval, burst, mult); in mtu3_ep_enable()
110 mep->ep.maxpacket = mep->maxp; in mtu3_ep_enable()
111 mep->ep.desc = desc; in mtu3_ep_enable()
112 mep->ep.comp_desc = comp_desc; in mtu3_ep_enable()
115 mep->slot = usb_endpoint_xfer_int(desc) ? 0 : mtu->slot; in mtu3_ep_enable()
117 ret = mtu3_config_ep(mtu, mep, interval, burst, mult); in mtu3_ep_enable()
121 ret = mtu3_gpd_ring_alloc(mep); in mtu3_ep_enable()
123 mtu3_deconfig_ep(mtu, mep); in mtu3_ep_enable()
127 mtu3_qmu_start(mep); in mtu3_ep_enable()
132 static int mtu3_ep_disable(struct mtu3_ep *mep) in mtu3_ep_disable() argument
134 struct mtu3 *mtu = mep->mtu; in mtu3_ep_disable()
136 mtu3_qmu_stop(mep); in mtu3_ep_disable()
139 nuke(mep, -ESHUTDOWN); in mtu3_ep_disable()
140 mtu3_deconfig_ep(mtu, mep); in mtu3_ep_disable()
141 mtu3_gpd_ring_free(mep); in mtu3_ep_disable()
143 mep->desc = NULL; in mtu3_ep_disable()
144 mep->ep.desc = NULL; in mtu3_ep_disable()
145 mep->comp_desc = NULL; in mtu3_ep_disable()
146 mep->type = 0; in mtu3_ep_disable()
147 mep->flags = 0; in mtu3_ep_disable()
155 struct mtu3_ep *mep; in mtu3_gadget_ep_enable() local
169 mep = to_mtu3_ep(ep); in mtu3_gadget_ep_enable()
170 mtu = mep->mtu; in mtu3_gadget_ep_enable()
173 if (usb_endpoint_num(desc) != mep->epnum) in mtu3_gadget_ep_enable()
176 if (!!usb_endpoint_dir_in(desc) ^ !!mep->is_in) in mtu3_gadget_ep_enable()
181 if (mep->flags & MTU3_EP_ENABLED) { in mtu3_gadget_ep_enable()
183 mep->name); in mtu3_gadget_ep_enable()
188 mep->desc = desc; in mtu3_gadget_ep_enable()
189 mep->comp_desc = ep->comp_desc; in mtu3_gadget_ep_enable()
191 ret = mtu3_ep_enable(mep); in mtu3_gadget_ep_enable()
195 mep->flags = MTU3_EP_ENABLED; in mtu3_gadget_ep_enable()
202 trace_mtu3_gadget_ep_enable(mep); in mtu3_gadget_ep_enable()
209 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_ep_disable() local
210 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_ep_disable()
213 dev_dbg(mtu->dev, "%s %s\n", __func__, mep->name); in mtu3_gadget_ep_disable()
214 trace_mtu3_gadget_ep_disable(mep); in mtu3_gadget_ep_disable()
216 if (!(mep->flags & MTU3_EP_ENABLED)) { in mtu3_gadget_ep_disable()
217 dev_warn(mtu->dev, "%s is already disabled\n", mep->name); in mtu3_gadget_ep_disable()
222 mtu3_ep_disable(mep); in mtu3_gadget_ep_disable()
223 mep->flags = 0; in mtu3_gadget_ep_disable()
235 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_alloc_request() local
243 mreq->epnum = mep->epnum; in mtu3_alloc_request()
244 mreq->mep = mep; in mtu3_alloc_request()
262 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_queue() local
264 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_queue()
271 if (mreq->mep != mep) in mtu3_gadget_queue()
275 __func__, mep->is_in ? "TX" : "RX", mreq->epnum, ep->name, in mtu3_gadget_queue()
288 if (!mep->desc) { in mtu3_gadget_queue()
298 ret = usb_gadget_map_request(&mtu->g, req, mep->is_in); in mtu3_gadget_queue()
306 if (mtu3_prepare_transfer(mep)) { in mtu3_gadget_queue()
311 list_add_tail(&mreq->list, &mep->req_list); in mtu3_gadget_queue()
312 mtu3_insert_gpd(mep, mreq); in mtu3_gadget_queue()
313 mtu3_qmu_resume(mep); in mtu3_gadget_queue()
324 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_dequeue() local
327 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_dequeue()
331 if (mreq->mep != mep) in mtu3_gadget_dequeue()
339 list_for_each_entry(r, &mep->req_list, list) { in mtu3_gadget_dequeue()
349 mtu3_qmu_flush(mep); /* REVISIT: set BPS ?? */ in mtu3_gadget_dequeue()
350 mtu3_req_complete(mep, req, -ECONNRESET); in mtu3_gadget_dequeue()
351 mtu3_qmu_start(mep); in mtu3_gadget_dequeue()
365 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_ep_set_halt() local
366 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_ep_set_halt()
375 if (mep->type == USB_ENDPOINT_XFER_ISOC) { in mtu3_gadget_ep_set_halt()
380 mreq = next_request(mep); in mtu3_gadget_ep_set_halt()
394 mep->flags &= ~MTU3_EP_WEDGE; in mtu3_gadget_ep_set_halt()
399 mtu3_ep_stall_set(mep, value); in mtu3_gadget_ep_set_halt()
403 trace_mtu3_gadget_ep_set_halt(mep); in mtu3_gadget_ep_set_halt()
411 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_ep_set_wedge() local
413 mep->flags |= MTU3_EP_WEDGE; in mtu3_gadget_ep_set_wedge()
616 static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep *mep, in init_hw_ep() argument
619 mep->epnum = epnum; in init_hw_ep()
620 mep->mtu = mtu; in init_hw_ep()
621 mep->is_in = is_in; in init_hw_ep()
623 INIT_LIST_HEAD(&mep->req_list); in init_hw_ep()
625 sprintf(mep->name, "ep%d%s", epnum, in init_hw_ep()
628 mep->ep.name = mep->name; in init_hw_ep()
629 INIT_LIST_HEAD(&mep->ep.ep_list); in init_hw_ep()
633 usb_ep_set_maxpacket_limit(&mep->ep, 512); in init_hw_ep()
634 mep->ep.caps.type_control = true; in init_hw_ep()
635 mep->ep.ops = &mtu3_ep0_ops; in init_hw_ep()
636 mtu->g.ep0 = &mep->ep; in init_hw_ep()
638 usb_ep_set_maxpacket_limit(&mep->ep, 1024); in init_hw_ep()
639 mep->ep.caps.type_iso = true; in init_hw_ep()
640 mep->ep.caps.type_bulk = true; in init_hw_ep()
641 mep->ep.caps.type_int = true; in init_hw_ep()
642 mep->ep.ops = &mtu3_ep_ops; in init_hw_ep()
643 list_add_tail(&mep->ep.ep_list, &mtu->g.ep_list); in init_hw_ep()
646 dev_dbg(mtu->dev, "%s, name=%s, maxp=%d\n", __func__, mep->ep.name, in init_hw_ep()
647 mep->ep.maxpacket); in init_hw_ep()
650 mep->ep.caps.dir_in = true; in init_hw_ep()
651 mep->ep.caps.dir_out = true; in init_hw_ep()
653 mep->ep.caps.dir_in = true; in init_hw_ep()
655 mep->ep.caps.dir_out = true; in init_hw_ep()