Lines Matching refs:pdev
129 static void cdnsp_next_trb(struct cdnsp_device *pdev, in cdnsp_next_trb() argument
146 void cdnsp_inc_deq(struct cdnsp_device *pdev, struct cdnsp_ring *ring) in cdnsp_inc_deq() argument
187 static void cdnsp_inc_enq(struct cdnsp_device *pdev, in cdnsp_inc_enq() argument
236 static bool cdnsp_room_on_ring(struct cdnsp_device *pdev, in cdnsp_room_on_ring() argument
260 static void cdnsp_force_l0_go(struct cdnsp_device *pdev) in cdnsp_force_l0_go() argument
262 if (pdev->active_port == &pdev->usb2_port && pdev->gadget.lpm_capable) in cdnsp_force_l0_go()
263 cdnsp_set_link_state(pdev, &pdev->active_port->regs->portsc, XDEV_U0); in cdnsp_force_l0_go()
267 void cdnsp_ring_cmd_db(struct cdnsp_device *pdev) in cdnsp_ring_cmd_db() argument
269 writel(DB_VALUE_CMD, &pdev->dba->cmd_db); in cdnsp_ring_cmd_db()
276 static bool cdnsp_ring_ep_doorbell(struct cdnsp_device *pdev, in cdnsp_ring_ep_doorbell() argument
280 __le32 __iomem *reg_addr = &pdev->dba->ep_db; in cdnsp_ring_ep_doorbell()
301 if (pep->idx == 0 && pdev->ep0_stage == CDNSP_DATA_STAGE && in cdnsp_ring_ep_doorbell()
302 !pdev->ep0_expect_in) in cdnsp_ring_ep_doorbell()
311 cdnsp_force_l0_go(pdev); in cdnsp_ring_ep_doorbell()
322 static struct cdnsp_ring *cdnsp_get_transfer_ring(struct cdnsp_device *pdev, in cdnsp_get_transfer_ring() argument
330 dev_err(pdev->dev, "ERR: %s ring doesn't exist for SID: %d.\n", in cdnsp_get_transfer_ring()
339 cdnsp_request_to_transfer_ring(struct cdnsp_device *pdev, in cdnsp_request_to_transfer_ring() argument
342 return cdnsp_get_transfer_ring(pdev, preq->pep, in cdnsp_request_to_transfer_ring()
347 void cdnsp_ring_doorbell_for_active_rings(struct cdnsp_device *pdev, in cdnsp_ring_doorbell_for_active_rings() argument
360 cdnsp_ring_ep_doorbell(pdev, pep, 0); in cdnsp_ring_doorbell_for_active_rings()
373 ep_ring = cdnsp_get_transfer_ring(pdev, pep, stream_id); in cdnsp_ring_doorbell_for_active_rings()
385 ret = cdnsp_ring_ep_doorbell(pdev, pep, stream_id); in cdnsp_ring_doorbell_for_active_rings()
398 static u64 cdnsp_get_hw_deq(struct cdnsp_device *pdev, in cdnsp_get_hw_deq() argument
405 pep = &pdev->eps[stream_id]; in cdnsp_get_hw_deq()
430 static void cdnsp_find_new_dequeue_state(struct cdnsp_device *pdev, in cdnsp_find_new_dequeue_state() argument
443 ep_ring = cdnsp_get_transfer_ring(pdev, pep, stream_id); in cdnsp_find_new_dequeue_state()
451 hw_dequeue = cdnsp_get_hw_deq(pdev, pep->idx, stream_id); in cdnsp_find_new_dequeue_state()
479 cdnsp_next_trb(pdev, ep_ring, &new_seg, &new_deq); in cdnsp_find_new_dequeue_state()
483 dev_err(pdev->dev, in cdnsp_find_new_dequeue_state()
503 static void cdnsp_td_to_noop(struct cdnsp_device *pdev, in cdnsp_td_to_noop() argument
521 cdnsp_next_trb(pdev, ep_ring, &seg, &trb); in cdnsp_td_to_noop()
531 static struct cdnsp_segment *cdnsp_trb_in_td(struct cdnsp_device *pdev, in cdnsp_trb_in_td() argument
597 static void cdnsp_unmap_td_bounce_buffer(struct cdnsp_device *pdev, in cdnsp_unmap_td_bounce_buffer() argument
614 dma_unmap_single(pdev->dev, seg->bounce_dma, in cdnsp_unmap_td_bounce_buffer()
619 dma_unmap_single(pdev->dev, seg->bounce_dma, ring->bounce_buf_len, in cdnsp_unmap_td_bounce_buffer()
627 dev_warn(pdev->dev, "WARN Wrong bounce buffer read length: %zu != %d\n", in cdnsp_unmap_td_bounce_buffer()
634 static int cdnsp_cmd_set_deq(struct cdnsp_device *pdev, in cdnsp_cmd_set_deq() argument
642 cdnsp_ring_doorbell_for_active_rings(pdev, pep); in cdnsp_cmd_set_deq()
646 cdnsp_queue_new_dequeue_state(pdev, pep, deq_state); in cdnsp_cmd_set_deq()
647 cdnsp_ring_cmd_db(pdev); in cdnsp_cmd_set_deq()
648 ret = cdnsp_wait_for_cmd_compl(pdev); in cdnsp_cmd_set_deq()
650 trace_cdnsp_handle_cmd_set_deq(cdnsp_get_slot_ctx(&pdev->out_ctx)); in cdnsp_cmd_set_deq()
657 ep_ring = cdnsp_get_transfer_ring(pdev, pep, deq_state->stream_id); in cdnsp_cmd_set_deq()
685 cdnsp_ring_doorbell_for_active_rings(pdev, pep); in cdnsp_cmd_set_deq()
690 int cdnsp_remove_request(struct cdnsp_device *pdev, in cdnsp_remove_request() argument
708 ep_ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_remove_request()
715 hw_deq = cdnsp_get_hw_deq(pdev, pep->idx, preq->request.stream_id); in cdnsp_remove_request()
718 seg = cdnsp_trb_in_td(pdev, cur_td->start_seg, cur_td->first_trb, in cdnsp_remove_request()
722 cdnsp_find_new_dequeue_state(pdev, pep, preq->request.stream_id, in cdnsp_remove_request()
725 cdnsp_td_to_noop(pdev, ep_ring, cur_td, false); in cdnsp_remove_request()
739 if (pdev->cdnsp_state & CDNSP_STATE_DISCONNECT_PENDING) { in cdnsp_remove_request()
741 ret = cdnsp_cmd_set_deq(pdev, pep, &deq_state); in cdnsp_remove_request()
744 cdnsp_unmap_td_bounce_buffer(pdev, ep_ring, cur_td); in cdnsp_remove_request()
750 static int cdnsp_update_port_id(struct cdnsp_device *pdev, u32 port_id) in cdnsp_update_port_id() argument
752 struct cdnsp_port *port = pdev->active_port; in cdnsp_update_port_id()
761 if (port_id == pdev->usb2_port.port_num) { in cdnsp_update_port_id()
762 port = &pdev->usb2_port; in cdnsp_update_port_id()
763 } else if (port_id == pdev->usb3_port.port_num) { in cdnsp_update_port_id()
764 port = &pdev->usb3_port; in cdnsp_update_port_id()
766 dev_err(pdev->dev, "Port event with invalid port ID %d\n", in cdnsp_update_port_id()
772 cdnsp_disable_slot(pdev); in cdnsp_update_port_id()
773 pdev->active_port = port; in cdnsp_update_port_id()
774 cdnsp_enable_slot(pdev); in cdnsp_update_port_id()
777 if (port_id == pdev->usb2_port.port_num) in cdnsp_update_port_id()
778 cdnsp_set_usb2_hardware_lpm(pdev, NULL, 1); in cdnsp_update_port_id()
781 &pdev->usb3_port.regs->portpmsc); in cdnsp_update_port_id()
786 static void cdnsp_handle_port_status(struct cdnsp_device *pdev, in cdnsp_handle_port_status() argument
797 dev_err(pdev->dev, "ERR: incorrect PSC event\n"); in cdnsp_handle_port_status()
801 if (cdnsp_update_port_id(pdev, port_id)) in cdnsp_handle_port_status()
804 port_regs = pdev->active_port->regs; in cdnsp_handle_port_status()
806 if (port_id == pdev->usb2_port.port_num) in cdnsp_handle_port_status()
814 trace_cdnsp_handle_port_status(pdev->active_port->port_num, portsc); in cdnsp_handle_port_status()
816 pdev->gadget.speed = cdnsp_port_speed(portsc); in cdnsp_handle_port_status()
821 if (!(pdev->cdnsp_state & CDNSP_WAKEUP_PENDING) && in cdnsp_handle_port_status()
823 cmd_regs = readl(&pdev->op_regs->command); in cdnsp_handle_port_status()
828 cdnsp_set_link_state(pdev, &port_regs->portsc, in cdnsp_handle_port_status()
831 cdnsp_resume_gadget(pdev); in cdnsp_handle_port_status()
835 if ((pdev->cdnsp_state & CDNSP_WAKEUP_PENDING) && in cdnsp_handle_port_status()
837 pdev->cdnsp_state &= ~CDNSP_WAKEUP_PENDING; in cdnsp_handle_port_status()
839 cdnsp_force_header_wakeup(pdev, 1); in cdnsp_handle_port_status()
840 cdnsp_ring_cmd_db(pdev); in cdnsp_handle_port_status()
841 cdnsp_wait_for_cmd_compl(pdev); in cdnsp_handle_port_status()
844 if (link_state == XDEV_U0 && pdev->link_state == XDEV_U3 && in cdnsp_handle_port_status()
846 cdnsp_resume_gadget(pdev); in cdnsp_handle_port_status()
848 if (link_state == XDEV_U3 && pdev->link_state != XDEV_U3) in cdnsp_handle_port_status()
849 cdnsp_suspend_gadget(pdev); in cdnsp_handle_port_status()
851 pdev->link_state = link_state; in cdnsp_handle_port_status()
856 if (pdev->gadget.connected && !(portsc & PORT_CONNECT)) in cdnsp_handle_port_status()
857 cdnsp_disconnect_gadget(pdev); in cdnsp_handle_port_status()
862 cdnsp_irq_reset(pdev); in cdnsp_handle_port_status()
864 usb_gadget_set_state(&pdev->gadget, USB_STATE_ATTACHED); in cdnsp_handle_port_status()
870 cdnsp_irq_reset(pdev); in cdnsp_handle_port_status()
871 pdev->u1_allowed = 0; in cdnsp_handle_port_status()
872 pdev->u2_allowed = 0; in cdnsp_handle_port_status()
873 pdev->may_wakeup = 0; in cdnsp_handle_port_status()
877 dev_err(pdev->dev, "Port Over Current detected\n"); in cdnsp_handle_port_status()
880 dev_err(pdev->dev, "Port Configure Error detected\n"); in cdnsp_handle_port_status()
886 cdnsp_inc_deq(pdev, pdev->event_ring); in cdnsp_handle_port_status()
889 static void cdnsp_td_cleanup(struct cdnsp_device *pdev, in cdnsp_td_cleanup() argument
897 cdnsp_unmap_td_bounce_buffer(pdev, ep_ring, td); in cdnsp_td_cleanup()
915 static void cdnsp_finish_td(struct cdnsp_device *pdev, in cdnsp_finish_td() argument
940 cdnsp_inc_deq(pdev, ep_ring); in cdnsp_finish_td()
942 cdnsp_inc_deq(pdev, ep_ring); in cdnsp_finish_td()
944 cdnsp_td_cleanup(pdev, td, ep_ring, status); in cdnsp_finish_td()
948 static int cdnsp_sum_trb_lengths(struct cdnsp_device *pdev, in cdnsp_sum_trb_lengths() argument
956 for (sum = 0; trb != stop_trb; cdnsp_next_trb(pdev, ring, &seg, &trb)) { in cdnsp_sum_trb_lengths()
963 static int cdnsp_giveback_first_trb(struct cdnsp_device *pdev, in cdnsp_giveback_first_trb() argument
986 return cdnsp_ring_ep_doorbell(pdev, pep, stream_id); in cdnsp_giveback_first_trb()
992 static void cdnsp_process_ctrl_td(struct cdnsp_device *pdev, in cdnsp_process_ctrl_td() argument
1021 if (pdev->ep0_stage == CDNSP_DATA_STAGE && pep->number == 0 && in cdnsp_process_ctrl_td()
1022 pdev->three_stage_setup) { in cdnsp_process_ctrl_td()
1025 pdev->ep0_stage = CDNSP_STATUS_STAGE; in cdnsp_process_ctrl_td()
1027 cdnsp_giveback_first_trb(pdev, pep, 0, ep_ring->cycle_state, in cdnsp_process_ctrl_td()
1034 cdnsp_finish_td(pdev, td, event, pep, status); in cdnsp_process_ctrl_td()
1040 static void cdnsp_process_isoc_td(struct cdnsp_device *pdev, in cdnsp_process_isoc_td() argument
1093 td_length = cdnsp_sum_trb_lengths(pdev, ep_ring, ep_trb); in cdnsp_process_isoc_td()
1101 cdnsp_finish_td(pdev, td, event, pep, &status); in cdnsp_process_isoc_td()
1104 static void cdnsp_skip_isoc_td(struct cdnsp_device *pdev, in cdnsp_skip_isoc_td() argument
1118 cdnsp_inc_deq(pdev, ep_ring); in cdnsp_skip_isoc_td()
1120 cdnsp_inc_deq(pdev, ep_ring); in cdnsp_skip_isoc_td()
1122 cdnsp_td_cleanup(pdev, td, ep_ring, &status); in cdnsp_skip_isoc_td()
1128 static void cdnsp_process_bulk_intr_td(struct cdnsp_device *pdev, in cdnsp_process_bulk_intr_td() argument
1163 ep_trb_len = cdnsp_sum_trb_lengths(pdev, ep_ring, ep_trb) + in cdnsp_process_bulk_intr_td()
1170 cdnsp_finish_td(pdev, td, event, ep, status); in cdnsp_process_bulk_intr_td()
1173 static void cdnsp_handle_tx_nrdy(struct cdnsp_device *pdev, in cdnsp_handle_tx_nrdy() argument
1189 pep = &pdev->eps[ep_index]; in cdnsp_handle_tx_nrdy()
1218 cdnsp_ring_doorbell_for_active_rings(pdev, pep); in cdnsp_handle_tx_nrdy()
1225 static int cdnsp_handle_tx_event(struct cdnsp_device *pdev, in cdnsp_handle_tx_event() argument
1246 pep = &pdev->eps[ep_index]; in cdnsp_handle_tx_event()
1254 if (invalidate || !pdev->gadget.connected) in cdnsp_handle_tx_event()
1271 dev_err(pdev->dev, "ERROR: %s event for unknown ring\n", in cdnsp_handle_tx_event()
1332 ep_seg = cdnsp_trb_in_td(pdev, ep_ring->deq_seg, in cdnsp_handle_tx_event()
1367 dev_err(pdev->dev, in cdnsp_handle_tx_event()
1375 cdnsp_skip_isoc_td(pdev, td, event, pep, status); in cdnsp_handle_tx_event()
1386 cdnsp_skip_isoc_td(pdev, td, event, pep, status); in cdnsp_handle_tx_event()
1394 cdnsp_process_ctrl_td(pdev, td, ep_trb, event, pep, in cdnsp_handle_tx_event()
1397 cdnsp_process_isoc_td(pdev, td, ep_trb, event, pep, in cdnsp_handle_tx_event()
1400 cdnsp_process_bulk_intr_td(pdev, td, ep_trb, event, pep, in cdnsp_handle_tx_event()
1410 cdnsp_inc_deq(pdev, pdev->event_ring); in cdnsp_handle_tx_event()
1422 dev_err(pdev->dev, "@%016llx %08x %08x %08x %08x\n", in cdnsp_handle_tx_event()
1424 cdnsp_trb_virt_to_dma(pdev->event_ring->deq_seg, in cdnsp_handle_tx_event()
1425 pdev->event_ring->dequeue), in cdnsp_handle_tx_event()
1438 static bool cdnsp_handle_event(struct cdnsp_device *pdev) in cdnsp_handle_event() argument
1447 event = pdev->event_ring->dequeue; in cdnsp_handle_event()
1452 if (cycle_bit != pdev->event_ring->cycle_state) in cdnsp_handle_event()
1455 trace_cdnsp_handle_event(pdev->event_ring, &event->generic); in cdnsp_handle_event()
1469 cdnsp_inc_deq(pdev, pdev->cmd_ring); in cdnsp_handle_event()
1472 cdnsp_handle_port_status(pdev, event); in cdnsp_handle_event()
1476 ret = cdnsp_handle_tx_event(pdev, &event->trans_event); in cdnsp_handle_event()
1481 pdev->ep0_stage = CDNSP_SETUP_STAGE; in cdnsp_handle_event()
1482 pdev->setup_id = TRB_SETUPID_TO_TYPE(flags); in cdnsp_handle_event()
1483 pdev->setup_speed = TRB_SETUP_SPEEDID(flags); in cdnsp_handle_event()
1484 pdev->setup = *((struct usb_ctrlrequest *) in cdnsp_handle_event()
1487 cdnsp_setup_analyze(pdev); in cdnsp_handle_event()
1490 cdnsp_handle_tx_nrdy(pdev, &event->trans_event); in cdnsp_handle_event()
1497 dev_err(pdev->dev, "Event Ring Full\n"); in cdnsp_handle_event()
1500 dev_err(pdev->dev, "Controller error code 0x%02x\n", in cdnsp_handle_event()
1510 dev_warn(pdev->dev, "ERROR unknown event type %ld\n", in cdnsp_handle_event()
1516 cdnsp_inc_deq(pdev, pdev->event_ring); in cdnsp_handle_event()
1527 struct cdnsp_device *pdev = (struct cdnsp_device *)data; in cdnsp_thread_irq_handler() local
1532 spin_lock_irqsave(&pdev->lock, flags); in cdnsp_thread_irq_handler()
1534 if (pdev->cdnsp_state & (CDNSP_STATE_HALTED | CDNSP_STATE_DYING)) { in cdnsp_thread_irq_handler()
1540 if (pdev->gadget_driver) in cdnsp_thread_irq_handler()
1541 cdnsp_died(pdev); in cdnsp_thread_irq_handler()
1543 spin_unlock_irqrestore(&pdev->lock, flags); in cdnsp_thread_irq_handler()
1547 event_ring_deq = pdev->event_ring->dequeue; in cdnsp_thread_irq_handler()
1549 while (cdnsp_handle_event(pdev)) { in cdnsp_thread_irq_handler()
1551 cdnsp_update_erst_dequeue(pdev, event_ring_deq, 0); in cdnsp_thread_irq_handler()
1552 event_ring_deq = pdev->event_ring->dequeue; in cdnsp_thread_irq_handler()
1557 cdnsp_update_erst_dequeue(pdev, event_ring_deq, 1); in cdnsp_thread_irq_handler()
1559 spin_unlock_irqrestore(&pdev->lock, flags); in cdnsp_thread_irq_handler()
1566 struct cdnsp_device *pdev = (struct cdnsp_device *)priv; in cdnsp_irq_handler() local
1570 status = readl(&pdev->op_regs->status); in cdnsp_irq_handler()
1573 cdnsp_died(pdev); in cdnsp_irq_handler()
1580 writel(status | STS_EINT, &pdev->op_regs->status); in cdnsp_irq_handler()
1581 irq_pending = readl(&pdev->ir_set->irq_pending); in cdnsp_irq_handler()
1583 writel(irq_pending, &pdev->ir_set->irq_pending); in cdnsp_irq_handler()
1586 cdnsp_died(pdev); in cdnsp_irq_handler()
1599 static void cdnsp_queue_trb(struct cdnsp_device *pdev, struct cdnsp_ring *ring, in cdnsp_queue_trb() argument
1613 cdnsp_inc_enq(pdev, ring, more_trbs_coming); in cdnsp_queue_trb()
1620 static int cdnsp_prepare_ring(struct cdnsp_device *pdev, in cdnsp_prepare_ring() argument
1635 dev_err(pdev->dev, "ERROR: incorrect endpoint state\n"); in cdnsp_prepare_ring()
1640 if (cdnsp_room_on_ring(pdev, ep_ring, num_trbs)) in cdnsp_prepare_ring()
1646 if (cdnsp_ring_expansion(pdev, ep_ring, num_trbs_needed, in cdnsp_prepare_ring()
1648 dev_err(pdev->dev, "Ring expansion failed\n"); in cdnsp_prepare_ring()
1668 static int cdnsp_prepare_transfer(struct cdnsp_device *pdev, in cdnsp_prepare_transfer() argument
1675 ep_ring = cdnsp_get_transfer_ring(pdev, preq->pep, in cdnsp_prepare_transfer()
1680 ret = cdnsp_prepare_ring(pdev, ep_ring, in cdnsp_prepare_transfer()
1739 dev_err(preq->pep->pdev->dev, in cdnsp_check_trb_math()
1763 static u32 cdnsp_td_remainder(struct cdnsp_device *pdev, in cdnsp_td_remainder() argument
1789 static int cdnsp_align_td(struct cdnsp_device *pdev, in cdnsp_align_td() argument
1793 struct device *dev = pdev->dev; in cdnsp_align_td()
1837 dev_warn(pdev->dev, in cdnsp_align_td()
1856 int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) in cdnsp_queue_bulk_tx() argument
1873 ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_queue_bulk_tx()
1900 ret = cdnsp_prepare_transfer(pdev, preq, num_trbs); in cdnsp_queue_bulk_tx()
1940 if (cdnsp_align_td(pdev, preq, enqd_len, in cdnsp_queue_bulk_tx()
1968 remainder = cdnsp_td_remainder(pdev, enqd_len, trb_buff_len, in cdnsp_queue_bulk_tx()
1976 cdnsp_queue_trb(pdev, ring, more_trbs_coming, in cdnsp_queue_bulk_tx()
2000 ret = cdnsp_giveback_first_trb(pdev, pep, preq->request.stream_id, in cdnsp_queue_bulk_tx()
2009 int cdnsp_queue_ctrl_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq) in cdnsp_queue_ctrl_tx() argument
2018 ep_ring = cdnsp_request_to_transfer_ring(pdev, preq); in cdnsp_queue_ctrl_tx()
2023 num_trbs = (pdev->three_stage_setup) ? 2 : 1; in cdnsp_queue_ctrl_tx()
2033 ret = cdnsp_prepare_transfer(pdev, preq, num_trbs); in cdnsp_queue_ctrl_tx()
2044 field |= TRB_IOC | (pdev->ep0_expect_in ? 0 : TRB_ISP); in cdnsp_queue_ctrl_tx()
2046 if (pdev->ep0_expect_in) in cdnsp_queue_ctrl_tx()
2052 cdnsp_queue_trb(pdev, ep_ring, true, in cdnsp_queue_ctrl_tx()
2056 TRB_SETUPID(pdev->setup_id) | in cdnsp_queue_ctrl_tx()
2057 pdev->setup_speed); in cdnsp_queue_ctrl_tx()
2062 if (!pdev->ep0_expect_in) in cdnsp_queue_ctrl_tx()
2065 cdnsp_queue_trb(pdev, ep_ring, true, in cdnsp_queue_ctrl_tx()
2069 TRB_SETUPID(pdev->setup_id) | in cdnsp_queue_ctrl_tx()
2070 pdev->setup_speed); in cdnsp_queue_ctrl_tx()
2073 pdev->ep0_stage = CDNSP_DATA_STAGE; in cdnsp_queue_ctrl_tx()
2085 if (preq->request.length > 0 && pdev->ep0_expect_in) in cdnsp_queue_ctrl_tx()
2095 cdnsp_queue_trb(pdev, ep_ring, false, 0, 0, TRB_INTR_TARGET(0), in cdnsp_queue_ctrl_tx()
2096 field | TRB_IOC | TRB_SETUPID(pdev->setup_id) | in cdnsp_queue_ctrl_tx()
2097 TRB_TYPE(TRB_STATUS) | pdev->setup_speed); in cdnsp_queue_ctrl_tx()
2099 cdnsp_ring_ep_doorbell(pdev, pep, preq->request.stream_id); in cdnsp_queue_ctrl_tx()
2104 int cdnsp_cmd_stop_ep(struct cdnsp_device *pdev, struct cdnsp_ep *pep) in cdnsp_cmd_stop_ep() argument
2115 cdnsp_queue_stop_endpoint(pdev, pep->idx); in cdnsp_cmd_stop_ep()
2116 cdnsp_ring_cmd_db(pdev); in cdnsp_cmd_stop_ep()
2117 ret = cdnsp_wait_for_cmd_compl(pdev); in cdnsp_cmd_stop_ep()
2126 int cdnsp_cmd_flush_ep(struct cdnsp_device *pdev, struct cdnsp_ep *pep) in cdnsp_cmd_flush_ep() argument
2130 cdnsp_queue_flush_endpoint(pdev, pep->idx); in cdnsp_cmd_flush_ep()
2131 cdnsp_ring_cmd_db(pdev); in cdnsp_cmd_flush_ep()
2132 ret = cdnsp_wait_for_cmd_compl(pdev); in cdnsp_cmd_flush_ep()
2147 static unsigned int cdnsp_get_burst_count(struct cdnsp_device *pdev, in cdnsp_get_burst_count() argument
2153 if (pdev->gadget.speed < USB_SPEED_SUPER) in cdnsp_get_burst_count()
2169 cdnsp_get_last_burst_packet_count(struct cdnsp_device *pdev, in cdnsp_get_last_burst_packet_count() argument
2176 if (pdev->gadget.speed >= USB_SPEED_SUPER) { in cdnsp_get_last_burst_packet_count()
2197 int cdnsp_queue_isoc_tx(struct cdnsp_device *pdev, in cdnsp_queue_isoc_tx() argument
2231 ret = cdnsp_prepare_transfer(pdev, preq, trbs_per_td); in cdnsp_queue_isoc_tx()
2247 burst_count = cdnsp_get_burst_count(pdev, preq, total_pkt_count); in cdnsp_queue_isoc_tx()
2248 last_burst_pkt = cdnsp_get_last_burst_packet_count(pdev, preq, in cdnsp_queue_isoc_tx()
2273 remainder = cdnsp_td_remainder(pdev, running_total, in cdnsp_queue_isoc_tx()
2302 cdnsp_queue_trb(pdev, ep_ring, more_trbs_coming, in cdnsp_queue_isoc_tx()
2328 dev_err(pdev->dev, "ISOC TD length unmatch\n"); in cdnsp_queue_isoc_tx()
2333 cdnsp_giveback_first_trb(pdev, preq->pep, preq->request.stream_id, in cdnsp_queue_isoc_tx()
2352 cdnsp_td_to_noop(pdev, ep_ring, &preq->td, true); in cdnsp_queue_isoc_tx()
2366 static void cdnsp_queue_command(struct cdnsp_device *pdev, in cdnsp_queue_command() argument
2372 cdnsp_prepare_ring(pdev, pdev->cmd_ring, EP_STATE_RUNNING, 1, in cdnsp_queue_command()
2375 pdev->cmd.command_trb = pdev->cmd_ring->enqueue; in cdnsp_queue_command()
2377 cdnsp_queue_trb(pdev, pdev->cmd_ring, false, field1, field2, in cdnsp_queue_command()
2378 field3, field4 | pdev->cmd_ring->cycle_state); in cdnsp_queue_command()
2382 void cdnsp_queue_slot_control(struct cdnsp_device *pdev, u32 trb_type) in cdnsp_queue_slot_control() argument
2384 cdnsp_queue_command(pdev, 0, 0, 0, TRB_TYPE(trb_type) | in cdnsp_queue_slot_control()
2385 SLOT_ID_FOR_TRB(pdev->slot_id)); in cdnsp_queue_slot_control()
2389 void cdnsp_queue_address_device(struct cdnsp_device *pdev, in cdnsp_queue_address_device() argument
2393 cdnsp_queue_command(pdev, lower_32_bits(in_ctx_ptr), in cdnsp_queue_address_device()
2396 SLOT_ID_FOR_TRB(pdev->slot_id) | in cdnsp_queue_address_device()
2401 void cdnsp_queue_reset_device(struct cdnsp_device *pdev) in cdnsp_queue_reset_device() argument
2403 cdnsp_queue_command(pdev, 0, 0, 0, TRB_TYPE(TRB_RESET_DEV) | in cdnsp_queue_reset_device()
2404 SLOT_ID_FOR_TRB(pdev->slot_id)); in cdnsp_queue_reset_device()
2408 void cdnsp_queue_configure_endpoint(struct cdnsp_device *pdev, in cdnsp_queue_configure_endpoint() argument
2411 cdnsp_queue_command(pdev, lower_32_bits(in_ctx_ptr), in cdnsp_queue_configure_endpoint()
2414 SLOT_ID_FOR_TRB(pdev->slot_id)); in cdnsp_queue_configure_endpoint()
2421 void cdnsp_queue_stop_endpoint(struct cdnsp_device *pdev, unsigned int ep_index) in cdnsp_queue_stop_endpoint() argument
2423 cdnsp_queue_command(pdev, 0, 0, 0, SLOT_ID_FOR_TRB(pdev->slot_id) | in cdnsp_queue_stop_endpoint()
2428 void cdnsp_queue_new_dequeue_state(struct cdnsp_device *pdev, in cdnsp_queue_new_dequeue_state() argument
2433 u32 trb_slot_id = SLOT_ID_FOR_TRB(pdev->slot_id); in cdnsp_queue_new_dequeue_state()
2444 cdnsp_queue_command(pdev, lower_32_bits(addr) | trb_sct | in cdnsp_queue_new_dequeue_state()
2450 void cdnsp_queue_reset_ep(struct cdnsp_device *pdev, unsigned int ep_index) in cdnsp_queue_reset_ep() argument
2452 return cdnsp_queue_command(pdev, 0, 0, 0, in cdnsp_queue_reset_ep()
2453 SLOT_ID_FOR_TRB(pdev->slot_id) | in cdnsp_queue_reset_ep()
2461 void cdnsp_queue_halt_endpoint(struct cdnsp_device *pdev, unsigned int ep_index) in cdnsp_queue_halt_endpoint() argument
2463 cdnsp_queue_command(pdev, 0, 0, 0, TRB_TYPE(TRB_HALT_ENDPOINT) | in cdnsp_queue_halt_endpoint()
2464 SLOT_ID_FOR_TRB(pdev->slot_id) | in cdnsp_queue_halt_endpoint()
2471 void cdnsp_queue_flush_endpoint(struct cdnsp_device *pdev, in cdnsp_queue_flush_endpoint() argument
2474 cdnsp_queue_command(pdev, 0, 0, 0, TRB_TYPE(TRB_FLUSH_ENDPOINT) | in cdnsp_queue_flush_endpoint()
2475 SLOT_ID_FOR_TRB(pdev->slot_id) | in cdnsp_queue_flush_endpoint()
2479 void cdnsp_force_header_wakeup(struct cdnsp_device *pdev, int intf_num) in cdnsp_force_header_wakeup() argument
2484 TRB_FH_TO_DEVICE_ADDRESS(pdev->device_address); in cdnsp_force_header_wakeup()
2489 cdnsp_queue_command(pdev, lo, mid, 0, in cdnsp_force_header_wakeup()