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()
957 struct spi_transfer *xfer; in __spi_map_msg() local
973 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in __spi_map_msg()
974 if (!ctlr->can_dma(ctlr, msg->spi, xfer)) in __spi_map_msg()
977 if (xfer->tx_buf != NULL) { in __spi_map_msg()
978 ret = spi_map_buf(ctlr, tx_dev, &xfer->tx_sg, in __spi_map_msg()
979 (void *)xfer->tx_buf, xfer->len, in __spi_map_msg()
985 if (xfer->rx_buf != NULL) { in __spi_map_msg()
986 ret = spi_map_buf(ctlr, rx_dev, &xfer->rx_sg, in __spi_map_msg()
987 xfer->rx_buf, xfer->len, in __spi_map_msg()
990 spi_unmap_buf(ctlr, tx_dev, &xfer->tx_sg, in __spi_map_msg()
1004 struct spi_transfer *xfer; in __spi_unmap_msg() local
1020 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in __spi_unmap_msg()
1021 if (!ctlr->can_dma(ctlr, msg->spi, xfer)) in __spi_unmap_msg()
1024 spi_unmap_buf(ctlr, rx_dev, &xfer->rx_sg, DMA_FROM_DEVICE); in __spi_unmap_msg()
1025 spi_unmap_buf(ctlr, tx_dev, &xfer->tx_sg, DMA_TO_DEVICE); in __spi_unmap_msg()
1049 struct spi_transfer *xfer; in spi_unmap_msg() local
1051 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_unmap_msg()
1056 if (xfer->tx_buf == ctlr->dummy_tx) in spi_unmap_msg()
1057 xfer->tx_buf = NULL; in spi_unmap_msg()
1058 if (xfer->rx_buf == ctlr->dummy_rx) in spi_unmap_msg()
1059 xfer->rx_buf = NULL; in spi_unmap_msg()
1067 struct spi_transfer *xfer; in spi_map_msg() local
1076 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_map_msg()
1078 !xfer->tx_buf) in spi_map_msg()
1079 max_tx = max(xfer->len, max_tx); in spi_map_msg()
1081 !xfer->rx_buf) in spi_map_msg()
1082 max_rx = max(xfer->len, max_rx); in spi_map_msg()
1103 list_for_each_entry(xfer, &msg->transfers, in spi_map_msg()
1105 if (!xfer->len) in spi_map_msg()
1107 if (!xfer->tx_buf) in spi_map_msg()
1108 xfer->tx_buf = ctlr->dummy_tx; in spi_map_msg()
1109 if (!xfer->rx_buf) in spi_map_msg()
1110 xfer->rx_buf = ctlr->dummy_rx; in spi_map_msg()
1120 struct spi_transfer *xfer) in spi_transfer_wait() argument
1124 u32 speed_hz = xfer->speed_hz; in spi_transfer_wait()
1136 ms = 8LL * 1000LL * xfer->len; in spi_transfer_wait()
1174 int spi_delay_to_ns(struct spi_delay *_delay, struct spi_transfer *xfer) in spi_delay_to_ns() argument
1191 if (!xfer) in spi_delay_to_ns()
1196 hz = xfer->effective_speed_hz ?: xfer->speed_hz / 2; in spi_delay_to_ns()
1209 int spi_delay_exec(struct spi_delay *_delay, struct spi_transfer *xfer) in spi_delay_exec() argument
1218 delay = spi_delay_to_ns(_delay, xfer); in spi_delay_exec()
1229 struct spi_transfer *xfer) in _spi_transfer_cs_change_delay() argument
1231 u32 delay = xfer->cs_change_delay.value; in _spi_transfer_cs_change_delay()
1232 u32 unit = xfer->cs_change_delay.unit; in _spi_transfer_cs_change_delay()
1242 ret = spi_delay_exec(&xfer->cs_change_delay, xfer); in _spi_transfer_cs_change_delay()
1261 struct spi_transfer *xfer; in spi_transfer_one_message() local
1272 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_transfer_one_message()
1273 trace_spi_transfer_start(msg, xfer); in spi_transfer_one_message()
1275 spi_statistics_add_transfer_stats(statm, xfer, ctlr); in spi_transfer_one_message()
1276 spi_statistics_add_transfer_stats(stats, xfer, ctlr); in spi_transfer_one_message()
1279 xfer->ptp_sts_word_pre = 0; in spi_transfer_one_message()
1280 ptp_read_system_prets(xfer->ptp_sts); in spi_transfer_one_message()
1283 if ((xfer->tx_buf || xfer->rx_buf) && xfer->len) { in spi_transfer_one_message()
1287 ret = ctlr->transfer_one(ctlr, msg->spi, xfer); in spi_transfer_one_message()
1290 (xfer->error & SPI_TRANS_FAIL_NO_START)) { in spi_transfer_one_message()
1293 xfer->error &= ~SPI_TRANS_FAIL_NO_START; in spi_transfer_one_message()
1307 ret = spi_transfer_wait(ctlr, msg, xfer); in spi_transfer_one_message()
1312 if (xfer->len) in spi_transfer_one_message()
1315 xfer->len); in spi_transfer_one_message()
1319 ptp_read_system_postts(xfer->ptp_sts); in spi_transfer_one_message()
1320 xfer->ptp_sts_word_post = xfer->len; in spi_transfer_one_message()
1323 trace_spi_transfer_stop(msg, xfer); in spi_transfer_one_message()
1328 spi_transfer_delay_exec(xfer); in spi_transfer_one_message()
1330 if (xfer->cs_change) { in spi_transfer_one_message()
1331 if (list_is_last(&xfer->transfer_list, in spi_transfer_one_message()
1336 _spi_transfer_cs_change_delay(msg, xfer); in spi_transfer_one_message()
1341 msg->actual_length += xfer->len; in spi_transfer_one_message()
1396 struct spi_transfer *xfer; in __spi_pump_messages() local
1528 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in __spi_pump_messages()
1529 xfer->ptp_sts_word_pre = 0; in __spi_pump_messages()
1530 ptp_read_system_prets(xfer->ptp_sts); in __spi_pump_messages()
1583 struct spi_transfer *xfer, in spi_take_timestamp_pre() argument
1586 if (!xfer->ptp_sts) in spi_take_timestamp_pre()
1589 if (xfer->timestamped) in spi_take_timestamp_pre()
1592 if (progress > xfer->ptp_sts_word_pre) in spi_take_timestamp_pre()
1596 xfer->ptp_sts_word_pre = progress; in spi_take_timestamp_pre()
1603 ptp_read_system_prets(xfer->ptp_sts); in spi_take_timestamp_pre()
1620 struct spi_transfer *xfer, in spi_take_timestamp_post() argument
1623 if (!xfer->ptp_sts) in spi_take_timestamp_post()
1626 if (xfer->timestamped) in spi_take_timestamp_post()
1629 if (progress < xfer->ptp_sts_word_post) in spi_take_timestamp_post()
1632 ptp_read_system_postts(xfer->ptp_sts); in spi_take_timestamp_post()
1640 xfer->ptp_sts_word_post = progress; in spi_take_timestamp_post()
1642 xfer->timestamped = true; in spi_take_timestamp_post()
1728 struct spi_transfer *xfer; in spi_finalize_current_message() local
1738 list_for_each_entry(xfer, &mesg->transfers, transfer_list) { in spi_finalize_current_message()
1739 ptp_read_system_postts(xfer->ptp_sts); in spi_finalize_current_message()
1740 xfer->ptp_sts_word_post = xfer->len; in spi_finalize_current_message()
1745 list_for_each_entry(xfer, &mesg->transfers, transfer_list) in spi_finalize_current_message()
1746 WARN_ON_ONCE(xfer->ptp_sts && !xfer->timestamped); in spi_finalize_current_message()
3113 struct spi_transfer *xfer; in spi_replace_transfers() local
3172 xfer = &rxfer->inserted_transfers[insert - 1 - i]; in spi_replace_transfers()
3175 memcpy(xfer, xfer_first, sizeof(*xfer)); in spi_replace_transfers()
3178 list_add(&xfer->transfer_list, rxfer->replaced_after); in spi_replace_transfers()
3182 xfer->cs_change = false; in spi_replace_transfers()
3183 xfer->delay_usecs = 0; in spi_replace_transfers()
3184 xfer->delay.value = 0; in spi_replace_transfers()
3204 struct spi_transfer *xfer = *xferp, *xfers; in __spi_split_transfer_maxsize() local
3210 count = DIV_ROUND_UP(xfer->len, maxsize); in __spi_split_transfer_maxsize()
3213 srt = spi_replace_transfers(msg, xfer, 1, count, NULL, 0, gfp); in __spi_split_transfer_maxsize()
3231 xfers[0].len = min_t(size_t, maxsize, xfer[0].len); in __spi_split_transfer_maxsize()
3279 struct spi_transfer *xfer; in spi_split_transfers_maxsize() local
3288 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in spi_split_transfers_maxsize()
3289 if (xfer->len > maxsize) { in spi_split_transfers_maxsize()
3290 ret = __spi_split_transfer_maxsize(ctlr, msg, &xfer, in spi_split_transfers_maxsize()
3496 static int _spi_xfer_word_delay_update(struct spi_transfer *xfer, in _spi_xfer_word_delay_update() argument
3501 delay1 = spi_delay_to_ns(&xfer->word_delay, xfer); in _spi_xfer_word_delay_update()
3505 delay2 = spi_delay_to_ns(&spi->word_delay, xfer); in _spi_xfer_word_delay_update()
3510 memcpy(&xfer->word_delay, &spi->word_delay, in _spi_xfer_word_delay_update()
3511 sizeof(xfer->word_delay)); in _spi_xfer_word_delay_update()
3519 struct spi_transfer *xfer; in __spi_validate() local
3547 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_validate()
3549 if (list_is_last(&xfer->transfer_list, &message->transfers)) in __spi_validate()
3551 xfer->cs_change = 1; in __spi_validate()
3564 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_validate()
3565 if (xfer->rx_buf && xfer->tx_buf) in __spi_validate()
3567 if ((flags & SPI_CONTROLLER_NO_TX) && xfer->tx_buf) in __spi_validate()
3569 if ((flags & SPI_CONTROLLER_NO_RX) && xfer->rx_buf) in __spi_validate()
3583 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_validate()
3584 xfer->effective_speed_hz = 0; in __spi_validate()
3585 message->frame_length += xfer->len; in __spi_validate()
3586 if (!xfer->bits_per_word) in __spi_validate()
3587 xfer->bits_per_word = spi->bits_per_word; in __spi_validate()
3589 if (!xfer->speed_hz) in __spi_validate()
3590 xfer->speed_hz = spi->max_speed_hz; in __spi_validate()
3592 if (ctlr->max_speed_hz && xfer->speed_hz > ctlr->max_speed_hz) in __spi_validate()
3593 xfer->speed_hz = ctlr->max_speed_hz; in __spi_validate()
3595 if (__spi_validate_bits_per_word(ctlr, xfer->bits_per_word)) in __spi_validate()
3602 if (xfer->bits_per_word <= 8) in __spi_validate()
3604 else if (xfer->bits_per_word <= 16) in __spi_validate()
3610 if (xfer->len % w_size) in __spi_validate()
3613 if (xfer->speed_hz && ctlr->min_speed_hz && in __spi_validate()
3614 xfer->speed_hz < ctlr->min_speed_hz) in __spi_validate()
3617 if (xfer->tx_buf && !xfer->tx_nbits) in __spi_validate()
3618 xfer->tx_nbits = SPI_NBITS_SINGLE; in __spi_validate()
3619 if (xfer->rx_buf && !xfer->rx_nbits) in __spi_validate()
3620 xfer->rx_nbits = SPI_NBITS_SINGLE; in __spi_validate()
3625 if (xfer->tx_buf) { in __spi_validate()
3626 if (xfer->tx_nbits != SPI_NBITS_SINGLE && in __spi_validate()
3627 xfer->tx_nbits != SPI_NBITS_DUAL && in __spi_validate()
3628 xfer->tx_nbits != SPI_NBITS_QUAD) in __spi_validate()
3630 if ((xfer->tx_nbits == SPI_NBITS_DUAL) && in __spi_validate()
3633 if ((xfer->tx_nbits == SPI_NBITS_QUAD) && in __spi_validate()
3638 if (xfer->rx_buf) { in __spi_validate()
3639 if (xfer->rx_nbits != SPI_NBITS_SINGLE && in __spi_validate()
3640 xfer->rx_nbits != SPI_NBITS_DUAL && in __spi_validate()
3641 xfer->rx_nbits != SPI_NBITS_QUAD) in __spi_validate()
3643 if ((xfer->rx_nbits == SPI_NBITS_DUAL) && in __spi_validate()
3646 if ((xfer->rx_nbits == SPI_NBITS_QUAD) && in __spi_validate()
3651 if (_spi_xfer_word_delay_update(xfer, spi)) in __spi_validate()
3663 struct spi_transfer *xfer; in __spi_async() local
3680 list_for_each_entry(xfer, &message->transfers, transfer_list) { in __spi_async()
3681 xfer->ptp_sts_word_pre = 0; in __spi_async()
3682 ptp_read_system_prets(xfer->ptp_sts); in __spi_async()