Deleted Added
full compact
66c66
< __FBSDID("$FreeBSD: head/sys/dev/usb2/serial/uchcom2.c 187970 2009-02-01 00:51:25Z thompsa $");
---
> __FBSDID("$FreeBSD: head/sys/dev/usb2/serial/uchcom2.c 188413 2009-02-09 22:05:25Z thompsa $");
151,152d150
< UCHCOM_BULK_CS_WR,
< UCHCOM_BULK_CS_RD,
154,155c152
< UCHCOM_INTR_CS_RD,
< UCHCOM_N_TRANSFER = 6,
---
> UCHCOM_N_TRANSFER,
170,173d166
< uint8_t sc_flag;
< #define UCHCOM_FLAG_INTR_STALL 0x01
< #define UCHCOM_FLAG_READ_STALL 0x02
< #define UCHCOM_FLAG_WRITE_STALL 0x04
233d225
< static usb2_callback_t uchcom_intr_clear_stall_callback;
235d226
< static usb2_callback_t uchcom_write_clear_stall_callback;
237d227
< static usb2_callback_t uchcom_read_clear_stall_callback;
259,278d248
< [UCHCOM_BULK_CS_WR] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.callback = &uchcom_write_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
<
< [UCHCOM_BULK_CS_RD] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.callback = &uchcom_read_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
<
287,296d256
<
< [UCHCOM_INTR_CS_RD] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.callback = &uchcom_intr_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
381,382c341,342
< sc->sc_flag |= (UCHCOM_FLAG_READ_STALL |
< UCHCOM_FLAG_WRITE_STALL);
---
> usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_WR]);
> usb2_transfer_set_stall(sc->sc_xfer[UCHCOM_BULK_DT_RD]);
415,443d374
< uchcom_do_request(struct uchcom_softc *sc,
< struct usb2_device_request *req, void *data)
< {
< uint16_t length;
< uint16_t actlen;
< usb2_error_t err;
<
< length = UGETW(req->wLength);
< actlen = 0;
<
< if (usb2_com_cfg_is_gone(&sc->sc_ucom)) {
< goto done;
< }
< err = usb2_do_request_flags(sc->sc_udev, &Giant, req,
< data, USB_SHORT_XFER_OK, &actlen, 1000);
<
< if (err) {
< DPRINTFN(0, "device request failed, err=%s "
< "(ignored)\n", usb2_errstr(err));
< }
< done:
< if (length != actlen) {
< if (req->bmRequestType & UT_READ) {
< bzero(USB_ADD_BYTES(data, actlen), length - actlen);
< }
< }
< }
<
< static void
455c386,387
< uchcom_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev,
> &sc->sc_ucom, &req, NULL, 0, 1000);
470c402,403
< uchcom_do_request(sc, &req, buf);
---
> usb2_com_cfg_do_request(sc->sc_udev,
> &sc->sc_ucom, &req, buf, USB_SHORT_XFER_OK, 1000);
815d747
< usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_CS_RD]);
832d763
< usb2_transfer_stop(sc->sc_xfer[UCHCOM_BULK_CS_WR]);
862,867c793,795
< if (sc->sc_flag & UCHCOM_FLAG_INTR_STALL) {
< usb2_transfer_start(sc->sc_xfer[UCHCOM_INTR_CS_RD]);
< } else {
< xfer->frlengths[0] = xfer->max_data_length;
< usb2_start_hardware(xfer);
< }
---
> tr_setup:
> xfer->frlengths[0] = xfer->max_data_length;
> usb2_start_hardware(xfer);
872,873c800,802
< sc->sc_flag |= UCHCOM_FLAG_INTR_STALL;
< usb2_transfer_start(sc->sc_xfer[UCHCOM_INTR_CS_RD]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
880,892d808
< uchcom_intr_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uchcom_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UCHCOM_INTR_DT_RD];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flag &= ~UCHCOM_FLAG_INTR_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<
< static void
901,904c817
< if (sc->sc_flag & UCHCOM_FLAG_WRITE_STALL) {
< usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_WR]);
< return;
< }
---
> tr_setup:
917,918c830,832
< sc->sc_flag |= UCHCOM_FLAG_WRITE_STALL;
< usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_WR]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
926,938d839
< uchcom_write_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uchcom_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UCHCOM_BULK_DT_WR];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flag &= ~UCHCOM_FLAG_WRITE_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<
< static void
948,953c849,851
< if (sc->sc_flag & UCHCOM_FLAG_READ_STALL) {
< usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_RD]);
< } else {
< xfer->frlengths[0] = xfer->max_data_length;
< usb2_start_hardware(xfer);
< }
---
> tr_setup:
> xfer->frlengths[0] = xfer->max_data_length;
> usb2_start_hardware(xfer);
958,959c856,858
< sc->sc_flag |= UCHCOM_FLAG_READ_STALL;
< usb2_transfer_start(sc->sc_xfer[UCHCOM_BULK_CS_RD]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
962d860
<
966,978d863
< static void
< uchcom_read_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uchcom_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UCHCOM_BULK_DT_RD];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flag &= ~UCHCOM_FLAG_READ_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<