diff options
author | Vinod Koul <vinod.koul@linux.intel.com> | 2011-10-14 01:17:38 -0400 |
---|---|---|
committer | Vinod Koul <vinod.koul@linux.intel.com> | 2011-10-31 00:10:26 -0400 |
commit | a485df4b4404379786c4bdd258bc528b2617449d (patch) | |
tree | 67244495fab89846568cf40d3b7c3a2bd011133e | |
parent | 05f5799cbe5c9e2c03f604b3de5783cf4d726227 (diff) |
spi, serial: move to dma_transfer_direction
fixup usage of dma direction by introducing dma_transfer_direction,
this patch moves spi, serial drivers to use new enum
Signed-off-by: Vinod Koul <vinod.koul@linux.intel.com>
Cc: Grant Likely <grant.likely@secretlab.ca>
Cc: Alan Cox <alan@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@iki.fi>
-rw-r--r-- | drivers/spi/spi-dw-mid.c | 8 | ||||
-rw-r--r-- | drivers/spi/spi-ep93xx.c | 9 | ||||
-rw-r--r-- | drivers/spi/spi-pl022.c | 8 | ||||
-rw-r--r-- | drivers/spi/spi-topcliff-pch.c | 4 | ||||
-rw-r--r-- | drivers/tty/serial/amba-pl011.c | 8 | ||||
-rw-r--r-- | drivers/tty/serial/pch_uart.c | 4 | ||||
-rw-r--r-- | drivers/tty/serial/sh-sci.c | 4 |
7 files changed, 24 insertions, 21 deletions
diff --git a/drivers/spi/spi-dw-mid.c b/drivers/spi/spi-dw-mid.c index 130e55537db6..0a1fc8a27e3d 100644 --- a/drivers/spi/spi-dw-mid.c +++ b/drivers/spi/spi-dw-mid.c | |||
@@ -131,7 +131,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
131 | rxchan = dws->rxchan; | 131 | rxchan = dws->rxchan; |
132 | 132 | ||
133 | /* 2. Prepare the TX dma transfer */ | 133 | /* 2. Prepare the TX dma transfer */ |
134 | txconf.direction = DMA_TO_DEVICE; | 134 | txconf.direction = DMA_MEM_TO_DEV; |
135 | txconf.dst_addr = dws->dma_addr; | 135 | txconf.dst_addr = dws->dma_addr; |
136 | txconf.dst_maxburst = LNW_DMA_MSIZE_16; | 136 | txconf.dst_maxburst = LNW_DMA_MSIZE_16; |
137 | txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 137 | txconf.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
@@ -147,13 +147,13 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
147 | txdesc = txchan->device->device_prep_slave_sg(txchan, | 147 | txdesc = txchan->device->device_prep_slave_sg(txchan, |
148 | &dws->tx_sgl, | 148 | &dws->tx_sgl, |
149 | 1, | 149 | 1, |
150 | DMA_TO_DEVICE, | 150 | DMA_MEM_TO_DEV, |
151 | DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); | 151 | DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); |
152 | txdesc->callback = dw_spi_dma_done; | 152 | txdesc->callback = dw_spi_dma_done; |
153 | txdesc->callback_param = dws; | 153 | txdesc->callback_param = dws; |
154 | 154 | ||
155 | /* 3. Prepare the RX dma transfer */ | 155 | /* 3. Prepare the RX dma transfer */ |
156 | rxconf.direction = DMA_FROM_DEVICE; | 156 | rxconf.direction = DMA_DEV_TO_MEM; |
157 | rxconf.src_addr = dws->dma_addr; | 157 | rxconf.src_addr = dws->dma_addr; |
158 | rxconf.src_maxburst = LNW_DMA_MSIZE_16; | 158 | rxconf.src_maxburst = LNW_DMA_MSIZE_16; |
159 | rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; | 159 | rxconf.dst_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; |
@@ -169,7 +169,7 @@ static int mid_spi_dma_transfer(struct dw_spi *dws, int cs_change) | |||
169 | rxdesc = rxchan->device->device_prep_slave_sg(rxchan, | 169 | rxdesc = rxchan->device->device_prep_slave_sg(rxchan, |
170 | &dws->rx_sgl, | 170 | &dws->rx_sgl, |
171 | 1, | 171 | 1, |
172 | DMA_FROM_DEVICE, | 172 | DMA_DEV_TO_MEM, |
173 | DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); | 173 | DMA_PREP_INTERRUPT | DMA_COMPL_SKIP_DEST_UNMAP); |
174 | rxdesc->callback = dw_spi_dma_done; | 174 | rxdesc->callback = dw_spi_dma_done; |
175 | rxdesc->callback_param = dws; | 175 | rxdesc->callback_param = dws; |
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c index 1cf645479bfe..0afd87dd9459 100644 --- a/drivers/spi/spi-ep93xx.c +++ b/drivers/spi/spi-ep93xx.c | |||
@@ -550,6 +550,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
550 | struct dma_async_tx_descriptor *txd; | 550 | struct dma_async_tx_descriptor *txd; |
551 | enum dma_slave_buswidth buswidth; | 551 | enum dma_slave_buswidth buswidth; |
552 | struct dma_slave_config conf; | 552 | struct dma_slave_config conf; |
553 | enum dma_transfer_direction slave_dirn; | ||
553 | struct scatterlist *sg; | 554 | struct scatterlist *sg; |
554 | struct sg_table *sgt; | 555 | struct sg_table *sgt; |
555 | struct dma_chan *chan; | 556 | struct dma_chan *chan; |
@@ -572,6 +573,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
572 | 573 | ||
573 | conf.src_addr = espi->sspdr_phys; | 574 | conf.src_addr = espi->sspdr_phys; |
574 | conf.src_addr_width = buswidth; | 575 | conf.src_addr_width = buswidth; |
576 | slave_dirn = DMA_DEV_TO_MEM; | ||
575 | } else { | 577 | } else { |
576 | chan = espi->dma_tx; | 578 | chan = espi->dma_tx; |
577 | buf = t->tx_buf; | 579 | buf = t->tx_buf; |
@@ -579,6 +581,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
579 | 581 | ||
580 | conf.dst_addr = espi->sspdr_phys; | 582 | conf.dst_addr = espi->sspdr_phys; |
581 | conf.dst_addr_width = buswidth; | 583 | conf.dst_addr_width = buswidth; |
584 | slave_dirn = DMA_MEM_TO_DEV; | ||
582 | } | 585 | } |
583 | 586 | ||
584 | ret = dmaengine_slave_config(chan, &conf); | 587 | ret = dmaengine_slave_config(chan, &conf); |
@@ -630,7 +633,7 @@ ep93xx_spi_dma_prepare(struct ep93xx_spi *espi, enum dma_data_direction dir) | |||
630 | return ERR_PTR(-ENOMEM); | 633 | return ERR_PTR(-ENOMEM); |
631 | 634 | ||
632 | txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents, | 635 | txd = chan->device->device_prep_slave_sg(chan, sgt->sgl, nents, |
633 | dir, DMA_CTRL_ACK); | 636 | slave_dirn, DMA_CTRL_ACK); |
634 | if (!txd) { | 637 | if (!txd) { |
635 | dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); | 638 | dma_unmap_sg(chan->device->dev, sgt->sgl, sgt->nents, dir); |
636 | return ERR_PTR(-ENOMEM); | 639 | return ERR_PTR(-ENOMEM); |
@@ -978,7 +981,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi) | |||
978 | dma_cap_set(DMA_SLAVE, mask); | 981 | dma_cap_set(DMA_SLAVE, mask); |
979 | 982 | ||
980 | espi->dma_rx_data.port = EP93XX_DMA_SSP; | 983 | espi->dma_rx_data.port = EP93XX_DMA_SSP; |
981 | espi->dma_rx_data.direction = DMA_FROM_DEVICE; | 984 | espi->dma_rx_data.direction = DMA_DEV_TO_MEM; |
982 | espi->dma_rx_data.name = "ep93xx-spi-rx"; | 985 | espi->dma_rx_data.name = "ep93xx-spi-rx"; |
983 | 986 | ||
984 | espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter, | 987 | espi->dma_rx = dma_request_channel(mask, ep93xx_spi_dma_filter, |
@@ -989,7 +992,7 @@ static int ep93xx_spi_setup_dma(struct ep93xx_spi *espi) | |||
989 | } | 992 | } |
990 | 993 | ||
991 | espi->dma_tx_data.port = EP93XX_DMA_SSP; | 994 | espi->dma_tx_data.port = EP93XX_DMA_SSP; |
992 | espi->dma_tx_data.direction = DMA_TO_DEVICE; | 995 | espi->dma_tx_data.direction = DMA_MEM_TO_DEV; |
993 | espi->dma_tx_data.name = "ep93xx-spi-tx"; | 996 | espi->dma_tx_data.name = "ep93xx-spi-tx"; |
994 | 997 | ||
995 | espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter, | 998 | espi->dma_tx = dma_request_channel(mask, ep93xx_spi_dma_filter, |
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 730b4a37b823..ddcddf4b1248 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c | |||
@@ -910,11 +910,11 @@ static int configure_dma(struct pl022 *pl022) | |||
910 | { | 910 | { |
911 | struct dma_slave_config rx_conf = { | 911 | struct dma_slave_config rx_conf = { |
912 | .src_addr = SSP_DR(pl022->phybase), | 912 | .src_addr = SSP_DR(pl022->phybase), |
913 | .direction = DMA_FROM_DEVICE, | 913 | .direction = DMA_DEV_TO_MEM, |
914 | }; | 914 | }; |
915 | struct dma_slave_config tx_conf = { | 915 | struct dma_slave_config tx_conf = { |
916 | .dst_addr = SSP_DR(pl022->phybase), | 916 | .dst_addr = SSP_DR(pl022->phybase), |
917 | .direction = DMA_TO_DEVICE, | 917 | .direction = DMA_MEM_TO_DEV, |
918 | }; | 918 | }; |
919 | unsigned int pages; | 919 | unsigned int pages; |
920 | int ret; | 920 | int ret; |
@@ -1051,7 +1051,7 @@ static int configure_dma(struct pl022 *pl022) | |||
1051 | rxdesc = rxchan->device->device_prep_slave_sg(rxchan, | 1051 | rxdesc = rxchan->device->device_prep_slave_sg(rxchan, |
1052 | pl022->sgt_rx.sgl, | 1052 | pl022->sgt_rx.sgl, |
1053 | rx_sglen, | 1053 | rx_sglen, |
1054 | DMA_FROM_DEVICE, | 1054 | DMA_DEV_TO_MEM, |
1055 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1055 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1056 | if (!rxdesc) | 1056 | if (!rxdesc) |
1057 | goto err_rxdesc; | 1057 | goto err_rxdesc; |
@@ -1059,7 +1059,7 @@ static int configure_dma(struct pl022 *pl022) | |||
1059 | txdesc = txchan->device->device_prep_slave_sg(txchan, | 1059 | txdesc = txchan->device->device_prep_slave_sg(txchan, |
1060 | pl022->sgt_tx.sgl, | 1060 | pl022->sgt_tx.sgl, |
1061 | tx_sglen, | 1061 | tx_sglen, |
1062 | DMA_TO_DEVICE, | 1062 | DMA_MEM_TO_DEV, |
1063 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1063 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1064 | if (!txdesc) | 1064 | if (!txdesc) |
1065 | goto err_txdesc; | 1065 | goto err_txdesc; |
diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c index 1d23f3831866..7eba26e20aeb 100644 --- a/drivers/spi/spi-topcliff-pch.c +++ b/drivers/spi/spi-topcliff-pch.c | |||
@@ -1051,7 +1051,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) | |||
1051 | } | 1051 | } |
1052 | sg = dma->sg_rx_p; | 1052 | sg = dma->sg_rx_p; |
1053 | desc_rx = dma->chan_rx->device->device_prep_slave_sg(dma->chan_rx, sg, | 1053 | desc_rx = dma->chan_rx->device->device_prep_slave_sg(dma->chan_rx, sg, |
1054 | num, DMA_FROM_DEVICE, | 1054 | num, DMA_DEV_TO_MEM, |
1055 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1055 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1056 | if (!desc_rx) { | 1056 | if (!desc_rx) { |
1057 | dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n", | 1057 | dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n", |
@@ -1086,7 +1086,7 @@ static void pch_spi_handle_dma(struct pch_spi_data *data, int *bpw) | |||
1086 | } | 1086 | } |
1087 | sg = dma->sg_tx_p; | 1087 | sg = dma->sg_tx_p; |
1088 | desc_tx = dma->chan_tx->device->device_prep_slave_sg(dma->chan_tx, | 1088 | desc_tx = dma->chan_tx->device->device_prep_slave_sg(dma->chan_tx, |
1089 | sg, num, DMA_TO_DEVICE, | 1089 | sg, num, DMA_MEM_TO_DEV, |
1090 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1090 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1091 | if (!desc_tx) { | 1091 | if (!desc_tx) { |
1092 | dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n", | 1092 | dev_err(&data->master->dev, "%s:device_prep_slave_sg Failed\n", |
diff --git a/drivers/tty/serial/amba-pl011.c b/drivers/tty/serial/amba-pl011.c index f5f6831b0a64..460ff7dbfd63 100644 --- a/drivers/tty/serial/amba-pl011.c +++ b/drivers/tty/serial/amba-pl011.c | |||
@@ -268,7 +268,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
268 | struct dma_slave_config tx_conf = { | 268 | struct dma_slave_config tx_conf = { |
269 | .dst_addr = uap->port.mapbase + UART01x_DR, | 269 | .dst_addr = uap->port.mapbase + UART01x_DR, |
270 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | 270 | .dst_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, |
271 | .direction = DMA_TO_DEVICE, | 271 | .direction = DMA_MEM_TO_DEV, |
272 | .dst_maxburst = uap->fifosize >> 1, | 272 | .dst_maxburst = uap->fifosize >> 1, |
273 | }; | 273 | }; |
274 | struct dma_chan *chan; | 274 | struct dma_chan *chan; |
@@ -301,7 +301,7 @@ static void pl011_dma_probe_initcall(struct uart_amba_port *uap) | |||
301 | struct dma_slave_config rx_conf = { | 301 | struct dma_slave_config rx_conf = { |
302 | .src_addr = uap->port.mapbase + UART01x_DR, | 302 | .src_addr = uap->port.mapbase + UART01x_DR, |
303 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, | 303 | .src_addr_width = DMA_SLAVE_BUSWIDTH_1_BYTE, |
304 | .direction = DMA_FROM_DEVICE, | 304 | .direction = DMA_DEV_TO_MEM, |
305 | .src_maxburst = uap->fifosize >> 1, | 305 | .src_maxburst = uap->fifosize >> 1, |
306 | }; | 306 | }; |
307 | 307 | ||
@@ -480,7 +480,7 @@ static int pl011_dma_tx_refill(struct uart_amba_port *uap) | |||
480 | return -EBUSY; | 480 | return -EBUSY; |
481 | } | 481 | } |
482 | 482 | ||
483 | desc = dma_dev->device_prep_slave_sg(chan, &dmatx->sg, 1, DMA_TO_DEVICE, | 483 | desc = dma_dev->device_prep_slave_sg(chan, &dmatx->sg, 1, DMA_MEM_TO_DEV, |
484 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 484 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
485 | if (!desc) { | 485 | if (!desc) { |
486 | dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE); | 486 | dma_unmap_sg(dma_dev->dev, &dmatx->sg, 1, DMA_TO_DEVICE); |
@@ -676,7 +676,7 @@ static int pl011_dma_rx_trigger_dma(struct uart_amba_port *uap) | |||
676 | &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; | 676 | &uap->dmarx.sgbuf_b : &uap->dmarx.sgbuf_a; |
677 | dma_dev = rxchan->device; | 677 | dma_dev = rxchan->device; |
678 | desc = rxchan->device->device_prep_slave_sg(rxchan, &sgbuf->sg, 1, | 678 | desc = rxchan->device->device_prep_slave_sg(rxchan, &sgbuf->sg, 1, |
679 | DMA_FROM_DEVICE, | 679 | DMA_DEV_TO_MEM, |
680 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 680 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
681 | /* | 681 | /* |
682 | * If the DMA engine is busy and cannot prepare a | 682 | * If the DMA engine is busy and cannot prepare a |
diff --git a/drivers/tty/serial/pch_uart.c b/drivers/tty/serial/pch_uart.c index b46218d679e2..73201a11697a 100644 --- a/drivers/tty/serial/pch_uart.c +++ b/drivers/tty/serial/pch_uart.c | |||
@@ -747,7 +747,7 @@ static int dma_handle_rx(struct eg20t_port *priv) | |||
747 | sg_dma_address(sg) = priv->rx_buf_dma; | 747 | sg_dma_address(sg) = priv->rx_buf_dma; |
748 | 748 | ||
749 | desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx, | 749 | desc = priv->chan_rx->device->device_prep_slave_sg(priv->chan_rx, |
750 | sg, 1, DMA_FROM_DEVICE, | 750 | sg, 1, DMA_DEV_TO_MEM, |
751 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 751 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
752 | 752 | ||
753 | if (!desc) | 753 | if (!desc) |
@@ -906,7 +906,7 @@ static unsigned int dma_handle_tx(struct eg20t_port *priv) | |||
906 | } | 906 | } |
907 | 907 | ||
908 | desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx, | 908 | desc = priv->chan_tx->device->device_prep_slave_sg(priv->chan_tx, |
909 | priv->sg_tx_p, nent, DMA_TO_DEVICE, | 909 | priv->sg_tx_p, nent, DMA_MEM_TO_DEV, |
910 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 910 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
911 | if (!desc) { | 911 | if (!desc) { |
912 | dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n", | 912 | dev_err(priv->port.dev, "%s:device_prep_slave_sg Failed\n", |
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index dbd32a1286d3..3683a69b45ee 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
@@ -1207,7 +1207,7 @@ static void sci_submit_rx(struct sci_port *s) | |||
1207 | struct dma_async_tx_descriptor *desc; | 1207 | struct dma_async_tx_descriptor *desc; |
1208 | 1208 | ||
1209 | desc = chan->device->device_prep_slave_sg(chan, | 1209 | desc = chan->device->device_prep_slave_sg(chan, |
1210 | sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT); | 1210 | sg, 1, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT); |
1211 | 1211 | ||
1212 | if (desc) { | 1212 | if (desc) { |
1213 | s->desc_rx[i] = desc; | 1213 | s->desc_rx[i] = desc; |
@@ -1322,7 +1322,7 @@ static void work_fn_tx(struct work_struct *work) | |||
1322 | BUG_ON(!sg_dma_len(sg)); | 1322 | BUG_ON(!sg_dma_len(sg)); |
1323 | 1323 | ||
1324 | desc = chan->device->device_prep_slave_sg(chan, | 1324 | desc = chan->device->device_prep_slave_sg(chan, |
1325 | sg, s->sg_len_tx, DMA_TO_DEVICE, | 1325 | sg, s->sg_len_tx, DMA_MEM_TO_DEV, |
1326 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); | 1326 | DMA_PREP_INTERRUPT | DMA_CTRL_ACK); |
1327 | if (!desc) { | 1327 | if (!desc) { |
1328 | /* switch to PIO */ | 1328 | /* switch to PIO */ |