Lines Matching full:hs_ep

110  * @hs_ep: The endpoint
115 static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep)
117 struct dwc2_hsotg *hsotg = hs_ep->parent;
123 hs_ep->target_frame += hs_ep->interval;
124 if (hs_ep->target_frame > limit) {
125 hs_ep->frame_overrun = true;
126 hs_ep->target_frame &= limit;
128 hs_ep->frame_overrun = false;
135 * @hs_ep: The endpoint.
142 static inline void dwc2_gadget_dec_frame_num_by_one(struct dwc2_hsotg_ep *hs_ep)
144 struct dwc2_hsotg *hsotg = hs_ep->parent;
150 if (hs_ep->target_frame)
151 hs_ep->target_frame -= 1;
153 hs_ep->target_frame = limit;
411 * @hs_ep: The endpoint to query.
416 static inline int is_ep_periodic(struct dwc2_hsotg_ep *hs_ep)
418 return hs_ep->periodic;
424 * @hs_ep: The endpoint for the request
431 struct dwc2_hsotg_ep *hs_ep,
436 usb_gadget_unmap_request(&hsotg->gadget, req, hs_ep->map_dir);
490 * @hs_ep: The endpoint we're going to write for.
504 struct dwc2_hsotg_ep *hs_ep,
507 bool periodic = is_ep_periodic(hs_ep);
510 int to_write = hs_ep->size_loaded;
516 to_write -= (buf_pos - hs_ep->last_load);
523 u32 epsize = dwc2_readl(hsotg, DIEPTSIZ(hs_ep->index));
538 if (hs_ep->fifo_load != 0) {
545 hs_ep->size_loaded, hs_ep->fifo_load, hs_ep->fifo_size);
548 size_done = hs_ep->size_loaded - size_left;
551 can_write = hs_ep->fifo_load - size_done;
555 can_write = hs_ep->fifo_size - can_write;
563 } else if (hsotg->dedicated_fifos && hs_ep->index != 0) {
565 DTXFSTS(hs_ep->fifo_index));
583 max_transfer = hs_ep->ep.maxpacket * hs_ep->mc;
647 hs_ep->total_data += to_write;
650 hs_ep->fifo_load += to_write;
655 dwc2_writel_rep(hsotg, EPFIFO(hs_ep->index), data, to_write);
662 * @hs_ep: The endpoint
667 static unsigned int get_ep_limit(struct dwc2_hsotg_ep *hs_ep)
669 int index = hs_ep->index;
678 if (hs_ep->dir_in)
693 if ((maxpkt * hs_ep->ep.maxpacket) < maxsize)
694 maxsize = maxpkt * hs_ep->ep.maxpacket;
719 * @hs_ep: The endpoint
725 static unsigned int dwc2_gadget_get_chain_limit(struct dwc2_hsotg_ep *hs_ep)
727 const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc;
728 int is_isoc = hs_ep->isochronous;
730 u32 mps = hs_ep->ep.maxpacket;
731 int dir_in = hs_ep->dir_in;
734 maxsize = (hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_LIMIT :
741 if (hs_ep->index)
750 * @hs_ep: The endpoint
765 static u32 dwc2_gadget_get_desc_params(struct dwc2_hsotg_ep *hs_ep, u32 *mask)
767 const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc;
768 u32 mps = hs_ep->ep.maxpacket;
769 int dir_in = hs_ep->dir_in;
772 if (!hs_ep->index && !dir_in) {
775 } else if (hs_ep->isochronous) {
792 if (hs_ep->index)
801 static void dwc2_gadget_fill_nonisoc_xfer_ddma_one(struct dwc2_hsotg_ep *hs_ep,
807 int dir_in = hs_ep->dir_in;
808 u32 mps = hs_ep->ep.maxpacket;
814 maxsize = dwc2_gadget_get_desc_params(hs_ep, &mask);
816 hs_ep->desc_count = (len / maxsize) +
819 hs_ep->desc_count = 1;
821 for (i = 0; i < hs_ep->desc_count; ++i) {
827 if (!hs_ep->index && !dir_in)
842 ((hs_ep->send_zlp && true_last) ?
859 * @hs_ep: The endpoint
867 static void dwc2_gadget_config_nonisoc_xfer_ddma(struct dwc2_hsotg_ep *hs_ep,
872 struct dwc2_dma_desc *desc = hs_ep->desc_list;
877 if (hs_ep->req)
878 ureq = &hs_ep->req->req;
882 dwc2_gadget_fill_nonisoc_xfer_ddma_one(hs_ep, &desc,
889 dwc2_gadget_fill_nonisoc_xfer_ddma_one(hs_ep, &desc,
892 desc_count += hs_ep->desc_count;
895 hs_ep->desc_count = desc_count;
900 * @hs_ep: The isochronous endpoint.
909 static int dwc2_gadget_fill_isoc_desc(struct dwc2_hsotg_ep *hs_ep,
913 struct dwc2_hsotg *hsotg = hs_ep->parent;
918 dwc2_gadget_get_desc_params(hs_ep, &mask);
920 index = hs_ep->next_desc;
921 desc = &hs_ep->desc_list[index];
931 if (hs_ep->next_desc)
932 hs_ep->desc_list[index - 1].status &= ~DEV_DMA_L;
935 __func__, hs_ep->index, hs_ep->dir_in ? "in" : "out", index);
944 if (hs_ep->dir_in) {
946 pid = DIV_ROUND_UP(len, hs_ep->ep.maxpacket);
951 ((len % hs_ep->ep.maxpacket) ?
953 ((hs_ep->target_frame <<
962 if (hs_ep->dir_in)
963 dwc2_gadget_incr_frame_num(hs_ep);
966 hs_ep->next_desc++;
967 if (hs_ep->next_desc >= MAX_DMA_DESC_NUM_HS_ISOC)
968 hs_ep->next_desc = 0;
975 * @hs_ep: The isochronous endpoint.
980 static void dwc2_gadget_start_isoc_ddma(struct dwc2_hsotg_ep *hs_ep)
982 struct dwc2_hsotg *hsotg = hs_ep->parent;
984 int index = hs_ep->index;
992 if (list_empty(&hs_ep->queue)) {
993 hs_ep->target_frame = TARGET_FRAME_INITIAL;
1000 desc = &hs_ep->desc_list[i];
1006 hs_ep->next_desc = 0;
1007 list_for_each_entry_safe(hs_req, treq, &hs_ep->queue, queue) {
1014 ret = dwc2_gadget_fill_isoc_desc(hs_ep, dma_addr,
1020 hs_ep->compl_desc = 0;
1021 depctl = hs_ep->dir_in ? DIEPCTL(index) : DOEPCTL(index);
1022 dma_reg = hs_ep->dir_in ? DIEPDMA(index) : DOEPDMA(index);
1025 dwc2_writel(hsotg, hs_ep->desc_list_dma, dma_reg);
1032 static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep);
1034 struct dwc2_hsotg_ep *hs_ep,
1041 * @hs_ep: The endpoint to process a request for
1049 struct dwc2_hsotg_ep *hs_ep,
1054 int index = hs_ep->index;
1055 int dir_in = hs_ep->dir_in;
1066 if (hs_ep->req && !continuing) {
1070 } else if (hs_ep->req != hs_req && continuing) {
1084 hs_ep->dir_in ? "in" : "out");
1099 maxreq = get_ep_limit(hs_ep);
1101 maxreq = dwc2_gadget_get_chain_limit(hs_ep);
1104 int round = maxreq % hs_ep->ep.maxpacket;
1117 packets = DIV_ROUND_UP(length, hs_ep->ep.maxpacket);
1122 if (hs_ep->isochronous)
1135 if ((ureq->length >= hs_ep->ep.maxpacket) &&
1136 !(ureq->length % hs_ep->ep.maxpacket))
1137 hs_ep->send_zlp = 1;
1147 hs_ep->req = hs_req;
1151 u32 mps = hs_ep->ep.maxpacket;
1165 dwc2_gadget_config_nonisoc_xfer_ddma(hs_ep, ureq->dma + offset,
1169 dwc2_writel(hsotg, hs_ep->desc_list_dma, dma_reg);
1172 __func__, (u32)hs_ep->desc_list_dma, dma_reg);
1190 if (hs_ep->isochronous) {
1191 if (!dwc2_gadget_target_frame_elapsed(hs_ep)) {
1192 if (hs_ep->interval == 1) {
1193 if (hs_ep->target_frame & 0x1)
1200 hs_req->req.frame_number = hs_ep->target_frame;
1202 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA);
1223 hs_ep->size_loaded = length;
1224 hs_ep->last_load = ureq->actual;
1228 hs_ep->fifo_load = 0;
1230 dwc2_hsotg_write_fifo(hsotg, hs_ep, hs_req);
1248 dwc2_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 1);
1254 * @hs_ep: The endpoint the request is on.
1264 struct dwc2_hsotg_ep *hs_ep,
1269 hs_ep->map_dir = hs_ep->dir_in;
1270 ret = usb_gadget_map_request(&hsotg->gadget, req, hs_ep->dir_in);
1284 struct dwc2_hsotg_ep *hs_ep,
1296 hs_ep->ep.name, req_buf, hs_req->req.length);
1310 if (hs_ep->dir_in)
1317 struct dwc2_hsotg_ep *hs_ep,
1325 hs_ep->ep.name, hs_req->req.status, hs_req->req.actual);
1328 if (!hs_ep->dir_in && !hs_req->req.status)
1341 * @hs_ep: The driver endpoint to check
1346 static bool dwc2_gadget_target_frame_elapsed(struct dwc2_hsotg_ep *hs_ep)
1348 struct dwc2_hsotg *hsotg = hs_ep->parent;
1349 u32 target_frame = hs_ep->target_frame;
1351 bool frame_overrun = hs_ep->frame_overrun;
1370 * @hs_ep: the ep descriptor chain is for
1376 struct dwc2_hsotg_ep *hs_ep)
1381 hs_ep->desc_list = hsotg->setup_desc[0];
1382 hs_ep->desc_list_dma = hsotg->setup_desc_dma[0];
1386 hs_ep->desc_list = hsotg->ctrl_in_desc;
1387 hs_ep->desc_list_dma = hsotg->ctrl_in_desc_dma;
1390 hs_ep->desc_list = hsotg->ctrl_out_desc;
1391 hs_ep->desc_list_dma = hsotg->ctrl_out_desc_dma;
1406 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
1407 struct dwc2_hsotg *hs = hs_ep->parent;
1435 if (hs_ep->isochronous &&
1436 req->length > (hs_ep->mc * hs_ep->ep.maxpacket)) {
1444 if (using_desc_dma(hs) && hs_ep->isochronous) {
1445 maxsize = dwc2_gadget_get_desc_params(hs_ep, &mask);
1446 if (hs_ep->dir_in && req->length > maxsize) {
1452 if (!hs_ep->dir_in && req->length > hs_ep->ep.maxpacket) {
1454 req->length, hs_ep->ep.maxpacket);
1459 ret = dwc2_hsotg_handle_unaligned_buf_start(hs, hs_ep, hs_req);
1465 ret = dwc2_hsotg_map_dma(hs, hs_ep, req);
1470 if (using_desc_dma(hs) && !hs_ep->index) {
1471 ret = dwc2_gadget_set_ep0_desc_chain(hs, hs_ep);
1476 first = list_empty(&hs_ep->queue);
1477 list_add_tail(&hs_req->queue, &hs_ep->queue);
1485 if (using_desc_dma(hs) && hs_ep->isochronous) {
1486 if (hs_ep->target_frame != TARGET_FRAME_INITIAL) {
1493 dwc2_gadget_fill_isoc_desc(hs_ep, dma_addr,
1500 if (!hs_ep->index && !req->length && !hs_ep->dir_in &&
1502 hs_ep->dir_in = 1;
1505 if (!hs_ep->isochronous) {
1506 dwc2_hsotg_start_req(hs, hs_ep, hs_req, false);
1512 while (dwc2_gadget_target_frame_elapsed(hs_ep)) {
1513 dwc2_gadget_incr_frame_num(hs_ep);
1520 if (hs_ep->target_frame != TARGET_FRAME_INITIAL)
1521 dwc2_hsotg_start_req(hs, hs_ep, hs_req, false);
1529 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
1530 struct dwc2_hsotg *hs = hs_ep->parent;
1560 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
1561 struct dwc2_hsotg *hsotg = hs_ep->parent;
1728 * @hs_ep: The controller endpoint to get
1732 static struct dwc2_hsotg_req *get_ep_head(struct dwc2_hsotg_ep *hs_ep)
1734 return list_first_entry_or_null(&hs_ep->queue, struct dwc2_hsotg_req,
1740 * @hs_ep: Endpoint structure
1746 static void dwc2_gadget_start_next_request(struct dwc2_hsotg_ep *hs_ep)
1748 struct dwc2_hsotg *hsotg = hs_ep->parent;
1749 int dir_in = hs_ep->dir_in;
1752 if (!list_empty(&hs_ep->queue)) {
1753 hs_req = get_ep_head(hs_ep);
1754 dwc2_hsotg_start_req(hsotg, hs_ep, hs_req, false);
1757 if (!hs_ep->isochronous)
2015 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
2016 struct dwc2_hsotg *hsotg = hs_ep->parent;
2071 struct dwc2_hsotg_ep *hs_ep)
2074 u8 index = hs_ep->index;
2075 u32 epctl_reg = hs_ep->dir_in ? DIEPCTL(index) : DOEPCTL(index);
2076 u32 epsiz_reg = hs_ep->dir_in ? DIEPTSIZ(index) : DOEPTSIZ(index);
2078 if (hs_ep->dir_in)
2086 dma_addr_t dma = hs_ep->desc_list_dma;
2089 dwc2_gadget_set_ep0_desc_chain(hsotg, hs_ep);
2091 dwc2_gadget_config_nonisoc_xfer_ddma(hs_ep, dma, 0);
2108 * @hs_ep: The endpoint the request was on.
2119 struct dwc2_hsotg_ep *hs_ep,
2129 hs_ep, hs_ep->ep.name, hs_req, result, hs_req->req.complete);
2140 dwc2_hsotg_unmap_dma(hsotg, hs_ep, hs_req);
2142 dwc2_hsotg_handle_unaligned_buf_complete(hsotg, hs_ep, hs_req);
2144 hs_ep->req = NULL;
2154 usb_gadget_giveback_request(&hs_ep->ep, &hs_req->req);
2159 if (using_desc_dma(hsotg) && hs_ep->isochronous)
2168 if (!hs_ep->req && result >= 0)
2169 dwc2_gadget_start_next_request(hs_ep);
2174 * @hs_ep: The endpoint the request was on.
2181 static void dwc2_gadget_complete_isoc_request_ddma(struct dwc2_hsotg_ep *hs_ep)
2183 struct dwc2_hsotg *hsotg = hs_ep->parent;
2189 desc_sts = hs_ep->desc_list[hs_ep->compl_desc].status;
2195 hs_req = get_ep_head(hs_ep);
2205 mask = hs_ep->dir_in ? DEV_DMA_ISOC_TX_NBYTES_MASK :
2213 if (!hs_ep->dir_in && ureq->length & 0x3)
2222 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
2224 hs_ep->compl_desc++;
2225 if (hs_ep->compl_desc > (MAX_DMA_DESC_NUM_HS_ISOC - 1))
2226 hs_ep->compl_desc = 0;
2227 desc_sts = hs_ep->desc_list[hs_ep->compl_desc].status;
2233 * @hs_ep: The isochronous endpoint.
2240 static void dwc2_gadget_handle_isoc_bna(struct dwc2_hsotg_ep *hs_ep)
2242 struct dwc2_hsotg *hsotg = hs_ep->parent;
2244 if (!hs_ep->dir_in)
2246 dwc2_hsotg_complete_request(hsotg, hs_ep, get_ep_head(hs_ep), 0);
2248 hs_ep->target_frame = TARGET_FRAME_INITIAL;
2249 hs_ep->next_desc = 0;
2250 hs_ep->compl_desc = 0;
2265 struct dwc2_hsotg_ep *hs_ep = hsotg->eps_out[ep_idx];
2266 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2303 hs_ep->total_data += to_read;
2338 * @hs_ep - The endpoint on which transfer went
2343 static unsigned int dwc2_gadget_get_xfersize_ddma(struct dwc2_hsotg_ep *hs_ep)
2345 const struct usb_endpoint_descriptor *ep_desc = hs_ep->ep.desc;
2346 struct dwc2_hsotg *hsotg = hs_ep->parent;
2349 struct dwc2_dma_desc *desc = hs_ep->desc_list;
2352 u32 mps = hs_ep->ep.maxpacket;
2353 int dir_in = hs_ep->dir_in;
2359 if (hs_ep->index)
2363 for (i = 0; i < hs_ep->desc_count; ++i) {
2393 struct dwc2_hsotg_ep *hs_ep = hsotg->eps_out[epnum];
2394 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2406 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
2412 size_left = dwc2_gadget_get_xfersize_ddma(hs_ep);
2426 size_done = hs_ep->size_loaded - size_left;
2427 size_done += hs_ep->last_load;
2434 dwc2_hsotg_start_req(hsotg, hs_ep, hs_req, true);
2457 if (!using_desc_dma(hsotg) && hs_ep->isochronous) {
2458 req->frame_number = hs_ep->target_frame;
2459 dwc2_gadget_incr_frame_num(hs_ep);
2462 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, result);
2585 struct dwc2_hsotg_ep *hs_ep;
2588 hs_ep = index_to_ep(hsotg, ep, dir_in);
2589 if (!hs_ep)
2599 hs_ep->ep.maxpacket = mps_bytes;
2600 hs_ep->mc = 1;
2604 hs_ep->mc = mc;
2607 hs_ep->ep.maxpacket = mps;
2647 * @hs_ep: The driver endpoint to check.
2653 struct dwc2_hsotg_ep *hs_ep)
2655 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2657 if (!hs_ep->dir_in || !hs_req) {
2662 if (hs_ep->index != 0)
2663 dwc2_hsotg_ctrl_epint(hsotg, hs_ep->index,
2664 hs_ep->dir_in, 0);
2670 hs_ep->index);
2671 return dwc2_hsotg_write_fifo(hsotg, hs_ep, hs_req);
2680 * @hs_ep: The endpoint that has just completed.
2686 struct dwc2_hsotg_ep *hs_ep)
2688 struct dwc2_hsotg_req *hs_req = hs_ep->req;
2689 u32 epsize = dwc2_readl(hsotg, DIEPTSIZ(hs_ep->index));
2698 if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_STATUS_IN) {
2705 hs_ep->dir_in = 0;
2707 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
2733 size_left = dwc2_gadget_get_xfersize_ddma(hs_ep);
2741 size_done = hs_ep->size_loaded - size_left;
2742 size_done += hs_ep->last_load;
2754 dwc2_hsotg_start_req(hsotg, hs_ep, hs_req, true);
2759 if (hs_ep->send_zlp) {
2760 hs_ep->send_zlp = 0;
2762 dwc2_hsotg_program_zlp(hsotg, hs_ep);
2768 if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) {
2775 if (!using_desc_dma(hsotg) && hs_ep->isochronous) {
2776 hs_req->req.frame_number = hs_ep->target_frame;
2777 dwc2_gadget_incr_frame_num(hs_ep);
2780 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, 0);
2813 * @hs_ep: The endpoint on which interrupt is asserted.
2824 static void dwc2_gadget_handle_ep_disabled(struct dwc2_hsotg_ep *hs_ep)
2826 struct dwc2_hsotg *hsotg = hs_ep->parent;
2828 unsigned char idx = hs_ep->index;
2829 int dir_in = hs_ep->dir_in;
2838 dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index);
2854 if (!hs_ep->isochronous)
2857 if (list_empty(&hs_ep->queue)) {
2859 __func__, hs_ep);
2864 hs_req = get_ep_head(hs_ep);
2866 hs_req->req.frame_number = hs_ep->target_frame;
2868 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req,
2871 dwc2_gadget_incr_frame_num(hs_ep);
2874 } while (dwc2_gadget_target_frame_elapsed(hs_ep));
2940 struct dwc2_hsotg_ep *hs_ep);
2944 * @hs_ep: The endpoint on which interrupt is asserted.
2956 static void dwc2_gadget_handle_nak(struct dwc2_hsotg_ep *hs_ep)
2958 struct dwc2_hsotg *hsotg = hs_ep->parent;
2960 int dir_in = hs_ep->dir_in;
2963 if (!dir_in || !hs_ep->isochronous)
2966 if (hs_ep->target_frame == TARGET_FRAME_INITIAL) {
2969 hs_ep->target_frame = hsotg->frame_number;
2970 dwc2_gadget_incr_frame_num(hs_ep);
2979 hs_ep->target_frame &= ~hs_ep->interval + 1;
2984 dwc2_gadget_incr_frame_num(hs_ep);
2985 dwc2_gadget_dec_frame_num_by_one(hs_ep);
2988 dwc2_gadget_start_isoc_ddma(hs_ep);
2992 hs_ep->target_frame = hsotg->frame_number;
2993 if (hs_ep->interval > 1) {
2995 DIEPCTL(hs_ep->index));
2996 if (hs_ep->target_frame & 0x1)
3001 dwc2_writel(hsotg, ctrl, DIEPCTL(hs_ep->index));
3008 ctrl = dwc2_readl(hsotg, DIEPCTL(hs_ep->index));
3010 dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep);
3012 dwc2_hsotg_txfifo_flush(hsotg, hs_ep->fifo_index);
3014 while (dwc2_gadget_target_frame_elapsed(hs_ep)) {
3015 hs_req = get_ep_head(hs_ep);
3017 hs_req->req.frame_number = hs_ep->target_frame;
3019 dwc2_hsotg_complete_request(hsotg, hs_ep, hs_req, -ENODATA);
3022 dwc2_gadget_incr_frame_num(hs_ep);
3027 if (!hs_ep->req)
3028 dwc2_gadget_start_next_request(hs_ep);
3042 struct dwc2_hsotg_ep *hs_ep = index_to_ep(hsotg, idx, dir_in);
3053 if (!hs_ep) {
3072 if (using_desc_dma(hsotg) && idx == 0 && !hs_ep->dir_in &&
3083 if (using_desc_dma(hsotg) && hs_ep->isochronous) {
3084 dwc2_gadget_complete_isoc_request_ddma(hs_ep);
3091 if (!hs_ep->isochronous || !(ints & DXEPINT_NAKINTRPT))
3092 dwc2_hsotg_complete_in(hsotg, hs_ep);
3094 if (idx == 0 && !hs_ep->req)
3101 if (!hs_ep->isochronous || !(ints & DXEPINT_OUTTKNEPDIS))
3107 dwc2_gadget_handle_ep_disabled(hs_ep);
3110 dwc2_gadget_handle_out_token_ep_disabled(hs_ep);
3113 dwc2_gadget_handle_nak(hs_ep);
3165 if (hs_ep->isochronous)
3166 dwc2_gadget_handle_isoc_bna(hs_ep);
3169 if (dir_in && !hs_ep->isochronous) {
3188 dwc2_hsotg_trytx(hsotg, hs_ep);
3619 struct dwc2_hsotg_ep *hs_ep;
3629 hs_ep = hsotg->eps_in[idx];
3631 if ((BIT(idx) & ~daintmsk) || !hs_ep->isochronous)
3636 dwc2_gadget_target_frame_elapsed(hs_ep)) {
3666 struct dwc2_hsotg_ep *hs_ep;
3675 hs_ep = hsotg->eps_out[idx];
3677 if ((BIT(idx) & ~daintmsk) || !hs_ep->isochronous)
3682 dwc2_gadget_target_frame_elapsed(hs_ep)) {
3844 struct dwc2_hsotg_ep *hs_ep;
3855 hs_ep = hsotg->eps_out[idx];
3863 if ((epctrl & DXEPCTL_EPENA) && hs_ep->isochronous) {
3871 if (hs_ep->halted) {
3915 struct dwc2_hsotg_ep *hs_ep)
3920 epctrl_reg = hs_ep->dir_in ? DIEPCTL(hs_ep->index) :
3921 DOEPCTL(hs_ep->index);
3922 epint_reg = hs_ep->dir_in ? DIEPINT(hs_ep->index) :
3923 DOEPINT(hs_ep->index);
3926 hs_ep->name);
3928 if (hs_ep->dir_in) {
3929 if (hsotg->dedicated_fifos || hs_ep->periodic) {
3986 if (hs_ep->dir_in) {
3989 if (hsotg->dedicated_fifos || hs_ep->periodic)
3990 fifo_index = hs_ep->fifo_index;
3998 if (!hsotg->dedicated_fifos && !hs_ep->periodic)
4017 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4018 struct dwc2_hsotg *hsotg = hs_ep->parent;
4020 unsigned int index = hs_ep->index;
4044 if (dir_in != hs_ep->dir_in) {
4083 if (using_desc_dma(hsotg) && !hs_ep->desc_list) {
4084 hs_ep->desc_list = dmam_alloc_coherent(hsotg->dev,
4086 &hs_ep->desc_list_dma, GFP_ATOMIC);
4087 if (!hs_ep->desc_list) {
4105 dwc2_hsotg_set_ep_maxpacket(hsotg, hs_ep->index, mps, mc, dir_in);
4108 hs_ep->isochronous = 0;
4109 hs_ep->periodic = 0;
4110 hs_ep->halted = 0;
4111 hs_ep->wedged = 0;
4112 hs_ep->interval = desc->bInterval;
4118 hs_ep->isochronous = 1;
4119 hs_ep->interval = 1 << (desc->bInterval - 1);
4120 hs_ep->target_frame = TARGET_FRAME_INITIAL;
4121 hs_ep->next_desc = 0;
4122 hs_ep->compl_desc = 0;
4124 hs_ep->periodic = 1;
4142 hs_ep->periodic = 1;
4145 hs_ep->interval = 1 << (desc->bInterval - 1);
4164 size = hs_ep->ep.maxpacket * hs_ep->mc;
4187 hs_ep->fifo_index = fifo_index;
4188 hs_ep->fifo_size = fifo_size;
4192 if (index && !hs_ep->isochronous)
4202 hs_ep->isochronous && dir_in) {
4230 if (ret && using_desc_dma(hsotg) && hs_ep->desc_list) {
4233 hs_ep->desc_list, hs_ep->desc_list_dma);
4234 hs_ep->desc_list = NULL;
4246 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4247 struct dwc2_hsotg *hsotg = hs_ep->parent;
4248 int dir_in = hs_ep->dir_in;
4249 int index = hs_ep->index;
4270 dwc2_hsotg_ep_stop_xfr(hsotg, hs_ep);
4280 dwc2_hsotg_ctrl_epint(hsotg, hs_ep->index, hs_ep->dir_in, 0);
4283 kill_all_requests(hsotg, hs_ep, -ESHUTDOWN);
4285 hsotg->fifo_map &= ~(1 << hs_ep->fifo_index);
4286 hs_ep->fifo_index = 0;
4287 hs_ep->fifo_size = 0;
4294 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4295 struct dwc2_hsotg *hsotg = hs_ep->parent;
4330 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4331 struct dwc2_hsotg *hs = hs_ep->parent;
4338 if (!on_list(hs_ep, hs_req)) {
4344 if (req == &hs_ep->req->req)
4345 dwc2_hsotg_ep_stop_xfr(hs, hs_ep);
4347 dwc2_hsotg_complete_request(hs, hs_ep, hs_req, -ECONNRESET);
4360 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4361 struct dwc2_hsotg *hs = hs_ep->parent;
4367 hs_ep->wedged = 1;
4386 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4387 struct dwc2_hsotg *hs = hs_ep->parent;
4388 int index = hs_ep->index;
4404 if (hs_ep->isochronous) {
4409 if (!now && value && !list_empty(&hs_ep->queue)) {
4415 if (hs_ep->dir_in) {
4425 hs_ep->wedged = 0;
4445 hs_ep->wedged = 0;
4454 hs_ep->halted = value;
4465 struct dwc2_hsotg_ep *hs_ep = our_ep(ep);
4466 struct dwc2_hsotg *hs = hs_ep->parent;
4789 * @hs_ep: The endpoint to be initialised.
4798 struct dwc2_hsotg_ep *hs_ep,
4811 hs_ep->dir_in = dir_in;
4812 hs_ep->index = epnum;
4814 snprintf(hs_ep->name, sizeof(hs_ep->name), "ep%d%s", epnum, dir);
4816 INIT_LIST_HEAD(&hs_ep->queue);
4817 INIT_LIST_HEAD(&hs_ep->ep.ep_list);
4821 list_add_tail(&hs_ep->ep.ep_list, &hsotg->gadget.ep_list);
4823 hs_ep->parent = hsotg;
4824 hs_ep->ep.name = hs_ep->name;
4827 usb_ep_set_maxpacket_limit(&hs_ep->ep, 8);
4829 usb_ep_set_maxpacket_limit(&hs_ep->ep,
4831 hs_ep->ep.ops = &dwc2_hsotg_ep_ops;
4834 hs_ep->ep.caps.type_control = true;
4837 hs_ep->ep.caps.type_iso = true;
4838 hs_ep->ep.caps.type_bulk = true;
4840 hs_ep->ep.caps.type_int = true;
4844 hs_ep->ep.caps.dir_in = true;
4846 hs_ep->ep.caps.dir_out = true;