summaryrefslogtreecommitdiffstats
path: root/drivers/spi/spi-rockchip.c
diff options
context:
space:
mode:
authorEmil Renner Berthing <kernel@esmil.dk>2018-10-10 05:00:37 -0400
committerMark Brown <broonie@kernel.org>2018-10-11 10:17:31 -0400
commitd9071b7e9fc474e474e3b865428a8d30d88daaf4 (patch)
tree1830fe0c9bbea2c999c133be32d9a5e299d5f9a9 /drivers/spi/spi-rockchip.c
parentf340b920511a666b02d371e88801d3817ea7a880 (diff)
spi: rockchip: directly use direction constants
The dma direction for the tx and rx dma channels never change, so just use the constants directly rather than storing them in device data. Signed-off-by: Emil Renner Berthing <kernel@esmil.dk> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/spi/spi-rockchip.c')
-rw-r--r--drivers/spi/spi-rockchip.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/spi/spi-rockchip.c b/drivers/spi/spi-rockchip.c
index 99943aa71bc1..6fa809da61dd 100644
--- a/drivers/spi/spi-rockchip.c
+++ b/drivers/spi/spi-rockchip.c
@@ -164,7 +164,6 @@ enum rockchip_ssi_type {
164 164
165struct rockchip_spi_dma_data { 165struct rockchip_spi_dma_data {
166 struct dma_chan *ch; 166 struct dma_chan *ch;
167 enum dma_transfer_direction direction;
168 dma_addr_t addr; 167 dma_addr_t addr;
169}; 168};
170 169
@@ -451,7 +450,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
451 450
452 rxdesc = NULL; 451 rxdesc = NULL;
453 if (rs->rx) { 452 if (rs->rx) {
454 rxconf.direction = rs->dma_rx.direction; 453 rxconf.direction = DMA_DEV_TO_MEM;
455 rxconf.src_addr = rs->dma_rx.addr; 454 rxconf.src_addr = rs->dma_rx.addr;
456 rxconf.src_addr_width = rs->n_bytes; 455 rxconf.src_addr_width = rs->n_bytes;
457 rxconf.src_maxburst = 1; 456 rxconf.src_maxburst = 1;
@@ -460,7 +459,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
460 rxdesc = dmaengine_prep_slave_sg( 459 rxdesc = dmaengine_prep_slave_sg(
461 rs->dma_rx.ch, 460 rs->dma_rx.ch,
462 rs->rx_sg.sgl, rs->rx_sg.nents, 461 rs->rx_sg.sgl, rs->rx_sg.nents,
463 rs->dma_rx.direction, DMA_PREP_INTERRUPT); 462 DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT);
464 if (!rxdesc) 463 if (!rxdesc)
465 return -EINVAL; 464 return -EINVAL;
466 465
@@ -470,7 +469,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
470 469
471 txdesc = NULL; 470 txdesc = NULL;
472 if (rs->tx) { 471 if (rs->tx) {
473 txconf.direction = rs->dma_tx.direction; 472 txconf.direction = DMA_MEM_TO_DEV;
474 txconf.dst_addr = rs->dma_tx.addr; 473 txconf.dst_addr = rs->dma_tx.addr;
475 txconf.dst_addr_width = rs->n_bytes; 474 txconf.dst_addr_width = rs->n_bytes;
476 txconf.dst_maxburst = rs->fifo_len / 2; 475 txconf.dst_maxburst = rs->fifo_len / 2;
@@ -479,7 +478,7 @@ static int rockchip_spi_prepare_dma(struct rockchip_spi *rs)
479 txdesc = dmaengine_prep_slave_sg( 478 txdesc = dmaengine_prep_slave_sg(
480 rs->dma_tx.ch, 479 rs->dma_tx.ch,
481 rs->tx_sg.sgl, rs->tx_sg.nents, 480 rs->tx_sg.sgl, rs->tx_sg.nents,
482 rs->dma_tx.direction, DMA_PREP_INTERRUPT); 481 DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT);
483 if (!txdesc) { 482 if (!txdesc) {
484 if (rxdesc) 483 if (rxdesc)
485 dmaengine_terminate_sync(rs->dma_rx.ch); 484 dmaengine_terminate_sync(rs->dma_rx.ch);
@@ -775,8 +774,6 @@ static int rockchip_spi_probe(struct platform_device *pdev)
775 if (rs->dma_tx.ch && rs->dma_rx.ch) { 774 if (rs->dma_tx.ch && rs->dma_rx.ch) {
776 rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR); 775 rs->dma_tx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_TXDR);
777 rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR); 776 rs->dma_rx.addr = (dma_addr_t)(mem->start + ROCKCHIP_SPI_RXDR);
778 rs->dma_tx.direction = DMA_MEM_TO_DEV;
779 rs->dma_rx.direction = DMA_DEV_TO_MEM;
780 777
781 master->can_dma = rockchip_spi_can_dma; 778 master->can_dma = rockchip_spi_can_dma;
782 master->dma_tx = rs->dma_tx.ch; 779 master->dma_tx = rs->dma_tx.ch;