• Home
  • Raw
  • Download

Lines Matching refs:xfer

417 static inline bool atmel_spi_is_vmalloc_xfer(struct spi_transfer *xfer)  in atmel_spi_is_vmalloc_xfer()  argument
419 return is_vmalloc_addr(xfer->tx_buf) || is_vmalloc_addr(xfer->rx_buf); in atmel_spi_is_vmalloc_xfer()
423 struct spi_transfer *xfer) in atmel_spi_use_dma() argument
425 return as->use_dma && xfer->len >= DMA_MIN_BYTES; in atmel_spi_use_dma()
430 struct spi_transfer *xfer) in atmel_spi_can_dma() argument
435 return atmel_spi_use_dma(as, xfer) && in atmel_spi_can_dma()
436 !atmel_spi_is_vmalloc_xfer(xfer); in atmel_spi_can_dma()
438 return atmel_spi_use_dma(as, xfer); in atmel_spi_can_dma()
589 struct spi_transfer *xfer) in atmel_spi_next_xfer_single() argument
592 unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; in atmel_spi_next_xfer_single()
603 if (xfer->bits_per_word > 8) in atmel_spi_next_xfer_single()
604 spi_writel(as, TDR, *(u16 *)(xfer->tx_buf + xfer_pos)); in atmel_spi_next_xfer_single()
606 spi_writel(as, TDR, *(u8 *)(xfer->tx_buf + xfer_pos)); in atmel_spi_next_xfer_single()
610 xfer, xfer->len, xfer->tx_buf, xfer->rx_buf, in atmel_spi_next_xfer_single()
611 xfer->bits_per_word); in atmel_spi_next_xfer_single()
621 struct spi_transfer *xfer) in atmel_spi_next_xfer_fifo() argument
625 u32 offset = xfer->len - as->current_remaining_bytes; in atmel_spi_next_xfer_fifo()
626 const u16 *words = (const u16 *)((u8 *)xfer->tx_buf + offset); in atmel_spi_next_xfer_fifo()
627 const u8 *bytes = (const u8 *)((u8 *)xfer->tx_buf + offset); in atmel_spi_next_xfer_fifo()
634 current_remaining_data = ((xfer->bits_per_word > 8) ? in atmel_spi_next_xfer_fifo()
653 if (xfer->bits_per_word > 8) { in atmel_spi_next_xfer_fifo()
666 if (xfer->bits_per_word > 8) in atmel_spi_next_xfer_fifo()
677 xfer, xfer->len, xfer->tx_buf, xfer->rx_buf, in atmel_spi_next_xfer_fifo()
678 xfer->bits_per_word); in atmel_spi_next_xfer_fifo()
691 struct spi_transfer *xfer) in atmel_spi_next_xfer_pio() argument
696 atmel_spi_next_xfer_fifo(master, xfer); in atmel_spi_next_xfer_pio()
698 atmel_spi_next_xfer_single(master, xfer); in atmel_spi_next_xfer_pio()
705 struct spi_transfer *xfer, in atmel_spi_next_xfer_dma_submit() argument
726 *plen = xfer->len; in atmel_spi_next_xfer_dma_submit()
729 xfer->bits_per_word)) in atmel_spi_next_xfer_dma_submit()
733 if (atmel_spi_is_vmalloc_xfer(xfer) && in atmel_spi_next_xfer_dma_submit()
737 xfer->len, in atmel_spi_next_xfer_dma_submit()
743 xfer->rx_sg.sgl, in atmel_spi_next_xfer_dma_submit()
744 xfer->rx_sg.nents, in atmel_spi_next_xfer_dma_submit()
752 if (atmel_spi_is_vmalloc_xfer(xfer) && in atmel_spi_next_xfer_dma_submit()
754 memcpy(as->addr_tx_bbuf, xfer->tx_buf, xfer->len); in atmel_spi_next_xfer_dma_submit()
757 xfer->len, DMA_MEM_TO_DEV, in atmel_spi_next_xfer_dma_submit()
762 xfer->tx_sg.sgl, in atmel_spi_next_xfer_dma_submit()
763 xfer->tx_sg.nents, in atmel_spi_next_xfer_dma_submit()
773 xfer, xfer->len, xfer->tx_buf, (unsigned long long)xfer->tx_dma, in atmel_spi_next_xfer_dma_submit()
774 xfer->rx_buf, (unsigned long long)xfer->rx_dma); in atmel_spi_next_xfer_dma_submit()
806 struct spi_transfer *xfer, in atmel_spi_next_xfer_data() argument
811 *rx_dma = xfer->rx_dma + xfer->len - *plen; in atmel_spi_next_xfer_data()
812 *tx_dma = xfer->tx_dma + xfer->len - *plen; in atmel_spi_next_xfer_data()
819 struct spi_transfer *xfer) in atmel_spi_set_xfer_speed() argument
839 scbr = DIV_ROUND_UP(bus_hz, xfer->speed_hz); in atmel_spi_set_xfer_speed()
848 xfer->speed_hz, scbr, bus_hz/255); in atmel_spi_set_xfer_speed()
854 xfer->speed_hz, scbr, bus_hz); in atmel_spi_set_xfer_speed()
860 xfer->effective_speed_hz = bus_hz / scbr; in atmel_spi_set_xfer_speed()
871 struct spi_transfer *xfer) in atmel_spi_pdc_next_xfer() argument
880 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); in atmel_spi_pdc_next_xfer()
893 xfer, xfer->len, xfer->tx_buf, in atmel_spi_pdc_next_xfer()
894 (unsigned long long)xfer->tx_dma, xfer->rx_buf, in atmel_spi_pdc_next_xfer()
895 (unsigned long long)xfer->rx_dma); in atmel_spi_pdc_next_xfer()
899 atmel_spi_next_xfer_data(master, xfer, &tx_dma, &rx_dma, &len); in atmel_spi_pdc_next_xfer()
912 xfer, xfer->len, xfer->tx_buf, in atmel_spi_pdc_next_xfer()
913 (unsigned long long)xfer->tx_dma, xfer->rx_buf, in atmel_spi_pdc_next_xfer()
914 (unsigned long long)xfer->rx_dma); in atmel_spi_pdc_next_xfer()
939 atmel_spi_dma_map_xfer(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_dma_map_xfer() argument
943 xfer->tx_dma = xfer->rx_dma = INVALID_DMA_ADDRESS; in atmel_spi_dma_map_xfer()
944 if (xfer->tx_buf) { in atmel_spi_dma_map_xfer()
947 void *nonconst_tx = (void *)xfer->tx_buf; in atmel_spi_dma_map_xfer()
949 xfer->tx_dma = dma_map_single(dev, in atmel_spi_dma_map_xfer()
950 nonconst_tx, xfer->len, in atmel_spi_dma_map_xfer()
952 if (dma_mapping_error(dev, xfer->tx_dma)) in atmel_spi_dma_map_xfer()
955 if (xfer->rx_buf) { in atmel_spi_dma_map_xfer()
956 xfer->rx_dma = dma_map_single(dev, in atmel_spi_dma_map_xfer()
957 xfer->rx_buf, xfer->len, in atmel_spi_dma_map_xfer()
959 if (dma_mapping_error(dev, xfer->rx_dma)) { in atmel_spi_dma_map_xfer()
960 if (xfer->tx_buf) in atmel_spi_dma_map_xfer()
962 xfer->tx_dma, xfer->len, in atmel_spi_dma_map_xfer()
971 struct spi_transfer *xfer) in atmel_spi_dma_unmap_xfer() argument
973 if (xfer->tx_dma != INVALID_DMA_ADDRESS) in atmel_spi_dma_unmap_xfer()
974 dma_unmap_single(master->dev.parent, xfer->tx_dma, in atmel_spi_dma_unmap_xfer()
975 xfer->len, DMA_TO_DEVICE); in atmel_spi_dma_unmap_xfer()
976 if (xfer->rx_dma != INVALID_DMA_ADDRESS) in atmel_spi_dma_unmap_xfer()
977 dma_unmap_single(master->dev.parent, xfer->rx_dma, in atmel_spi_dma_unmap_xfer()
978 xfer->len, DMA_FROM_DEVICE); in atmel_spi_dma_unmap_xfer()
987 atmel_spi_pump_single_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_single_data() argument
991 unsigned long xfer_pos = xfer->len - as->current_remaining_bytes; in atmel_spi_pump_single_data()
993 if (xfer->bits_per_word > 8) { in atmel_spi_pump_single_data()
994 rxp16 = (u16 *)(((u8 *)xfer->rx_buf) + xfer_pos); in atmel_spi_pump_single_data()
997 rxp = ((u8 *)xfer->rx_buf) + xfer_pos; in atmel_spi_pump_single_data()
1000 if (xfer->bits_per_word > 8) { in atmel_spi_pump_single_data()
1011 atmel_spi_pump_fifo_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_fifo_data() argument
1015 u32 offset = xfer->len - as->current_remaining_bytes; in atmel_spi_pump_fifo_data()
1016 u16 *words = (u16 *)((u8 *)xfer->rx_buf + offset); in atmel_spi_pump_fifo_data()
1017 u8 *bytes = (u8 *)((u8 *)xfer->rx_buf + offset); in atmel_spi_pump_fifo_data()
1021 num_bytes = ((xfer->bits_per_word > 8) ? in atmel_spi_pump_fifo_data()
1031 if (xfer->bits_per_word > 8) in atmel_spi_pump_fifo_data()
1037 if (xfer->bits_per_word > 8) in atmel_spi_pump_fifo_data()
1051 atmel_spi_pump_pio_data(struct atmel_spi *as, struct spi_transfer *xfer) in atmel_spi_pump_pio_data() argument
1054 atmel_spi_pump_fifo_data(as, xfer); in atmel_spi_pump_pio_data()
1056 atmel_spi_pump_single_data(as, xfer); in atmel_spi_pump_pio_data()
1070 struct spi_transfer *xfer; in atmel_spi_pio_interrupt() local
1104 xfer = as->current_transfer; in atmel_spi_pio_interrupt()
1105 atmel_spi_pump_pio_data(as, xfer); in atmel_spi_pio_interrupt()
1282 struct spi_transfer *xfer) in atmel_spi_one_transfer() argument
1295 if (!(xfer->tx_buf || xfer->rx_buf) && xfer->len) { in atmel_spi_one_transfer()
1302 if (bits != xfer->bits_per_word - 8) { in atmel_spi_one_transfer()
1314 if (atmel_spi_dma_map_xfer(as, xfer) < 0) in atmel_spi_one_transfer()
1318 atmel_spi_set_xfer_speed(as, msg->spi, xfer); in atmel_spi_one_transfer()
1321 as->current_transfer = xfer; in atmel_spi_one_transfer()
1322 as->current_remaining_bytes = xfer->len; in atmel_spi_one_transfer()
1327 atmel_spi_pdc_next_xfer(master, msg, xfer); in atmel_spi_one_transfer()
1328 } else if (atmel_spi_use_dma(as, xfer)) { in atmel_spi_one_transfer()
1331 xfer, &len); in atmel_spi_one_transfer()
1335 atmel_spi_next_xfer_pio(master, xfer); in atmel_spi_one_transfer()
1342 atmel_spi_next_xfer_pio(master, xfer); in atmel_spi_one_transfer()
1385 } else if (atmel_spi_use_dma(as, xfer)) { in atmel_spi_one_transfer()
1391 atmel_spi_dma_unmap_xfer(master, xfer); in atmel_spi_one_transfer()
1397 msg->actual_length += xfer->len; in atmel_spi_one_transfer()
1402 atmel_spi_dma_unmap_xfer(master, xfer); in atmel_spi_one_transfer()
1404 spi_transfer_delay_exec(xfer); in atmel_spi_one_transfer()
1406 if (xfer->cs_change) { in atmel_spi_one_transfer()
1407 if (list_is_last(&xfer->transfer_list, in atmel_spi_one_transfer()
1424 struct spi_transfer *xfer; in atmel_spi_transfer_one_message() local
1441 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in atmel_spi_transfer_one_message()
1442 trace_spi_transfer_start(msg, xfer); in atmel_spi_transfer_one_message()
1444 ret = atmel_spi_one_transfer(master, msg, xfer); in atmel_spi_transfer_one_message()
1448 trace_spi_transfer_stop(msg, xfer); in atmel_spi_transfer_one_message()
1454 list_for_each_entry(xfer, &msg->transfers, transfer_list) { in atmel_spi_transfer_one_message()
1457 xfer, xfer->len, in atmel_spi_transfer_one_message()
1458 xfer->tx_buf, &xfer->tx_dma, in atmel_spi_transfer_one_message()
1459 xfer->rx_buf, &xfer->rx_dma); in atmel_spi_transfer_one_message()