Lines Matching refs:xfer
227 static void hci_pio_write_cmd(struct i3c_hci *hci, struct hci_xfer *xfer) in hci_pio_write_cmd() argument
229 DBG("cmd_desc[%d] = 0x%08x", 0, xfer->cmd_desc[0]); in hci_pio_write_cmd()
230 DBG("cmd_desc[%d] = 0x%08x", 1, xfer->cmd_desc[1]); in hci_pio_write_cmd()
231 pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[0]); in hci_pio_write_cmd()
232 pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[1]); in hci_pio_write_cmd()
234 DBG("cmd_desc[%d] = 0x%08x", 2, xfer->cmd_desc[2]); in hci_pio_write_cmd()
235 DBG("cmd_desc[%d] = 0x%08x", 3, xfer->cmd_desc[3]); in hci_pio_write_cmd()
236 pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[2]); in hci_pio_write_cmd()
237 pio_reg_write(COMMAND_QUEUE_PORT, xfer->cmd_desc[3]); in hci_pio_write_cmd()
243 struct hci_xfer *xfer = pio->curr_rx; in hci_pio_do_rx() local
247 p = xfer->data; in hci_pio_do_rx()
248 p += (xfer->data_len - xfer->data_left) / 4; in hci_pio_do_rx()
250 while (xfer->data_left >= 4) { in hci_pio_do_rx()
254 nr_words = min(xfer->data_left / 4, pio->rx_thresh_size); in hci_pio_do_rx()
256 xfer->data_left -= nr_words * 4; in hci_pio_do_rx()
257 DBG("now %d left %d", nr_words * 4, xfer->data_left); in hci_pio_do_rx()
263 return !xfer->data_left; in hci_pio_do_rx()
269 struct hci_xfer *xfer = pio->curr_rx; in hci_pio_do_trailing_rx() local
274 p = xfer->data; in hci_pio_do_trailing_rx()
275 p += (xfer->data_len - xfer->data_left) / 4; in hci_pio_do_trailing_rx()
280 xfer->data_left -= nr_words * 4; in hci_pio_do_trailing_rx()
281 DBG("now %d left %d", nr_words * 4, xfer->data_left); in hci_pio_do_trailing_rx()
297 xfer->data_word_before_partial = data; in hci_pio_do_trailing_rx()
298 xfer->data_left -= count; in hci_pio_do_trailing_rx()
309 struct hci_xfer *xfer = pio->curr_tx; in hci_pio_do_tx() local
313 p = xfer->data; in hci_pio_do_tx()
314 p += (xfer->data_len - xfer->data_left) / 4; in hci_pio_do_tx()
316 while (xfer->data_left >= 4) { in hci_pio_do_tx()
321 nr_words = min(xfer->data_left / 4, pio->tx_thresh_size); in hci_pio_do_tx()
323 xfer->data_left -= nr_words * 4; in hci_pio_do_tx()
324 DBG("now %d left %d", nr_words * 4, xfer->data_left); in hci_pio_do_tx()
329 if (xfer->data_left) { in hci_pio_do_tx()
339 DBG("trailing %d", xfer->data_left); in hci_pio_do_tx()
341 xfer->data_left = 0; in hci_pio_do_tx()
363 struct hci_xfer *xfer = pio->curr_xfer; in hci_pio_queue_data() local
366 if (!xfer->data) { in hci_pio_queue_data()
367 xfer->data_len = xfer->data_left = 0; in hci_pio_queue_data()
371 if (xfer->rnw) { in hci_pio_queue_data()
373 pio->rx_queue = xfer; in hci_pio_queue_data()
375 prev_queue_tail->next_data = xfer; in hci_pio_queue_data()
377 pio->curr_rx = xfer; in hci_pio_queue_data()
383 pio->tx_queue = xfer; in hci_pio_queue_data()
385 prev_queue_tail->next_data = xfer; in hci_pio_queue_data()
387 pio->curr_tx = xfer; in hci_pio_queue_data()
394 static void hci_pio_push_to_next_rx(struct i3c_hci *hci, struct hci_xfer *xfer, in hci_pio_push_to_next_rx() argument
397 u32 *from = xfer->data; in hci_pio_push_to_next_rx()
401 received = (xfer->data_len - xfer->data_left) / 4; in hci_pio_push_to_next_rx()
402 if ((xfer->data_len - xfer->data_left) & 3) { in hci_pio_push_to_next_rx()
403 from_last = xfer->data_word_before_partial; in hci_pio_push_to_next_rx()
415 xfer = xfer->next_data; in hci_pio_push_to_next_rx()
416 if (!xfer) { in hci_pio_push_to_next_rx()
421 room = DIV_ROUND_UP(xfer->data_len, 4); in hci_pio_push_to_next_rx()
422 left = DIV_ROUND_UP(xfer->data_left, 4); in hci_pio_push_to_next_rx()
425 hci_pio_push_to_next_rx(hci, xfer, chunk - left); in hci_pio_push_to_next_rx()
427 xfer->data_left = left * 4; in hci_pio_push_to_next_rx()
430 bytes_to_move = xfer->data_len - xfer->data_left; in hci_pio_push_to_next_rx()
433 u32 *p = xfer->data; in hci_pio_push_to_next_rx()
435 xfer->data_word_before_partial = p[bytes_to_move / 4]; in hci_pio_push_to_next_rx()
437 memmove(xfer->data + chunk, xfer->data, bytes_to_move); in hci_pio_push_to_next_rx()
442 memcpy(xfer->data, from, chunk * 4); in hci_pio_push_to_next_rx()
443 xfer->data_left -= chunk * 4; in hci_pio_push_to_next_rx()
448 if (xfer->data_left < 4) { in hci_pio_push_to_next_rx()
454 u8 *p_byte = xfer->data; in hci_pio_push_to_next_rx()
457 xfer->data_word_before_partial = last_word; in hci_pio_push_to_next_rx()
459 while (xfer->data_left--) { in hci_pio_push_to_next_rx()
464 u32 *p = xfer->data; in hci_pio_push_to_next_rx()
467 xfer->data_left -= 4; in hci_pio_push_to_next_rx()
480 struct hci_xfer *xfer = pio->curr_resp; in hci_pio_process_resp() local
485 if (tid != xfer->cmd_tid) { in hci_pio_process_resp()
488 tid, xfer->cmd_tid); in hci_pio_process_resp()
493 xfer->response = resp; in hci_pio_process_resp()
495 if (pio->curr_rx == xfer) { in hci_pio_process_resp()
503 received = xfer->data_len - xfer->data_left; in hci_pio_process_resp()
504 expected = RESP_DATA_LENGTH(xfer->response); in hci_pio_process_resp()
511 hci_pio_push_to_next_rx(hci, xfer, to_keep); in hci_pio_process_resp()
524 if (pio->curr_rx == xfer) { in hci_pio_process_resp()
527 } else if (pio->curr_tx == xfer) { in hci_pio_process_resp()
530 } else if (xfer->data_left) { in hci_pio_process_resp()
532 xfer->data_left); in hci_pio_process_resp()
535 pio->curr_resp = xfer->next_resp; in hci_pio_process_resp()
536 if (xfer->completion) in hci_pio_process_resp()
537 complete(xfer->completion); in hci_pio_process_resp()
544 struct hci_xfer *xfer = pio->curr_xfer; in hci_pio_queue_resp() local
547 if (!(xfer->cmd_desc[0] & CMD_0_ROC)) in hci_pio_queue_resp()
551 pio->resp_queue = xfer; in hci_pio_queue_resp()
553 prev_queue_tail->next_resp = xfer; in hci_pio_queue_resp()
555 pio->curr_resp = xfer; in hci_pio_queue_resp()
588 static int hci_pio_queue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n) in hci_pio_queue_xfer() argument
598 xfer[i].next_xfer = (i + 1 < n) ? &xfer[i + 1] : NULL; in hci_pio_queue_xfer()
599 xfer[i].next_data = NULL; in hci_pio_queue_xfer()
600 xfer[i].next_resp = NULL; in hci_pio_queue_xfer()
601 xfer[i].data_left = xfer[i].data_len; in hci_pio_queue_xfer()
606 pio->xfer_queue = &xfer[n - 1]; in hci_pio_queue_xfer()
608 prev_queue_tail->next_xfer = xfer; in hci_pio_queue_xfer()
610 pio->curr_xfer = xfer; in hci_pio_queue_xfer()
623 struct hci_xfer *xfer, int n) in hci_pio_dequeue_xfer_common() argument
636 if (p == &xfer[i]) in hci_pio_dequeue_xfer_common()
640 if (p == &xfer[i]) in hci_pio_dequeue_xfer_common()
644 if (p == &xfer[i]) in hci_pio_dequeue_xfer_common()
653 if (p == &xfer[0]) { in hci_pio_dequeue_xfer_common()
654 *p_prev_next = xfer[n - 1].next_xfer; in hci_pio_dequeue_xfer_common()
683 static bool hci_pio_dequeue_xfer(struct i3c_hci *hci, struct hci_xfer *xfer, int n) in hci_pio_dequeue_xfer() argument
694 ret = hci_pio_dequeue_xfer_common(hci, pio, xfer, n); in hci_pio_dequeue_xfer()