Lines Matching refs:xfer
289 struct spi_transfer *xfer, in spi_statistics_add_transfer_stats() argument
293 int l2len = min(fls(xfer->len), SPI_STATISTICS_HISTO_SIZE) - 1; in spi_statistics_add_transfer_stats()
303 stats->bytes += xfer->len; in spi_statistics_add_transfer_stats()
304 if ((xfer->tx_buf) && in spi_statistics_add_transfer_stats()
305 (xfer->tx_buf != ctlr->dummy_tx)) in spi_statistics_add_transfer_stats()
306 stats->bytes_tx += xfer->len; in spi_statistics_add_transfer_stats()
307 if ((xfer->rx_buf) && in spi_statistics_add_transfer_stats()
308 (xfer->rx_buf != ctlr->dummy_rx)) in spi_statistics_add_transfer_stats()
309 stats->bytes_rx += xfer->len; in spi_statistics_add_transfer_stats()
1096 struct spi_transfer *xfer; in __spi_map_msg() local
1116 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in __spi_map_msg()
1117 if (!ctlr->can_dma(ctlr, msg->spi, xfer)) in __spi_map_msg()
1120 if (xfer->tx_buf != NULL) { in __spi_map_msg()
1121 ret = spi_map_buf(ctlr, tx_dev, &xfer->tx_sg, in __spi_map_msg()
1122 (void *)xfer->tx_buf, xfer->len, in __spi_map_msg()
1128 if (xfer->rx_buf != NULL) { in __spi_map_msg()
1129 ret = spi_map_buf(ctlr, rx_dev, &xfer->rx_sg, in __spi_map_msg()
1130 xfer->rx_buf, xfer->len, in __spi_map_msg()
1133 spi_unmap_buf(ctlr, tx_dev, &xfer->tx_sg, in __spi_map_msg()
1147 struct spi_transfer *xfer; in __spi_unmap_msg() local
1163 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in __spi_unmap_msg()
1164 if (!ctlr->can_dma(ctlr, msg->spi, xfer)) in __spi_unmap_msg()
1167 spi_unmap_buf(ctlr, rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); in __spi_unmap_msg()
1168 spi_unmap_buf(ctlr, tx_dev, &xfer->tx_sg, DMA_TO_DEVICE); in __spi_unmap_msg()
1192 struct spi_transfer *xfer; in spi_unmap_msg() local
1194 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_unmap_msg()
1199 if (xfer->tx_buf == ctlr->dummy_tx) in spi_unmap_msg()
1200 xfer->tx_buf = NULL; in spi_unmap_msg()
1201 if (xfer->rx_buf == ctlr->dummy_rx) in spi_unmap_msg()
1202 xfer->rx_buf = NULL; in spi_unmap_msg()
1210 struct spi_transfer *xfer; in spi_map_msg() local
1219 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_map_msg()
1221 !xfer->tx_buf) in spi_map_msg()
1222 max_tx = max(xfer->len, max_tx); in spi_map_msg()
1224 !xfer->rx_buf) in spi_map_msg()
1225 max_rx = max(xfer->len, max_rx); in spi_map_msg()
1246 list_for_each_entry(xfer, &msg->transfers, in spi_map_msg()
1248 if (!xfer->len) in spi_map_msg()
1250 if (!xfer->tx_buf) in spi_map_msg()
1251 xfer->tx_buf = ctlr->dummy_tx; in spi_map_msg()
1252 if (!xfer->rx_buf) in spi_map_msg()
1253 xfer->rx_buf = ctlr->dummy_rx; in spi_map_msg()
1263 struct spi_transfer *xfer) in spi_transfer_wait() argument
1267 u32 speed_hz = xfer->speed_hz; in spi_transfer_wait()
1285 ms = 8LL * MSEC_PER_SEC * xfer->len; in spi_transfer_wait()
1327 int spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer) in spi_delay_to_ns() argument
1345 if (!xfer) in spi_delay_to_ns()
1351 hz = xfer->effective_speed_hz ?: xfer->speed_hz / 2; in spi_delay_to_ns()
1366 int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer) in spi_delay_exec() argument
1375 delay = spi_delay_to_ns(_delay, xfer); in spi_delay_exec()
1386 struct spi_transfer *xfer) in _spi_transfer_cs_change_delay() argument
1389 u32 delay = xfer->cs_change_delay.value; in _spi_transfer_cs_change_delay()
1390 u32 unit = xfer->cs_change_delay.unit; in _spi_transfer_cs_change_delay()
1400 ret = spi_delay_exec(&xfer->cs_change_delay, xfer); in _spi_transfer_cs_change_delay()
1419 struct spi_transfer *xfer; in spi_transfer_one_message() local
1430 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_transfer_one_message()
1431 trace_spi_transfer_start(msg, xfer); in spi_transfer_one_message()
1433 spi_statistics_add_transfer_stats(statm, xfer, ctlr); in spi_transfer_one_message()
1434 spi_statistics_add_transfer_stats(stats, xfer, ctlr); in spi_transfer_one_message()
1437 xfer->ptp_sts_word_pre = 0; in spi_transfer_one_message()
1438 ptp_read_system_prets(xfer->ptp_sts); in spi_transfer_one_message()
1441 if ((xfer->tx_buf || xfer->rx_buf) && xfer->len) { in spi_transfer_one_message()
1445 ret = ctlr->transfer_one(ctlr, msg->spi, xfer); in spi_transfer_one_message()
1448 (xfer->error & SPI_TRANS_FAIL_NO_START)) { in spi_transfer_one_message()
1451 xfer->error &= ~SPI_TRANS_FAIL_NO_START; in spi_transfer_one_message()
1465 ret = spi_transfer_wait(ctlr, msg, xfer); in spi_transfer_one_message()
1470 if (xfer->len) in spi_transfer_one_message()
1473 xfer->len); in spi_transfer_one_message()
1477 ptp_read_system_postts(xfer->ptp_sts); in spi_transfer_one_message()
1478 xfer->ptp_sts_word_post = xfer->len; in spi_transfer_one_message()
1481 trace_spi_transfer_stop(msg, xfer); in spi_transfer_one_message()
1486 spi_transfer_delay_exec(xfer); in spi_transfer_one_message()
1488 if (xfer->cs_change) { in spi_transfer_one_message()
1489 if (list_is_last(&xfer->transfer_list, in spi_transfer_one_message()
1494 _spi_transfer_cs_change_delay(msg, xfer); in spi_transfer_one_message()
1499 msg->actual_length += xfer->len; in spi_transfer_one_message()
1554 struct spi_transfer *xfer; in __spi_pump_messages() local
1686 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in __spi_pump_messages()
1687 xfer->ptp_sts_word_pre = 0; in __spi_pump_messages()
1688 ptp_read_system_prets(xfer->ptp_sts); in __spi_pump_messages()
1741 struct spi_transfer *xfer, in spi_take_timestamp_pre() argument
1744 if (!xfer->ptp_sts) in spi_take_timestamp_pre()
1747 if (xfer->timestamped) in spi_take_timestamp_pre()
1750 if (progress > xfer->ptp_sts_word_pre) in spi_take_timestamp_pre()
1754 xfer->ptp_sts_word_pre = progress; in spi_take_timestamp_pre()
1761 ptp_read_system_prets(xfer->ptp_sts); in spi_take_timestamp_pre()
1778 struct spi_transfer *xfer, in spi_take_timestamp_post() argument
1781 if (!xfer->ptp_sts) in spi_take_timestamp_post()
1784 if (xfer->timestamped) in spi_take_timestamp_post()
1787 if (progress < xfer->ptp_sts_word_post) in spi_take_timestamp_post()
1790 ptp_read_system_postts(xfer->ptp_sts); in spi_take_timestamp_post()
1798 xfer->ptp_sts_word_post = progress; in spi_take_timestamp_post()
1800 xfer->timestamped = true; in spi_take_timestamp_post()
1886 struct spi_transfer *xfer; in spi_finalize_current_message() local
1896 list_for_each_entry(xfer, &mesg->transfers, transfer_list) { in spi_finalize_current_message()
1897 ptp_read_system_postts(xfer->ptp_sts); in spi_finalize_current_message()
1898 xfer->ptp_sts_word_post = xfer->len; in spi_finalize_current_message()
1903 list_for_each_entry(xfer, &mesg->transfers, transfer_list) in spi_finalize_current_message()
1904 WARN_ON_ONCE(xfer->ptp_sts && !xfer->timestamped); in spi_finalize_current_message()
3198 struct spi_transfer *xfer; in spi_replace_transfers() local
3257 xfer = &rxfer->inserted_transfers[insert - 1 - i]; in spi_replace_transfers()
3260 memcpy(xfer, xfer_first, sizeof(*xfer)); in spi_replace_transfers()
3263 list_add(&xfer->transfer_list, rxfer->replaced_after); in spi_replace_transfers()
3267 xfer->cs_change = false; in spi_replace_transfers()
3268 xfer->delay.value = 0; in spi_replace_transfers()
3287 struct spi_transfer *xfer = *xferp, *xfers; in __spi_split_transfer_maxsize() local
3293 count = DIV_ROUND_UP(xfer->len, maxsize); in __spi_split_transfer_maxsize()
3296 srt = spi_replace_transfers(msg, xfer, 1, count, NULL, 0, gfp); in __spi_split_transfer_maxsize()
3314 xfers[0].len = min_t(size_t, maxsize, xfer[0].len); in __spi_split_transfer_maxsize()
3362 struct spi_transfer *xfer; in spi_split_transfers_maxsize() local
3371 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_split_transfers_maxsize()
3372 if (xfer->len > maxsize) { in spi_split_transfers_maxsize()
3373 ret = __spi_split_transfer_maxsize(ctlr, msg, &xfer, in spi_split_transfers_maxsize()
3547 static int _spi_xfer_word_delay_update(struct spi_transfer *xfer, in _spi_xfer_word_delay_update() argument
3552 delay1 = spi_delay_to_ns(&xfer->word_delay, xfer); in _spi_xfer_word_delay_update()
3556 delay2 = spi_delay_to_ns(&spi->word_delay, xfer); in _spi_xfer_word_delay_update()
3561 memcpy(&xfer->word_delay, &spi->word_delay, in _spi_xfer_word_delay_update()
3562 sizeof(xfer->word_delay)); in _spi_xfer_word_delay_update()
3570 struct spi_transfer *xfer; in __spi_validate() local
3598 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_validate()
3600 if (list_is_last(&xfer->transfer_list, &message->transfers)) in __spi_validate()
3602 xfer->cs_change = 1; in __spi_validate()
3615 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_validate()
3616 if (xfer->rx_buf && xfer->tx_buf) in __spi_validate()
3618 if ((flags & SPI_CONTROLLER_NO_TX) && xfer->tx_buf) in __spi_validate()
3620 if ((flags & SPI_CONTROLLER_NO_RX) && xfer->rx_buf) in __spi_validate()
3634 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_validate()
3635 xfer->effective_speed_hz = 0; in __spi_validate()
3636 message->frame_length += xfer->len; in __spi_validate()
3637 if (!xfer->bits_per_word) in __spi_validate()
3638 xfer->bits_per_word = spi->bits_per_word; in __spi_validate()
3640 if (!xfer->speed_hz) in __spi_validate()
3641 xfer->speed_hz = spi->max_speed_hz; in __spi_validate()
3643 if (ctlr->max_speed_hz && xfer->speed_hz > ctlr->max_speed_hz) in __spi_validate()
3644 xfer->speed_hz = ctlr->max_speed_hz; in __spi_validate()
3646 if (__spi_validate_bits_per_word(ctlr, xfer->bits_per_word)) in __spi_validate()
3653 if (xfer->bits_per_word <= 8) in __spi_validate()
3655 else if (xfer->bits_per_word <= 16) in __spi_validate()
3661 if (xfer->len % w_size) in __spi_validate()
3664 if (xfer->speed_hz && ctlr->min_speed_hz && in __spi_validate()
3665 xfer->speed_hz < ctlr->min_speed_hz) in __spi_validate()
3668 if (xfer->tx_buf && !xfer->tx_nbits) in __spi_validate()
3669 xfer->tx_nbits = SPI_NBITS_SINGLE; in __spi_validate()
3670 if (xfer->rx_buf && !xfer->rx_nbits) in __spi_validate()
3671 xfer->rx_nbits = SPI_NBITS_SINGLE; in __spi_validate()
3676 if (xfer->tx_buf) { in __spi_validate()
3679 if (xfer->tx_nbits != SPI_NBITS_SINGLE && in __spi_validate()
3680 xfer->tx_nbits != SPI_NBITS_DUAL && in __spi_validate()
3681 xfer->tx_nbits != SPI_NBITS_QUAD) in __spi_validate()
3683 if ((xfer->tx_nbits == SPI_NBITS_DUAL) && in __spi_validate()
3686 if ((xfer->tx_nbits == SPI_NBITS_QUAD) && in __spi_validate()
3691 if (xfer->rx_buf) { in __spi_validate()
3694 if (xfer->rx_nbits != SPI_NBITS_SINGLE && in __spi_validate()
3695 xfer->rx_nbits != SPI_NBITS_DUAL && in __spi_validate()
3696 xfer->rx_nbits != SPI_NBITS_QUAD) in __spi_validate()
3698 if ((xfer->rx_nbits == SPI_NBITS_DUAL) && in __spi_validate()
3701 if ((xfer->rx_nbits == SPI_NBITS_QUAD) && in __spi_validate()
3706 if (_spi_xfer_word_delay_update(xfer, spi)) in __spi_validate()
3718 struct spi_transfer *xfer; in __spi_async() local
3735 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_async()
3736 xfer->ptp_sts_word_pre = 0; in __spi_async()
3737 ptp_read_system_prets(xfer->ptp_sts); in __spi_async()