Lines Matching refs:ep

43 static inline struct dwc2_hsotg_ep *our_ep(struct usb_ep *ep)  in our_ep()  argument
45 return container_of(ep, struct dwc2_hsotg_ep, ep); in our_ep()
144 unsigned int ep, unsigned int dir_in, in dwc2_hsotg_ctrl_epint() argument
148 u32 bit = 1 << ep; in dwc2_hsotg_ctrl_epint()
170 unsigned int ep; in dwc2_hsotg_init_fifo() local
200 for (ep = 1; ep < MAX_EPS_CHANNELS; ep++) { in dwc2_hsotg_init_fifo()
201 if (!hsotg->g_tx_fifo_sz[ep]) in dwc2_hsotg_init_fifo()
204 val |= hsotg->g_tx_fifo_sz[ep] << FIFOSIZE_DEPTH_SHIFT; in dwc2_hsotg_init_fifo()
205 WARN_ONCE(addr + hsotg->g_tx_fifo_sz[ep] > hsotg->fifo_mem, in dwc2_hsotg_init_fifo()
207 addr += hsotg->g_tx_fifo_sz[ep]; in dwc2_hsotg_init_fifo()
209 dwc2_writel(val, hsotg->regs + DPTXFSIZN(ep)); in dwc2_hsotg_init_fifo()
247 static struct usb_request *dwc2_hsotg_ep_alloc_request(struct usb_ep *ep, in dwc2_hsotg_ep_alloc_request() argument
390 max_transfer = hs_ep->ep.maxpacket * hs_ep->mc; in dwc2_hsotg_write_fifo()
500 if ((maxpkt * hs_ep->ep.maxpacket) < maxsize) in get_ep_limit()
501 maxsize = maxpkt * hs_ep->ep.maxpacket; in get_ep_limit()
566 int round = maxreq % hs_ep->ep.maxpacket; in dwc2_hsotg_start_req()
579 packets = DIV_ROUND_UP(length, hs_ep->ep.maxpacket); in dwc2_hsotg_start_req()
583 if (hs_ep->isochronous && length > (hs_ep->mc * hs_ep->ep.maxpacket)) { in dwc2_hsotg_start_req()
602 if ((ureq->length >= hs_ep->ep.maxpacket) && in dwc2_hsotg_start_req()
603 !(ureq->length % hs_ep->ep.maxpacket)) in dwc2_hsotg_start_req()
735 hs_ep->ep.name, req_buf, hs_req->req.length); in dwc2_hsotg_handle_unaligned_buf_start()
762 hs_ep->ep.name, hs_req->req.status, hs_req->req.actual); in dwc2_hsotg_handle_unaligned_buf_complete()
776 static int dwc2_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, in dwc2_hsotg_ep_queue() argument
780 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_queue()
786 ep->name, req, req->length, req->buf, req->no_interrupt, in dwc2_hsotg_ep_queue()
821 static int dwc2_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req, in dwc2_hsotg_ep_queue_lock() argument
824 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_queue_lock()
830 ret = dwc2_hsotg_ep_queue(ep, req, gfp_flags); in dwc2_hsotg_ep_queue_lock()
836 static void dwc2_hsotg_ep_free_request(struct usb_ep *ep, in dwc2_hsotg_ep_free_request() argument
852 static void dwc2_hsotg_complete_oursetup(struct usb_ep *ep, in dwc2_hsotg_complete_oursetup() argument
855 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_complete_oursetup()
858 dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req); in dwc2_hsotg_complete_oursetup()
860 dwc2_hsotg_ep_free_request(ep, req); in dwc2_hsotg_complete_oursetup()
874 struct dwc2_hsotg_ep *ep; in ep_from_windex() local
884 ep = index_to_ep(hsotg, idx, dir); in ep_from_windex()
886 if (idx && ep->dir_in != dir) in ep_from_windex()
889 return ep; in ep_from_windex()
929 struct dwc2_hsotg_ep *ep, in dwc2_hsotg_send_reply() argument
938 req = dwc2_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC); in dwc2_hsotg_send_reply()
957 ret = dwc2_hsotg_ep_queue(&ep->ep, req, GFP_ATOMIC); in dwc2_hsotg_send_reply()
975 struct dwc2_hsotg_ep *ep; in dwc2_hsotg_process_req_status() local
998 ep = ep_from_windex(hsotg, le16_to_cpu(ctrl->wIndex)); in dwc2_hsotg_process_req_status()
999 if (!ep) in dwc2_hsotg_process_req_status()
1002 reply = cpu_to_le16(ep->halted ? 1 : 0); in dwc2_hsotg_process_req_status()
1021 static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value);
1049 struct dwc2_hsotg_ep *ep; in dwc2_hsotg_process_req_feature() local
1086 ep = ep_from_windex(hsotg, wIndex); in dwc2_hsotg_process_req_feature()
1087 if (!ep) { in dwc2_hsotg_process_req_feature()
1095 halted = ep->halted; in dwc2_hsotg_process_req_feature()
1097 dwc2_hsotg_ep_sethalt(&ep->ep, set); in dwc2_hsotg_process_req_feature()
1116 if (ep->req) { in dwc2_hsotg_process_req_feature()
1117 hs_req = ep->req; in dwc2_hsotg_process_req_feature()
1118 ep->req = NULL; in dwc2_hsotg_process_req_feature()
1123 &ep->ep, &hs_req->req); in dwc2_hsotg_process_req_feature()
1129 if (!ep->req) { in dwc2_hsotg_process_req_feature()
1130 restart = !list_empty(&ep->queue); in dwc2_hsotg_process_req_feature()
1132 hs_req = get_ep_head(ep); in dwc2_hsotg_process_req_feature()
1133 dwc2_hsotg_start_req(hsotg, ep, in dwc2_hsotg_process_req_feature()
1274 static void dwc2_hsotg_complete_setup(struct usb_ep *ep, in dwc2_hsotg_complete_setup() argument
1277 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_complete_setup()
1322 ret = dwc2_hsotg_ep_queue(&hsotg->eps_out[0]->ep, req, GFP_ATOMIC); in dwc2_hsotg_enqueue_setup()
1384 hs_ep, hs_ep->ep.name, hs_req, result, hs_req->req.complete); in dwc2_hsotg_complete_request()
1409 usb_gadget_giveback_request(&hs_ep->ep, &hs_req->req); in dwc2_hsotg_complete_request()
1740 unsigned int ep, unsigned int mps, unsigned int dir_in) in dwc2_hsotg_set_ep_maxpacket() argument
1748 hs_ep = index_to_ep(hsotg, ep, dir_in); in dwc2_hsotg_set_ep_maxpacket()
1752 if (ep == 0) { in dwc2_hsotg_set_ep_maxpacket()
1757 hs_ep->ep.maxpacket = mps; in dwc2_hsotg_set_ep_maxpacket()
1767 hs_ep->ep.maxpacket = mpsval; in dwc2_hsotg_set_ep_maxpacket()
1771 reg = dwc2_readl(regs + DIEPCTL(ep)); in dwc2_hsotg_set_ep_maxpacket()
1774 dwc2_writel(reg, regs + DIEPCTL(ep)); in dwc2_hsotg_set_ep_maxpacket()
1776 reg = dwc2_readl(regs + DOEPCTL(ep)); in dwc2_hsotg_set_ep_maxpacket()
1779 dwc2_writel(reg, regs + DOEPCTL(ep)); in dwc2_hsotg_set_ep_maxpacket()
1785 dev_err(hsotg->dev, "ep%d: bad mps of %d\n", ep, mps); in dwc2_hsotg_set_ep_maxpacket()
2161 struct dwc2_hsotg_ep *ep, in kill_all_requests() argument
2167 ep->req = NULL; in kill_all_requests()
2169 list_for_each_entry_safe(req, treq, &ep->queue, queue) in kill_all_requests()
2170 dwc2_hsotg_complete_request(hsotg, ep, req, in kill_all_requests()
2175 size = (dwc2_readl(hsotg->regs + DTXFSTS(ep->index)) & 0xffff) * 4; in kill_all_requests()
2176 if (size < ep->fifo_size) in kill_all_requests()
2177 dwc2_hsotg_txfifo_flush(hsotg, ep->fifo_index); in kill_all_requests()
2190 unsigned ep; in dwc2_hsotg_disconnect() local
2198 for (ep = 0; ep < hsotg->num_of_eps; ep++) { in dwc2_hsotg_disconnect()
2199 if (hsotg->eps_in[ep]) in dwc2_hsotg_disconnect()
2200 kill_all_requests(hsotg, hsotg->eps_in[ep], in dwc2_hsotg_disconnect()
2202 if (hsotg->eps_out[ep]) in dwc2_hsotg_disconnect()
2203 kill_all_requests(hsotg, hsotg->eps_out[ep], in dwc2_hsotg_disconnect()
2218 struct dwc2_hsotg_ep *ep; in dwc2_hsotg_irq_fifoempty() local
2223 ep = index_to_ep(hsotg, epno, 1); in dwc2_hsotg_irq_fifoempty()
2225 if (!ep) in dwc2_hsotg_irq_fifoempty()
2228 if (!ep->dir_in) in dwc2_hsotg_irq_fifoempty()
2231 if ((periodic && !ep->periodic) || in dwc2_hsotg_irq_fifoempty()
2232 (!periodic && ep->periodic)) in dwc2_hsotg_irq_fifoempty()
2235 ret = dwc2_hsotg_trytx(hsotg, ep); in dwc2_hsotg_irq_fifoempty()
2418 dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | in dwc2_hsotg_core_init_disconnected()
2424 dwc2_writel(dwc2_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | in dwc2_hsotg_core_init_disconnected()
2519 int ep; in dwc2_hsotg_irq() local
2527 for (ep = 0; ep < hsotg->num_of_eps && daint_out; in dwc2_hsotg_irq()
2528 ep++, daint_out >>= 1) { in dwc2_hsotg_irq()
2530 dwc2_hsotg_epint(hsotg, ep, 0); in dwc2_hsotg_irq()
2533 for (ep = 0; ep < hsotg->num_of_eps && daint_in; in dwc2_hsotg_irq()
2534 ep++, daint_in >>= 1) { in dwc2_hsotg_irq()
2536 dwc2_hsotg_epint(hsotg, ep, 1); in dwc2_hsotg_irq()
2655 static int dwc2_hsotg_ep_enable(struct usb_ep *ep, in dwc2_hsotg_ep_enable() argument
2658 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_enable()
2671 __func__, ep->name, desc->bEndpointAddress, desc->bmAttributes, in dwc2_hsotg_ep_enable()
2753 size = hs_ep->ep.maxpacket * hs_ep->mc; in dwc2_hsotg_ep_enable()
2769 size = hs_ep->ep.maxpacket*hs_ep->mc; in dwc2_hsotg_ep_enable()
2818 static int dwc2_hsotg_ep_disable(struct usb_ep *ep) in dwc2_hsotg_ep_disable() argument
2820 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_disable()
2828 dev_dbg(hsotg->dev, "%s(ep %p)\n", __func__, ep); in dwc2_hsotg_ep_disable()
2830 if (ep == &hsotg->eps_out[0]->ep) { in dwc2_hsotg_ep_disable()
2866 static bool on_list(struct dwc2_hsotg_ep *ep, struct dwc2_hsotg_req *test) in on_list() argument
2870 list_for_each_entry_safe(req, treq, &ep->queue, queue) { in on_list()
2956 static int dwc2_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) in dwc2_hsotg_ep_dequeue() argument
2959 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_dequeue()
2963 dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req); in dwc2_hsotg_ep_dequeue()
2987 static int dwc2_hsotg_ep_sethalt(struct usb_ep *ep, int value) in dwc2_hsotg_ep_sethalt() argument
2989 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_sethalt()
2996 dev_info(hs->dev, "%s(ep %p %s, %d)\n", __func__, ep, ep->name, value); in dwc2_hsotg_ep_sethalt()
3050 static int dwc2_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) in dwc2_hsotg_ep_sethalt_lock() argument
3052 struct dwc2_hsotg_ep *hs_ep = our_ep(ep); in dwc2_hsotg_ep_sethalt_lock()
3058 ret = dwc2_hsotg_ep_sethalt(ep, value); in dwc2_hsotg_ep_sethalt_lock()
3190 int ep; in dwc2_hsotg_udc_stop() local
3196 for (ep = 1; ep < hsotg->num_of_eps; ep++) { in dwc2_hsotg_udc_stop()
3197 if (hsotg->eps_in[ep]) in dwc2_hsotg_udc_stop()
3198 dwc2_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); in dwc2_hsotg_udc_stop()
3199 if (hsotg->eps_out[ep]) in dwc2_hsotg_udc_stop()
3200 dwc2_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); in dwc2_hsotg_udc_stop()
3354 INIT_LIST_HEAD(&hs_ep->ep.ep_list); in dwc2_hsotg_initep()
3358 list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list); in dwc2_hsotg_initep()
3361 hs_ep->ep.name = hs_ep->name; in dwc2_hsotg_initep()
3362 usb_ep_set_maxpacket_limit(&hs_ep->ep, epnum ? 1024 : EP0_MPS_LIMIT); in dwc2_hsotg_initep()
3363 hs_ep->ep.ops = &dwc2_hsotg_ep_ops; in dwc2_hsotg_initep()
3366 hs_ep->ep.caps.type_control = true; in dwc2_hsotg_initep()
3368 hs_ep->ep.caps.type_iso = true; in dwc2_hsotg_initep()
3369 hs_ep->ep.caps.type_bulk = true; in dwc2_hsotg_initep()
3370 hs_ep->ep.caps.type_int = true; in dwc2_hsotg_initep()
3374 hs_ep->ep.caps.dir_in = true; in dwc2_hsotg_initep()
3376 hs_ep->ep.caps.dir_out = true; in dwc2_hsotg_initep()
3638 hsotg->gadget.ep0 = &hsotg->eps_out[0]->ep; in dwc2_gadget_init()
3642 hsotg->ctrl_req = dwc2_hsotg_ep_alloc_request(&hsotg->eps_out[0]->ep, in dwc2_gadget_init()
3687 int ep; in dwc2_hsotg_suspend() local
3699 for (ep = 0; ep < hsotg->num_of_eps; ep++) { in dwc2_hsotg_suspend()
3700 if (hsotg->eps_in[ep]) in dwc2_hsotg_suspend()
3701 dwc2_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); in dwc2_hsotg_suspend()
3702 if (hsotg->eps_out[ep]) in dwc2_hsotg_suspend()
3703 dwc2_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); in dwc2_hsotg_suspend()