Lines Matching refs:urb
17 * These are the stages for a control urb, they are kept
18 * in both urb->interval and td->privdata.
62 struct urb *urb;
66 * an urb can be dequeued while a td is in progress
75 struct urb *urb;
141 dev_dbg(dev, "urb: 0x%p\n", td->urb);
194 * c67x00_release_urb - remove link from all tds to this urb
195 * Disconnects the urb from it's tds, so that it can be given back.
196 * pre: urb->hcpriv != NULL
198 static void c67x00_release_urb(struct c67x00_hcd *c67x00, struct urb *urb)
203 BUG_ON(!urb);
207 if (usb_pipetype(urb->pipe) == PIPE_ISOCHRONOUS) {
219 if (urb == td->urb)
220 td->urb = NULL;
222 urbp = urb->hcpriv;
223 urb->hcpriv = NULL;
231 c67x00_ep_data_alloc(struct c67x00_hcd *c67x00, struct urb *urb)
233 struct usb_host_endpoint *hep = urb->ep;
259 ep_data->dev = usb_get_dev(urb->dev);
267 type = usb_pipetype(urb->pipe);
311 dev_warn(c67x00_hcd_dev(c67x00), "error: urb list not empty\n");
343 struct urb *urb, gfp_t mem_flags)
349 int port = get_root_port(urb->dev)-1;
351 /* Allocate and initialize urb private data */
366 ret = usb_hcd_link_urb_to_ep(hcd, urb);
371 urbp->urb = urb;
374 urbp->ep_data = c67x00_ep_data_alloc(c67x00, urb);
384 urb->hcpriv = urbp;
386 urb->actual_length = 0; /* Nothing received/transmitted yet */
388 switch (usb_pipetype(urb->pipe)) {
390 urb->interval = SETUP_STAGE;
402 urb->start_frame = urbp->ep_data->next_frame;
405 struct urb *last_urb;
409 hep_node)->urb;
410 urb->start_frame =
432 usb_hcd_unlink_urb_from_ep(hcd, urb);
441 int c67x00_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
448 rc = usb_hcd_check_unlink_urb(hcd, urb, status);
452 c67x00_release_urb(c67x00, urb);
453 usb_hcd_unlink_urb_from_ep(hcd, urb);
456 usb_hcd_giveback_urb(hcd, urb, status);
471 * pre: c67x00 locked, urb unlocked
474 c67x00_giveback_urb(struct c67x00_hcd *c67x00, struct urb *urb, int status)
478 if (!urb)
481 urbp = urb->hcpriv;
486 c67x00_release_urb(c67x00, urb);
487 usb_hcd_unlink_urb_from_ep(c67x00_hcd_to_hcd(c67x00), urb);
489 usb_hcd_giveback_urb(c67x00_hcd_to_hcd(c67x00), urb, status);
495 static int c67x00_claim_frame_bw(struct c67x00_hcd *c67x00, struct urb *urb,
498 struct c67x00_urb_priv *urbp = urb->hcpriv;
518 if (usb_pipein(urb->pipe))
524 if (usb_pipeisoc(urb->pipe))
525 bit_time = usb_pipein(urb->pipe) ? 9050 : 7840;
563 static int c67x00_create_td(struct c67x00_hcd *c67x00, struct urb *urb,
568 struct c67x00_urb_priv *urbp = urb->hcpriv;
573 if (c67x00_claim_frame_bw(c67x00, urb, len, usb_pipeisoc(urb->pipe)
574 || usb_pipeint(urb->pipe)))
581 td->pipe = urb->pipe;
628 td->urb = urb;
645 static int c67x00_add_data_urb(struct c67x00_hcd *c67x00, struct urb *urb)
654 toggle = usb_gettoggle(urb->dev, usb_pipeendpoint(urb->pipe),
655 usb_pipeout(urb->pipe));
656 remaining = urb->transfer_buffer_length - urb->actual_length;
658 maxps = usb_maxpacket(urb->dev, urb->pipe, usb_pipeout(urb->pipe));
660 need_empty = (urb->transfer_flags & URB_ZERO_PACKET) &&
661 usb_pipeout(urb->pipe) && !(remaining % maxps);
671 pid = usb_pipeout(urb->pipe) ? USB_PID_OUT : USB_PID_IN;
672 td_buf = urb->transfer_buffer + urb->transfer_buffer_length -
674 ret = c67x00_create_td(c67x00, urb, td_buf, len, pid, toggle,
681 if (usb_pipecontrol(urb->pipe))
691 static int c67x00_add_ctrl_urb(struct c67x00_hcd *c67x00, struct urb *urb)
696 switch (urb->interval) {
699 ret = c67x00_create_td(c67x00, urb, urb->setup_packet,
703 urb->interval = SETUP_STAGE;
704 usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe),
705 usb_pipeout(urb->pipe), 1);
708 if (urb->transfer_buffer_length) {
709 ret = c67x00_add_data_urb(c67x00, urb);
716 pid = !usb_pipeout(urb->pipe) ? USB_PID_OUT : USB_PID_IN;
717 ret = c67x00_create_td(c67x00, urb, NULL, 0, pid, 1,
730 static int c67x00_add_int_urb(struct c67x00_hcd *c67x00, struct urb *urb)
732 struct c67x00_urb_priv *urbp = urb->hcpriv;
736 frame_add(urbp->ep_data->next_frame, urb->interval);
737 return c67x00_add_data_urb(c67x00, urb);
742 static int c67x00_add_iso_urb(struct c67x00_hcd *c67x00, struct urb *urb)
744 struct c67x00_urb_priv *urbp = urb->hcpriv;
750 BUG_ON(urbp->cnt >= urb->number_of_packets);
752 td_buf = urb->transfer_buffer +
753 urb->iso_frame_desc[urbp->cnt].offset;
754 len = urb->iso_frame_desc[urbp->cnt].length;
755 pid = usb_pipeout(urb->pipe) ? USB_PID_OUT : USB_PID_IN;
757 ret = c67x00_create_td(c67x00, urb, td_buf, len, pid, 0,
762 urb->iso_frame_desc[urbp->cnt].actual_length = 0;
763 urb->iso_frame_desc[urbp->cnt].status = ret;
764 if (urbp->cnt + 1 == urb->number_of_packets)
765 c67x00_giveback_urb(c67x00, urb, 0);
769 frame_add(urbp->ep_data->next_frame, urb->interval);
778 int (*add)(struct c67x00_hcd *, struct urb *))
781 struct urb *urb;
786 /* and add the first urb */
788 urb = list_entry(ep_data->queue.next,
790 hep_node)->urb;
791 add(c67x00, urb);
861 struct urb *urb = td->urb;
874 remaining = urb->transfer_buffer_length - urb->actual_length;
875 need_empty = (urb->transfer_flags & URB_ZERO_PACKET) &&
876 usb_pipeout(urb->pipe) && !(remaining % maxps);
910 struct urb *urb = td->urb;
912 if (!urb)
915 urb->actual_length += td_actual_bytes(td);
922 urb->interval =
923 urb->transfer_buffer_length ?
926 urb->actual_length = 0;
931 urb->interval = STATUS_STAGE;
937 urb->interval = 0;
938 c67x00_giveback_urb(c67x00, urb, 0);
947 c67x00_giveback_urb(c67x00, urb, 0);
955 struct urb *urb = td->urb;
958 if (!urb)
964 urb->error_count++;
966 urb->iso_frame_desc[cnt].actual_length = td_actual_bytes(td);
967 urb->iso_frame_desc[cnt].status = c67x00_td_to_error(c67x00, td);
968 if (cnt + 1 == urb->number_of_packets) /* Last packet */
969 c67x00_giveback_urb(c67x00, urb, 0);
981 struct urb *urb;
988 urb = td->urb; /* urb can be NULL! */
1003 c67x00_giveback_urb(c67x00, urb,
1018 c67x00_giveback_urb(c67x00, urb, -EOVERFLOW);