Lines Matching full:transfer
275 * the SPI transfer machine do its thing. If you want to be able
279 * NOR/NAND devices tend to stop a block transfer.)
371 * Make initial transfer selections based on the transfer sizes
384 * For now only support doing a single FIFO transfer. in qcom_spi_hw_setup_transfer_selection()
385 * The main PIO transfer routine loop will break it up for us. in qcom_spi_hw_setup_transfer_selection()
388 sc->transfer.tx_offset = 0; in qcom_spi_hw_setup_transfer_selection()
389 sc->transfer.rx_offset = 0; in qcom_spi_hw_setup_transfer_selection()
390 sc->transfer.tx_len = 0; in qcom_spi_hw_setup_transfer_selection()
391 sc->transfer.rx_len = 0; in qcom_spi_hw_setup_transfer_selection()
392 sc->transfer.tx_buf = NULL; in qcom_spi_hw_setup_transfer_selection()
393 sc->transfer.rx_buf = NULL; in qcom_spi_hw_setup_transfer_selection()
411 * Blank the transfer state after a full transfer is completed.
419 sc->transfer.tx_offset = 0; in qcom_spi_hw_complete_transfer()
420 sc->transfer.rx_offset = 0; in qcom_spi_hw_complete_transfer()
421 sc->transfer.tx_len = 0; in qcom_spi_hw_complete_transfer()
422 sc->transfer.rx_len = 0; in qcom_spi_hw_complete_transfer()
423 sc->transfer.tx_buf = NULL; in qcom_spi_hw_complete_transfer()
424 sc->transfer.rx_buf = NULL; in qcom_spi_hw_complete_transfer()
430 * Configure up the transfer selection for the current transfer.
432 * This calculates how many words we can transfer in the current
433 * transfer and what's left to transfer.
447 * if the transfer sizes are not symmetrical.) in qcom_spi_hw_setup_current_transfer()
449 bytes_left = sc->transfer.tx_len - sc->transfer.tx_offset; in qcom_spi_hw_setup_current_transfer()
458 sc->transfer.num_words = bytes_left / sc->state.transfer_word_size; in qcom_spi_hw_setup_current_transfer()
459 sc->transfer.num_words = MIN(sc->transfer.num_words, in qcom_spi_hw_setup_current_transfer()
466 * our maximum transfer size will ACTUALLY be capped by in qcom_spi_hw_setup_current_transfer()
467 * SPI_MAX_XFER (65536-64 bytes.) Each transfer in qcom_spi_hw_setup_current_transfer()
469 * last transfer. in qcom_spi_hw_setup_current_transfer()
471 sc->transfer.num_words = bytes_left / sc->state.transfer_word_size; in qcom_spi_hw_setup_current_transfer()
472 sc->transfer.num_words = MIN(sc->transfer.num_words, in qcom_spi_hw_setup_current_transfer()
478 "%s: transfer.tx_len=%u," in qcom_spi_hw_setup_current_transfer()
479 "transfer.tx_offset=%u," in qcom_spi_hw_setup_current_transfer()
483 sc->transfer.tx_len, in qcom_spi_hw_setup_current_transfer()
484 sc->transfer.tx_offset, in qcom_spi_hw_setup_current_transfer()
487 sc->transfer.num_words, in qcom_spi_hw_setup_current_transfer()
494 * Setup the PIO FIFO transfer count.
505 QCOM_SPI_WRITE_4(sc, QUP_MX_READ_CNT, sc->transfer.num_words); in qcom_spi_hw_setup_pio_transfer_cnt()
506 QCOM_SPI_WRITE_4(sc, QUP_MX_WRITE_CNT, sc->transfer.num_words); in qcom_spi_hw_setup_pio_transfer_cnt()
512 sc->transfer.num_words); in qcom_spi_hw_setup_pio_transfer_cnt()
520 * Setup the PIO BLOCK transfer count.
522 * This sets up the total transfer size, in TX/RX FIFO block size
534 QCOM_SPI_WRITE_4(sc, QUP_MX_INPUT_CNT, sc->transfer.num_words); in qcom_spi_hw_setup_block_transfer_cnt()
535 QCOM_SPI_WRITE_4(sc, QUP_MX_OUTPUT_CNT, sc->transfer.num_words); in qcom_spi_hw_setup_block_transfer_cnt()
559 * see the pio/block transfer routines. in qcom_spi_hw_setup_io_modes()
566 /* Transfer mode */ in qcom_spi_hw_setup_io_modes()
613 * or the clock/transfer phase. When we do then here's where we in qcom_spi_hw_setup_spi_config()
748 if (sc->transfer.tx_buf == NULL) in qcom_spi_hw_write_from_tx_buf()
751 if (sc->transfer.tx_offset < sc->transfer.tx_len) { in qcom_spi_hw_write_from_tx_buf()
752 *val |= (sc->transfer.tx_buf[sc->transfer.tx_offset] & 0xff) in qcom_spi_hw_write_from_tx_buf()
754 sc->transfer.tx_offset++; in qcom_spi_hw_write_from_tx_buf()
773 * Loop over the transfer num_words, do complain if we are full. in qcom_spi_hw_write_pio_fifo()
775 for (i = 0; i < sc->transfer.num_words; i++) { in qcom_spi_hw_write_pio_fifo()
786 * Handle 1, 2, 4 byte transfer packing rules. in qcom_spi_hw_write_pio_fifo()
828 __func__, num_bytes, sc->transfer.num_words); in qcom_spi_hw_write_pio_fifo()
851 if (sc->transfer.rx_buf == NULL) in qcom_spi_hw_read_into_rx_buf()
855 if (sc->transfer.rx_offset < sc->transfer.rx_len) { in qcom_spi_hw_read_into_rx_buf()
856 sc->transfer.rx_buf[sc->transfer.rx_offset] = val; in qcom_spi_hw_read_into_rx_buf()
857 sc->transfer.rx_offset++; in qcom_spi_hw_read_into_rx_buf()
880 for (i = 0; i < sc->transfer.num_words; i++) { in qcom_spi_hw_read_pio_fifo()
898 * doing 1, 2, or 4 byte transfer words. in qcom_spi_hw_read_pio_fifo()
921 "%s: read %d bytes (%d transfer words)\n", in qcom_spi_hw_read_pio_fifo()
922 __func__, num_bytes, sc->transfer.num_words); in qcom_spi_hw_read_pio_fifo()
940 * And see if we've finished the transfer and won't be getting in qcom_spi_hw_read_pio_fifo()
947 && (sc->transfer.rx_offset >= sc->transfer.rx_len)) { in qcom_spi_hw_read_pio_fifo()
956 * the FIFO transfer. We won't get any subsequent transfers; in qcom_spi_hw_read_pio_fifo()
957 * we'll need to schedule a new FIFO transfer. in qcom_spi_hw_read_pio_fifo()