struct octeon_hcd {
spinlock_t lock;
struct cvmx_usb_state usb;
- struct tasklet_struct dequeue_tasklet;
- struct list_head dequeue_list;
};
/* This macro spins on a field waiting for it to reach a value */
urb->actual_length = bytes_transferred;
urb->hcpriv = NULL;
- if (!list_empty(&urb->urb_list))
- /*
- * It is on the dequeue_list, but we are going to call
- * usb_hcd_giveback_urb(), so we must clear it from
- * the list. We got to it before the
- * octeon_usb_urb_dequeue_work() tasklet did.
- */
- list_del_init(&urb->urb_list);
-
/* For Isochronous transactions we need to update the URB packet status
list from data in our private copy */
if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
struct usb_host_endpoint *ep = urb->ep;
urb->status = 0;
- INIT_LIST_HEAD(&urb->urb_list); /* not enqueued on dequeue_list */
spin_lock_irqsave(&priv->lock, flags);
if (!ep->hcpriv) {
return 0;
}
-static void octeon_usb_urb_dequeue_work(unsigned long arg)
-{
- struct urb *urb;
- struct urb *next;
- unsigned long flags;
- struct octeon_hcd *priv = (struct octeon_hcd *)arg;
-
- spin_lock_irqsave(&priv->lock, flags);
-
- list_for_each_entry_safe(urb, next, &priv->dequeue_list, urb_list) {
- list_del_init(&urb->urb_list);
- cvmx_usb_cancel(&priv->usb, urb->ep->hcpriv, urb->hcpriv);
- }
-
- spin_unlock_irqrestore(&priv->lock, flags);
-}
-
static int octeon_usb_urb_dequeue(struct usb_hcd *hcd,
struct urb *urb,
int status)
spin_lock_irqsave(&priv->lock, flags);
urb->status = status;
- list_add_tail(&urb->urb_list, &priv->dequeue_list);
+ cvmx_usb_cancel(&priv->usb, urb->ep->hcpriv, urb->hcpriv);
spin_unlock_irqrestore(&priv->lock, flags);
- tasklet_schedule(&priv->dequeue_tasklet);
-
return 0;
}
spin_lock_init(&priv->lock);
- tasklet_init(&priv->dequeue_tasklet, octeon_usb_urb_dequeue_work,
- (unsigned long)priv);
- INIT_LIST_HEAD(&priv->dequeue_list);
-
status = cvmx_usb_initialize(&priv->usb, usb_num, initialize_flags);
if (status) {
dev_dbg(dev, "USB initialization failed with %d\n", status);
unsigned long flags;
usb_remove_hcd(hcd);
- tasklet_kill(&priv->dequeue_tasklet);
spin_lock_irqsave(&priv->lock, flags);
status = cvmx_usb_shutdown(&priv->usb);
spin_unlock_irqrestore(&priv->lock, flags);