mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 02:50:49 +09:00
spi: rockchip_slave: Remove redundant dma_map behavior
The driver itself has implemented DMA buffer, and does not require the map/unmap behavior of the spi framework. Change-Id: I00abd65233bf5b3112337c8da623bc8afe586bb6 Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
@@ -471,6 +471,20 @@ static int rockchip_spi_slave_prepare_dma(struct rockchip_spi *rs,
|
||||
return 1;
|
||||
}
|
||||
|
||||
static bool rockchip_spi_slave_can_dma(struct spi_controller *ctlr,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *xfer)
|
||||
{
|
||||
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
|
||||
unsigned int bytes_per_word = xfer->bits_per_word <= 8 ? 1 : 2;
|
||||
|
||||
/* if the numbor of spi words to transfer is less than the fifo
|
||||
* length we can just fill the fifo and wait for a single irq,
|
||||
* so don't bother setting up dma
|
||||
*/
|
||||
return xfer->len / bytes_per_word >= rs->fifo_len;
|
||||
}
|
||||
|
||||
static int rockchip_spi_slave_config(struct rockchip_spi *rs,
|
||||
struct spi_device *spi, struct spi_transfer *xfer)
|
||||
{
|
||||
@@ -673,7 +687,7 @@ static int rockchip_spi_slave_do_one_msg(struct spi_controller *ctlr, struct spi
|
||||
rs->n_bytes = xfer->bits_per_word <= 8 ? 1 : 2;
|
||||
rs->xfer = xfer;
|
||||
|
||||
use_dma = ctlr->can_dma(ctlr, spi, xfer);
|
||||
use_dma = rockchip_spi_slave_can_dma(ctlr, spi, xfer);
|
||||
if (use_dma)
|
||||
rs->xfer_mode = ROCKCHIP_SPI_DMA;
|
||||
else
|
||||
@@ -724,20 +738,6 @@ out:
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool rockchip_spi_slave_can_dma(struct spi_controller *ctlr,
|
||||
struct spi_device *spi,
|
||||
struct spi_transfer *xfer)
|
||||
{
|
||||
struct rockchip_spi *rs = spi_controller_get_devdata(ctlr);
|
||||
unsigned int bytes_per_word = xfer->bits_per_word <= 8 ? 1 : 2;
|
||||
|
||||
/* if the numbor of spi words to transfer is less than the fifo
|
||||
* length we can just fill the fifo and wait for a single irq,
|
||||
* so don't bother setting up dma
|
||||
*/
|
||||
return xfer->len / bytes_per_word >= rs->fifo_len;
|
||||
}
|
||||
|
||||
static int rockchip_spi_slave_setup(struct spi_device *spi)
|
||||
{
|
||||
struct rockchip_spi *rs = spi_controller_get_devdata(spi->controller);
|
||||
@@ -885,7 +885,6 @@ static int rockchip_spi_slave_probe(struct platform_device *pdev)
|
||||
}
|
||||
rs->dma_addr_tx = mem->start + ROCKCHIP_SPI_TXDR;
|
||||
rs->dma_addr_rx = mem->start + ROCKCHIP_SPI_RXDR;
|
||||
ctlr->can_dma = rockchip_spi_slave_can_dma;
|
||||
|
||||
init_completion(&rs->xfer_done);
|
||||
switch (rs->version) {
|
||||
|
||||
Reference in New Issue
Block a user