Lines Matching refs:urb
83 struct urb *urb, int is_out,
193 struct urb *urb = next_urb(qh); in musb_start_urb() local
194 void *buf = urb->transfer_buffer; in musb_start_urb()
197 unsigned pipe = urb->pipe; in musb_start_urb()
211 buf = urb->setup_packet; in musb_start_urb()
218 offset = urb->iso_frame_desc[0].offset; in musb_start_urb()
219 len = urb->iso_frame_desc[0].length; in musb_start_urb()
224 buf = urb->transfer_buffer + urb->actual_length; in musb_start_urb()
225 len = urb->transfer_buffer_length - urb->actual_length; in musb_start_urb()
229 qh, urb, address, qh->epnum, in musb_start_urb()
243 musb_ep_program(musb, epnum, urb, !is_in, buf, offset, len); in musb_start_urb()
261 if ((urb->transfer_flags & URB_ISO_ASAP) in musb_start_urb()
262 || (frame >= urb->start_frame)) { in musb_start_urb()
270 qh->frame = urb->start_frame; in musb_start_urb()
293 static void musb_giveback(struct musb *musb, struct urb *urb, int status) in musb_giveback() argument
299 urb, urb->complete, status, in musb_giveback()
300 usb_pipedevice(urb->pipe), in musb_giveback()
301 usb_pipeendpoint(urb->pipe), in musb_giveback()
302 usb_pipein(urb->pipe) ? "in" : "out", in musb_giveback()
303 urb->actual_length, urb->transfer_buffer_length in musb_giveback()
306 usb_hcd_unlink_urb_from_ep(musb_to_hcd(musb), urb); in musb_giveback()
308 usb_hcd_giveback_urb(musb_to_hcd(musb), urb, status); in musb_giveback()
314 struct urb *urb) in musb_save_toggle() argument
329 usb_settoggle(urb->dev, qh->epnum, !is_in, csr ? 1 : 0); in musb_save_toggle()
339 static void musb_advance_schedule(struct musb *musb, struct urb *urb, in musb_advance_schedule() argument
347 status = (urb->status == -EINPROGRESS) ? 0 : urb->status; in musb_advance_schedule()
353 musb_save_toggle(qh, is_in, urb); in musb_advance_schedule()
357 if (status == 0 && urb->error_count) in musb_advance_schedule()
364 musb_giveback(musb, urb, status); in musb_advance_schedule()
449 musb_host_packet_rx(struct musb *musb, struct urb *urb, u8 epnum, u8 iso_err) in musb_host_packet_rx() argument
460 int pipe = urb->pipe; in musb_host_packet_rx()
461 void *buffer = urb->transfer_buffer; in musb_host_packet_rx()
466 urb->transfer_buffer, qh->offset, in musb_host_packet_rx()
467 urb->transfer_buffer_length); in musb_host_packet_rx()
477 urb->error_count++; in musb_host_packet_rx()
480 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_packet_rx()
486 urb->error_count++; in musb_host_packet_rx()
492 urb->actual_length += length; in musb_host_packet_rx()
498 done = (++qh->iso_idx >= urb->number_of_packets); in musb_host_packet_rx()
503 length = urb->transfer_buffer_length - qh->offset; in musb_host_packet_rx()
505 if (urb->status == -EINPROGRESS) in musb_host_packet_rx()
506 urb->status = -EOVERFLOW; in musb_host_packet_rx()
511 urb->actual_length += length; in musb_host_packet_rx()
515 done = (urb->actual_length == urb->transfer_buffer_length) in musb_host_packet_rx()
517 || (urb->status != -EINPROGRESS); in musb_host_packet_rx()
519 && (urb->status == -EINPROGRESS) in musb_host_packet_rx()
520 && (urb->transfer_flags & URB_SHORT_NOT_OK) in musb_host_packet_rx()
521 && (urb->actual_length in musb_host_packet_rx()
522 < urb->transfer_buffer_length)) in musb_host_packet_rx()
523 urb->status = -EREMOTEIO; in musb_host_packet_rx()
618 struct urb *urb, u32 offset, u32 length) in musb_tx_dma_program() argument
654 mode = (urb->transfer_flags & URB_ZERO_PACKET) ? 1 : 0; in musb_tx_dma_program()
666 urb->transfer_dma + offset, length)) { in musb_tx_dma_program()
683 struct urb *urb, int is_out, in musb_ep_program() argument
698 epnum, urb, urb->dev->speed, in musb_ep_program()
754 if (usb_gettoggle(urb->dev, qh->epnum, 1)) in musb_ep_program()
808 hw_ep, qh, urb, offset, len)) in musb_ep_program()
828 if (usb_gettoggle(urb->dev, qh->epnum, 0)) in musb_ep_program()
865 packet_sz, !(urb->transfer_flags & in musb_ep_program()
867 urb->transfer_dma + offset, in musb_ep_program()
888 static bool musb_h_ep0_continue(struct musb *musb, u16 len, struct urb *urb) in musb_h_ep0_continue() argument
899 fifo_dest = urb->transfer_buffer + urb->actual_length; in musb_h_ep0_continue()
900 fifo_count = min_t(size_t, len, urb->transfer_buffer_length - in musb_h_ep0_continue()
901 urb->actual_length); in musb_h_ep0_continue()
903 urb->status = -EOVERFLOW; in musb_h_ep0_continue()
907 urb->actual_length += fifo_count; in musb_h_ep0_continue()
912 } else if (urb->actual_length < in musb_h_ep0_continue()
913 urb->transfer_buffer_length) in musb_h_ep0_continue()
917 request = (struct usb_ctrlrequest *) urb->setup_packet; in musb_h_ep0_continue()
935 urb->transfer_buffer_length - in musb_h_ep0_continue()
936 urb->actual_length); in musb_h_ep0_continue()
938 fifo_dest = (u8 *) (urb->transfer_buffer in musb_h_ep0_continue()
939 + urb->actual_length); in musb_h_ep0_continue()
946 urb->actual_length += fifo_count; in musb_h_ep0_continue()
966 struct urb *urb; in musb_h_ep0_irq() local
977 urb = next_urb(qh); in musb_h_ep0_irq()
986 csr, qh, len, urb, musb->ep0_stage); in musb_h_ep0_irq()
1021 if (urb) in musb_h_ep0_irq()
1022 urb->status = status; in musb_h_ep0_irq()
1041 if (unlikely(!urb)) { in musb_h_ep0_irq()
1052 if (musb_h_ep0_continue(musb, len, urb)) { in musb_h_ep0_irq()
1058 if (usb_pipeout(urb->pipe) in musb_h_ep0_irq()
1059 || !urb->transfer_buffer_length) in musb_h_ep0_irq()
1079 musb_advance_schedule(musb, urb, hw_ep, 1); in musb_h_ep0_irq()
1112 struct urb *urb = next_urb(qh); in musb_host_tx() local
1122 if (!urb) { in musb_host_tx()
1127 pipe = urb->pipe; in musb_host_tx()
1268 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_tx()
1271 if (++qh->iso_idx >= urb->number_of_packets) { in musb_host_tx()
1279 } else if (dma && urb->transfer_buffer_length == qh->offset) { in musb_host_tx()
1285 else if (qh->offset == urb->transfer_buffer_length in musb_host_tx()
1286 && !(urb->transfer_flags in musb_host_tx()
1291 length = urb->transfer_buffer_length - offset; in musb_host_tx()
1300 if (urb->status != -EINPROGRESS) { in musb_host_tx()
1303 status = urb->status; in musb_host_tx()
1308 urb->status = status; in musb_host_tx()
1309 urb->actual_length = qh->offset; in musb_host_tx()
1310 musb_advance_schedule(musb, urb, hw_ep, USB_DIR_OUT); in musb_host_tx()
1313 if (musb_tx_dma_program(musb->dma_controller, hw_ep, qh, urb, in musb_host_tx()
1334 usb_hcd_unmap_urb_for_dma(musb_to_hcd(musb), urb); in musb_host_tx()
1335 musb_write_fifo(hw_ep, length, urb->transfer_buffer + offset); in musb_host_tx()
1389 struct urb *urb; in musb_bulk_rx_nak_timeout() local
1406 urb = next_urb(cur_qh); in musb_bulk_rx_nak_timeout()
1410 urb->actual_length += dma->actual_len; in musb_bulk_rx_nak_timeout()
1413 musb_save_toggle(cur_qh, 1, urb); in musb_bulk_rx_nak_timeout()
1433 struct urb *urb; in musb_host_rx() local
1448 urb = next_urb(qh); in musb_host_rx()
1456 if (unlikely(!urb)) { in musb_host_rx()
1467 pipe = urb->pipe; in musb_host_rx()
1470 epnum, rx_csr, urb->actual_length, in musb_host_rx()
1500 if (usb_pipebulk(urb->pipe) in musb_host_rx()
1586 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_rx()
1595 if (++qh->iso_idx >= urb->number_of_packets) in musb_host_rx()
1602 done = (urb->actual_length + xfer_len >= in musb_host_rx()
1603 urb->transfer_buffer_length in musb_host_rx()
1621 } else if (urb->status == -EINPROGRESS) { in musb_host_rx()
1649 urb->transfer_dma in musb_host_rx()
1650 + urb->actual_length, in musb_host_rx()
1652 urb->transfer_buffer_length); in musb_host_rx()
1660 d = urb->iso_frame_desc + qh->iso_idx; in musb_host_rx()
1664 urb->error_count++; in musb_host_rx()
1669 urb->error_count++; in musb_host_rx()
1678 buf = urb->transfer_dma + d->offset; in musb_host_rx()
1681 buf = urb->transfer_dma + in musb_host_rx()
1682 urb->actual_length; in musb_host_rx()
1690 if ((urb->transfer_flags & in musb_host_rx()
1692 && (urb->transfer_buffer_length - in musb_host_rx()
1693 urb->actual_length) in musb_host_rx()
1700 length = urb->transfer_buffer_length; in musb_host_rx()
1760 usb_hcd_unmap_urb_for_dma(musb_to_hcd(musb), urb); in musb_host_rx()
1761 done = musb_host_packet_rx(musb, urb, in musb_host_rx()
1768 urb->actual_length += xfer_len; in musb_host_rx()
1771 if (urb->status == -EINPROGRESS) in musb_host_rx()
1772 urb->status = status; in musb_host_rx()
1773 musb_advance_schedule(musb, urb, hw_ep, USB_DIR_IN); in musb_host_rx()
1794 struct urb *urb = next_urb(qh); in musb_schedule() local
1847 toggle = usb_gettoggle(urb->dev, qh->epnum, !is_in); in musb_schedule()
1915 struct urb *urb, argument
1920 struct usb_host_endpoint *hep = urb->ep;
1932 ret = usb_hcd_link_urb_to_ep(hcd, urb);
1935 urb->hcpriv = qh;
1958 usb_hcd_unlink_urb_from_ep(hcd, urb);
1964 qh->dev = urb->dev;
1980 ok = (usb_pipein(urb->pipe) && musb->hb_iso_rx)
1981 || (usb_pipeout(urb->pipe) && musb->hb_iso_tx);
1992 qh->addr_reg = (u8) usb_pipedevice(urb->pipe);
1996 switch (urb->dev->speed) {
2015 if (urb->dev->speed <= USB_SPEED_FULL) {
2046 struct usb_device *parent = urb->dev->parent;
2048 struct usb_device *parent = usb_dev_get_parent(urb->dev);
2060 if (urb->dev->tt) {
2061 qh->h_port_reg = (u8) urb->dev->ttport;
2062 if (urb->dev->tt->hub)
2064 (u8) urb->dev->tt->hub->devnum;
2065 if (urb->dev->tt->multi)
2069 if (tt_needed(musb, urb->dev)) {
2072 usb_find_usb2_hub_address_port(urb->dev,
2099 urb->hcpriv = qh;
2109 usb_hcd_unlink_urb_from_ep(hcd, urb);
2121 static int musb_cleanup_urb(struct urb *urb, struct musb_qh *qh) argument
2128 int is_in = usb_pipein(urb->pipe);
2143 urb, status);
2144 urb->actual_length += dma->actual_len;
2175 musb_advance_schedule(ep->musb, urb, ep, is_in);
2185 struct urb *urb, argument
2191 int is_in = usb_pipein(urb->pipe);
2194 dev_dbg(musb->controller, "urb=%p, dev%d ep%d%s\n", urb,
2195 usb_pipedevice(urb->pipe),
2196 usb_pipeendpoint(urb->pipe),
2200 ret = usb_hcd_check_unlink_urb(hcd, urb, status);
2204 qh = urb->hcpriv;
2221 || urb->urb_list.prev != &qh->hep->urb_list
2226 musb_giveback(musb, urb, 0);
2238 ret = musb_cleanup_urb(urb, qh);
2253 struct urb *urb; local
2266 urb = next_urb(qh);
2269 if (!urb->unlinked)
2270 urb->status = -ESHUTDOWN;
2273 musb_cleanup_urb(urb, qh);
2279 urb = next_urb(qh);
2280 urb->status = -ESHUTDOWN;
2281 musb_advance_schedule(musb, urb, qh->hw_ep, is_in);