Lines Matching refs:td

715 dwc_otg_host_check_tx_fifo_empty(struct dwc_otg_softc *sc, struct dwc_otg_td *td)  in dwc_otg_host_check_tx_fifo_empty()  argument
721 if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_check_tx_fifo_empty()
750 struct dwc_otg_td *td, uint8_t is_out) in dwc_otg_host_channel_alloc() argument
756 if (td->channel[0] < DWC_OTG_MAX_CHANNELS) in dwc_otg_host_channel_alloc()
760 if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0) in dwc_otg_host_channel_alloc()
765 if (dwc_otg_host_check_tx_fifo_empty(sc, td) != 0) in dwc_otg_host_channel_alloc()
768 z = td->max_packet_count; in dwc_otg_host_channel_alloc()
777 td->channel[y++] = x; in dwc_otg_host_channel_alloc()
784 td->channel[0] = DWC_OTG_MAX_CHANNELS; in dwc_otg_host_channel_alloc()
785 td->channel[1] = DWC_OTG_MAX_CHANNELS; in dwc_otg_host_channel_alloc()
786 td->channel[2] = DWC_OTG_MAX_CHANNELS; in dwc_otg_host_channel_alloc()
793 x = td->channel[y]; in dwc_otg_host_channel_alloc()
805 "HCSPLT=0x%08x\n", x, td->hcchar, td->hcsplt); in dwc_otg_host_channel_alloc()
814 dwc_otg_host_channel_free_sub(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t index) in dwc_otg_host_channel_free_sub() argument
819 if (td->channel[index] >= DWC_OTG_MAX_CHANNELS) in dwc_otg_host_channel_free_sub()
823 x = td->channel[index]; in dwc_otg_host_channel_free_sub()
824 td->channel[index] = DWC_OTG_MAX_CHANNELS; in dwc_otg_host_channel_free_sub()
860 dwc_otg_host_channel_free(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_channel_free() argument
863 for (x = 0; x != td->max_packet_count; x++) in dwc_otg_host_channel_free()
864 dwc_otg_host_channel_free_sub(sc, td, x); in dwc_otg_host_channel_free()
868 dwc_otg_host_dump_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_dump_rx() argument
874 for (x = 0; x != td->max_packet_count; x++) { in dwc_otg_host_dump_rx()
875 if (td->channel[x] >= DWC_OTG_MAX_CHANNELS || in dwc_otg_host_dump_rx()
876 td->channel[x] != GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status)) in dwc_otg_host_dump_rx()
884 dwc_otg_host_setup_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_setup_tx() argument
891 dwc_otg_host_dump_rx(sc, td); in dwc_otg_host_setup_tx()
893 if (td->channel[0] < DWC_OTG_MAX_CHANNELS) { in dwc_otg_host_setup_tx()
894 hcint = sc->sc_chan_state[td->channel[0]].hcint; in dwc_otg_host_setup_tx()
897 td->channel[0], td->state, hcint, in dwc_otg_host_setup_tx()
898 DWC_OTG_READ_4(sc, DOTG_HCCHAR(td->channel[0])), in dwc_otg_host_setup_tx()
899 DWC_OTG_READ_4(sc, DOTG_HCTSIZ(td->channel[0]))); in dwc_otg_host_setup_tx()
909 DPRINTF("CH=%d STALL\n", td->channel[0]); in dwc_otg_host_setup_tx()
910 td->error_stall = 1; in dwc_otg_host_setup_tx()
911 td->error_any = 1; in dwc_otg_host_setup_tx()
914 DPRINTF("CH=%d ERROR\n", td->channel[0]); in dwc_otg_host_setup_tx()
915 td->errcnt++; in dwc_otg_host_setup_tx()
916 if (td->hcsplt != 0 || td->errcnt >= 3) { in dwc_otg_host_setup_tx()
917 td->error_any = 1; in dwc_otg_host_setup_tx()
925 td->errcnt = 0; in dwc_otg_host_setup_tx()
929 switch (td->state) { in dwc_otg_host_setup_tx()
935 td->did_nak = 1; in dwc_otg_host_setup_tx()
936 td->tt_scheduled = 0; in dwc_otg_host_setup_tx()
939 td->offset += td->tx_bytes; in dwc_otg_host_setup_tx()
940 td->remainder -= td->tx_bytes; in dwc_otg_host_setup_tx()
941 td->toggle = 1; in dwc_otg_host_setup_tx()
942 td->tt_scheduled = 0; in dwc_otg_host_setup_tx()
949 td->did_nak = 1; in dwc_otg_host_setup_tx()
950 td->tt_scheduled = 0; in dwc_otg_host_setup_tx()
961 td->did_nak = 1; in dwc_otg_host_setup_tx()
962 td->tt_scheduled = 0; in dwc_otg_host_setup_tx()
965 td->offset += td->tx_bytes; in dwc_otg_host_setup_tx()
966 td->remainder -= td->tx_bytes; in dwc_otg_host_setup_tx()
967 td->toggle = 1; in dwc_otg_host_setup_tx()
982 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_setup_tx()
984 if (sizeof(req) != td->remainder) { in dwc_otg_host_setup_tx()
985 td->error_any = 1; in dwc_otg_host_setup_tx()
989 if (td->hcsplt != 0) { in dwc_otg_host_setup_tx()
990 delta = td->tt_start_slot - sc->sc_last_frame_num - 1; in dwc_otg_host_setup_tx()
991 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { in dwc_otg_host_setup_tx()
992 td->state = DWC_CHAN_ST_START; in dwc_otg_host_setup_tx()
995 delta = sc->sc_last_frame_num - td->tt_start_slot; in dwc_otg_host_setup_tx()
998 td->tt_scheduled = 0; in dwc_otg_host_setup_tx()
999 td->state = DWC_CHAN_ST_START; in dwc_otg_host_setup_tx()
1005 if (dwc_otg_host_channel_alloc(sc, td, 1)) { in dwc_otg_host_setup_tx()
1006 td->state = DWC_CHAN_ST_START; in dwc_otg_host_setup_tx()
1010 if (td->hcsplt != 0) { in dwc_otg_host_setup_tx()
1011 td->hcsplt &= ~HCSPLT_COMPSPLT; in dwc_otg_host_setup_tx()
1012 td->state = DWC_CHAN_ST_WAIT_S_ANE; in dwc_otg_host_setup_tx()
1014 td->state = DWC_CHAN_ST_WAIT_ANE; in dwc_otg_host_setup_tx()
1018 usbd_copy_out(td->pc, 0, &req, sizeof(req)); in dwc_otg_host_setup_tx()
1020 DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel[0]), in dwc_otg_host_setup_tx()
1025 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel[0]), td->hcsplt); in dwc_otg_host_setup_tx()
1027 hcchar = td->hcchar; in dwc_otg_host_setup_tx()
1032 DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel[0]), hcchar); in dwc_otg_host_setup_tx()
1036 DOTG_DFIFO(td->channel[0]), (uint32_t *)&req, sizeof(req) / 4); in dwc_otg_host_setup_tx()
1039 td->tt_complete_slot = sc->sc_last_frame_num + 1; in dwc_otg_host_setup_tx()
1042 td->tx_bytes = sizeof(req); in dwc_otg_host_setup_tx()
1047 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_setup_tx()
1049 delta = td->tt_complete_slot - sc->sc_last_frame_num - 1; in dwc_otg_host_setup_tx()
1050 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { in dwc_otg_host_setup_tx()
1051 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_setup_tx()
1054 delta = sc->sc_last_frame_num - td->tt_start_slot; in dwc_otg_host_setup_tx()
1057 if (td->ep_type != UE_ISOCHRONOUS) in dwc_otg_host_setup_tx()
1058 td->error_any = 1; in dwc_otg_host_setup_tx()
1062 if (dwc_otg_host_channel_alloc(sc, td, 0)) { in dwc_otg_host_setup_tx()
1063 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_setup_tx()
1068 td->tt_complete_slot = sc->sc_last_frame_num + 1; in dwc_otg_host_setup_tx()
1070 td->hcsplt |= HCSPLT_COMPSPLT; in dwc_otg_host_setup_tx()
1071 td->state = DWC_CHAN_ST_WAIT_C_ANE; in dwc_otg_host_setup_tx()
1073 DWC_OTG_WRITE_4(sc, DOTG_HCTSIZ(td->channel[0]), in dwc_otg_host_setup_tx()
1076 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(td->channel[0]), td->hcsplt); in dwc_otg_host_setup_tx()
1078 hcchar = td->hcchar; in dwc_otg_host_setup_tx()
1083 DWC_OTG_WRITE_4(sc, DOTG_HCCHAR(td->channel[0]), hcchar); in dwc_otg_host_setup_tx()
1089 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_setup_tx()
1094 dwc_otg_setup_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_setup_rx() argument
1111 GRXSTSRD_STP_COMPLETE || td->remainder != 0) { in dwc_otg_setup_rx()
1131 td->did_stall = 0; in dwc_otg_setup_rx()
1145 dwc_otg_read_fifo(sc, td->pc, 0, sizeof(req)); in dwc_otg_setup_rx()
1148 usbd_copy_out(td->pc, 0, &req, sizeof(req)); in dwc_otg_setup_rx()
1150 td->offset = sizeof(req); in dwc_otg_setup_rx()
1151 td->remainder = 0; in dwc_otg_setup_rx()
1171 td->did_stall = 1; in dwc_otg_setup_rx()
1175 if (!td->did_stall) { in dwc_otg_setup_rx()
1176 td->did_stall = 1; in dwc_otg_setup_rx()
1196 dwc_otg_host_rate_check_interrupt(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_rate_check_interrupt() argument
1200 delta = sc->sc_tmr_val - td->tmr_val; in dwc_otg_host_rate_check_interrupt()
1204 td->tmr_val = sc->sc_tmr_val + td->tmr_res; in dwc_otg_host_rate_check_interrupt()
1207 if (td->set_toggle) { in dwc_otg_host_rate_check_interrupt()
1208 td->set_toggle = 0; in dwc_otg_host_rate_check_interrupt()
1209 td->toggle = 1; in dwc_otg_host_rate_check_interrupt()
1215 dwc_otg_host_rate_check(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_rate_check() argument
1219 if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_rate_check()
1221 if (frame_num & (td->tmr_res - 1)) in dwc_otg_host_rate_check()
1223 if ((frame_num ^ td->tmr_val) & td->tmr_res) in dwc_otg_host_rate_check()
1225 td->tmr_val = td->tmr_res + sc->sc_last_frame_num; in dwc_otg_host_rate_check()
1226 td->toggle = 0; in dwc_otg_host_rate_check()
1228 } else if (td->ep_type == UE_INTERRUPT) { in dwc_otg_host_rate_check()
1229 if (!td->tt_scheduled) in dwc_otg_host_rate_check()
1231 td->tt_scheduled = 0; in dwc_otg_host_rate_check()
1233 } else if (td->did_nak != 0) { in dwc_otg_host_rate_check()
1235 if (td->tmr_res == frame_num) { in dwc_otg_host_rate_check()
1240 } else if (td->set_toggle) { in dwc_otg_host_rate_check()
1241 td->set_toggle = 0; in dwc_otg_host_rate_check()
1242 td->toggle = 1; in dwc_otg_host_rate_check()
1245 td->tmr_res = frame_num; in dwc_otg_host_rate_check()
1246 td->did_nak = 0; in dwc_otg_host_rate_check()
1253 dwc_otg_host_data_rx_sub(struct dwc_otg_softc *sc, struct dwc_otg_td *td, in dwc_otg_host_data_rx_sub() argument
1272 (int)td->state, (int)sc->sc_last_rx_status); in dwc_otg_host_data_rx_sub()
1287 if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_data_rx_sub()
1291 td->tt_xactpos = HCSPLT_XACTPOS_MIDDLE; in dwc_otg_host_data_rx_sub()
1294 td->tt_xactpos = HCSPLT_XACTPOS_BEGIN; in dwc_otg_host_data_rx_sub()
1296 if (count != td->remainder) { in dwc_otg_host_data_rx_sub()
1298 td->short_pkt = 1; in dwc_otg_host_data_rx_sub()
1299 td->got_short = 1; in dwc_otg_host_data_rx_sub()
1304 if (count != td->max_packet_size) { in dwc_otg_host_data_rx_sub()
1305 if (count < td->max_packet_size) { in dwc_otg_host_data_rx_sub()
1307 td->short_pkt = 1; in dwc_otg_host_data_rx_sub()
1308 td->got_short = 1; in dwc_otg_host_data_rx_sub()
1311 td->error_any = 1; in dwc_otg_host_data_rx_sub()
1318 td->toggle ^= 1; in dwc_otg_host_data_rx_sub()
1319 td->tt_scheduled = 0; in dwc_otg_host_data_rx_sub()
1323 if (count > td->remainder) { in dwc_otg_host_data_rx_sub()
1325 td->error_any = 1; in dwc_otg_host_data_rx_sub()
1333 dwc_otg_read_fifo(sc, td->pc, td->offset, count); in dwc_otg_host_data_rx_sub()
1335 td->remainder -= count; in dwc_otg_host_data_rx_sub()
1336 td->offset += count; in dwc_otg_host_data_rx_sub()
1351 dwc_otg_host_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_data_rx() argument
1359 for (x = 0; x != td->max_packet_count; x++) { in dwc_otg_host_data_rx()
1360 channel = td->channel[x]; in dwc_otg_host_data_rx()
1366 channel, td->state, hcint, in dwc_otg_host_data_rx()
1376 td->error_stall = 1; in dwc_otg_host_data_rx()
1377 td->error_any = 1; in dwc_otg_host_data_rx()
1381 td->errcnt++; in dwc_otg_host_data_rx()
1382 if (td->hcsplt != 0 || td->errcnt >= 3) { in dwc_otg_host_data_rx()
1383 if (td->ep_type != UE_ISOCHRONOUS) { in dwc_otg_host_data_rx()
1384 td->error_any = 1; in dwc_otg_host_data_rx()
1391 if (dwc_otg_host_data_rx_sub(sc, td, channel)) in dwc_otg_host_data_rx()
1400 td->errcnt = 0; in dwc_otg_host_data_rx()
1404 switch (td->state) { in dwc_otg_host_data_rx()
1406 if (td->hcsplt != 0) in dwc_otg_host_data_rx()
1413 if (td->ep_type == UE_INTERRUPT) { in dwc_otg_host_data_rx()
1425 td->toggle ^= 1; in dwc_otg_host_data_rx()
1428 } else if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_data_rx()
1429 if (td->hcsplt != 0) { in dwc_otg_host_data_rx()
1444 td->did_nak = 1; in dwc_otg_host_data_rx()
1445 td->tt_scheduled = 0; in dwc_otg_host_data_rx()
1446 if (td->hcsplt != 0) in dwc_otg_host_data_rx()
1451 if (td->hcsplt != 0) { in dwc_otg_host_data_rx()
1456 td->error_any = 1; in dwc_otg_host_data_rx()
1464 if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_data_rx()
1466 if (td->tt_xactpos == HCSPLT_XACTPOS_BEGIN) { in dwc_otg_host_data_rx()
1468 } else if (td->hcsplt != 0) { in dwc_otg_host_data_rx()
1476 if ((td->remainder == 0) || (td->got_short != 0)) { in dwc_otg_host_data_rx()
1477 if (td->short_pkt) in dwc_otg_host_data_rx()
1485 td->tt_scheduled = 0; in dwc_otg_host_data_rx()
1486 td->did_nak = 0; in dwc_otg_host_data_rx()
1487 if (td->hcsplt != 0) in dwc_otg_host_data_rx()
1501 td->did_nak = 1; in dwc_otg_host_data_rx()
1502 td->tt_scheduled = 0; in dwc_otg_host_data_rx()
1505 td->tt_scheduled = 0; in dwc_otg_host_data_rx()
1508 td->did_nak = 0; in dwc_otg_host_data_rx()
1523 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_data_rx()
1525 if (td->hcsplt != 0) { in dwc_otg_host_data_rx()
1526 delta = td->tt_complete_slot - sc->sc_last_frame_num - 1; in dwc_otg_host_data_rx()
1527 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { in dwc_otg_host_data_rx()
1528 if (td->ep_type != UE_ISOCHRONOUS) { in dwc_otg_host_data_rx()
1529 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_data_rx()
1533 delta = sc->sc_last_frame_num - td->tt_start_slot; in dwc_otg_host_data_rx()
1535 if (td->ep_type != UE_ISOCHRONOUS) { in dwc_otg_host_data_rx()
1537 td->error_any = 1; in dwc_otg_host_data_rx()
1542 td->hcsplt |= HCSPLT_COMPSPLT; in dwc_otg_host_data_rx()
1543 } else if (dwc_otg_host_rate_check(sc, td)) { in dwc_otg_host_data_rx()
1544 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_data_rx()
1549 if (dwc_otg_host_channel_alloc(sc, td, 0)) { in dwc_otg_host_data_rx()
1550 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_data_rx()
1555 if (td->set_toggle) { in dwc_otg_host_data_rx()
1556 td->set_toggle = 0; in dwc_otg_host_data_rx()
1557 td->toggle = 1; in dwc_otg_host_data_rx()
1560 td->state = DWC_CHAN_ST_WAIT_ANE; in dwc_otg_host_data_rx()
1562 for (x = 0; x != td->max_packet_count; x++) { in dwc_otg_host_data_rx()
1563 channel = td->channel[x]; in dwc_otg_host_data_rx()
1567 (td->max_packet_size << HCTSIZ_XFERSIZE_SHIFT) | in dwc_otg_host_data_rx()
1569 (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) : in dwc_otg_host_data_rx()
1572 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt); in dwc_otg_host_data_rx()
1574 hcchar = td->hcchar; in dwc_otg_host_data_rx()
1577 if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_data_rx()
1578 if (td->hcsplt != 0) { in dwc_otg_host_data_rx()
1599 td->tt_complete_slot = sc->sc_last_frame_num + 1; in dwc_otg_host_data_rx()
1605 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_data_rx()
1607 delta = td->tt_start_slot - sc->sc_last_frame_num - 1; in dwc_otg_host_data_rx()
1608 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { in dwc_otg_host_data_rx()
1609 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_rx()
1612 delta = sc->sc_last_frame_num - td->tt_start_slot; in dwc_otg_host_data_rx()
1615 td->tt_scheduled = 0; in dwc_otg_host_data_rx()
1616 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_rx()
1621 if (dwc_otg_host_channel_alloc(sc, td, 0)) { in dwc_otg_host_data_rx()
1622 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_rx()
1626 channel = td->channel[0]; in dwc_otg_host_data_rx()
1628 td->hcsplt &= ~HCSPLT_COMPSPLT; in dwc_otg_host_data_rx()
1629 td->state = DWC_CHAN_ST_WAIT_S_ANE; in dwc_otg_host_data_rx()
1635 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt); in dwc_otg_host_data_rx()
1639 td->ep_type == UE_ISOCHRONOUS) in dwc_otg_host_data_rx()
1640 td->hcchar |= HCCHAR_ODDFRM; in dwc_otg_host_data_rx()
1642 td->hcchar &= ~HCCHAR_ODDFRM; in dwc_otg_host_data_rx()
1644 hcchar = td->hcchar; in dwc_otg_host_data_rx()
1648 td->tt_complete_slot = sc->sc_last_frame_num + 1; in dwc_otg_host_data_rx()
1656 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_data_rx()
1661 dwc_otg_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_data_rx() argument
1673 if (GRXSTSRD_CHNUM_GET(sc->sc_last_rx_status) != td->ep_no) in dwc_otg_data_rx()
1681 if (td->remainder == 0) { in dwc_otg_data_rx()
1692 td->error_any = 1; in dwc_otg_data_rx()
1707 if (count != td->max_packet_size) { in dwc_otg_data_rx()
1708 if (count < td->max_packet_size) { in dwc_otg_data_rx()
1710 td->short_pkt = 1; in dwc_otg_data_rx()
1714 td->error_any = 1; in dwc_otg_data_rx()
1722 if (count > td->remainder) { in dwc_otg_data_rx()
1724 td->error_any = 1; in dwc_otg_data_rx()
1732 dwc_otg_read_fifo(sc, td->pc, td->offset, count); in dwc_otg_data_rx()
1734 td->remainder -= count; in dwc_otg_data_rx()
1735 td->offset += count; in dwc_otg_data_rx()
1740 temp = sc->sc_out_ctl[td->ep_no]; in dwc_otg_data_rx()
1753 sc->sc_out_ctl[td->ep_no] = temp; in dwc_otg_data_rx()
1757 if ((td->remainder == 0) || got_short) { in dwc_otg_data_rx()
1758 if (td->short_pkt) { in dwc_otg_data_rx()
1768 if (td->ep_no == 0) { in dwc_otg_data_rx()
1772 DXEPTSIZ_SET_NBYTES(td->max_packet_size)); in dwc_otg_data_rx()
1775 DWC_OTG_WRITE_4(sc, DOTG_DOEPTSIZ(td->ep_no), in dwc_otg_data_rx()
1779 ((td->max_packet_size + 3) & ~3))); in dwc_otg_data_rx()
1781 temp = sc->sc_out_ctl[td->ep_no]; in dwc_otg_data_rx()
1782 DWC_OTG_WRITE_4(sc, DOTG_DOEPCTL(td->ep_no), temp | in dwc_otg_data_rx()
1789 dwc_otg_host_data_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_host_data_tx() argument
1798 dwc_otg_host_dump_rx(sc, td); in dwc_otg_host_data_tx()
1801 channel = td->channel[td->npkt]; in dwc_otg_host_data_tx()
1807 channel, td->state, hcint, in dwc_otg_host_data_tx()
1816 td->error_stall = 1; in dwc_otg_host_data_tx()
1817 td->error_any = 1; in dwc_otg_host_data_tx()
1821 td->errcnt++; in dwc_otg_host_data_tx()
1822 if (td->hcsplt != 0 || td->errcnt >= 3) { in dwc_otg_host_data_tx()
1823 td->error_any = 1; in dwc_otg_host_data_tx()
1831 td->errcnt = 0; in dwc_otg_host_data_tx()
1837 switch (td->state) { in dwc_otg_host_data_tx()
1843 td->did_nak = 1; in dwc_otg_host_data_tx()
1844 td->tt_scheduled = 0; in dwc_otg_host_data_tx()
1847 td->offset += td->tx_bytes; in dwc_otg_host_data_tx()
1848 td->remainder -= td->tx_bytes; in dwc_otg_host_data_tx()
1849 td->toggle ^= 1; in dwc_otg_host_data_tx()
1852 td->did_nak = 1; in dwc_otg_host_data_tx()
1854 td->did_nak = 0; in dwc_otg_host_data_tx()
1855 td->tt_scheduled = 0; in dwc_otg_host_data_tx()
1858 if (td->remainder == 0) { in dwc_otg_host_data_tx()
1859 if (td->short_pkt) in dwc_otg_host_data_tx()
1873 td->did_nak = 1; in dwc_otg_host_data_tx()
1874 td->tt_scheduled = 0; in dwc_otg_host_data_tx()
1877 td->did_nak = 0; in dwc_otg_host_data_tx()
1886 td->did_nak = 1; in dwc_otg_host_data_tx()
1887 td->tt_scheduled = 0; in dwc_otg_host_data_tx()
1890 td->offset += td->tx_bytes; in dwc_otg_host_data_tx()
1891 td->remainder -= td->tx_bytes; in dwc_otg_host_data_tx()
1892 td->toggle ^= 1; in dwc_otg_host_data_tx()
1893 td->did_nak = 0; in dwc_otg_host_data_tx()
1894 td->tt_scheduled = 0; in dwc_otg_host_data_tx()
1897 if (td->remainder == 0) { in dwc_otg_host_data_tx()
1898 if (td->short_pkt) in dwc_otg_host_data_tx()
1915 td->offset += td->tx_bytes; in dwc_otg_host_data_tx()
1916 td->remainder -= td->tx_bytes; in dwc_otg_host_data_tx()
1925 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_data_tx()
1927 if (td->hcsplt != 0) { in dwc_otg_host_data_tx()
1928 delta = td->tt_start_slot - sc->sc_last_frame_num - 1; in dwc_otg_host_data_tx()
1929 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { in dwc_otg_host_data_tx()
1930 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_tx()
1933 delta = sc->sc_last_frame_num - td->tt_start_slot; in dwc_otg_host_data_tx()
1936 td->tt_scheduled = 0; in dwc_otg_host_data_tx()
1937 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_tx()
1940 } else if (dwc_otg_host_rate_check(sc, td)) { in dwc_otg_host_data_tx()
1941 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_tx()
1946 if (dwc_otg_host_channel_alloc(sc, td, 1)) { in dwc_otg_host_data_tx()
1947 td->state = DWC_CHAN_ST_START; in dwc_otg_host_data_tx()
1952 if (td->set_toggle) { in dwc_otg_host_data_tx()
1953 td->set_toggle = 0; in dwc_otg_host_data_tx()
1954 td->toggle = 1; in dwc_otg_host_data_tx()
1957 if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_host_data_tx()
1959 td->state = DWC_CHAN_ST_TX_WAIT_ISOC; in dwc_otg_host_data_tx()
1960 td->hcsplt &= ~HCSPLT_COMPSPLT; in dwc_otg_host_data_tx()
1961 if (td->hcsplt != 0) { in dwc_otg_host_data_tx()
1963 count = td->remainder; in dwc_otg_host_data_tx()
1966 td->error_any = 1; in dwc_otg_host_data_tx()
1970 td->hcsplt &= ~HCSPLT_XACTPOS_MASK; in dwc_otg_host_data_tx()
1971 td->hcsplt |= (HCSPLT_XACTPOS_ALL << HCSPLT_XACTPOS_SHIFT); in dwc_otg_host_data_tx()
1973 } else if (td->hcsplt != 0) { in dwc_otg_host_data_tx()
1974 td->hcsplt &= ~HCSPLT_COMPSPLT; in dwc_otg_host_data_tx()
1976 td->state = DWC_CHAN_ST_WAIT_S_ANE; in dwc_otg_host_data_tx()
1979 td->state = DWC_CHAN_ST_WAIT_ANE; in dwc_otg_host_data_tx()
1982 td->tx_bytes = 0; in dwc_otg_host_data_tx()
1984 for (x = 0; x != td->max_packet_count; x++) { in dwc_otg_host_data_tx()
1987 channel = td->channel[x]; in dwc_otg_host_data_tx()
1990 count = td->max_packet_size; in dwc_otg_host_data_tx()
1991 rem_bytes = td->remainder - td->tx_bytes; in dwc_otg_host_data_tx()
1994 td->short_pkt = 1; in dwc_otg_host_data_tx()
2004 (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) : in dwc_otg_host_data_tx()
2020 } else if (td->ep_type == UE_ISOCHRONOUS && in dwc_otg_host_data_tx()
2021 td->max_packet_count > 1) { in dwc_otg_host_data_tx()
2033 (td->toggle ? (HCTSIZ_PID_DATA1 << HCTSIZ_PID_SHIFT) : in dwc_otg_host_data_tx()
2037 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt); in dwc_otg_host_data_tx()
2039 hcchar = td->hcchar; in dwc_otg_host_data_tx()
2044 td->ep_type == UE_ISOCHRONOUS) in dwc_otg_host_data_tx()
2054 dwc_otg_write_fifo(sc, td->pc, td->offset + in dwc_otg_host_data_tx()
2055 td->tx_bytes, DOTG_DFIFO(channel), count); in dwc_otg_host_data_tx()
2059 td->tx_bytes += count; in dwc_otg_host_data_tx()
2062 td->npkt = x; in dwc_otg_host_data_tx()
2072 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_data_tx()
2074 delta = td->tt_complete_slot - sc->sc_last_frame_num - 1; in dwc_otg_host_data_tx()
2075 if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) { in dwc_otg_host_data_tx()
2076 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_data_tx()
2079 delta = sc->sc_last_frame_num - td->tt_start_slot; in dwc_otg_host_data_tx()
2082 if (td->ep_type != UE_ISOCHRONOUS) in dwc_otg_host_data_tx()
2083 td->error_any = 1; in dwc_otg_host_data_tx()
2088 if (dwc_otg_host_channel_alloc(sc, td, 0)) { in dwc_otg_host_data_tx()
2089 td->state = DWC_CHAN_ST_WAIT_C_PKT; in dwc_otg_host_data_tx()
2093 channel = td->channel[0]; in dwc_otg_host_data_tx()
2095 td->hcsplt |= HCSPLT_COMPSPLT; in dwc_otg_host_data_tx()
2096 td->state = DWC_CHAN_ST_WAIT_C_ANE; in dwc_otg_host_data_tx()
2101 DWC_OTG_WRITE_4(sc, DOTG_HCSPLT(channel), td->hcsplt); in dwc_otg_host_data_tx()
2103 hcchar = td->hcchar; in dwc_otg_host_data_tx()
2108 td->ep_type == UE_ISOCHRONOUS) in dwc_otg_host_data_tx()
2117 td->tt_complete_slot = sc->sc_last_frame_num + 1; in dwc_otg_host_data_tx()
2122 dwc_otg_host_channel_free(sc, td); in dwc_otg_host_data_tx()
2127 dwc_otg_data_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_data_tx() argument
2138 max_buffer = sc->sc_hw_ep_profile[td->ep_no].max_buffer; in dwc_otg_data_tx()
2145 if ((td->ep_no == 0) && (temp != 0) && in dwc_otg_data_tx()
2158 td->error_any = 1; in dwc_otg_data_tx()
2164 if (td->tx_bytes != 0) { in dwc_otg_data_tx()
2168 temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no)); in dwc_otg_data_tx()
2173 if (cpkt >= td->npkt) { in dwc_otg_data_tx()
2177 fifo_left = (td->npkt - cpkt) * in dwc_otg_data_tx()
2178 td->max_packet_size; in dwc_otg_data_tx()
2183 fifo_left = td->max_packet_size; in dwc_otg_data_tx()
2187 count = td->tx_bytes; in dwc_otg_data_tx()
2193 dwc_otg_write_fifo(sc, td->pc, td->offset, in dwc_otg_data_tx()
2194 DOTG_DFIFO(td->ep_no), count); in dwc_otg_data_tx()
2196 td->tx_bytes -= count; in dwc_otg_data_tx()
2197 td->remainder -= count; in dwc_otg_data_tx()
2198 td->offset += count; in dwc_otg_data_tx()
2199 td->npkt = cpkt; in dwc_otg_data_tx()
2201 if (td->tx_bytes != 0) in dwc_otg_data_tx()
2205 if (td->remainder == 0) { in dwc_otg_data_tx()
2206 if (td->short_pkt) in dwc_otg_data_tx()
2217 temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no)); in dwc_otg_data_tx()
2221 "DIEPCTL=0x%08x\n", td->ep_no, in dwc_otg_data_tx()
2223 temp, DWC_OTG_READ_4(sc, DOTG_DIEPCTL(td->ep_no))); in dwc_otg_data_tx()
2228 DPRINTFN(5, "rem=%u ep=%d\n", td->remainder, td->ep_no); in dwc_otg_data_tx()
2231 if ((max_buffer != 0) && ((td->max_packet_size & 3) == 0)) { in dwc_otg_data_tx()
2233 mpkt = max_buffer / td->max_packet_size; in dwc_otg_data_tx()
2238 count = td->remainder; in dwc_otg_data_tx()
2240 count = 0x7FFFFF - (0x7FFFFF % td->max_packet_size); in dwc_otg_data_tx()
2242 td->npkt = count / td->max_packet_size; in dwc_otg_data_tx()
2252 if (td->npkt > mpkt) { in dwc_otg_data_tx()
2253 td->npkt = mpkt; in dwc_otg_data_tx()
2254 count = td->max_packet_size * mpkt; in dwc_otg_data_tx()
2255 } else if ((count == 0) || (count % td->max_packet_size)) { in dwc_otg_data_tx()
2257 td->npkt++; in dwc_otg_data_tx()
2258 td->short_pkt = 1; in dwc_otg_data_tx()
2263 count = td->max_packet_size; in dwc_otg_data_tx()
2264 if (td->remainder < count) { in dwc_otg_data_tx()
2266 td->short_pkt = 1; in dwc_otg_data_tx()
2267 count = td->remainder; in dwc_otg_data_tx()
2269 td->npkt = 1; in dwc_otg_data_tx()
2271 DWC_OTG_WRITE_4(sc, DOTG_DIEPTSIZ(td->ep_no), in dwc_otg_data_tx()
2273 DXEPTSIZ_SET_NPKT(td->npkt) | in dwc_otg_data_tx()
2277 td->npkt += mpkt; in dwc_otg_data_tx()
2279 temp = sc->sc_in_ctl[td->ep_no]; in dwc_otg_data_tx()
2292 sc->sc_in_ctl[td->ep_no] = temp; in dwc_otg_data_tx()
2296 DWC_OTG_WRITE_4(sc, DOTG_DIEPCTL(td->ep_no), temp | in dwc_otg_data_tx()
2299 td->tx_bytes = count; in dwc_otg_data_tx()
2302 if (td->tx_bytes == 0 && in dwc_otg_data_tx()
2303 td->remainder == 0) { in dwc_otg_data_tx()
2304 if (td->short_pkt) in dwc_otg_data_tx()
2316 dwc_otg_data_tx_sync(struct dwc_otg_softc *sc, struct dwc_otg_td *td) in dwc_otg_data_tx_sync() argument
2323 temp = DWC_OTG_READ_4(sc, DOTG_DIEPTSIZ(td->ep_no)); in dwc_otg_data_tx_sync()
2327 DPRINTFN(5, "busy ep=%d\n", td->ep_no); in dwc_otg_data_tx_sync()
2338 if ((td->ep_no == 0) && (temp != 0) && in dwc_otg_data_tx_sync()
2360 struct dwc_otg_td *td; in dwc_otg_xfer_do_fifo() local
2367 td = xfer->td_transfer_cache; in dwc_otg_xfer_do_fifo()
2368 if (td == NULL) in dwc_otg_xfer_do_fifo()
2372 if ((td->func) (sc, td)) { in dwc_otg_xfer_do_fifo()
2376 if (((void *)td) == xfer->td_transfer_last) { in dwc_otg_xfer_do_fifo()
2379 if (td->error_any) { in dwc_otg_xfer_do_fifo()
2381 } else if (td->remainder > 0) { in dwc_otg_xfer_do_fifo()
2386 if (!td->alt_next) in dwc_otg_xfer_do_fifo()
2394 tmr_res = td->tmr_res; in dwc_otg_xfer_do_fifo()
2395 tmr_val = td->tmr_val; in dwc_otg_xfer_do_fifo()
2396 toggle = td->toggle; in dwc_otg_xfer_do_fifo()
2397 td = td->obj_next; in dwc_otg_xfer_do_fifo()
2398 xfer->td_transfer_cache = td; in dwc_otg_xfer_do_fifo()
2399 td->toggle = toggle; /* transfer toggle */ in dwc_otg_xfer_do_fifo()
2400 td->tmr_res = tmr_res; in dwc_otg_xfer_do_fifo()
2401 td->tmr_val = tmr_val; in dwc_otg_xfer_do_fifo()
2413 struct dwc_otg_td *td; in dwc_otg_xfer_do_complete_locked() local
2417 td = xfer->td_transfer_cache; in dwc_otg_xfer_do_complete_locked()
2418 if (td == NULL) { in dwc_otg_xfer_do_complete_locked()
2493 struct dwc_otg_td *td; in dwc_otg_update_host_transfer_schedule_locked() local
2511 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2512 if (td == NULL || td->ep_type != UE_ISOCHRONOUS) in dwc_otg_update_host_transfer_schedule_locked()
2516 if ((td->hcchar & HCCHAR_EPDIR_IN) != 0) in dwc_otg_update_host_transfer_schedule_locked()
2521 if (td->hcsplt == 0 || td->tt_scheduled != 0) in dwc_otg_update_host_transfer_schedule_locked()
2526 sc->sc_tt_info + td->tt_index); in dwc_otg_update_host_transfer_schedule_locked()
2535 td->tt_start_slot = temp + slot; in dwc_otg_update_host_transfer_schedule_locked()
2536 td->tt_scheduled = 1; in dwc_otg_update_host_transfer_schedule_locked()
2542 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2543 if (td == NULL || td->ep_type != UE_ISOCHRONOUS) in dwc_otg_update_host_transfer_schedule_locked()
2547 if ((td->hcchar & HCCHAR_EPDIR_IN) == 0) in dwc_otg_update_host_transfer_schedule_locked()
2552 if (td->hcsplt == 0 || td->tt_scheduled != 0) in dwc_otg_update_host_transfer_schedule_locked()
2556 td->tt_start_slot = temp; in dwc_otg_update_host_transfer_schedule_locked()
2557 td->tt_scheduled = 1; in dwc_otg_update_host_transfer_schedule_locked()
2563 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2564 if (td == NULL || td->ep_type != UE_INTERRUPT) in dwc_otg_update_host_transfer_schedule_locked()
2567 if (td->tt_scheduled != 0) { in dwc_otg_update_host_transfer_schedule_locked()
2572 if (dwc_otg_host_rate_check_interrupt(sc, td)) in dwc_otg_update_host_transfer_schedule_locked()
2575 if (td->hcsplt == 0) { in dwc_otg_update_host_transfer_schedule_locked()
2577 td->tt_scheduled = 1; in dwc_otg_update_host_transfer_schedule_locked()
2582 td->tt_start_slot = temp; in dwc_otg_update_host_transfer_schedule_locked()
2584 td->tt_scheduled = 1; in dwc_otg_update_host_transfer_schedule_locked()
2590 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2591 if (td == NULL || in dwc_otg_update_host_transfer_schedule_locked()
2592 td->ep_type != UE_CONTROL) { in dwc_otg_update_host_transfer_schedule_locked()
2598 if (td->hcsplt == 0 || td->tt_scheduled != 0) in dwc_otg_update_host_transfer_schedule_locked()
2602 td->tt_start_slot = temp; in dwc_otg_update_host_transfer_schedule_locked()
2603 td->tt_scheduled = 1; in dwc_otg_update_host_transfer_schedule_locked()
2610 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2611 if (td == NULL || in dwc_otg_update_host_transfer_schedule_locked()
2612 td->ep_type != UE_BULK) { in dwc_otg_update_host_transfer_schedule_locked()
2618 if (td->hcsplt == 0 || td->tt_scheduled != 0) in dwc_otg_update_host_transfer_schedule_locked()
2622 td->tt_start_slot = temp; in dwc_otg_update_host_transfer_schedule_locked()
2623 td->tt_scheduled = 1; in dwc_otg_update_host_transfer_schedule_locked()
2634 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2635 if (td == NULL || td->hcsplt == 0) in dwc_otg_update_host_transfer_schedule_locked()
2645 td = xfer->td_transfer_cache; in dwc_otg_update_host_transfer_schedule_locked()
2646 if (td == NULL || td->hcsplt != 0 || td->ep_type == UE_ISOCHRONOUS) in dwc_otg_update_host_transfer_schedule_locked()
3088 struct dwc_otg_td *td; in dwc_otg_setup_standard_chain_sub() local
3091 td = temp->td_next; in dwc_otg_setup_standard_chain_sub()
3092 temp->td = td; in dwc_otg_setup_standard_chain_sub()
3095 temp->td_next = td->obj_next; in dwc_otg_setup_standard_chain_sub()
3098 td->func = temp->func; in dwc_otg_setup_standard_chain_sub()
3099 td->pc = temp->pc; in dwc_otg_setup_standard_chain_sub()
3100 td->offset = temp->offset; in dwc_otg_setup_standard_chain_sub()
3101 td->remainder = temp->len; in dwc_otg_setup_standard_chain_sub()
3102 td->tx_bytes = 0; in dwc_otg_setup_standard_chain_sub()
3103 td->error_any = 0; in dwc_otg_setup_standard_chain_sub()
3104 td->error_stall = 0; in dwc_otg_setup_standard_chain_sub()
3105 td->npkt = 0; in dwc_otg_setup_standard_chain_sub()
3106 td->did_stall = temp->did_stall; in dwc_otg_setup_standard_chain_sub()
3107 td->short_pkt = temp->short_pkt; in dwc_otg_setup_standard_chain_sub()
3108 td->alt_next = temp->setup_alt_next; in dwc_otg_setup_standard_chain_sub()
3109 td->set_toggle = 0; in dwc_otg_setup_standard_chain_sub()
3110 td->got_short = 0; in dwc_otg_setup_standard_chain_sub()
3111 td->did_nak = 0; in dwc_otg_setup_standard_chain_sub()
3112 td->channel[0] = DWC_OTG_MAX_CHANNELS; in dwc_otg_setup_standard_chain_sub()
3113 td->channel[1] = DWC_OTG_MAX_CHANNELS; in dwc_otg_setup_standard_chain_sub()
3114 td->channel[2] = DWC_OTG_MAX_CHANNELS; in dwc_otg_setup_standard_chain_sub()
3115 td->state = 0; in dwc_otg_setup_standard_chain_sub()
3116 td->errcnt = 0; in dwc_otg_setup_standard_chain_sub()
3117 td->tt_scheduled = 0; in dwc_otg_setup_standard_chain_sub()
3118 td->tt_xactpos = HCSPLT_XACTPOS_BEGIN; in dwc_otg_setup_standard_chain_sub()
3125 struct dwc_otg_td *td; in dwc_otg_setup_standard_chain() local
3136 td = xfer->td_start[0]; in dwc_otg_setup_standard_chain()
3137 xfer->td_transfer_first = td; in dwc_otg_setup_standard_chain()
3138 xfer->td_transfer_cache = td; in dwc_otg_setup_standard_chain()
3143 temp.td = NULL; in dwc_otg_setup_standard_chain()
3281 td = temp.td; in dwc_otg_setup_standard_chain()
3282 td->set_toggle = 1; in dwc_otg_setup_standard_chain()
3305 td = temp.td; in dwc_otg_setup_standard_chain()
3306 xfer->td_transfer_last = td; in dwc_otg_setup_standard_chain()
3316 td = xfer->td_transfer_first; in dwc_otg_setup_standard_chain()
3317 td->toggle = (xfer->endpoint->toggle_next ? 1 : 0); in dwc_otg_setup_standard_chain()
3338 if (td->ep_type == UE_INTERRUPT) in dwc_otg_setup_standard_chain()
3341 hcchar |= (td->ep_type << HCCHAR_EPTYPE_SHIFT); in dwc_otg_setup_standard_chain()
3361 if (td->ep_type == UE_INTERRUPT) { in dwc_otg_setup_standard_chain()
3368 td->tmr_val = sc->sc_tmr_val + ival; in dwc_otg_setup_standard_chain()
3369 td->tmr_res = ival; in dwc_otg_setup_standard_chain()
3370 } else if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_setup_standard_chain()
3371 td->tmr_res = 1; in dwc_otg_setup_standard_chain()
3372 td->tmr_val = sc->sc_last_frame_num; in dwc_otg_setup_standard_chain()
3373 if (td->hcchar & HCCHAR_EPDIR_IN) in dwc_otg_setup_standard_chain()
3374 td->tmr_val++; in dwc_otg_setup_standard_chain()
3376 td->tmr_val = 0; in dwc_otg_setup_standard_chain()
3377 td->tmr_res = (uint8_t)sc->sc_last_frame_num; in dwc_otg_setup_standard_chain()
3382 if (td->ep_type == UE_INTERRUPT) { in dwc_otg_setup_standard_chain()
3391 td->tmr_val = sc->sc_tmr_val + ival; in dwc_otg_setup_standard_chain()
3392 td->tmr_res = ival; in dwc_otg_setup_standard_chain()
3393 } else if (td->ep_type == UE_ISOCHRONOUS) { in dwc_otg_setup_standard_chain()
3396 td->tmr_res = 1 << usbd_xfer_get_fps_shift(xfer); in dwc_otg_setup_standard_chain()
3397 td->tmr_val = sc->sc_last_frame_num; in dwc_otg_setup_standard_chain()
3398 if (td->hcchar & HCCHAR_EPDIR_IN) in dwc_otg_setup_standard_chain()
3399 td->tmr_val += td->tmr_res; in dwc_otg_setup_standard_chain()
3402 td->tmr_val = 0; in dwc_otg_setup_standard_chain()
3403 td->tmr_res = (uint8_t)sc->sc_last_frame_num; in dwc_otg_setup_standard_chain()
3408 td->tmr_val = 0; in dwc_otg_setup_standard_chain()
3409 td->tmr_res = 0; in dwc_otg_setup_standard_chain()
3415 td->hcchar = hcchar; in dwc_otg_setup_standard_chain()
3416 td->hcsplt = hcsplt; in dwc_otg_setup_standard_chain()
3418 if (((void *)td) == xfer->td_transfer_last) in dwc_otg_setup_standard_chain()
3421 td = td->obj_next; in dwc_otg_setup_standard_chain()
3458 struct dwc_otg_td *td = xfer->td_transfer_cache; in dwc_otg_start_standard_chain() local
3459 if (td->ep_type == UE_ISOCHRONOUS && in dwc_otg_start_standard_chain()
3460 (td->hcchar & HCCHAR_EPDIR_IN) == 0) { in dwc_otg_start_standard_chain()
3507 struct dwc_otg_td *td; in dwc_otg_standard_done_sub() local
3513 td = xfer->td_transfer_cache; in dwc_otg_standard_done_sub()
3516 len = td->remainder; in dwc_otg_standard_done_sub()
3519 xfer->endpoint->toggle_next = td->toggle; in dwc_otg_standard_done_sub()
3527 td->error_any = 1; in dwc_otg_standard_done_sub()
3533 if (td->error_any) { in dwc_otg_standard_done_sub()
3535 error = (td->error_stall ? in dwc_otg_standard_done_sub()
3537 td = NULL; in dwc_otg_standard_done_sub()
3545 if (td->alt_next) { in dwc_otg_standard_done_sub()
3546 td = td->obj_next; in dwc_otg_standard_done_sub()
3548 td = NULL; in dwc_otg_standard_done_sub()
3552 td = NULL; in dwc_otg_standard_done_sub()
3557 td = td->obj_next; in dwc_otg_standard_done_sub()
3567 xfer->td_transfer_cache = td; in dwc_otg_standard_done_sub()
3630 struct dwc_otg_td *td; in dwc_otg_device_done() local
3632 td = xfer->td_transfer_cache; in dwc_otg_device_done()
3633 if (td != NULL) in dwc_otg_device_done()
3634 dwc_otg_host_channel_free(sc, td); in dwc_otg_device_done()
4838 struct dwc_otg_td *td; in dwc_otg_xfer_setup() local
4841 td = USB_ADD_BYTES(parm->buf, parm->size[0]); in dwc_otg_xfer_setup()
4846 td->tt_index = parm->udev->device_index; in dwc_otg_xfer_setup()
4848 td->tt_index = parm->udev->parent_hs_hub->device_index; in dwc_otg_xfer_setup()
4850 td->tt_index = parm->udev->device_index; in dwc_otg_xfer_setup()
4854 td->max_packet_size = xfer->max_packet_size; in dwc_otg_xfer_setup()
4855 td->max_packet_count = xfer->max_packet_count; in dwc_otg_xfer_setup()
4857 if (td->max_packet_count == 0 || td->max_packet_count > 3) in dwc_otg_xfer_setup()
4858 td->max_packet_count = 1; in dwc_otg_xfer_setup()
4859 td->ep_no = ep_no; in dwc_otg_xfer_setup()
4860 td->ep_type = ep_type; in dwc_otg_xfer_setup()
4861 td->obj_next = last_obj; in dwc_otg_xfer_setup()
4863 last_obj = td; in dwc_otg_xfer_setup()
4865 parm->size[0] += sizeof(*td); in dwc_otg_xfer_setup()