Date: Thu, 18 Jun 2009 17:32:12 GMT From: Hans Petter Selasky <hselasky@FreeBSD.org> To: Perforce Change Reviews <perforce@FreeBSD.org> Subject: PERFORCE change 164675 for review Message-ID: <200906181732.n5IHWC13057944@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164675 Change 164675 by hselasky@hselasky_laptop001 on 2009/06/18 17:32:10 USB CORE (device side mode): - New feature: Add support for devices that handle set and clear stall in hardware. Affected files ... .. //depot/projects/usb/src/sys/dev/usb/controller/at91dci.c#24 edit .. //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#34 edit .. //depot/projects/usb/src/sys/dev/usb/controller/avr32dci.c#9 edit .. //depot/projects/usb/src/sys/dev/usb/controller/musb_otg.c#22 edit .. //depot/projects/usb/src/sys/dev/usb/controller/uss820dci.c#24 edit .. //depot/projects/usb/src/sys/dev/usb/usb_controller.h#14 edit .. //depot/projects/usb/src/sys/dev/usb/usb_device.c#40 edit .. //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#155 edit Differences ... ==== //depot/projects/usb/src/sys/dev/usb/controller/at91dci.c#24 (text+ko) ==== @@ -1208,7 +1208,7 @@ static void at91dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct at91dci_softc *sc; uint32_t csr_val; ==== //depot/projects/usb/src/sys/dev/usb/controller/atmegadci.c#34 (text+ko) ==== @@ -1094,7 +1094,7 @@ static void atmegadci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct atmegadci_softc *sc; uint8_t ep_no; ==== //depot/projects/usb/src/sys/dev/usb/controller/avr32dci.c#9 (text+ko) ==== @@ -1062,7 +1062,7 @@ static void avr32dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct avr32dci_softc *sc; uint8_t ep_no; ==== //depot/projects/usb/src/sys/dev/usb/controller/musb_otg.c#22 (text+ko) ==== @@ -1454,7 +1454,7 @@ static void musbotg_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct musbotg_softc *sc; uint8_t ep_no; ==== //depot/projects/usb/src/sys/dev/usb/controller/uss820dci.c#24 (text+ko) ==== @@ -1184,7 +1184,7 @@ static void uss820dci_set_stall(struct usb_device *udev, struct usb_xfer *xfer, - struct usb_endpoint *ep) + struct usb_endpoint *ep, uint8_t *did_stall) { struct uss820dci_softc *sc; uint8_t ep_no; ==== //depot/projects/usb/src/sys/dev/usb/usb_controller.h#14 (text+ko) ==== @@ -96,7 +96,7 @@ /* USB Device mode only - Mandatory */ void (*get_hw_ep_profile) (struct usb_device *udev, const struct usb_hw_ep_profile **ppf, uint8_t ep_addr); - void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep); + void (*set_stall) (struct usb_device *udev, struct usb_xfer *xfer, struct usb_endpoint *ep, uint8_t *did_stall); void (*clear_stall) (struct usb_device *udev, struct usb_endpoint *ep); }; ==== //depot/projects/usb/src/sys/dev/usb/usb_device.c#40 (text+ko) ==== @@ -916,7 +916,7 @@ * complete the USB transfer like in case of a timeout * setting the error code "USB_ERR_STALLED". */ - (udev->bus->methods->set_stall) (udev, xfer, ep); + (udev->bus->methods->set_stall) (udev, xfer, ep, &do_stall); } if (!do_stall) { ep->toggle_next = 0; /* reset data toggle */ ==== //depot/projects/usb/src/sys/dev/usb/usb_transfer.c#155 (text+ko) ==== @@ -2240,29 +2240,37 @@ (type == UE_INTERRUPT)) { struct usb_device *udev; struct usb_xfer_root *info; + uint8_t did_stall; info = xfer->xroot; udev = info->udev; - ep->is_stalled = 1; + did_stall = 1; if (udev->flags.usb_mode == USB_MODE_DEVICE) { (udev->bus->methods->set_stall) ( - udev, NULL, ep); + udev, NULL, ep, &did_stall); } else if (udev->default_xfer[1]) { info = udev->default_xfer[1]->xroot; - if (usb_proc_msignal( + usb_proc_msignal( &info->bus->non_giant_callback_proc, - &udev->cs_msg[0], &udev->cs_msg[1])) { - /* ignore */ - } + &udev->cs_msg[0], &udev->cs_msg[1]); } else { /* should not happen */ DPRINTFN(0, "No stall handler!\n"); } /* - * We get started again when the stall is cleared! + * Check if we should stall. Some USB hardware + * handles set- and clear-stall in hardware. */ - return; + if (did_stall) { + /* + * The transfer will be continued when + * the clear-stall control endpoint + * message is received. + */ + ep->is_stalled = 1; + return; + } } } /* Set or clear stall complete - special case */
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906181732.n5IHWC13057944>