Lines Matching +full:no +full:- +full:temp +full:- +full:support

1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
82 USS820_DCI_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
119 * Here is a list of what the USS820D chip can support. The main
166 uint8_t temp; in uss820dci_update_shared_1() local
169 temp = USS820_READ_1(sc, reg); in uss820dci_update_shared_1()
170 temp &= (keep_mask); in uss820dci_update_shared_1()
171 temp |= (set_mask); in uss820dci_update_shared_1()
172 USS820_WRITE_1(sc, reg, temp); in uss820dci_update_shared_1()
196 uint8_t temp; in uss820dci_pull_up() local
200 if (!sc->sc_flags.d_pulled_up && in uss820dci_pull_up()
201 sc->sc_flags.port_powered) { in uss820dci_pull_up()
202 sc->sc_flags.d_pulled_up = 1; in uss820dci_pull_up()
206 temp = USS820_READ_1(sc, USS820_MCSR); in uss820dci_pull_up()
207 temp |= USS820_MCSR_DPEN; in uss820dci_pull_up()
208 USS820_WRITE_1(sc, USS820_MCSR, temp); in uss820dci_pull_up()
215 uint8_t temp; in uss820dci_pull_down() local
219 if (sc->sc_flags.d_pulled_up) { in uss820dci_pull_down()
220 sc->sc_flags.d_pulled_up = 0; in uss820dci_pull_down()
224 temp = USS820_READ_1(sc, USS820_MCSR); in uss820dci_pull_down()
225 temp &= ~USS820_MCSR_DPEN; in uss820dci_pull_down()
226 USS820_WRITE_1(sc, USS820_MCSR, temp); in uss820dci_pull_down()
233 if (!(sc->sc_flags.status_suspend)) { in uss820dci_wakeup_peer()
253 uint8_t temp; in uss820dci_setup_rx() local
256 USS820_WRITE_1(sc, USS820_EPINDEX, td->ep_index); in uss820dci_setup_rx()
261 DPRINTFN(5, "rx_stat=0x%02x rem=%u\n", rx_stat, td->remainder); in uss820dci_setup_rx()
267 td->did_stall = 0; in uss820dci_setup_rx()
286 if (count != td->remainder) { in uss820dci_setup_rx()
297 bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, in uss820dci_setup_rx()
315 temp = USS820_READ_1(sc, USS820_RXCON); in uss820dci_setup_rx()
316 temp |= USS820_RXCON_RXFFRC; in uss820dci_setup_rx()
317 USS820_WRITE_1(sc, USS820_RXCON, temp); in uss820dci_setup_rx()
320 usbd_copy_in(td->pc, 0, &req, sizeof(req)); in uss820dci_setup_rx()
322 td->offset = sizeof(req); in uss820dci_setup_rx()
323 td->remainder = 0; in uss820dci_setup_rx()
328 sc->sc_dv_addr = req.wValue[0] & 0x7F; in uss820dci_setup_rx()
330 sc->sc_dv_addr = 0xFF; in uss820dci_setup_rx()
334 temp = USS820_READ_1(sc, USS820_TXCON); in uss820dci_setup_rx()
335 temp |= USS820_TXCON_TXCLR; in uss820dci_setup_rx()
336 USS820_WRITE_1(sc, USS820_TXCON, temp); in uss820dci_setup_rx()
337 temp &= ~USS820_TXCON_TXCLR; in uss820dci_setup_rx()
338 USS820_WRITE_1(sc, USS820_TXCON, temp); in uss820dci_setup_rx()
345 temp = USS820_READ_1(sc, USS820_RXCON); in uss820dci_setup_rx()
346 temp |= USS820_RXCON_RXFFRC; in uss820dci_setup_rx()
347 USS820_WRITE_1(sc, USS820_RXCON, temp); in uss820dci_setup_rx()
353 if (!td->did_stall) { in uss820dci_setup_rx()
359 td->did_stall = 1; in uss820dci_setup_rx()
387 USS820_WRITE_1(sc, USS820_EPINDEX, td->ep_index); in uss820dci_data_rx()
397 rx_stat, rx_flag, td->remainder); in uss820dci_data_rx()
402 if (td->remainder == 0 && td->ep_index == 0) { in uss820dci_data_rx()
413 td->error = 1; in uss820dci_data_rx()
421 td->error = 1; in uss820dci_data_rx()
429 if (!td->did_enable) { in uss820dci_data_rx()
430 uss820dci_update_shared_1(USS820_DCI_PC2SC(td->pc), in uss820dci_data_rx()
432 td->did_enable = 1; in uss820dci_data_rx()
444 if (count != td->max_packet_size) { in uss820dci_data_rx()
445 if (count < td->max_packet_size) { in uss820dci_data_rx()
447 td->short_pkt = 1; in uss820dci_data_rx()
451 td->error = 1; in uss820dci_data_rx()
456 if (count > td->remainder) { in uss820dci_data_rx()
458 td->error = 1; in uss820dci_data_rx()
462 usbd_get_page(td->pc, td->offset, &buf_res); in uss820dci_data_rx()
469 bus_space_read_multi_1(sc->sc_io_tag, sc->sc_io_hdl, in uss820dci_data_rx()
473 count -= buf_res.length; in uss820dci_data_rx()
474 td->offset += buf_res.length; in uss820dci_data_rx()
475 td->remainder -= buf_res.length; in uss820dci_data_rx()
484 if ((td->remainder == 0) || got_short) { in uss820dci_data_rx()
485 if (td->short_pkt) { in uss820dci_data_rx()
491 if (--to) { in uss820dci_data_rx()
508 USS820_WRITE_1(sc, USS820_EPINDEX, td->ep_index); in uss820dci_data_tx()
516 DPRINTFN(5, "tx_flag=0x%02x rem=%u\n", tx_flag, td->remainder); in uss820dci_data_tx()
518 if (td->ep_index == 0) { in uss820dci_data_tx()
531 td->error = 1; in uss820dci_data_tx()
537 td->error = 1; in uss820dci_data_tx()
545 if ((!td->support_multi_buffer) && in uss820dci_data_tx()
550 count = td->max_packet_size; in uss820dci_data_tx()
551 if (td->remainder < count) { in uss820dci_data_tx()
553 td->short_pkt = 1; in uss820dci_data_tx()
554 count = td->remainder; in uss820dci_data_tx()
558 usbd_get_page(td->pc, td->offset, &buf_res); in uss820dci_data_tx()
565 bus_space_write_multi_1(sc->sc_io_tag, sc->sc_io_hdl, in uss820dci_data_tx()
569 count -= buf_res.length; in uss820dci_data_tx()
570 td->offset += buf_res.length; in uss820dci_data_tx()
571 td->remainder -= buf_res.length; in uss820dci_data_tx()
574 /* post-write high packet byte count first */ in uss820dci_data_tx()
577 /* post-write low packet byte count last */ in uss820dci_data_tx()
584 if (!td->did_enable) { in uss820dci_data_tx()
585 uss820dci_update_shared_1(USS820_DCI_PC2SC(td->pc), in uss820dci_data_tx()
587 td->did_enable = 1; in uss820dci_data_tx()
590 if (td->remainder == 0) { in uss820dci_data_tx()
591 if (td->short_pkt) { in uss820dci_data_tx()
596 if (--to) { in uss820dci_data_tx()
609 USS820_WRITE_1(sc, USS820_EPINDEX, td->ep_index); in uss820dci_data_tx_sync()
614 if (td->ep_index == 0) { in uss820dci_data_tx_sync()
618 DPRINTFN(5, "rx_stat=0x%02x rem=%u\n", rx_stat, td->remainder); in uss820dci_data_tx_sync()
628 DPRINTFN(5, "tx_flag=0x%02x rem=%u\n", tx_flag, td->remainder); in uss820dci_data_tx_sync()
632 td->error = 1; in uss820dci_data_tx_sync()
639 if (td->ep_index == 0 && sc->sc_dv_addr != 0xFF) { in uss820dci_data_tx_sync()
641 uss820dci_set_address(sc, sc->sc_dv_addr); in uss820dci_data_tx_sync()
649 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); in uss820dci_xfer_do_fifo()
654 td = xfer->td_transfer_cache; in uss820dci_xfer_do_fifo()
659 if ((td->func) (sc, td)) { in uss820dci_xfer_do_fifo()
663 if (((void *)td) == xfer->td_transfer_last) { in uss820dci_xfer_do_fifo()
666 if (td->error) { in uss820dci_xfer_do_fifo()
668 } else if (td->remainder > 0) { in uss820dci_xfer_do_fifo()
670 * We had a short transfer. If there is no alternate in uss820dci_xfer_do_fifo()
673 if (!td->alt_next) { in uss820dci_xfer_do_fifo()
680 td = td->obj_next; in uss820dci_xfer_do_fifo()
681 xfer->td_transfer_cache = td; in uss820dci_xfer_do_fifo()
687 xfer->td_transfer_cache = NULL; in uss820dci_xfer_do_fifo()
688 sc->sc_xfer_complete = 1; in uss820dci_xfer_do_fifo()
698 td = xfer->td_transfer_cache; in uss820dci_xfer_do_complete()
712 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) in uss820dci_interrupt_poll_locked()
721 TAILQ_FOREACH(xfer, &sc->sc_bus.intr_q.head, wait_entry) { in uss820dci_interrupt_complete_locked()
755 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_filter_interrupt()
766 if (sc->sc_xfer_complete != 0) in uss820dci_filter_interrupt()
769 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_filter_interrupt()
781 USB_BUS_LOCK(&sc->sc_bus); in uss820dci_interrupt()
782 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_interrupt()
796 sc->sc_flags.status_bus_reset = 1; in uss820dci_interrupt()
797 sc->sc_flags.status_suspend = 0; in uss820dci_interrupt()
798 sc->sc_flags.change_suspend = 0; in uss820dci_interrupt()
799 sc->sc_flags.change_connect = 1; in uss820dci_interrupt()
813 if (sc->sc_flags.status_suspend) { in uss820dci_interrupt()
814 sc->sc_flags.status_suspend = 0; in uss820dci_interrupt()
815 sc->sc_flags.change_suspend = 1; in uss820dci_interrupt()
821 if (!sc->sc_flags.status_suspend) { in uss820dci_interrupt()
822 sc->sc_flags.status_suspend = 1; in uss820dci_interrupt()
823 sc->sc_flags.change_suspend = 1; in uss820dci_interrupt()
842 if (sc->sc_xfer_complete != 0) { in uss820dci_interrupt()
843 sc->sc_xfer_complete = 0; in uss820dci_interrupt()
848 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_interrupt()
849 USB_BUS_UNLOCK(&sc->sc_bus); in uss820dci_interrupt()
853 uss820dci_setup_standard_chain_sub(struct uss820_std_temp *temp) in uss820dci_setup_standard_chain_sub() argument
858 td = temp->td_next; in uss820dci_setup_standard_chain_sub()
859 temp->td = td; in uss820dci_setup_standard_chain_sub()
862 temp->td_next = td->obj_next; in uss820dci_setup_standard_chain_sub()
865 td->func = temp->func; in uss820dci_setup_standard_chain_sub()
866 td->pc = temp->pc; in uss820dci_setup_standard_chain_sub()
867 td->offset = temp->offset; in uss820dci_setup_standard_chain_sub()
868 td->remainder = temp->len; in uss820dci_setup_standard_chain_sub()
869 td->error = 0; in uss820dci_setup_standard_chain_sub()
870 td->did_enable = 0; in uss820dci_setup_standard_chain_sub()
871 td->did_stall = temp->did_stall; in uss820dci_setup_standard_chain_sub()
872 td->short_pkt = temp->short_pkt; in uss820dci_setup_standard_chain_sub()
873 td->alt_next = temp->setup_alt_next; in uss820dci_setup_standard_chain_sub()
879 struct uss820_std_temp temp; in uss820dci_setup_standard_chain() local
884 xfer->address, UE_GET_ADDR(xfer->endpointno), in uss820dci_setup_standard_chain()
885 xfer->sumlen, usbd_get_speed(xfer->xroot->udev)); in uss820dci_setup_standard_chain()
887 temp.max_frame_size = xfer->max_frame_size; in uss820dci_setup_standard_chain()
889 td = xfer->td_start[0]; in uss820dci_setup_standard_chain()
890 xfer->td_transfer_first = td; in uss820dci_setup_standard_chain()
891 xfer->td_transfer_cache = td; in uss820dci_setup_standard_chain()
893 /* setup temp */ in uss820dci_setup_standard_chain()
895 temp.pc = NULL; in uss820dci_setup_standard_chain()
896 temp.td = NULL; in uss820dci_setup_standard_chain()
897 temp.td_next = xfer->td_start[0]; in uss820dci_setup_standard_chain()
898 temp.offset = 0; in uss820dci_setup_standard_chain()
899 temp.setup_alt_next = xfer->flags_int.short_frames_ok || in uss820dci_setup_standard_chain()
900 xfer->flags_int.isochronous_xfr; in uss820dci_setup_standard_chain()
901 temp.did_stall = !xfer->flags_int.control_stall; in uss820dci_setup_standard_chain()
905 if (xfer->flags_int.control_xfr) { in uss820dci_setup_standard_chain()
906 if (xfer->flags_int.control_hdr) { in uss820dci_setup_standard_chain()
907 temp.func = &uss820dci_setup_rx; in uss820dci_setup_standard_chain()
908 temp.len = xfer->frlengths[0]; in uss820dci_setup_standard_chain()
909 temp.pc = xfer->frbuffers + 0; in uss820dci_setup_standard_chain()
910 temp.short_pkt = temp.len ? 1 : 0; in uss820dci_setup_standard_chain()
912 if (xfer->nframes == 1) { in uss820dci_setup_standard_chain()
913 /* no STATUS stage yet, SETUP is last */ in uss820dci_setup_standard_chain()
914 if (xfer->flags_int.control_act) in uss820dci_setup_standard_chain()
915 temp.setup_alt_next = 0; in uss820dci_setup_standard_chain()
918 uss820dci_setup_standard_chain_sub(&temp); in uss820dci_setup_standard_chain()
925 if (x != xfer->nframes) { in uss820dci_setup_standard_chain()
926 if (xfer->endpointno & UE_DIR_IN) { in uss820dci_setup_standard_chain()
927 temp.func = &uss820dci_data_tx; in uss820dci_setup_standard_chain()
929 temp.func = &uss820dci_data_rx; in uss820dci_setup_standard_chain()
933 temp.pc = xfer->frbuffers + x; in uss820dci_setup_standard_chain()
935 while (x != xfer->nframes) { in uss820dci_setup_standard_chain()
938 temp.len = xfer->frlengths[x]; in uss820dci_setup_standard_chain()
942 if (x == xfer->nframes) { in uss820dci_setup_standard_chain()
943 if (xfer->flags_int.control_xfr) { in uss820dci_setup_standard_chain()
944 if (xfer->flags_int.control_act) { in uss820dci_setup_standard_chain()
945 temp.setup_alt_next = 0; in uss820dci_setup_standard_chain()
948 temp.setup_alt_next = 0; in uss820dci_setup_standard_chain()
951 if (temp.len == 0) { in uss820dci_setup_standard_chain()
954 temp.short_pkt = 0; in uss820dci_setup_standard_chain()
959 temp.short_pkt = (xfer->flags.force_short_xfer) ? 0 : 1; in uss820dci_setup_standard_chain()
962 uss820dci_setup_standard_chain_sub(&temp); in uss820dci_setup_standard_chain()
964 if (xfer->flags_int.isochronous_xfr) { in uss820dci_setup_standard_chain()
965 temp.offset += temp.len; in uss820dci_setup_standard_chain()
968 temp.pc = xfer->frbuffers + x; in uss820dci_setup_standard_chain()
973 if (xfer->flags_int.control_xfr) { in uss820dci_setup_standard_chain()
977 temp.pc = xfer->frbuffers + 0; in uss820dci_setup_standard_chain()
978 temp.len = 0; in uss820dci_setup_standard_chain()
979 temp.short_pkt = 0; in uss820dci_setup_standard_chain()
980 temp.setup_alt_next = 0; in uss820dci_setup_standard_chain()
983 if (!xfer->flags_int.control_act) { in uss820dci_setup_standard_chain()
988 if (xfer->endpointno & UE_DIR_IN) { in uss820dci_setup_standard_chain()
989 temp.func = &uss820dci_data_rx; in uss820dci_setup_standard_chain()
992 temp.func = &uss820dci_data_tx; in uss820dci_setup_standard_chain()
995 temp.len = 0; in uss820dci_setup_standard_chain()
996 temp.short_pkt = 0; in uss820dci_setup_standard_chain()
998 uss820dci_setup_standard_chain_sub(&temp); in uss820dci_setup_standard_chain()
1001 temp.func = &uss820dci_data_tx_sync; in uss820dci_setup_standard_chain()
1002 uss820dci_setup_standard_chain_sub(&temp); in uss820dci_setup_standard_chain()
1007 td = temp.td; in uss820dci_setup_standard_chain()
1008 xfer->td_transfer_last = td; in uss820dci_setup_standard_chain()
1018 USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); in uss820dci_timeout()
1027 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); in uss820dci_intr_set()
1028 uint8_t ep_no = (xfer->endpointno & UE_ADDR); in uss820dci_intr_set()
1030 uint8_t temp; in uss820dci_intr_set() local
1032 DPRINTFN(15, "endpoint 0x%02x\n", xfer->endpointno); in uss820dci_intr_set()
1043 if (xfer->flags_int.control_xfr) { in uss820dci_intr_set()
1044 if (xfer->flags_int.control_hdr) { in uss820dci_intr_set()
1050 if (!(xfer->endpointno & UE_DIR_IN)) { in uss820dci_intr_set()
1054 temp = USS820_READ_1(sc, ep_reg); in uss820dci_intr_set()
1056 temp |= ep_no; in uss820dci_intr_set()
1058 temp &= ~ep_no; in uss820dci_intr_set()
1060 USS820_WRITE_1(sc, ep_reg, temp); in uss820dci_intr_set()
1066 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); in uss820dci_start_standard_chain()
1070 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_start_standard_chain()
1084 usbd_transfer_enqueue(&xfer->xroot->bus->intr_q, xfer); in uss820dci_start_standard_chain()
1087 if (xfer->timeout != 0) { in uss820dci_start_standard_chain()
1089 &uss820dci_timeout, xfer->timeout); in uss820dci_start_standard_chain()
1092 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_start_standard_chain()
1100 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in uss820dci_root_intr()
1103 sc->sc_hub_idata[0] = 0x02; /* we only have one port */ in uss820dci_root_intr()
1105 uhub_root_intr(&sc->sc_bus, sc->sc_hub_idata, in uss820dci_root_intr()
1106 sizeof(sc->sc_hub_idata)); in uss820dci_root_intr()
1118 td = xfer->td_transfer_cache; in uss820dci_standard_done_sub()
1121 len = td->remainder; in uss820dci_standard_done_sub()
1123 if (xfer->aframes != xfer->nframes) { in uss820dci_standard_done_sub()
1128 if (len > xfer->frlengths[xfer->aframes]) { in uss820dci_standard_done_sub()
1129 td->error = 1; in uss820dci_standard_done_sub()
1131 xfer->frlengths[xfer->aframes] -= len; in uss820dci_standard_done_sub()
1135 if (td->error) { in uss820dci_standard_done_sub()
1143 if (xfer->flags_int.short_frames_ok || in uss820dci_standard_done_sub()
1144 xfer->flags_int.isochronous_xfr) { in uss820dci_standard_done_sub()
1146 if (td->alt_next) { in uss820dci_standard_done_sub()
1147 td = td->obj_next; in uss820dci_standard_done_sub()
1158 td = td->obj_next; in uss820dci_standard_done_sub()
1168 xfer->td_transfer_cache = td; in uss820dci_standard_done_sub()
1180 xfer, xfer->endpoint); in uss820dci_standard_done()
1184 xfer->td_transfer_cache = xfer->td_transfer_first; in uss820dci_standard_done()
1186 if (xfer->flags_int.control_xfr) { in uss820dci_standard_done()
1187 if (xfer->flags_int.control_hdr) { in uss820dci_standard_done()
1190 xfer->aframes = 1; in uss820dci_standard_done()
1192 if (xfer->td_transfer_cache == NULL) { in uss820dci_standard_done()
1196 while (xfer->aframes != xfer->nframes) { in uss820dci_standard_done()
1198 xfer->aframes++; in uss820dci_standard_done()
1200 if (xfer->td_transfer_cache == NULL) { in uss820dci_standard_done()
1205 if (xfer->flags_int.control_xfr && in uss820dci_standard_done()
1206 !xfer->flags_int.control_act) { in uss820dci_standard_done()
1213 /*------------------------------------------------------------------------*
1218 *------------------------------------------------------------------------*/
1222 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); in uss820dci_device_done()
1224 USB_BUS_LOCK_ASSERT(xfer->xroot->bus, MA_OWNED); in uss820dci_device_done()
1227 xfer, xfer->endpoint, error); in uss820dci_device_done()
1229 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_device_done()
1231 if (xfer->flags_int.usb_mode == USB_MODE_DEVICE) { in uss820dci_device_done()
1237 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_device_done()
1254 uint8_t temp; in uss820dci_set_stall() local
1256 USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); in uss820dci_set_stall()
1261 sc = USS820_DCI_BUS2SC(udev->bus); in uss820dci_set_stall()
1262 ep_no = (ep->edesc->bEndpointAddress & UE_ADDR); in uss820dci_set_stall()
1263 ep_dir = (ep->edesc->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT)); in uss820dci_set_stall()
1264 ep_type = (ep->edesc->bmAttributes & UE_XFERTYPE); in uss820dci_set_stall()
1270 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_set_stall()
1274 temp = USS820_EPCON_TXSTL; in uss820dci_set_stall()
1276 temp = USS820_EPCON_RXSTL; in uss820dci_set_stall()
1278 uss820dci_update_shared_1(sc, USS820_EPCON, 0xFF, temp); in uss820dci_set_stall()
1279 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_set_stall()
1286 uint8_t temp; in uss820dci_clear_stall_sub() local
1292 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_clear_stall_sub()
1299 temp = 0xFF ^ (USS820_EPCON_TXOE | in uss820dci_clear_stall_sub()
1302 temp = 0xFF ^ (USS820_EPCON_RXIE | in uss820dci_clear_stall_sub()
1305 uss820dci_update_shared_1(sc, USS820_EPCON, temp, 0); in uss820dci_clear_stall_sub()
1313 temp = USS820_READ_1(sc, USS820_TXCON); in uss820dci_clear_stall_sub()
1314 temp |= USS820_TXCON_TXCLR; in uss820dci_clear_stall_sub()
1315 USS820_WRITE_1(sc, USS820_TXCON, temp); in uss820dci_clear_stall_sub()
1316 temp &= ~USS820_TXCON_TXCLR; in uss820dci_clear_stall_sub()
1317 USS820_WRITE_1(sc, USS820_TXCON, temp); in uss820dci_clear_stall_sub()
1324 temp = USS820_READ_1(sc, USS820_RXCON); in uss820dci_clear_stall_sub()
1325 temp |= USS820_RXCON_RXCLR; in uss820dci_clear_stall_sub()
1326 temp &= ~USS820_RXCON_RXFFRC; in uss820dci_clear_stall_sub()
1327 USS820_WRITE_1(sc, USS820_RXCON, temp); in uss820dci_clear_stall_sub()
1328 temp &= ~USS820_RXCON_RXCLR; in uss820dci_clear_stall_sub()
1329 USS820_WRITE_1(sc, USS820_RXCON, temp); in uss820dci_clear_stall_sub()
1331 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_clear_stall_sub()
1340 USB_BUS_LOCK_ASSERT(udev->bus, MA_OWNED); in uss820dci_clear_stall()
1345 if (udev->flags.usb_mode != USB_MODE_DEVICE) { in uss820dci_clear_stall()
1350 sc = USS820_DCI_BUS2SC(udev->bus); in uss820dci_clear_stall()
1353 ed = ep->edesc; in uss820dci_clear_stall()
1357 (ed->bEndpointAddress & UE_ADDR), in uss820dci_clear_stall()
1358 (ed->bmAttributes & UE_XFERTYPE), in uss820dci_clear_stall()
1359 (ed->bEndpointAddress & (UE_DIR_IN | UE_DIR_OUT))); in uss820dci_clear_stall()
1367 uint8_t temp; in uss820dci_init() local
1372 sc->sc_bus.usbrev = USB_REV_1_1; in uss820dci_init()
1373 sc->sc_bus.methods = &uss820dci_bus_methods; in uss820dci_init()
1375 USB_BUS_LOCK(&sc->sc_bus); in uss820dci_init()
1378 sc->sc_flags.status_vbus = 1; in uss820dci_init()
1387 temp = USS820_READ_1(sc, USS820_MCSR); in uss820dci_init()
1389 if (temp & USS820_MCSR_INIT) { in uss820dci_init()
1393 USB_BUS_UNLOCK(&sc->sc_bus); in uss820dci_init()
1404 usb_pause_mtx(&sc->sc_bus.bus_mtx, hz / 100); in uss820dci_init()
1407 temp = USS820_READ_1(sc, USS820_REV); in uss820dci_init()
1409 if (temp < 0x13) { in uss820dci_init()
1410 USB_BUS_UNLOCK(&sc->sc_bus); in uss820dci_init()
1430 sc->sc_flags.mcsr_feat = 1; in uss820dci_init()
1455 if (pf->max_in_frame_size != pf->max_out_frame_size) { in uss820dci_init()
1457 pf->max_in_frame_size, pf->max_out_frame_size); in uss820dci_init()
1459 if (pf->support_isochronous) { in uss820dci_init()
1460 if (pf->max_in_frame_size <= 64) { in uss820dci_init()
1461 temp = (USS820_TXCON_FFSZ_16_64 | in uss820dci_init()
1464 } else if (pf->max_in_frame_size <= 256) { in uss820dci_init()
1465 temp = (USS820_TXCON_FFSZ_64_256 | in uss820dci_init()
1468 } else if (pf->max_in_frame_size <= 512) { in uss820dci_init()
1469 temp = (USS820_TXCON_FFSZ_8_512 | in uss820dci_init()
1473 temp = (USS820_TXCON_FFSZ_32_1024 | in uss820dci_init()
1478 if ((pf->max_in_frame_size <= 8) && in uss820dci_init()
1479 (sc->sc_flags.mcsr_feat)) { in uss820dci_init()
1480 temp = (USS820_TXCON_FFSZ_8_512 | in uss820dci_init()
1482 } else if (pf->max_in_frame_size <= 16) { in uss820dci_init()
1483 temp = (USS820_TXCON_FFSZ_16_64 | in uss820dci_init()
1485 } else if ((pf->max_in_frame_size <= 32) && in uss820dci_init()
1486 (sc->sc_flags.mcsr_feat)) { in uss820dci_init()
1487 temp = (USS820_TXCON_FFSZ_32_1024 | in uss820dci_init()
1490 temp = (USS820_TXCON_FFSZ_64_256 | in uss820dci_init()
1498 USS820_WRITE_1(sc, USS820_TXCON, temp); in uss820dci_init()
1499 USS820_WRITE_1(sc, USS820_RXCON, temp); in uss820dci_init()
1501 if (pf->support_control) { in uss820dci_init()
1502 temp = USS820_EPCON_CTLEP | in uss820dci_init()
1509 temp = USS820_EPCON_RXEPEN | USS820_EPCON_TXEPEN; in uss820dci_init()
1512 uss820dci_update_shared_1(sc, USS820_EPCON, 0, temp); in uss820dci_init()
1515 USB_BUS_UNLOCK(&sc->sc_bus); in uss820dci_init()
1519 uss820dci_do_poll(&sc->sc_bus); in uss820dci_init()
1527 uint8_t temp; in uss820dci_uninit() local
1529 USB_BUS_LOCK(&sc->sc_bus); in uss820dci_uninit()
1532 temp = USS820_READ_1(sc, USS820_SCR); in uss820dci_uninit()
1533 temp &= ~USS820_SCR_T_IRQ; in uss820dci_uninit()
1534 USS820_WRITE_1(sc, USS820_SCR, temp); in uss820dci_uninit()
1536 sc->sc_flags.port_powered = 0; in uss820dci_uninit()
1537 sc->sc_flags.status_vbus = 0; in uss820dci_uninit()
1538 sc->sc_flags.status_bus_reset = 0; in uss820dci_uninit()
1539 sc->sc_flags.status_suspend = 0; in uss820dci_uninit()
1540 sc->sc_flags.change_suspend = 0; in uss820dci_uninit()
1541 sc->sc_flags.change_connect = 1; in uss820dci_uninit()
1544 USB_BUS_UNLOCK(&sc->sc_bus); in uss820dci_uninit()
1564 USB_BUS_LOCK(&sc->sc_bus); in uss820dci_do_poll()
1565 USB_BUS_SPIN_LOCK(&sc->sc_bus); in uss820dci_do_poll()
1568 USB_BUS_SPIN_UNLOCK(&sc->sc_bus); in uss820dci_do_poll()
1569 USB_BUS_UNLOCK(&sc->sc_bus); in uss820dci_do_poll()
1572 /*------------------------------------------------------------------------*
1573 * uss820dci bulk support
1574 *------------------------------------------------------------------------*/
1609 /*------------------------------------------------------------------------*
1610 * uss820dci control support
1611 *------------------------------------------------------------------------*/
1646 /*------------------------------------------------------------------------*
1647 * uss820dci interrupt support
1648 *------------------------------------------------------------------------*/
1683 /*------------------------------------------------------------------------*
1684 * uss820dci full speed isochronous support
1685 *------------------------------------------------------------------------*/
1701 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(xfer->xroot->bus); in uss820dci_device_isoc_fs_enter()
1705 xfer, xfer->endpoint->isoc_next, xfer->nframes); in uss820dci_device_isoc_fs_enter()
1707 /* get the current frame index - we don't need the high bits */ in uss820dci_device_isoc_fs_enter()
1713 DPRINTFN(3, "start next=%d\n", xfer->endpoint->isoc_next); in uss820dci_device_isoc_fs_enter()
1734 /*------------------------------------------------------------------------*
1735 * uss820dci root control support
1736 *------------------------------------------------------------------------*
1738 *------------------------------------------------------------------------*/
1819 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(udev->bus); in uss820dci_roothub_exec()
1826 USB_BUS_LOCK_ASSERT(&sc->sc_bus, MA_OWNED); in uss820dci_roothub_exec()
1829 ptr = (const void *)&sc->sc_hub_temp; in uss820dci_roothub_exec()
1833 value = UGETW(req->wValue); in uss820dci_roothub_exec()
1834 index = UGETW(req->wIndex); in uss820dci_roothub_exec()
1838 switch (req->bmRequestType) { in uss820dci_roothub_exec()
1840 switch (req->bRequest) { in uss820dci_roothub_exec()
1853 switch (req->bRequest) { in uss820dci_roothub_exec()
1869 switch (req->bRequest) { in uss820dci_roothub_exec()
1871 switch (UGETW(req->wValue)) { in uss820dci_roothub_exec()
1881 switch (UGETW(req->wValue)) { in uss820dci_roothub_exec()
1898 switch (req->bRequest) { in uss820dci_roothub_exec()
1907 switch (req->bRequest) { in uss820dci_roothub_exec()
1919 switch (req->bRequest) { in uss820dci_roothub_exec()
1940 switch (req->bRequest) { in uss820dci_roothub_exec()
1952 switch (req->bRequest) { in uss820dci_roothub_exec()
1968 switch (req->bRequest) { in uss820dci_roothub_exec()
1979 switch (req->bRequest) { in uss820dci_roothub_exec()
2044 sc->sc_hub_temp.wValue[0] = sc->sc_conf; in uss820dci_roothub_exec()
2049 USETW(sc->sc_hub_temp.wValue, UDS_SELF_POWERED); in uss820dci_roothub_exec()
2056 sc->sc_rt_addr = value; in uss820dci_roothub_exec()
2063 sc->sc_conf = value; in uss820dci_roothub_exec()
2068 sc->sc_hub_temp.wValue[0] = 0; in uss820dci_roothub_exec()
2076 USETW(sc->sc_hub_temp.wValue, 0); in uss820dci_roothub_exec()
2098 sc->sc_flags.port_enabled = 0; in uss820dci_roothub_exec()
2109 sc->sc_flags.port_powered = 0; in uss820dci_roothub_exec()
2113 sc->sc_flags.change_connect = 0; in uss820dci_roothub_exec()
2116 sc->sc_flags.change_suspend = 0; in uss820dci_roothub_exec()
2132 sc->sc_flags.port_enabled = 1; in uss820dci_roothub_exec()
2141 sc->sc_flags.port_powered = 1; in uss820dci_roothub_exec()
2156 if (sc->sc_flags.status_vbus) { in uss820dci_roothub_exec()
2162 /* Select FULL-speed and Device Side Mode */ in uss820dci_roothub_exec()
2166 if (sc->sc_flags.port_powered) { in uss820dci_roothub_exec()
2169 if (sc->sc_flags.port_enabled) { in uss820dci_roothub_exec()
2172 if (sc->sc_flags.status_vbus && in uss820dci_roothub_exec()
2173 sc->sc_flags.status_bus_reset) { in uss820dci_roothub_exec()
2176 if (sc->sc_flags.status_suspend) { in uss820dci_roothub_exec()
2179 USETW(sc->sc_hub_temp.ps.wPortStatus, value); in uss820dci_roothub_exec()
2183 if (sc->sc_flags.change_connect) { in uss820dci_roothub_exec()
2186 if (sc->sc_flags.change_suspend) { in uss820dci_roothub_exec()
2189 USETW(sc->sc_hub_temp.ps.wPortChange, value); in uss820dci_roothub_exec()
2190 len = sizeof(sc->sc_hub_temp.ps); in uss820dci_roothub_exec()
2220 xfer = parm->curr_xfer; in uss820dci_xfer_setup()
2227 parm->hc_max_packet_size = 0x500; in uss820dci_xfer_setup()
2228 parm->hc_max_packet_count = 1; in uss820dci_xfer_setup()
2229 parm->hc_max_frame_size = 0x500; in uss820dci_xfer_setup()
2236 if (parm->methods == &uss820dci_device_ctrl_methods) { in uss820dci_xfer_setup()
2237 ntd = xfer->nframes + 1 /* STATUS */ + 1 /* SYNC */ ; in uss820dci_xfer_setup()
2239 } else if (parm->methods == &uss820dci_device_bulk_methods) { in uss820dci_xfer_setup()
2240 ntd = xfer->nframes + 1 /* SYNC */ ; in uss820dci_xfer_setup()
2242 } else if (parm->methods == &uss820dci_device_intr_methods) { in uss820dci_xfer_setup()
2243 ntd = xfer->nframes + 1 /* SYNC */ ; in uss820dci_xfer_setup()
2245 } else if (parm->methods == &uss820dci_device_isoc_fs_methods) { in uss820dci_xfer_setup()
2246 ntd = xfer->nframes + 1 /* SYNC */ ; in uss820dci_xfer_setup()
2255 if (parm->err) { in uss820dci_xfer_setup()
2267 ep_no = xfer->endpointno & UE_ADDR; in uss820dci_xfer_setup()
2268 uss820dci_get_hw_ep_profile(parm->udev, &pf, ep_no); in uss820dci_xfer_setup()
2272 parm->err = USB_ERR_INVAL; in uss820dci_xfer_setup()
2281 parm->size[0] += ((-parm->size[0]) & (USB_HOST_ALIGN - 1)); in uss820dci_xfer_setup()
2286 if (parm->buf) { in uss820dci_xfer_setup()
2287 td = USB_ADD_BYTES(parm->buf, parm->size[0]); in uss820dci_xfer_setup()
2290 td->max_packet_size = xfer->max_packet_size; in uss820dci_xfer_setup()
2291 td->ep_index = ep_no; in uss820dci_xfer_setup()
2292 if (pf->support_multi_buffer && in uss820dci_xfer_setup()
2293 (parm->methods != &uss820dci_device_ctrl_methods)) { in uss820dci_xfer_setup()
2294 td->support_multi_buffer = 1; in uss820dci_xfer_setup()
2296 td->obj_next = last_obj; in uss820dci_xfer_setup()
2300 parm->size[0] += sizeof(*td); in uss820dci_xfer_setup()
2303 xfer->td_start[0] = last_obj; in uss820dci_xfer_setup()
2316 struct uss820dci_softc *sc = USS820_DCI_BUS2SC(udev->bus); in uss820dci_ep_init()
2319 ep, udev->address, in uss820dci_ep_init()
2320 edesc->bEndpointAddress, udev->flags.usb_mode, in uss820dci_ep_init()
2321 sc->sc_rt_addr); in uss820dci_ep_init()
2323 if (udev->device_index != sc->sc_rt_addr) { in uss820dci_ep_init()
2324 if (udev->speed != USB_SPEED_FULL) { in uss820dci_ep_init()
2328 switch (edesc->bmAttributes & UE_XFERTYPE) { in uss820dci_ep_init()
2330 ep->methods = &uss820dci_device_ctrl_methods; in uss820dci_ep_init()
2333 ep->methods = &uss820dci_device_intr_methods; in uss820dci_ep_init()
2336 ep->methods = &uss820dci_device_isoc_fs_methods; in uss820dci_ep_init()
2339 ep->methods = &uss820dci_device_bulk_methods; in uss820dci_ep_init()