Lines Matching refs:transaction
108 * @CVMX_USB_STATUS_OK: The transaction / operation finished without
111 * @CVMX_USB_STATUS_CANCEL: The transaction was canceled while in flight
113 * @CVMX_USB_STATUS_ERROR: The transaction aborted with an unexpected
115 * @CVMX_USB_STATUS_STALL: The transaction received a USB STALL response
117 * @CVMX_USB_STATUS_XACTERR: The transaction failed with an error from the
119 * @CVMX_USB_STATUS_DATATGLERR: The transaction failed with a data toggle
121 * @CVMX_USB_STATUS_BABBLEERR: The transaction failed with a babble error
122 * @CVMX_USB_STATUS_FRAMEERR: The transaction failed with a frame error
238 * enum represents all of the possible stages a transaction can
241 * transaction with a simple clearing of bit 0.
255 * struct cvmx_usb_transaction - describes each pending USB transaction
260 * @type: Type of transaction, duplicated of the pipe.
261 * @flags: State flags for this transaction.
270 * @actual_bytes: Actual bytes transfer for this transaction.
304 * @transfer_type: Type of transaction supported by this pipe
1346 * @pipe: Pipe for control transaction
1354 struct cvmx_usb_transaction *transaction =
1355 list_first_entry(&pipe->transactions, typeof(*transaction),
1358 cvmx_phys_to_ptr(transaction->control_header);
1359 int bytes_to_transfer = transaction->buffer_length -
1360 transaction->actual_bytes;
1367 switch (transaction->stage) {
1385 transaction->control_header);
1490 * Start a channel to perform the pipe's head transaction
1499 struct cvmx_usb_transaction *transaction =
1500 list_first_entry(&pipe->transactions, typeof(*transaction),
1566 u64 dma_address = transaction->buffer +
1567 transaction->actual_bytes;
1569 if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
1570 dma_address = transaction->buffer +
1571 transaction->iso_packets[0].offset +
1572 transaction->actual_bytes;
1586 int bytes_to_transfer = transaction->buffer_length -
1587 transaction->actual_bytes;
1593 if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
1595 transaction->iso_packets[0].length -
1596 transaction->actual_bytes;
1609 if ((transaction->stage & 1) == 0) {
1610 if (transaction->type == CVMX_USB_TRANSFER_BULK)
1623 usbc_hcsplt.s.compsplt = (transaction->stage ==
1652 if (transaction->actual_bytes == 0) {
1775 usbc_hcchar.s.eptype = transaction->type;
1786 /* Do transaction type specific fixups as needed */
1787 switch (transaction->type) {
1821 transaction->xfersize = usbc_hctsiz.s.xfersize;
1822 transaction->pktcnt = usbc_hctsiz.s.pktcnt;
1824 /* Remember when we start a split transaction */
1826 usb->active_split = transaction;
1960 *transaction,
1995 dev_dbg(dev, "ISOCHRONOUS packet=%d of %d status=%d pipe=%p transaction=%p size=%d\n",
1998 transaction, iso_packet[i].length);
2016 dev_dbg(dev, "status=stall pipe=%p transaction=%p size=%d\n",
2017 pipe, transaction, bytes_transferred);
2021 dev_dbg(dev, "status=babble pipe=%p transaction=%p size=%d\n",
2022 pipe, transaction, bytes_transferred);
2026 dev_dbg(dev, "status=short pipe=%p transaction=%p size=%d\n",
2027 pipe, transaction, bytes_transferred);
2034 dev_dbg(dev, "status=%d pipe=%p transaction=%p size=%d\n",
2035 status, pipe, transaction, bytes_transferred);
2046 * Signal the completion of a transaction and free it. The
2047 * transaction will be removed from the pipe transaction list.
2050 * @pipe: Pipe the transaction is on
2051 * @transaction:
2058 struct cvmx_usb_transaction *transaction,
2062 if (usb->active_split == transaction)
2069 if (unlikely(transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)) {
2071 transaction->iso_packets[0].length = transaction->actual_bytes;
2072 transaction->iso_packets[0].status = complete_code;
2078 if ((transaction->iso_number_packets > 1) &&
2081 transaction->actual_bytes = 0;
2083 transaction->iso_number_packets--;
2085 transaction->iso_packets++;
2086 transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
2091 /* Remove the transaction from the pipe list */
2092 list_del(&transaction->node);
2096 transaction,
2097 transaction->actual_bytes,
2098 transaction->urb);
2099 kfree(transaction);
2103 * Submit a usb transaction to a pipe. Called for all types
2109 * @buffer: User buffer for the transaction
2117 * For ISO, the number of packet in the transaction.
2136 struct cvmx_usb_transaction *transaction;
2141 transaction = kzalloc(sizeof(*transaction), GFP_ATOMIC);
2142 if (unlikely(!transaction))
2145 transaction->type = type;
2146 transaction->buffer = buffer;
2147 transaction->buffer_length = buffer_length;
2148 transaction->control_header = control_header;
2150 transaction->iso_start_frame = iso_start_frame;
2151 transaction->iso_number_packets = iso_number_packets;
2152 transaction->iso_packets = iso_packets;
2153 transaction->urb = urb;
2154 if (transaction->type == CVMX_USB_TRANSFER_CONTROL)
2155 transaction->stage = CVMX_USB_STAGE_SETUP;
2157 transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
2160 list_add_tail(&transaction->node, &pipe->transactions);
2162 list_add_tail(&transaction->node, &pipe->transactions);
2173 return transaction;
2183 * Returns: A submitted transaction or NULL on failure.
2207 * Returns: A submitted transaction or NULL on failure.
2232 * Returns: A submitted transaction or NULL on failure.
2263 * Returns: A submitted transaction or NULL on failure.
2285 * can fail if the transaction has already completed before cancel
2292 * @transaction: Transaction to cancel, returned by the submit function.
2298 struct cvmx_usb_transaction *transaction)
2301 * If the transaction is the HEAD of the queue and scheduled. We need to
2304 if (list_first_entry(&pipe->transactions, typeof(*transaction), node) ==
2305 transaction && (pipe->flags & CVMX_USB_PIPE_FLAGS_SCHEDULED)) {
2317 * If the channel isn't enabled then the transaction already
2328 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_CANCEL);
2344 struct cvmx_usb_transaction *transaction, *next;
2346 /* Simply loop through and attempt to cancel each transaction */
2347 list_for_each_entry_safe(transaction, next, &pipe->transactions, node) {
2348 int result = cvmx_usb_cancel(usb, pipe, transaction);
2397 struct cvmx_usb_transaction *transaction,
2402 switch (transaction->stage) {
2406 cvmx_usb_complete(usb, pipe, transaction,
2412 transaction->stage =
2416 cvmx_phys_to_ptr(transaction->control_header);
2418 transaction->stage = CVMX_USB_STAGE_DATA;
2420 transaction->stage = CVMX_USB_STAGE_STATUS;
2426 cvmx_phys_to_ptr(transaction->control_header);
2428 transaction->stage = CVMX_USB_STAGE_DATA;
2430 transaction->stage = CVMX_USB_STAGE_STATUS;
2435 transaction->stage = CVMX_USB_STAGE_DATA_SPLIT_COMPLETE;
2444 transaction->actual_bytes +=
2447 transaction->actual_bytes +=
2453 transaction->stage = CVMX_USB_STAGE_STATUS;
2460 transaction->stage = CVMX_USB_STAGE_STATUS;
2462 transaction->stage = CVMX_USB_STAGE_DATA;
2467 transaction->stage =
2470 cvmx_usb_complete(usb, pipe, transaction,
2474 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
2481 struct cvmx_usb_transaction *transaction,
2488 * an ACK is during a split transaction. For splits we need to continue
2492 if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL)
2493 transaction->stage =
2497 transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
2499 cvmx_usb_complete(usb, pipe, transaction,
2508 cvmx_usb_complete(usb, pipe, transaction,
2515 struct cvmx_usb_transaction *transaction,
2520 if (transaction->stage == CVMX_USB_STAGE_NON_CONTROL) {
2521 transaction->stage =
2525 transaction->stage = CVMX_USB_STAGE_NON_CONTROL;
2528 cvmx_usb_complete(usb, pipe, transaction,
2534 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
2540 struct cvmx_usb_transaction *transaction,
2560 cvmx_usb_complete(usb, pipe, transaction,
2565 if (transaction->stage ==
2574 cvmx_usb_complete(usb, pipe, transaction,
2578 transaction->stage =
2583 cvmx_usb_complete(usb, pipe, transaction, CVMX_USB_STATUS_OK);
2603 struct cvmx_usb_transaction *transaction;
2678 transaction = list_first_entry(&pipe->transactions,
2679 typeof(*transaction),
2681 prefetch(transaction);
2703 packets_processed = transaction->pktcnt - usbc_hctsiz.s.pktcnt;
2711 bytes_this_transfer = transaction->xfersize -
2715 * OUT transaction don't decrement xfersize. Instead pktcnt is
2725 if (bytes_this_transfer > transaction->xfersize)
2726 bytes_this_transfer = transaction->xfersize;
2740 if ((transaction->stage == CVMX_USB_STAGE_SETUP) ||
2741 (transaction->stage == CVMX_USB_STAGE_SETUP_SPLIT_COMPLETE))
2749 transaction->actual_bytes += bytes_this_transfer;
2750 if (transaction->type == CVMX_USB_TRANSFER_ISOCHRONOUS)
2751 buffer_space_left = transaction->iso_packets[0].length -
2752 transaction->actual_bytes;
2754 buffer_space_left = transaction->buffer_length -
2755 transaction->actual_bytes;
2758 * We need to remember the PID toggle state for the next transaction.
2759 * The hardware already updated it for the next transaction
2764 * For high speed bulk out, assume the next transaction will need to do
2777 * such case we just need to fail every transaction.
2779 cvmx_usb_complete(usb, pipe, transaction,
2786 * STALL as a response means this transaction cannot be
2792 cvmx_usb_complete(usb, pipe, transaction,
2800 cvmx_usb_complete(usb, pipe, transaction,
2804 cvmx_usb_complete(usb, pipe, transaction,
2808 cvmx_usb_complete(usb, pipe, transaction,
2813 * response to a ping, as a response to a split transaction, and
2818 transaction->retries = 0;
2821 * again. Otherwise this transaction is complete
2826 transaction,
2834 transaction->retries++;
2835 if ((transaction->retries & 0x3) == 0) {
2837 * Rewind to the beginning of the transaction by
2840 transaction->stage &= ~1;
2845 transaction->retries = 0;
2859 switch (transaction->type) {
2861 cvmx_usb_transfer_control(usb, pipe, transaction,
2867 cvmx_usb_transfer_bulk(usb, pipe, transaction,
2872 cvmx_usb_transfer_intr(usb, pipe, transaction,
2877 cvmx_usb_transfer_isoc(usb, pipe, transaction,
2887 if (usb->active_split == transaction)
2891 * transaction, but it should be retried in the future. Rewind
2892 * to the beginning of the transaction by anding off the split
2895 transaction->retries = 0;
2896 transaction->stage &= ~1;
2908 /* We'll retry the exact same transaction again */
2909 transaction->retries++;
2915 cvmx_usb_complete(usb, pipe, transaction,
3073 struct cvmx_usb_transaction *transaction = NULL;
3202 transaction = cvmx_usb_submit_isochronous(usb,
3208 if (!transaction) {
3218 transaction = cvmx_usb_submit_interrupt(usb, pipe, urb);
3224 transaction = cvmx_usb_submit_control(usb, pipe, urb);
3230 transaction = cvmx_usb_submit_bulk(usb, pipe, urb);
3233 if (!transaction) {
3239 urb->hcpriv = transaction;