Lines Matching refs:hs_ep

402 static inline int is_ep_periodic(struct s3c_hsotg_ep *hs_ep)  in is_ep_periodic()  argument
404 return hs_ep->periodic; in is_ep_periodic()
417 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_unmap_dma() argument
423 dir = hs_ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE; in s3c_hsotg_unmap_dma()
458 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_write_fifo() argument
461 bool periodic = is_ep_periodic(hs_ep); in s3c_hsotg_write_fifo()
464 int to_write = hs_ep->size_loaded; in s3c_hsotg_write_fifo()
469 to_write -= (buf_pos - hs_ep->last_load); in s3c_hsotg_write_fifo()
476 u32 epsize = readl(hsotg->regs + S3C_DIEPTSIZ(hs_ep->index)); in s3c_hsotg_write_fifo()
488 if (hs_ep->fifo_load != 0) { in s3c_hsotg_write_fifo()
495 hs_ep->size_loaded, hs_ep->fifo_load, hs_ep->fifo_size); in s3c_hsotg_write_fifo()
498 size_done = hs_ep->size_loaded - size_left; in s3c_hsotg_write_fifo()
501 can_write = hs_ep->fifo_load - size_done; in s3c_hsotg_write_fifo()
505 can_write = hs_ep->fifo_size - can_write; in s3c_hsotg_write_fifo()
513 } else if (hsotg->dedicated_fifos && hs_ep->index != 0) { in s3c_hsotg_write_fifo()
514 can_write = readl(hsotg->regs + S3C_DTXFSTS(hs_ep->index)); in s3c_hsotg_write_fifo()
533 __func__, gnptxsts, can_write, to_write, hs_ep->ep.maxpacket); in s3c_hsotg_write_fifo()
545 if (to_write > hs_ep->ep.maxpacket) { in s3c_hsotg_write_fifo()
546 to_write = hs_ep->ep.maxpacket; in s3c_hsotg_write_fifo()
557 pkt_round = to_write % hs_ep->ep.maxpacket; in s3c_hsotg_write_fifo()
585 hs_ep->total_data += to_write; in s3c_hsotg_write_fifo()
588 hs_ep->fifo_load += to_write; in s3c_hsotg_write_fifo()
593 writesl(hsotg->regs + S3C_EPFIFO(hs_ep->index), data, to_write); in s3c_hsotg_write_fifo()
605 static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep) in get_ep_limit() argument
607 int index = hs_ep->index; in get_ep_limit()
616 if (hs_ep->dir_in) { in get_ep_limit()
630 if ((maxpkt * hs_ep->ep.maxpacket) < maxsize) in get_ep_limit()
631 maxsize = maxpkt * hs_ep->ep.maxpacket; in get_ep_limit()
647 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_start_req() argument
652 int index = hs_ep->index; in s3c_hsotg_start_req()
653 int dir_in = hs_ep->dir_in; in s3c_hsotg_start_req()
663 if (hs_ep->req && !continuing) { in s3c_hsotg_start_req()
667 } else if (hs_ep->req != hs_req && continuing) { in s3c_hsotg_start_req()
680 hs_ep->dir_in ? "in" : "out"); in s3c_hsotg_start_req()
690 maxreq = get_ep_limit(hs_ep); in s3c_hsotg_start_req()
692 int round = maxreq % hs_ep->ep.maxpacket; in s3c_hsotg_start_req()
705 packets = DIV_ROUND_UP(length, hs_ep->ep.maxpacket); in s3c_hsotg_start_req()
718 if (length == (packets * hs_ep->ep.maxpacket)) in s3c_hsotg_start_req()
729 hs_ep->req = hs_req; in s3c_hsotg_start_req()
769 hs_ep->size_loaded = length; in s3c_hsotg_start_req()
770 hs_ep->last_load = ureq->actual; in s3c_hsotg_start_req()
774 hs_ep->fifo_load = 0; in s3c_hsotg_start_req()
776 s3c_hsotg_write_fifo(hsotg, hs_ep, hs_req); in s3c_hsotg_start_req()
811 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_map_dma() argument
817 dir = hs_ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE; in s3c_hsotg_map_dma()
859 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_queue() local
860 struct s3c_hsotg *hs = hs_ep->parent; in s3c_hsotg_ep_queue()
875 int ret = s3c_hsotg_map_dma(hs, hs_ep, req); in s3c_hsotg_ep_queue()
880 spin_lock_irqsave(&hs_ep->lock, irqflags); in s3c_hsotg_ep_queue()
882 first = list_empty(&hs_ep->queue); in s3c_hsotg_ep_queue()
883 list_add_tail(&hs_req->queue, &hs_ep->queue); in s3c_hsotg_ep_queue()
886 s3c_hsotg_start_req(hs, hs_ep, hs_req, false); in s3c_hsotg_ep_queue()
888 spin_unlock_irqrestore(&hs_ep->lock, irqflags); in s3c_hsotg_ep_queue()
912 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_complete_oursetup() local
913 struct s3c_hsotg *hsotg = hs_ep->parent; in s3c_hsotg_complete_oursetup()
1200 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_complete_setup() local
1201 struct s3c_hsotg *hsotg = hs_ep->parent; in s3c_hsotg_complete_setup()
1255 static struct s3c_hsotg_req *get_ep_head(struct s3c_hsotg_ep *hs_ep) in get_ep_head() argument
1257 if (list_empty(&hs_ep->queue)) in get_ep_head()
1260 return list_first_entry(&hs_ep->queue, struct s3c_hsotg_req, queue); in get_ep_head()
1277 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_complete_request() argument
1289 hs_ep, hs_ep->ep.name, hs_req, result, hs_req->req.complete); in s3c_hsotg_complete_request()
1297 hs_ep->req = NULL; in s3c_hsotg_complete_request()
1301 s3c_hsotg_unmap_dma(hsotg, hs_ep, hs_req); in s3c_hsotg_complete_request()
1307 spin_unlock(&hs_ep->lock); in s3c_hsotg_complete_request()
1308 hs_req->req.complete(&hs_ep->ep, &hs_req->req); in s3c_hsotg_complete_request()
1309 spin_lock(&hs_ep->lock); in s3c_hsotg_complete_request()
1316 if (!hs_ep->req && result >= 0) { in s3c_hsotg_complete_request()
1317 restart = !list_empty(&hs_ep->queue); in s3c_hsotg_complete_request()
1319 hs_req = get_ep_head(hs_ep); in s3c_hsotg_complete_request()
1320 s3c_hsotg_start_req(hsotg, hs_ep, hs_req, false); in s3c_hsotg_complete_request()
1336 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_complete_request_lock() argument
1342 spin_lock_irqsave(&hs_ep->lock, flags); in s3c_hsotg_complete_request_lock()
1343 s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, result); in s3c_hsotg_complete_request_lock()
1344 spin_unlock_irqrestore(&hs_ep->lock, flags); in s3c_hsotg_complete_request_lock()
1359 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx]; in s3c_hsotg_rx_data() local
1360 struct s3c_hsotg_req *hs_req = hs_ep->req; in s3c_hsotg_rx_data()
1381 spin_lock(&hs_ep->lock); in s3c_hsotg_rx_data()
1399 hs_ep->total_data += to_read; in s3c_hsotg_rx_data()
1407 spin_unlock(&hs_ep->lock); in s3c_hsotg_rx_data()
1468 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[epnum]; in s3c_hsotg_handle_outdone() local
1469 struct s3c_hsotg_req *hs_req = hs_ep->req; in s3c_hsotg_handle_outdone()
1490 size_done = hs_ep->size_loaded - size_left; in s3c_hsotg_handle_outdone()
1491 size_done += hs_ep->last_load; in s3c_hsotg_handle_outdone()
1498 s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true); in s3c_hsotg_handle_outdone()
1515 s3c_hsotg_complete_request_lock(hsotg, hs_ep, hs_req, result); in s3c_hsotg_handle_outdone()
1648 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep]; in s3c_hsotg_set_ep_maxpacket() local
1665 hs_ep->ep.maxpacket = mps; in s3c_hsotg_set_ep_maxpacket()
1696 struct s3c_hsotg_ep *hs_ep) in s3c_hsotg_trytx() argument
1698 struct s3c_hsotg_req *hs_req = hs_ep->req; in s3c_hsotg_trytx()
1700 if (!hs_ep->dir_in || !hs_req) in s3c_hsotg_trytx()
1705 hs_ep->index); in s3c_hsotg_trytx()
1706 return s3c_hsotg_write_fifo(hsotg, hs_ep, hs_req); in s3c_hsotg_trytx()
1721 struct s3c_hsotg_ep *hs_ep) in s3c_hsotg_complete_in() argument
1723 struct s3c_hsotg_req *hs_req = hs_ep->req; in s3c_hsotg_complete_in()
1724 u32 epsize = readl(hsotg->regs + S3C_DIEPTSIZ(hs_ep->index)); in s3c_hsotg_complete_in()
1743 size_done = hs_ep->size_loaded - size_left; in s3c_hsotg_complete_in()
1744 size_done += hs_ep->last_load; in s3c_hsotg_complete_in()
1757 s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true); in s3c_hsotg_complete_in()
1759 s3c_hsotg_complete_request_lock(hsotg, hs_ep, hs_req, 0); in s3c_hsotg_complete_in()
1773 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[idx]; in s3c_hsotg_epint() local
1794 s3c_hsotg_complete_in(hsotg, hs_ep); in s3c_hsotg_epint()
1796 if (idx == 0 && !hs_ep->req) in s3c_hsotg_epint()
1862 s3c_hsotg_trytx(hsotg, hs_ep); in s3c_hsotg_epint()
2230 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_enable() local
2231 struct s3c_hsotg *hsotg = hs_ep->parent; in s3c_hsotg_ep_enable()
2233 int index = hs_ep->index; in s3c_hsotg_ep_enable()
2249 if (dir_in != hs_ep->dir_in) { in s3c_hsotg_ep_enable()
2264 spin_lock_irqsave(&hs_ep->lock, flags); in s3c_hsotg_ep_enable()
2282 hs_ep->ep.maxpacket = mps; in s3c_hsotg_ep_enable()
2285 hs_ep->periodic = 0; in s3c_hsotg_ep_enable()
2304 hs_ep->periodic = 1; in s3c_hsotg_ep_enable()
2337 spin_unlock_irqrestore(&hs_ep->lock, flags); in s3c_hsotg_ep_enable()
2343 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_disable() local
2344 struct s3c_hsotg *hsotg = hs_ep->parent; in s3c_hsotg_ep_disable()
2345 int dir_in = hs_ep->dir_in; in s3c_hsotg_ep_disable()
2346 int index = hs_ep->index; in s3c_hsotg_ep_disable()
2361 kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false); in s3c_hsotg_ep_disable()
2363 spin_lock_irqsave(&hs_ep->lock, flags); in s3c_hsotg_ep_disable()
2374 s3c_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0); in s3c_hsotg_ep_disable()
2376 spin_unlock_irqrestore(&hs_ep->lock, flags); in s3c_hsotg_ep_disable()
2400 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_dequeue() local
2401 struct s3c_hsotg *hs = hs_ep->parent; in s3c_hsotg_ep_dequeue()
2406 if (hs_req == hs_ep->req) { in s3c_hsotg_ep_dequeue()
2411 spin_lock_irqsave(&hs_ep->lock, flags); in s3c_hsotg_ep_dequeue()
2413 if (!on_list(hs_ep, hs_req)) { in s3c_hsotg_ep_dequeue()
2414 spin_unlock_irqrestore(&hs_ep->lock, flags); in s3c_hsotg_ep_dequeue()
2418 s3c_hsotg_complete_request(hs, hs_ep, hs_req, -ECONNRESET); in s3c_hsotg_ep_dequeue()
2419 spin_unlock_irqrestore(&hs_ep->lock, flags); in s3c_hsotg_ep_dequeue()
2426 struct s3c_hsotg_ep *hs_ep = our_ep(ep); in s3c_hsotg_ep_sethalt() local
2427 struct s3c_hsotg *hs = hs_ep->parent; in s3c_hsotg_ep_sethalt()
2428 int index = hs_ep->index; in s3c_hsotg_ep_sethalt()
2435 spin_lock_irqsave(&hs_ep->lock, irqflags); in s3c_hsotg_ep_sethalt()
2459 spin_unlock_irqrestore(&hs_ep->lock, irqflags); in s3c_hsotg_ep_sethalt()
2743 struct s3c_hsotg_ep *hs_ep, in s3c_hsotg_initep() argument
2755 hs_ep->dir_in = 1; in s3c_hsotg_initep()
2758 hs_ep->index = epnum; in s3c_hsotg_initep()
2760 snprintf(hs_ep->name, sizeof(hs_ep->name), "ep%d%s", epnum, dir); in s3c_hsotg_initep()
2762 INIT_LIST_HEAD(&hs_ep->queue); in s3c_hsotg_initep()
2763 INIT_LIST_HEAD(&hs_ep->ep.ep_list); in s3c_hsotg_initep()
2765 spin_lock_init(&hs_ep->lock); in s3c_hsotg_initep()
2769 list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list); in s3c_hsotg_initep()
2771 hs_ep->parent = hsotg; in s3c_hsotg_initep()
2772 hs_ep->ep.name = hs_ep->name; in s3c_hsotg_initep()
2773 hs_ep->ep.maxpacket = epnum ? 512 : EP0_MPS_LIMIT; in s3c_hsotg_initep()
2774 hs_ep->ep.ops = &s3c_hsotg_ep_ops; in s3c_hsotg_initep()
2782 hs_ep->fifo_size = S3C_DPTXFSIZn_DPTxFSize_GET(ptxfifo) * 4; in s3c_hsotg_initep()