Lines Matching refs:hs_ep
397 * @hs_ep: The endpoint to query.
402 static inline int is_ep_periodic(struct s3c_hsotg_ep *hs_ep)
404 return hs_ep->periodic;
410 * @hs_ep: The endpoint for the request
417 struct s3c_hsotg_ep *hs_ep,
423 dir = hs_ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
444 * @hs_ep: The endpoint we're going to write for.
458 struct s3c_hsotg_ep *hs_ep,
461 bool periodic = is_ep_periodic(hs_ep);
464 int to_write = hs_ep->size_loaded;
469 to_write -= (buf_pos - hs_ep->last_load);
476 u32 epsize = readl(hsotg->regs + S3C_DIEPTSIZ(hs_ep->index));
488 if (hs_ep->fifo_load != 0) {
495 hs_ep->size_loaded, hs_ep->fifo_load, hs_ep->fifo_size);
498 size_done = hs_ep->size_loaded - size_left;
501 can_write = hs_ep->fifo_load - size_done;
505 can_write = hs_ep->fifo_size - can_write;
513 } else if (hsotg->dedicated_fifos && hs_ep->index != 0) {
514 can_write = readl(hsotg->regs + S3C_DTXFSTS(hs_ep->index));
533 __func__, gnptxsts, can_write, to_write, hs_ep->ep.maxpacket);
545 if (to_write > hs_ep->ep.maxpacket) {
546 to_write = hs_ep->ep.maxpacket;
557 pkt_round = to_write % hs_ep->ep.maxpacket;
585 hs_ep->total_data += to_write;
588 hs_ep->fifo_load += to_write;
593 writesl(hsotg->regs + S3C_EPFIFO(hs_ep->index), data, to_write);
600 * @hs_ep: The endpoint
605 static unsigned get_ep_limit(struct s3c_hsotg_ep *hs_ep)
607 int index = hs_ep->index;
616 if (hs_ep->dir_in) {
630 if ((maxpkt * hs_ep->ep.maxpacket) < maxsize)
631 maxsize = maxpkt * hs_ep->ep.maxpacket;
639 * @hs_ep: The endpoint to process a request for
647 struct s3c_hsotg_ep *hs_ep,
652 int index = hs_ep->index;
653 int dir_in = hs_ep->dir_in;
663 if (hs_ep->req && !continuing) {
667 } else if (hs_ep->req != hs_req && continuing) {
680 hs_ep->dir_in ? "in" : "out");
690 maxreq = get_ep_limit(hs_ep);
692 int round = maxreq % hs_ep->ep.maxpacket;
705 packets = DIV_ROUND_UP(length, hs_ep->ep.maxpacket);
718 if (length == (packets * hs_ep->ep.maxpacket))
729 hs_ep->req = hs_req;
769 hs_ep->size_loaded = length;
770 hs_ep->last_load = ureq->actual;
774 hs_ep->fifo_load = 0;
776 s3c_hsotg_write_fifo(hsotg, hs_ep, hs_req);
801 * @hs_ep: The endpoint the request is on.
811 struct s3c_hsotg_ep *hs_ep,
817 dir = hs_ep->dir_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE;
859 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
860 struct s3c_hsotg *hs = hs_ep->parent;
875 int ret = s3c_hsotg_map_dma(hs, hs_ep, req);
880 spin_lock_irqsave(&hs_ep->lock, irqflags);
882 first = list_empty(&hs_ep->queue);
883 list_add_tail(&hs_req->queue, &hs_ep->queue);
886 s3c_hsotg_start_req(hs, hs_ep, hs_req, false);
888 spin_unlock_irqrestore(&hs_ep->lock, irqflags);
912 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
913 struct s3c_hsotg *hsotg = hs_ep->parent;
1200 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
1201 struct s3c_hsotg *hsotg = hs_ep->parent;
1251 * @hs_ep: The controller endpoint to get
1255 static struct s3c_hsotg_req *get_ep_head(struct s3c_hsotg_ep *hs_ep)
1257 if (list_empty(&hs_ep->queue))
1260 return list_first_entry(&hs_ep->queue, struct s3c_hsotg_req, queue);
1266 * @hs_ep: The endpoint the request was on.
1277 struct s3c_hsotg_ep *hs_ep,
1289 hs_ep, hs_ep->ep.name, hs_req, result, hs_req->req.complete);
1297 hs_ep->req = NULL;
1301 s3c_hsotg_unmap_dma(hsotg, hs_ep, hs_req);
1307 spin_unlock(&hs_ep->lock);
1308 hs_req->req.complete(&hs_ep->ep, &hs_req->req);
1309 spin_lock(&hs_ep->lock);
1316 if (!hs_ep->req && result >= 0) {
1317 restart = !list_empty(&hs_ep->queue);
1319 hs_req = get_ep_head(hs_ep);
1320 s3c_hsotg_start_req(hsotg, hs_ep, hs_req, false);
1328 * @hs_ep: The endpoint the request was on.
1336 struct s3c_hsotg_ep *hs_ep,
1342 spin_lock_irqsave(&hs_ep->lock, flags);
1343 s3c_hsotg_complete_request(hsotg, hs_ep, hs_req, result);
1344 spin_unlock_irqrestore(&hs_ep->lock, flags);
1359 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep_idx];
1360 struct s3c_hsotg_req *hs_req = hs_ep->req;
1381 spin_lock(&hs_ep->lock);
1399 hs_ep->total_data += to_read;
1407 spin_unlock(&hs_ep->lock);
1468 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[epnum];
1469 struct s3c_hsotg_req *hs_req = hs_ep->req;
1490 size_done = hs_ep->size_loaded - size_left;
1491 size_done += hs_ep->last_load;
1498 s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true);
1515 s3c_hsotg_complete_request_lock(hsotg, hs_ep, hs_req, result);
1648 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[ep];
1665 hs_ep->ep.maxpacket = mps;
1690 * @hs_ep: The driver endpoint to check.
1696 struct s3c_hsotg_ep *hs_ep)
1698 struct s3c_hsotg_req *hs_req = hs_ep->req;
1700 if (!hs_ep->dir_in || !hs_req)
1705 hs_ep->index);
1706 return s3c_hsotg_write_fifo(hsotg, hs_ep, hs_req);
1715 * @hs_ep: The endpoint that has just completed.
1721 struct s3c_hsotg_ep *hs_ep)
1723 struct s3c_hsotg_req *hs_req = hs_ep->req;
1724 u32 epsize = readl(hsotg->regs + S3C_DIEPTSIZ(hs_ep->index));
1743 size_done = hs_ep->size_loaded - size_left;
1744 size_done += hs_ep->last_load;
1757 s3c_hsotg_start_req(hsotg, hs_ep, hs_req, true);
1759 s3c_hsotg_complete_request_lock(hsotg, hs_ep, hs_req, 0);
1773 struct s3c_hsotg_ep *hs_ep = &hsotg->eps[idx];
1794 s3c_hsotg_complete_in(hsotg, hs_ep);
1796 if (idx == 0 && !hs_ep->req)
1862 s3c_hsotg_trytx(hsotg, hs_ep);
2230 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2231 struct s3c_hsotg *hsotg = hs_ep->parent;
2233 int index = hs_ep->index;
2249 if (dir_in != hs_ep->dir_in) {
2264 spin_lock_irqsave(&hs_ep->lock, flags);
2282 hs_ep->ep.maxpacket = mps;
2285 hs_ep->periodic = 0;
2304 hs_ep->periodic = 1;
2337 spin_unlock_irqrestore(&hs_ep->lock, flags);
2343 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2344 struct s3c_hsotg *hsotg = hs_ep->parent;
2345 int dir_in = hs_ep->dir_in;
2346 int index = hs_ep->index;
2361 kill_all_requests(hsotg, hs_ep, -ESHUTDOWN, false);
2363 spin_lock_irqsave(&hs_ep->lock, flags);
2374 s3c_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0);
2376 spin_unlock_irqrestore(&hs_ep->lock, flags);
2400 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2401 struct s3c_hsotg *hs = hs_ep->parent;
2406 if (hs_req == hs_ep->req) {
2411 spin_lock_irqsave(&hs_ep->lock, flags);
2413 if (!on_list(hs_ep, hs_req)) {
2414 spin_unlock_irqrestore(&hs_ep->lock, flags);
2418 s3c_hsotg_complete_request(hs, hs_ep, hs_req, -ECONNRESET);
2419 spin_unlock_irqrestore(&hs_ep->lock, flags);
2426 struct s3c_hsotg_ep *hs_ep = our_ep(ep);
2427 struct s3c_hsotg *hs = hs_ep->parent;
2428 int index = hs_ep->index;
2435 spin_lock_irqsave(&hs_ep->lock, irqflags);
2459 spin_unlock_irqrestore(&hs_ep->lock, irqflags);
2734 * @hs_ep: The endpoint to be initialised.
2742 struct s3c_hsotg_ep *hs_ep,
2754 hs_ep->dir_in = 1;
2757 hs_ep->index = epnum;
2759 snprintf(hs_ep->name, sizeof(hs_ep->name), "ep%d%s", epnum, dir);
2761 INIT_LIST_HEAD(&hs_ep->queue);
2762 INIT_LIST_HEAD(&hs_ep->ep.ep_list);
2764 spin_lock_init(&hs_ep->lock);
2768 list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list);
2770 hs_ep->parent = hsotg;
2771 hs_ep->ep.name = hs_ep->name;
2772 hs_ep->ep.maxpacket = epnum ? 512 : EP0_MPS_LIMIT;
2773 hs_ep->ep.ops = &s3c_hsotg_ep_ops;
2781 hs_ep->fifo_size = S3C_DPTXFSIZn_DPTxFSize_GET(ptxfifo) * 4;