Deleted Added
full compact
40c40
< __FBSDID("$FreeBSD: head/sys/dev/usb2/serial/uftdi2.c 187994 2009-02-02 00:49:39Z alfred $");
---
> __FBSDID("$FreeBSD: head/sys/dev/usb2/serial/uftdi2.c 188413 2009-02-09 22:05:25Z thompsa $");
89,91c89
< UFTDI_BULK_CS_WR,
< UFTDI_BULK_CS_RD,
< UFTDI_N_TRANSFER = 4,
---
> UFTDI_N_TRANSFER,
109d106
<
113,116d109
< uint8_t sc_flag;
< #define UFTDI_FLAG_WRITE_STALL 0x01
< #define UFTDI_FLAG_READ_STALL 0x02
<
135d127
< static usb2_callback_t uftdi_write_clear_stall_callback;
137d128
< static usb2_callback_t uftdi_read_clear_stall_callback;
139,140d129
< static void uftdi_cfg_do_request(struct uftdi_softc *,
< struct usb2_device_request *, void *);
176,197d164
<
< [UFTDI_BULK_CS_WR] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.flags = {},
< .mh.callback = &uftdi_write_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
<
< [UFTDI_BULK_CS_RD] = {
< .type = UE_CONTROL,
< .endpoint = 0x00, /* Control pipe */
< .direction = UE_DIR_ANY,
< .mh.bufsize = sizeof(struct usb2_device_request),
< .mh.flags = {},
< .mh.callback = &uftdi_read_clear_stall_callback,
< .mh.timeout = 1000, /* 1 second */
< .mh.interval = 50, /* 50ms */
< },
325a293,294
> usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_WR]);
> usb2_transfer_set_stall(sc->sc_xfer[UFTDI_BULK_DT_RD]);
327,329d295
< sc->sc_flag |= (UFTDI_FLAG_WRITE_STALL |
< UFTDI_FLAG_READ_STALL);
<
362,388d327
< uftdi_cfg_do_request(struct uftdi_softc *sc, struct usb2_device_request *req,
< void *data)
< {
< uint16_t length;
< usb2_error_t err;
<
< if (usb2_com_cfg_is_gone(&sc->sc_ucom)) {
< goto error;
< }
< err = usb2_do_request_flags
< (sc->sc_udev, &Giant, req, data, 0, NULL, 1000);
<
< if (err) {
<
< DPRINTFN(0, "device request failed, err=%s "
< "(ignored)\n", usb2_errstr(err));
<
< error:
< length = UGETW(req->wLength);
<
< if ((req->bmRequestType & UT_READ) && length) {
< bzero(data, length);
< }
< }
< }
<
< static void
404c343,344
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
413c353,354
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
432,435c373
< if (sc->sc_flag & UFTDI_FLAG_WRITE_STALL) {
< usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_WR]);
< return;
< }
---
> tr_setup:
452,453c390,392
< sc->sc_flag |= UFTDI_FLAG_WRITE_STALL;
< usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_WR]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
456d394
<
461,473d398
< uftdi_write_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uftdi_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UFTDI_BULK_DT_WR];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flag &= ~UFTDI_FLAG_WRITE_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<
< static void
522,527c447,448
< if (sc->sc_flag & UFTDI_FLAG_READ_STALL) {
< usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_RD]);
< } else {
< xfer->frlengths[0] = xfer->max_data_length;
< usb2_start_hardware(xfer);
< }
---
> xfer->frlengths[0] = xfer->max_data_length;
> usb2_start_hardware(xfer);
532,533c453,455
< sc->sc_flag |= UFTDI_FLAG_READ_STALL;
< usb2_transfer_start(sc->sc_xfer[UFTDI_BULK_CS_RD]);
---
> /* try to clear stall first */
> xfer->flags.stall_pipe = 1;
> goto tr_setup;
536d457
<
541,553d461
< uftdi_read_clear_stall_callback(struct usb2_xfer *xfer)
< {
< struct uftdi_softc *sc = xfer->priv_sc;
< struct usb2_xfer *xfer_other = sc->sc_xfer[UFTDI_BULK_DT_RD];
<
< if (usb2_clear_stall_callback(xfer, xfer_other)) {
< DPRINTF("stall cleared\n");
< sc->sc_flag &= ~UFTDI_FLAG_READ_STALL;
< usb2_transfer_start(xfer_other);
< }
< }
<
< static void
568c476,477
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
586c495,496
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
610c520,521
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
742c653,654
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
749c661,662
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
756c669,670
< uftdi_cfg_do_request(sc, &req, NULL);
---
> usb2_com_cfg_do_request(sc->sc_udev, &sc->sc_ucom,
> &req, NULL, 0, 1000);
784d697
< usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_CS_RD]);
801d713
< usb2_transfer_stop(sc->sc_xfer[UFTDI_BULK_CS_WR]);