Lines Matching refs:ep

49 static inline struct s3c_hsotg_ep *our_ep(struct usb_ep *ep)  in our_ep()  argument
51 return container_of(ep, struct s3c_hsotg_ep, ep); in our_ep()
150 unsigned int ep, unsigned int dir_in, in s3c_hsotg_ctrl_epint() argument
154 u32 bit = 1 << ep; in s3c_hsotg_ctrl_epint()
176 unsigned int ep; in s3c_hsotg_init_fifo() local
206 for (ep = 1; ep < MAX_EPS_CHANNELS; ep++) { in s3c_hsotg_init_fifo()
207 if (!hsotg->g_tx_fifo_sz[ep]) in s3c_hsotg_init_fifo()
210 val |= hsotg->g_tx_fifo_sz[ep] << FIFOSIZE_DEPTH_SHIFT; in s3c_hsotg_init_fifo()
211 WARN_ONCE(addr + hsotg->g_tx_fifo_sz[ep] > hsotg->fifo_mem, in s3c_hsotg_init_fifo()
213 addr += hsotg->g_tx_fifo_sz[ep]; in s3c_hsotg_init_fifo()
215 writel(val, hsotg->regs + DPTXFSIZN(ep)); in s3c_hsotg_init_fifo()
253 static struct usb_request *s3c_hsotg_ep_alloc_request(struct usb_ep *ep, in s3c_hsotg_ep_alloc_request() argument
396 max_transfer = hs_ep->ep.maxpacket * hs_ep->mc; in s3c_hsotg_write_fifo()
506 if ((maxpkt * hs_ep->ep.maxpacket) < maxsize) in get_ep_limit()
507 maxsize = maxpkt * hs_ep->ep.maxpacket; in get_ep_limit()
572 int round = maxreq % hs_ep->ep.maxpacket; in s3c_hsotg_start_req()
585 packets = DIV_ROUND_UP(length, hs_ep->ep.maxpacket); in s3c_hsotg_start_req()
589 if (hs_ep->isochronous && length > (hs_ep->mc * hs_ep->ep.maxpacket)) { in s3c_hsotg_start_req()
608 if ((ureq->length >= hs_ep->ep.maxpacket) && in s3c_hsotg_start_req()
609 !(ureq->length % hs_ep->ep.maxpacket)) in s3c_hsotg_start_req()
741 hs_ep->ep.name, req_buf, hs_req->req.length); in s3c_hsotg_handle_unaligned_buf_start()
768 hs_ep->ep.name, hs_req->req.status, hs_req->req.actual); in s3c_hsotg_handle_unaligned_buf_complete()
782 static int s3c_hsotg_ep_queue(struct usb_ep *ep, struct usb_request *req, in s3c_hsotg_ep_queue() argument
786 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_queue()
792 ep->name, req, req->length, req->buf, req->no_interrupt, in s3c_hsotg_ep_queue()
820 static int s3c_hsotg_ep_queue_lock(struct usb_ep *ep, struct usb_request *req, in s3c_hsotg_ep_queue_lock() argument
823 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_queue_lock()
829 ret = s3c_hsotg_ep_queue(ep, req, gfp_flags); in s3c_hsotg_ep_queue_lock()
835 static void s3c_hsotg_ep_free_request(struct usb_ep *ep, in s3c_hsotg_ep_free_request() argument
851 static void s3c_hsotg_complete_oursetup(struct usb_ep *ep, in s3c_hsotg_complete_oursetup() argument
854 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_complete_oursetup()
857 dev_dbg(hsotg->dev, "%s: ep %p, req %p\n", __func__, ep, req); in s3c_hsotg_complete_oursetup()
859 s3c_hsotg_ep_free_request(ep, req); in s3c_hsotg_complete_oursetup()
873 struct s3c_hsotg_ep *ep; in ep_from_windex() local
883 ep = index_to_ep(hsotg, idx, dir); in ep_from_windex()
885 if (idx && ep->dir_in != dir) in ep_from_windex()
888 return ep; in ep_from_windex()
928 struct s3c_hsotg_ep *ep, in s3c_hsotg_send_reply() argument
937 req = s3c_hsotg_ep_alloc_request(&ep->ep, GFP_ATOMIC); in s3c_hsotg_send_reply()
956 ret = s3c_hsotg_ep_queue(&ep->ep, req, GFP_ATOMIC); in s3c_hsotg_send_reply()
974 struct s3c_hsotg_ep *ep; in s3c_hsotg_process_req_status() local
997 ep = ep_from_windex(hsotg, le16_to_cpu(ctrl->wIndex)); in s3c_hsotg_process_req_status()
998 if (!ep) in s3c_hsotg_process_req_status()
1001 reply = cpu_to_le16(ep->halted ? 1 : 0); in s3c_hsotg_process_req_status()
1020 static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value);
1048 struct s3c_hsotg_ep *ep; in s3c_hsotg_process_req_feature() local
1085 ep = ep_from_windex(hsotg, wIndex); in s3c_hsotg_process_req_feature()
1086 if (!ep) { in s3c_hsotg_process_req_feature()
1094 halted = ep->halted; in s3c_hsotg_process_req_feature()
1096 s3c_hsotg_ep_sethalt(&ep->ep, set); in s3c_hsotg_process_req_feature()
1115 if (ep->req) { in s3c_hsotg_process_req_feature()
1116 hs_req = ep->req; in s3c_hsotg_process_req_feature()
1117 ep->req = NULL; in s3c_hsotg_process_req_feature()
1122 &ep->ep, &hs_req->req); in s3c_hsotg_process_req_feature()
1128 if (!ep->req) { in s3c_hsotg_process_req_feature()
1129 restart = !list_empty(&ep->queue); in s3c_hsotg_process_req_feature()
1131 hs_req = get_ep_head(ep); in s3c_hsotg_process_req_feature()
1132 s3c_hsotg_start_req(hsotg, ep, in s3c_hsotg_process_req_feature()
1272 static void s3c_hsotg_complete_setup(struct usb_ep *ep, in s3c_hsotg_complete_setup() argument
1275 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_complete_setup()
1320 ret = s3c_hsotg_ep_queue(&hsotg->eps_out[0]->ep, req, GFP_ATOMIC); in s3c_hsotg_enqueue_setup()
1382 hs_ep, hs_ep->ep.name, hs_req, result, hs_req->req.complete); in s3c_hsotg_complete_request()
1407 usb_gadget_giveback_request(&hs_ep->ep, &hs_req->req); in s3c_hsotg_complete_request()
1715 unsigned int ep, unsigned int mps, unsigned int dir_in) in s3c_hsotg_set_ep_maxpacket() argument
1723 hs_ep = index_to_ep(hsotg, ep, dir_in); in s3c_hsotg_set_ep_maxpacket()
1727 if (ep == 0) { in s3c_hsotg_set_ep_maxpacket()
1732 hs_ep->ep.maxpacket = mps; in s3c_hsotg_set_ep_maxpacket()
1742 hs_ep->ep.maxpacket = mpsval; in s3c_hsotg_set_ep_maxpacket()
1746 reg = readl(regs + DIEPCTL(ep)); in s3c_hsotg_set_ep_maxpacket()
1749 writel(reg, regs + DIEPCTL(ep)); in s3c_hsotg_set_ep_maxpacket()
1751 reg = readl(regs + DOEPCTL(ep)); in s3c_hsotg_set_ep_maxpacket()
1754 writel(reg, regs + DOEPCTL(ep)); in s3c_hsotg_set_ep_maxpacket()
1760 dev_err(hsotg->dev, "ep%d: bad mps of %d\n", ep, mps); in s3c_hsotg_set_ep_maxpacket()
2140 struct s3c_hsotg_ep *ep, in kill_all_requests() argument
2146 ep->req = NULL; in kill_all_requests()
2148 list_for_each_entry_safe(req, treq, &ep->queue, queue) in kill_all_requests()
2149 s3c_hsotg_complete_request(hsotg, ep, req, in kill_all_requests()
2154 size = (readl(hsotg->regs + DTXFSTS(ep->index)) & 0xffff) * 4; in kill_all_requests()
2155 if (size < ep->fifo_size) in kill_all_requests()
2156 s3c_hsotg_txfifo_flush(hsotg, ep->fifo_index); in kill_all_requests()
2169 unsigned ep; in s3c_hsotg_disconnect() local
2177 for (ep = 0; ep < hsotg->num_of_eps; ep++) { in s3c_hsotg_disconnect()
2178 if (hsotg->eps_in[ep]) in s3c_hsotg_disconnect()
2179 kill_all_requests(hsotg, hsotg->eps_in[ep], in s3c_hsotg_disconnect()
2181 if (hsotg->eps_out[ep]) in s3c_hsotg_disconnect()
2182 kill_all_requests(hsotg, hsotg->eps_out[ep], in s3c_hsotg_disconnect()
2197 struct s3c_hsotg_ep *ep; in s3c_hsotg_irq_fifoempty() local
2202 ep = index_to_ep(hsotg, epno, 1); in s3c_hsotg_irq_fifoempty()
2204 if (!ep) in s3c_hsotg_irq_fifoempty()
2207 if (!ep->dir_in) in s3c_hsotg_irq_fifoempty()
2210 if ((periodic && !ep->periodic) || in s3c_hsotg_irq_fifoempty()
2211 (!periodic && ep->periodic)) in s3c_hsotg_irq_fifoempty()
2214 ret = s3c_hsotg_trytx(hsotg, ep); in s3c_hsotg_irq_fifoempty()
2388 writel(s3c_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | in s3c_hsotg_core_init_disconnected()
2394 writel(s3c_hsotg_ep0_mps(hsotg->eps_out[0]->ep.maxpacket) | in s3c_hsotg_core_init_disconnected()
2459 int ep; in s3c_hsotg_irq() local
2467 for (ep = 0; ep < hsotg->num_of_eps && daint_out; in s3c_hsotg_irq()
2468 ep++, daint_out >>= 1) { in s3c_hsotg_irq()
2470 s3c_hsotg_epint(hsotg, ep, 0); in s3c_hsotg_irq()
2473 for (ep = 0; ep < hsotg->num_of_eps && daint_in; in s3c_hsotg_irq()
2474 ep++, daint_in >>= 1) { in s3c_hsotg_irq()
2476 s3c_hsotg_epint(hsotg, ep, 1); in s3c_hsotg_irq()
2586 static int s3c_hsotg_ep_enable(struct usb_ep *ep, in s3c_hsotg_ep_enable() argument
2589 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_enable()
2602 __func__, ep->name, desc->bEndpointAddress, desc->bmAttributes, in s3c_hsotg_ep_enable()
2683 size = hs_ep->ep.maxpacket * hs_ep->mc; in s3c_hsotg_ep_enable()
2699 size = hs_ep->ep.maxpacket*hs_ep->mc; in s3c_hsotg_ep_enable()
2748 static int s3c_hsotg_ep_disable_force(struct usb_ep *ep, bool force) in s3c_hsotg_ep_disable_force() argument
2750 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_disable_force()
2758 dev_dbg(hsotg->dev, "%s(ep %p)\n", __func__, ep); in s3c_hsotg_ep_disable_force()
2760 if (ep == &hsotg->eps_out[0]->ep) { in s3c_hsotg_ep_disable_force()
2791 static int s3c_hsotg_ep_disable(struct usb_ep *ep) in s3c_hsotg_ep_disable() argument
2793 return s3c_hsotg_ep_disable_force(ep, false); in s3c_hsotg_ep_disable()
2800 static bool on_list(struct s3c_hsotg_ep *ep, struct s3c_hsotg_req *test) in on_list() argument
2804 list_for_each_entry_safe(req, treq, &ep->queue, queue) { in on_list()
2817 static int s3c_hsotg_ep_dequeue(struct usb_ep *ep, struct usb_request *req) in s3c_hsotg_ep_dequeue() argument
2820 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_dequeue()
2824 dev_dbg(hs->dev, "ep_dequeue(%p,%p)\n", ep, req); in s3c_hsotg_ep_dequeue()
2844 static int s3c_hsotg_ep_sethalt(struct usb_ep *ep, int value) in s3c_hsotg_ep_sethalt() argument
2846 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_sethalt()
2853 dev_info(hs->dev, "%s(ep %p %s, %d)\n", __func__, ep, ep->name, value); in s3c_hsotg_ep_sethalt()
2907 static int s3c_hsotg_ep_sethalt_lock(struct usb_ep *ep, int value) in s3c_hsotg_ep_sethalt_lock() argument
2909 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_sethalt_lock()
2915 ret = s3c_hsotg_ep_sethalt(ep, value); in s3c_hsotg_ep_sethalt_lock()
3099 int ep; in s3c_hsotg_udc_stop() local
3107 for (ep = 1; ep < hsotg->num_of_eps; ep++) { in s3c_hsotg_udc_stop()
3108 if (hsotg->eps_in[ep]) in s3c_hsotg_udc_stop()
3109 s3c_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); in s3c_hsotg_udc_stop()
3110 if (hsotg->eps_out[ep]) in s3c_hsotg_udc_stop()
3111 s3c_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); in s3c_hsotg_udc_stop()
3259 INIT_LIST_HEAD(&hs_ep->ep.ep_list); in s3c_hsotg_initep()
3263 list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list); in s3c_hsotg_initep()
3266 hs_ep->ep.name = hs_ep->name; in s3c_hsotg_initep()
3267 usb_ep_set_maxpacket_limit(&hs_ep->ep, epnum ? 1024 : EP0_MPS_LIMIT); in s3c_hsotg_initep()
3268 hs_ep->ep.ops = &s3c_hsotg_ep_ops; in s3c_hsotg_initep()
3627 struct s3c_hsotg_ep *ep = seq->private; in ep_show() local
3628 struct dwc2_hsotg *hsotg = ep->parent; in ep_show()
3631 int index = ep->index; in ep_show()
3636 ep->index, ep->ep.name, decode_direction(ep->dir_in)); in ep_show()
3657 seq_printf(seq, "mps %d\n", ep->ep.maxpacket); in ep_show()
3658 seq_printf(seq, "total_data=%ld\n", ep->total_data); in ep_show()
3661 ep->queue.next, ep->queue.prev); in ep_show()
3665 list_for_each_entry(req, &ep->queue, queue) { in ep_show()
3672 req == ep->req ? '*' : ' ', in ep_show()
3741 struct s3c_hsotg_ep *ep; in s3c_hsotg_create_debug() local
3743 ep = hsotg->eps_out[epidx]; in s3c_hsotg_create_debug()
3744 if (ep) { in s3c_hsotg_create_debug()
3745 ep->debugfs = debugfs_create_file(ep->name, S_IRUGO, in s3c_hsotg_create_debug()
3746 root, ep, &ep_fops); in s3c_hsotg_create_debug()
3748 if (IS_ERR(ep->debugfs)) in s3c_hsotg_create_debug()
3750 ep->name); in s3c_hsotg_create_debug()
3755 struct s3c_hsotg_ep *ep; in s3c_hsotg_create_debug() local
3757 ep = hsotg->eps_in[epidx]; in s3c_hsotg_create_debug()
3758 if (ep) { in s3c_hsotg_create_debug()
3759 ep->debugfs = debugfs_create_file(ep->name, S_IRUGO, in s3c_hsotg_create_debug()
3760 root, ep, &ep_fops); in s3c_hsotg_create_debug()
3762 if (IS_ERR(ep->debugfs)) in s3c_hsotg_create_debug()
3764 ep->name); in s3c_hsotg_create_debug()
3995 hsotg->gadget.ep0 = &hsotg->eps_out[0]->ep; in dwc2_gadget_init()
3999 hsotg->ctrl_req = s3c_hsotg_ep_alloc_request(&hsotg->eps_out[0]->ep, in dwc2_gadget_init()
4068 int ep; in s3c_hsotg_suspend() local
4082 for (ep = 0; ep < hsotg->num_of_eps; ep++) { in s3c_hsotg_suspend()
4083 if (hsotg->eps_in[ep]) in s3c_hsotg_suspend()
4084 s3c_hsotg_ep_disable(&hsotg->eps_in[ep]->ep); in s3c_hsotg_suspend()
4085 if (hsotg->eps_out[ep]) in s3c_hsotg_suspend()
4086 s3c_hsotg_ep_disable(&hsotg->eps_out[ep]->ep); in s3c_hsotg_suspend()