Lines Matching refs:mep

12 void mtu3_req_complete(struct mtu3_ep *mep,  in mtu3_req_complete()  argument
14 __releases(mep->mtu->lock) in mtu3_req_complete()
15 __acquires(mep->mtu->lock) in mtu3_req_complete()
27 if (mep->epnum) in mtu3_req_complete()
28 usb_gadget_unmap_request(&mtu->g, req, mep->is_in); in mtu3_req_complete()
31 mep->name, req, req->status, req->actual, req->length); in mtu3_req_complete()
33 usb_gadget_giveback_request(&mep->ep, req); in mtu3_req_complete()
37 static void nuke(struct mtu3_ep *mep, const int status) in nuke() argument
41 if (list_empty(&mep->req_list)) in nuke()
44 dev_dbg(mep->mtu->dev, "abort %s's req: sts %d\n", mep->name, status); in nuke()
47 if (mep->epnum) in nuke()
48 mtu3_qmu_flush(mep); in nuke()
50 while (!list_empty(&mep->req_list)) { in nuke()
51 mreq = list_first_entry(&mep->req_list, in nuke()
53 mtu3_req_complete(mep, &mreq->request, status); in nuke()
57 static int mtu3_ep_enable(struct mtu3_ep *mep) in mtu3_ep_enable() argument
61 struct mtu3 *mtu = mep->mtu; in mtu3_ep_enable()
68 desc = mep->desc; in mtu3_ep_enable()
69 comp_desc = mep->comp_desc; in mtu3_ep_enable()
70 mep->type = usb_endpoint_type(desc); in mtu3_ep_enable()
72 mep->maxp = max_packet & GENMASK(10, 0); in mtu3_ep_enable()
101 __func__, mep->maxp, interval, burst, mult); in mtu3_ep_enable()
103 mep->ep.maxpacket = mep->maxp; in mtu3_ep_enable()
104 mep->ep.desc = desc; in mtu3_ep_enable()
105 mep->ep.comp_desc = comp_desc; in mtu3_ep_enable()
106 mep->slot = mtu->slot; in mtu3_ep_enable()
108 ret = mtu3_config_ep(mtu, mep, interval, burst, mult); in mtu3_ep_enable()
112 ret = mtu3_gpd_ring_alloc(mep); in mtu3_ep_enable()
114 mtu3_deconfig_ep(mtu, mep); in mtu3_ep_enable()
118 mtu3_qmu_start(mep); in mtu3_ep_enable()
123 static int mtu3_ep_disable(struct mtu3_ep *mep) in mtu3_ep_disable() argument
125 struct mtu3 *mtu = mep->mtu; in mtu3_ep_disable()
127 mtu3_qmu_stop(mep); in mtu3_ep_disable()
130 nuke(mep, -ESHUTDOWN); in mtu3_ep_disable()
131 mtu3_deconfig_ep(mtu, mep); in mtu3_ep_disable()
132 mtu3_gpd_ring_free(mep); in mtu3_ep_disable()
134 mep->desc = NULL; in mtu3_ep_disable()
135 mep->ep.desc = NULL; in mtu3_ep_disable()
136 mep->comp_desc = NULL; in mtu3_ep_disable()
137 mep->type = 0; in mtu3_ep_disable()
138 mep->flags = 0; in mtu3_ep_disable()
146 struct mtu3_ep *mep; in mtu3_gadget_ep_enable() local
160 mep = to_mtu3_ep(ep); in mtu3_gadget_ep_enable()
161 mtu = mep->mtu; in mtu3_gadget_ep_enable()
164 if (usb_endpoint_num(desc) != mep->epnum) in mtu3_gadget_ep_enable()
167 if (!!usb_endpoint_dir_in(desc) ^ !!mep->is_in) in mtu3_gadget_ep_enable()
172 if (mep->flags & MTU3_EP_ENABLED) { in mtu3_gadget_ep_enable()
173 dev_warn(mtu->dev, "%s is already enabled\n", mep->name); in mtu3_gadget_ep_enable()
178 mep->desc = desc; in mtu3_gadget_ep_enable()
179 mep->comp_desc = ep->comp_desc; in mtu3_gadget_ep_enable()
181 ret = mtu3_ep_enable(mep); in mtu3_gadget_ep_enable()
185 mep->flags = MTU3_EP_ENABLED; in mtu3_gadget_ep_enable()
198 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_ep_disable() local
199 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_ep_disable()
202 dev_dbg(mtu->dev, "%s %s\n", __func__, mep->name); in mtu3_gadget_ep_disable()
204 if (!(mep->flags & MTU3_EP_ENABLED)) { in mtu3_gadget_ep_disable()
205 dev_warn(mtu->dev, "%s is already disabled\n", mep->name); in mtu3_gadget_ep_disable()
210 mtu3_ep_disable(mep); in mtu3_gadget_ep_disable()
211 mep->flags = 0; in mtu3_gadget_ep_disable()
223 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_alloc_request() local
231 mreq->epnum = mep->epnum; in mtu3_alloc_request()
232 mreq->mep = mep; in mtu3_alloc_request()
247 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_queue() local
249 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_queue()
256 if (mreq->mep != mep) in mtu3_gadget_queue()
260 __func__, mep->is_in ? "TX" : "RX", mreq->epnum, ep->name, in mtu3_gadget_queue()
271 if (!mep->desc) { in mtu3_gadget_queue()
281 ret = usb_gadget_map_request(&mtu->g, req, mep->is_in); in mtu3_gadget_queue()
289 if (mtu3_prepare_transfer(mep)) { in mtu3_gadget_queue()
294 list_add_tail(&mreq->list, &mep->req_list); in mtu3_gadget_queue()
295 mtu3_insert_gpd(mep, mreq); in mtu3_gadget_queue()
296 mtu3_qmu_resume(mep); in mtu3_gadget_queue()
306 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_dequeue() local
309 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_dequeue()
313 if (mreq->mep != mep) in mtu3_gadget_dequeue()
320 list_for_each_entry(r, &mep->req_list, list) { in mtu3_gadget_dequeue()
330 mtu3_qmu_flush(mep); /* REVISIT: set BPS ?? */ in mtu3_gadget_dequeue()
331 mtu3_req_complete(mep, req, -ECONNRESET); in mtu3_gadget_dequeue()
332 mtu3_qmu_start(mep); in mtu3_gadget_dequeue()
346 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_ep_set_halt() local
347 struct mtu3 *mtu = mep->mtu; in mtu3_gadget_ep_set_halt()
356 if (mep->type == USB_ENDPOINT_XFER_ISOC) { in mtu3_gadget_ep_set_halt()
361 mreq = next_request(mep); in mtu3_gadget_ep_set_halt()
375 mep->flags &= ~MTU3_EP_WEDGE; in mtu3_gadget_ep_set_halt()
380 mtu3_ep_stall_set(mep, value); in mtu3_gadget_ep_set_halt()
391 struct mtu3_ep *mep = to_mtu3_ep(ep); in mtu3_gadget_ep_set_wedge() local
393 mep->flags |= MTU3_EP_WEDGE; in mtu3_gadget_ep_set_wedge()
575 static void init_hw_ep(struct mtu3 *mtu, struct mtu3_ep *mep, in init_hw_ep() argument
578 mep->epnum = epnum; in init_hw_ep()
579 mep->mtu = mtu; in init_hw_ep()
580 mep->is_in = is_in; in init_hw_ep()
582 INIT_LIST_HEAD(&mep->req_list); in init_hw_ep()
584 sprintf(mep->name, "ep%d%s", epnum, in init_hw_ep()
587 mep->ep.name = mep->name; in init_hw_ep()
588 INIT_LIST_HEAD(&mep->ep.ep_list); in init_hw_ep()
592 usb_ep_set_maxpacket_limit(&mep->ep, USB_HS_MAXP); in init_hw_ep()
593 mep->ep.ops = &mtu3_ep0_ops; in init_hw_ep()
594 mtu->g.ep0 = &mep->ep; in init_hw_ep()
596 usb_ep_set_maxpacket_limit(&mep->ep, USB_SS_MAXP); in init_hw_ep()
597 mep->ep.ops = &mtu3_ep_ops; in init_hw_ep()
598 list_add_tail(&mep->ep.ep_list, &mtu->g.ep_list); in init_hw_ep()
601 dev_dbg(mtu->dev, "%s, name=%s, maxp=%d\n", __func__, mep->ep.name, in init_hw_ep()
602 mep->ep.maxpacket); in init_hw_ep()