Lines Matching refs:urb
88 struct urb *urb, int is_out,
198 struct urb *urb = next_urb(qh); in musb_start_urb() local
199 void *buf = urb->transfer_buffer; in musb_start_urb()
202 unsigned pipe = urb->pipe; in musb_start_urb()
216 buf = urb->setup_packet; in musb_start_urb()
223 offset = urb->iso_frame_desc[0].offset; in musb_start_urb()
224 len = urb->iso_frame_desc[0].length; in musb_start_urb()
229 buf = urb->transfer_buffer + urb->actual_length; in musb_start_urb()
230 len = urb->transfer_buffer_length - urb->actual_length; in musb_start_urb()
234 qh, urb, address, qh->epnum, in musb_start_urb()
248 musb_ep_program(musb, epnum, urb, !is_in, buf, offset, len); in musb_start_urb()
266 if ((urb->transfer_flags & URB_ISO_ASAP) in musb_start_urb()
267 || (frame >= urb->start_frame)) { in musb_start_urb()
275 qh->frame = urb->start_frame; in musb_start_urb()
298 static void musb_giveback(struct musb *musb, struct urb *urb, int status) in musb_giveback() argument
304 urb, urb->complete, status, in musb_giveback()
305 usb_pipedevice(urb->pipe), in musb_giveback()
306 usb_pipeendpoint(urb->pipe), in musb_giveback()
307 usb_pipein(urb->pipe) ? "in" : "out", in musb_giveback()
308 urb->actual_length, urb->transfer_buffer_length in musb_giveback()
311 usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb); in musb_giveback()
313 usb_hcd_giveback_urb(musb_to_hcd(musb), urb, status); in musb_giveback()
319 struct urb *urb) in musb_save_toggle() argument
334 usb_settoggle(urb->dev, qh->epnum, !is_in, csr ? 1 : 0); in musb_save_toggle()
344 static void musb_advance_schedule(struct musb *musb, struct urb *urb, in musb_advance_schedule() argument
352 status = (urb->status == -EINPROGRESS) ? 0 : urb->status; in musb_advance_schedule()
358 musb_save_toggle(qh, is_in, urb); in musb_advance_schedule()
362 if (status == 0 && urb->error_count) in musb_advance_schedule()
369 musb_giveback(musb, urb, status); in musb_advance_schedule()
454 musb_host_packet_rx(struct musb *musb, struct urb *urb, u8 epnum, u8 iso_err) in musb_host_packet_rx() argument
465 int pipe = urb->pipe; in musb_host_packet_rx()
466 void *buffer = urb->transfer_buffer; in musb_host_packet_rx()
471 urb->transfer_buffer, qh->offset, in musb_host_packet_rx()
472 urb->transfer_buffer_length); in musb_host_packet_rx()
482 urb->error_count++; in musb_host_packet_rx()
485 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_packet_rx()
491 urb->error_count++; in musb_host_packet_rx()
497 urb->actual_length += length; in musb_host_packet_rx()
503 done = (++qh->iso_idx >= urb->number_of_packets); in musb_host_packet_rx()
508 length = urb->transfer_buffer_length - qh->offset; in musb_host_packet_rx()
510 if (urb->status == -EINPROGRESS) in musb_host_packet_rx()
511 urb->status = -EOVERFLOW; in musb_host_packet_rx()
516 urb->actual_length += length; in musb_host_packet_rx()
520 done = (urb->actual_length == urb->transfer_buffer_length) in musb_host_packet_rx()
522 || (urb->status != -EINPROGRESS); in musb_host_packet_rx()
524 && (urb->status == -EINPROGRESS) in musb_host_packet_rx()
525 && (urb->transfer_flags & URB_SHORT_NOT_OK) in musb_host_packet_rx()
526 && (urb->actual_length in musb_host_packet_rx()
527 < urb->transfer_buffer_length)) in musb_host_packet_rx()
528 urb->status = -EREMOTEIO; in musb_host_packet_rx()
623 struct urb *urb, u32 offset, u32 length) in musb_tx_dma_program() argument
659 mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0; in musb_tx_dma_program()
671 urb->transfer_dma + offset, length)) { in musb_tx_dma_program()
688 struct urb *urb, int is_out, in musb_ep_program() argument
703 epnum, urb, urb->dev->speed, in musb_ep_program()
759 if (usb_gettoggle(urb->dev, qh->epnum, 1)) in musb_ep_program()
813 hw_ep, qh, urb, offset, len)) in musb_ep_program()
833 if (usb_gettoggle(urb->dev, qh->epnum, 0)) in musb_ep_program()
870 packet_sz, !(urb->transfer_flags & in musb_ep_program()
872 urb->transfer_dma + offset, in musb_ep_program()
893 static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb) in musb_h_ep0_continue() argument
904 fifo_dest = urb->transfer_buffer + urb->actual_length; in musb_h_ep0_continue()
905 fifo_count = min_t(size_t, len, urb->transfer_buffer_length - in musb_h_ep0_continue()
906 urb->actual_length); in musb_h_ep0_continue()
908 urb->status = -EOVERFLOW; in musb_h_ep0_continue()
912 urb->actual_length += fifo_count; in musb_h_ep0_continue()
917 } else if (urb->actual_length < in musb_h_ep0_continue()
918 urb->transfer_buffer_length) in musb_h_ep0_continue()
922 request = (struct usb_ctrlrequest *) urb->setup_packet; in musb_h_ep0_continue()
940 urb->transfer_buffer_length - in musb_h_ep0_continue()
941 urb->actual_length); in musb_h_ep0_continue()
943 fifo_dest = (u8 *) (urb->transfer_buffer in musb_h_ep0_continue()
944 + urb->actual_length); in musb_h_ep0_continue()
951 urb->actual_length += fifo_count; in musb_h_ep0_continue()
971 struct urb *urb; in musb_h_ep0_irq() local
982 urb = next_urb(qh); in musb_h_ep0_irq()
991 csr, qh, len, urb, musb->ep0_stage); in musb_h_ep0_irq()
1026 if (urb) in musb_h_ep0_irq()
1027 urb->status = status; in musb_h_ep0_irq()
1046 if (unlikely(!urb)) { in musb_h_ep0_irq()
1057 if (musb_h_ep0_continue(musb, len, urb)) { in musb_h_ep0_irq()
1063 if (usb_pipeout(urb->pipe) in musb_h_ep0_irq()
1064 || !urb->transfer_buffer_length) in musb_h_ep0_irq()
1084 musb_advance_schedule(musb, urb, hw_ep, 1); in musb_h_ep0_irq()
1117 struct urb *urb = next_urb(qh); in musb_host_tx() local
1127 if (!urb) { in musb_host_tx()
1132 pipe = urb->pipe; in musb_host_tx()
1273 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_tx()
1276 if (++qh->iso_idx >= urb->number_of_packets) { in musb_host_tx()
1284 } else if (dma && urb->transfer_buffer_length == qh->offset) { in musb_host_tx()
1290 else if (qh->offset == urb->transfer_buffer_length in musb_host_tx()
1291 && !(urb->transfer_flags in musb_host_tx()
1296 length = urb->transfer_buffer_length - offset; in musb_host_tx()
1305 if (urb->status != -EINPROGRESS) { in musb_host_tx()
1308 status = urb->status; in musb_host_tx()
1313 urb->status = status; in musb_host_tx()
1314 urb->actual_length = qh->offset; in musb_host_tx()
1315 musb_advance_schedule(musb, urb, hw_ep, USB_DIR_OUT); in musb_host_tx()
1318 if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, in musb_host_tx()
1339 usb_hcd_unmap_urb_for_dma(musb_to_hcd(musb), urb); in musb_host_tx()
1340 musb_write_fifo(hw_ep, length, urb->transfer_buffer + offset); in musb_host_tx()
1394 struct urb *urb; in musb_bulk_rx_nak_timeout() local
1411 urb = next_urb(cur_qh); in musb_bulk_rx_nak_timeout()
1415 urb->actual_length += dma->actual_len; in musb_bulk_rx_nak_timeout()
1418 musb_save_toggle(cur_qh, 1, urb); in musb_bulk_rx_nak_timeout()
1438 struct urb *urb; in musb_host_rx() local
1453 urb = next_urb(qh); in musb_host_rx()
1461 if (unlikely(!urb)) { in musb_host_rx()
1472 pipe = urb->pipe; in musb_host_rx()
1475 epnum, rx_csr, urb->actual_length, in musb_host_rx()
1505 if (usb_pipebulk(urb->pipe) in musb_host_rx()
1591 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_rx()
1600 if (++qh->iso_idx >= urb->number_of_packets) in musb_host_rx()
1607 done = (urb->actual_length + xfer_len >= in musb_host_rx()
1608 urb->transfer_buffer_length in musb_host_rx()
1626 } else if (urb->status == -EINPROGRESS) { in musb_host_rx()
1654 urb->transfer_dma in musb_host_rx()
1655 + urb->actual_length, in musb_host_rx()
1657 urb->transfer_buffer_length); in musb_host_rx()
1665 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_rx()
1669 urb->error_count++; in musb_host_rx()
1674 urb->error_count++; in musb_host_rx()
1683 buf = urb->transfer_dma + d->offset; in musb_host_rx()
1686 buf = urb->transfer_dma + in musb_host_rx()
1687 urb->actual_length; in musb_host_rx()
1695 if ((urb->transfer_flags & in musb_host_rx()
1697 && (urb->transfer_buffer_length - in musb_host_rx()
1698 urb->actual_length) in musb_host_rx()
1705 length = urb->transfer_buffer_length; in musb_host_rx()
1765 usb_hcd_unmap_urb_for_dma(musb_to_hcd(musb), urb); in musb_host_rx()
1766 done = musb_host_packet_rx(musb, urb, in musb_host_rx()
1773 urb->actual_length += xfer_len; in musb_host_rx()
1776 if (urb->status == -EINPROGRESS) in musb_host_rx()
1777 urb->status = status; in musb_host_rx()
1778 musb_advance_schedule(musb, urb, hw_ep, USB_DIR_IN); in musb_host_rx()
1799 struct urb *urb = next_urb(qh); in musb_schedule() local
1852 toggle = usb_gettoggle(urb->dev, qh->epnum, !is_in); in musb_schedule()
1920 struct urb *urb, argument
1925 struct usb_host_endpoint *hep = urb->ep;
1937 ret = usb_hcd_link_urb_to_ep(hcd, urb);
1940 urb->hcpriv = qh;
1963 usb_hcd_unlink_urb_from_ep(hcd, urb);
1969 qh->dev = urb->dev;
1985 ok = (usb_pipein(urb->pipe) && musb->hb_iso_rx)
1986 || (usb_pipeout(urb->pipe) && musb->hb_iso_tx);
1997 qh->addr_reg = (u8) usb_pipedevice(urb->pipe);
2001 switch (urb->dev->speed) {
2020 if (urb->dev->speed <= USB_SPEED_FULL) {
2051 struct usb_device *parent = urb->dev->parent;
2053 struct usb_device *parent = usb_dev_get_parent(urb->dev);
2065 if (urb->dev->tt) {
2066 qh->h_port_reg = (u8) urb->dev->ttport;
2067 if (urb->dev->tt->hub)
2069 (u8) urb->dev->tt->hub->devnum;
2070 if (urb->dev->tt->multi)
2074 if (tt_needed(musb, urb->dev)) {
2077 usb_find_usb2_hub_address_port(urb->dev,
2104 urb->hcpriv = qh;
2114 usb_hcd_unlink_urb_from_ep(hcd, urb);
2126 static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) argument
2133 int is_in = usb_pipein(urb->pipe);
2148 urb, status);
2149 urb->actual_length += dma->actual_len;
2180 musb_advance_schedule(ep->musb, urb, ep, is_in);
2190 struct urb *urb, argument
2196 int is_in = usb_pipein(urb->pipe);
2199 dev_dbg(musb->controller, "urb=%p, dev%d ep%d%s\n", urb,
2200 usb_pipedevice(urb->pipe),
2201 usb_pipeendpoint(urb->pipe),
2205 ret = usb_hcd_check_unlink_urb(hcd, urb, status);
2209 qh = urb->hcpriv;
2226 || urb->urb_list.prev != &qh->hep->urb_list
2231 musb_giveback(musb, urb, 0);
2243 ret = musb_cleanup_urb(urb, qh);
2258 struct urb *urb; local
2271 urb = next_urb(qh);
2274 if (!urb->unlinked)
2275 urb->status = -ESHUTDOWN;
2278 musb_cleanup_urb(urb, qh);
2284 urb = next_urb(qh);
2285 urb->status = -ESHUTDOWN;
2286 musb_advance_schedule(musb, urb, qh->hw_ep, is_in);