Lines Matching refs:pep

344 int cdnsp_ep_enqueue(struct cdnsp_ep *pep, struct cdnsp_request *preq)
346 struct cdnsp_device *pdev = pep->pdev;
350 if (preq->epnum == 0 && !list_empty(&pep->pending_list)) {
358 preq->direction = pep->direction;
359 preq->epnum = pep->number;
362 ret = usb_gadget_map_request_by_dev(pdev->dev, request, pep->direction);
368 list_add_tail(&preq->list, &pep->pending_list);
372 switch (usb_endpoint_type(pep->endpoint.desc)) {
391 pep->direction);
423 int cdnsp_ep_dequeue(struct cdnsp_ep *pep, struct cdnsp_request *preq)
425 struct cdnsp_device *pdev = pep->pdev;
431 if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_RUNNING)
432 ret_stop = cdnsp_cmd_stop_ep(pdev, pep);
434 ret_rem = cdnsp_remove_request(pdev, preq, pep);
488 struct cdnsp_ep *pep)
507 TRB_TO_EP_ID(data) == (pep->idx + 1)) {
596 struct cdnsp_ep *pep,
603 ret = cdnsp_cmd_stop_ep(pdev, pep);
608 if (GET_EP_CTX_STATE(pep->out_ctx) == EP_STATE_STOPPED) {
609 cdnsp_queue_halt_endpoint(pdev, pep->idx);
614 pep->ep_state |= EP_HALTED;
616 cdnsp_queue_reset_ep(pdev, pep->idx);
619 trace_cdnsp_handle_cmd_reset_ep(pep->out_ctx);
624 pep->ep_state &= ~EP_HALTED;
626 if (pep->idx != 0 && !(pep->ep_state & EP_WEDGE))
627 cdnsp_ring_doorbell_for_active_rings(pdev, pep);
629 pep->ep_state &= ~EP_WEDGE;
636 struct cdnsp_ep *pep)
667 ep_sts = GET_EP_CTX_STATE(pep->out_ctx);
675 trace_cdnsp_handle_cmd_config_ep(pep->out_ctx);
765 int cdnsp_alloc_streams(struct cdnsp_device *pdev, struct cdnsp_ep *pep)
767 unsigned int num_streams = usb_ss_max_streams(pep->endpoint.comp_desc);
787 trace_cdnsp_stream_number(pep, num_stream_ctxs, num_streams);
789 ret = cdnsp_alloc_stream_info(pdev, pep, num_stream_ctxs, num_streams);
793 cdnsp_setup_streams_ep_input_ctx(pdev, pep->in_ctx, &pep->stream_info);
795 pep->ep_state |= EP_HAS_STREAMS;
796 pep->stream_info.td_count = 0;
797 pep->stream_info.first_prime_det = 0;
931 struct cdnsp_ep *pep;
940 pep = to_cdnsp_ep(ep);
941 pdev = pep->pdev;
942 pep->ep_state &= ~EP_UNCONFIGURED;
944 if (dev_WARN_ONCE(pdev->dev, pep->ep_state & EP_ENABLED,
945 "%s is already enabled\n", pep->name))
957 pep->interval = desc->bInterval ? BIT(desc->bInterval - 1) : 0;
961 pep->interval = desc->bInterval << 3;
963 pep->interval = BIT(desc->bInterval - 1) << 3;
967 if (pep->interval > BIT(12)) {
976 ret = cdnsp_endpoint_init(pdev, pep, GFP_ATOMIC);
984 ret = cdnsp_update_eps_configuration(pdev, pep);
986 cdnsp_free_endpoint_rings(pdev, pep);
990 pep->ep_state |= EP_ENABLED;
991 pep->ep_state &= ~EP_STOPPED;
994 trace_cdnsp_ep_enable_end(pep, 0);
1005 struct cdnsp_ep *pep;
1013 pep = to_cdnsp_ep(ep);
1014 pdev = pep->pdev;
1018 if (!(pep->ep_state & EP_ENABLED)) {
1019 dev_err(pdev->dev, "%s is already disabled\n", pep->name);
1024 pep->ep_state |= EP_DIS_IN_RROGRESS;
1027 if (!(pep->ep_state & EP_UNCONFIGURED)) {
1028 cdnsp_cmd_stop_ep(pdev, pep);
1029 cdnsp_cmd_flush_ep(pdev, pep);
1033 while (!list_empty(&pep->pending_list)) {
1034 preq = next_request(&pep->pending_list);
1035 cdnsp_ep_dequeue(pep, preq);
1038 cdnsp_invalidate_ep_events(pdev, pep);
1040 pep->ep_state &= ~EP_DIS_IN_RROGRESS;
1041 drop_flag = cdnsp_get_endpoint_flag(pep->endpoint.desc);
1046 cdnsp_endpoint_zero(pdev, pep);
1048 if (!(pep->ep_state & EP_UNCONFIGURED))
1049 ret = cdnsp_update_eps_configuration(pdev, pep);
1051 cdnsp_free_endpoint_rings(pdev, pep);
1053 pep->ep_state &= ~(EP_ENABLED | EP_UNCONFIGURED);
1054 pep->ep_state |= EP_STOPPED;
1057 trace_cdnsp_ep_disable_end(pep, 0);
1066 struct cdnsp_ep *pep = to_cdnsp_ep(ep);
1073 preq->epnum = pep->number;
1074 preq->pep = pep;
1096 struct cdnsp_ep *pep;
1103 pep = to_cdnsp_ep(ep);
1104 pdev = pep->pdev;
1106 if (!(pep->ep_state & EP_ENABLED)) {
1108 pep->name);
1114 ret = cdnsp_ep_enqueue(pep, preq);
1123 struct cdnsp_ep *pep = to_cdnsp_ep(ep);
1124 struct cdnsp_device *pdev = pep->pdev;
1131 if (!pep->endpoint.desc) {
1134 pep->name);
1139 if (!(pep->ep_state & EP_ENABLED))
1143 ret = cdnsp_ep_dequeue(pep, to_cdnsp_request(request));
1151 struct cdnsp_ep *pep = to_cdnsp_ep(ep);
1152 struct cdnsp_device *pdev = pep->pdev;
1159 preq = next_request(&pep->pending_list);
1162 trace_cdnsp_ep_busy_try_halt_again(pep, 0);
1168 ret = cdnsp_halt_endpoint(pdev, pep, value);
1177 struct cdnsp_ep *pep = to_cdnsp_ep(ep);
1178 struct cdnsp_device *pdev = pep->pdev;
1183 pep->ep_state |= EP_WEDGE;
1184 ret = cdnsp_halt_endpoint(pdev, pep, 1);
1212 void cdnsp_gadget_giveback(struct cdnsp_ep *pep,
1216 struct cdnsp_device *pdev = pep->pdev;
1230 usb_gadget_giveback_request(&pep->endpoint, &preq->request);
1574 struct cdnsp_ep *pep)
1581 if (!pep->direction) {
1582 pep->buffering = readl(reg + XBUF_RX_TAG_MASK_0_OFFSET);
1583 pep->buffering_period = readl(reg + XBUF_RX_TAG_MASK_1_OFFSET);
1584 pep->buffering = (pep->buffering + 1) / 2;
1585 pep->buffering_period = (pep->buffering_period + 1) / 2;
1594 reg += pep->number * sizeof(u32) * 2;
1596 pep->buffering = (readl(reg) + 1) / 2;
1597 pep->buffering_period = pep->buffering;
1603 struct cdnsp_ep *pep;
1623 pep = &pdev->eps[i];
1624 pep->pdev = pdev;
1625 pep->number = epnum;
1626 pep->direction = direction; /* 0 for OUT, 1 for IN. */
1633 snprintf(pep->name, sizeof(pep->name), "ep%d%s",
1636 pep->idx = 0;
1637 usb_ep_set_maxpacket_limit(&pep->endpoint, 512);
1638 pep->endpoint.maxburst = 1;
1639 pep->endpoint.ops = &cdnsp_gadget_ep0_ops;
1640 pep->endpoint.desc = &cdnsp_gadget_ep0_desc;
1641 pep->endpoint.comp_desc = NULL;
1642 pep->endpoint.caps.type_control = true;
1643 pep->endpoint.caps.dir_in = true;
1644 pep->endpoint.caps.dir_out = true;
1646 pdev->ep0_preq.epnum = pep->number;
1647 pdev->ep0_preq.pep = pep;
1648 pdev->gadget.ep0 = &pep->endpoint;
1650 snprintf(pep->name, sizeof(pep->name), "ep%d%s",
1651 epnum, (pep->direction) ? "in" : "out");
1653 pep->idx = (epnum * 2 + (direction ? 1 : 0)) - 1;
1654 usb_ep_set_maxpacket_limit(&pep->endpoint, 1024);
1656 pep->endpoint.max_streams = max_streams;
1657 pep->endpoint.ops = &cdnsp_gadget_ep_ops;
1658 list_add_tail(&pep->endpoint.ep_list,
1661 pep->endpoint.caps.type_iso = true;
1662 pep->endpoint.caps.type_bulk = true;
1663 pep->endpoint.caps.type_int = true;
1665 pep->endpoint.caps.dir_in = direction;
1666 pep->endpoint.caps.dir_out = !direction;
1669 pep->endpoint.name = pep->name;
1670 pep->in_ctx = cdnsp_get_ep_ctx(&pdev->in_ctx, pep->idx);
1671 pep->out_ctx = cdnsp_get_ep_ctx(&pdev->out_ctx, pep->idx);
1672 cdnsp_get_ep_buffering(pdev, pep);
1677 pep->name, 1024,
1678 (pep->endpoint.caps.type_control) ? "yes" : "no",
1679 (pep->endpoint.caps.type_int) ? "yes" : "no",
1680 (pep->endpoint.caps.type_bulk) ? "yes" : "no",
1681 (pep->endpoint.caps.type_iso) ? "yes" : "no",
1682 (pep->endpoint.caps.dir_in) ? "yes" : "no",
1683 (pep->endpoint.caps.dir_out) ? "yes" : "no");
1685 INIT_LIST_HEAD(&pep->pending_list);
1693 struct cdnsp_ep *pep;
1697 pep = &pdev->eps[i];
1698 if (pep->number != 0 && pep->out_ctx)
1699 list_del(&pep->endpoint.ep_list);