diff mbox

[2/3] spi-topcliff-pch: Fix DMA channel

Message ID 1392802569-11148-2-git-send-email-alexander.stein@systec-electronic.com (mailing list archive)
State Accepted
Commit 7611c7a5613f20ec2fb536c1d868d15045730bc0
Delegated to: Mark Brown
Headers show

Commit Message

Alexander Stein Feb. 19, 2014, 9:36 a.m. UTC
bus_num might be asigned dynamically to e.g. 32766. In this case the
calculated DMA channel based on SPI bus number is bogus. Use SPI channel
number instead for calculation.

Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com>
---
 drivers/spi/spi-topcliff-pch.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Mark Brown Feb. 19, 2014, 12:43 p.m. UTC | #1
On Wed, Feb 19, 2014 at 10:36:08AM +0100, Alexander Stein wrote:
> bus_num might be asigned dynamically to e.g. 32766. In this case the
> calculated DMA channel based on SPI bus number is bogus. Use SPI channel
> number instead for calculation.

Applied, thanks.
diff mbox

Patch

diff --git a/drivers/spi/spi-topcliff-pch.c b/drivers/spi/spi-topcliff-pch.c
index d038a7b..7cb71b0 100644
--- a/drivers/spi/spi-topcliff-pch.c
+++ b/drivers/spi/spi-topcliff-pch.c
@@ -921,7 +921,7 @@  static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
 	/* Set Tx DMA */
 	param = &dma->param_tx;
 	param->dma_dev = &dma_dev->dev;
-	param->chan_id = data->master->bus_num * 2; /* Tx = 0, 2 */
+	param->chan_id = data->ch * 2; /* Tx = 0, 2 */;
 	param->tx_reg = data->io_base_addr + PCH_SPDWR;
 	param->width = width;
 	chan = dma_request_channel(mask, pch_spi_filter, param);
@@ -936,7 +936,7 @@  static void pch_spi_request_dma(struct pch_spi_data *data, int bpw)
 	/* Set Rx DMA */
 	param = &dma->param_rx;
 	param->dma_dev = &dma_dev->dev;
-	param->chan_id = data->master->bus_num * 2 + 1; /* Rx = Tx + 1 */
+	param->chan_id = data->ch * 2 + 1; /* Rx = Tx + 1 */;
 	param->rx_reg = data->io_base_addr + PCH_SPDRR;
 	param->width = width;
 	chan = dma_request_channel(mask, pch_spi_filter, param);