Lines Matching refs:xfer
344 struct spi_transfer *xfer) in rockchip_spi_prepare_irq() argument
346 rs->tx = xfer->tx_buf; in rockchip_spi_prepare_irq()
347 rs->rx = xfer->rx_buf; in rockchip_spi_prepare_irq()
348 rs->tx_left = rs->tx ? xfer->len / rs->n_bytes : 0; in rockchip_spi_prepare_irq()
349 rs->rx_left = xfer->len / rs->n_bytes; in rockchip_spi_prepare_irq()
404 struct spi_controller *ctlr, struct spi_transfer *xfer) in rockchip_spi_prepare_dma() argument
411 if (xfer->rx_buf) { in rockchip_spi_prepare_dma()
416 .src_maxburst = rockchip_spi_calc_burst_size(xfer->len / in rockchip_spi_prepare_dma()
424 xfer->rx_sg.sgl, xfer->rx_sg.nents, in rockchip_spi_prepare_dma()
434 if (xfer->tx_buf) { in rockchip_spi_prepare_dma()
446 xfer->tx_sg.sgl, xfer->tx_sg.nents, in rockchip_spi_prepare_dma()
478 struct spi_device *spi, struct spi_transfer *xfer, in rockchip_spi_config() argument
497 if (xfer->rx_buf && xfer->tx_buf) in rockchip_spi_config()
499 else if (xfer->rx_buf) in rockchip_spi_config()
504 switch (xfer->bits_per_word) { in rockchip_spi_config()
507 cr1 = xfer->len - 1; in rockchip_spi_config()
511 cr1 = xfer->len - 1; in rockchip_spi_config()
515 cr1 = xfer->len / 2 - 1; in rockchip_spi_config()
523 xfer->bits_per_word); in rockchip_spi_config()
528 if (xfer->tx_buf) in rockchip_spi_config()
530 if (xfer->rx_buf) in rockchip_spi_config()
541 if (xfer->len < rs->fifo_len) in rockchip_spi_config()
542 writel_relaxed(xfer->len - 1, rs->regs + ROCKCHIP_SPI_RXFTLR); in rockchip_spi_config()
547 writel_relaxed(rockchip_spi_calc_burst_size(xfer->len / rs->n_bytes) - 1, in rockchip_spi_config()
555 writel_relaxed(2 * DIV_ROUND_UP(rs->freq, 2 * xfer->speed_hz), in rockchip_spi_config()
585 struct spi_transfer *xfer) in rockchip_spi_transfer_one() argument
592 if (!xfer->len) { in rockchip_spi_transfer_one()
600 if (!xfer->tx_buf && !xfer->rx_buf) { in rockchip_spi_transfer_one()
605 if (xfer->len > ROCKCHIP_SPI_MAX_TRANLEN) { in rockchip_spi_transfer_one()
606 dev_err(rs->dev, "Transfer is too long (%d)\n", xfer->len); in rockchip_spi_transfer_one()
610 rs->n_bytes = xfer->bits_per_word <= 8 ? 1 : 2; in rockchip_spi_transfer_one()
612 use_dma = ctlr->can_dma ? ctlr->can_dma(ctlr, spi, xfer) : false; in rockchip_spi_transfer_one()
614 ret = rockchip_spi_config(rs, spi, xfer, use_dma, ctlr->slave); in rockchip_spi_transfer_one()
619 return rockchip_spi_prepare_dma(rs, ctlr, xfer); in rockchip_spi_transfer_one()
621 return rockchip_spi_prepare_irq(rs, xfer); in rockchip_spi_transfer_one()
626 struct spi_transfer *xfer) in rockchip_spi_can_dma() argument
629 unsigned int bytes_per_word = xfer->bits_per_word <= 8 ? 1 : 2; in rockchip_spi_can_dma()
635 return xfer->len / bytes_per_word >= rs->fifo_len; in rockchip_spi_can_dma()