[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1209095926-21279-1-git-send-email-cooloney@kernel.org>
Date: Fri, 25 Apr 2008 11:58:46 +0800
From: Bryan Wu <cooloney@...nel.org>
To: dbrownell@...rs.sourceforge.net,
spi-devel-general@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Cc: Vitja Makarov <vitja.makarov@...il.com>,
Bryan Wu <cooloney@...nel.org>
Subject: [PATCH 1/1] Blackfin SPI Driver: Fix bug when SPI full-duplex
From: Vitja Makarov <vitja.makarov@...il.com>
Check if full-duplex and DMA are used together, fall-back to PIO mode.
Signed-off-by: Vitja Makarov <vitja.makarov@...il.com>
Signed-off-by: Bryan Wu <cooloney@...nel.org>
---
drivers/spi/spi_bfin5xx.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c
index a9ac1fd..a94f1e9 100644
--- a/drivers/spi/spi_bfin5xx.c
+++ b/drivers/spi/spi_bfin5xx.c
@@ -608,6 +608,7 @@ static void pump_transfers(unsigned long data)
u8 width;
u16 cr, dma_width, dma_config;
u32 tranf_success = 1;
+ u8 full_duplex = 0;
/* Get current state information */
message = drv_data->cur_msg;
@@ -658,6 +659,7 @@ static void pump_transfers(unsigned long data)
}
if (transfer->rx_buf != NULL) {
+ full_duplex = transfer->tx_buf != NULL;
drv_data->rx = transfer->rx_buf;
drv_data->rx_end = drv_data->rx + transfer->len;
dev_dbg(&drv_data->pdev->dev, "rx_buf is %p, rx_end is %p\n",
@@ -740,7 +742,7 @@ static void pump_transfers(unsigned long data)
* successful use different way to r/w according to
* drv_data->cur_chip->enable_dma
*/
- if (drv_data->cur_chip->enable_dma && drv_data->len > 6) {
+ if (!full_duplex && drv_data->cur_chip->enable_dma && drv_data->len > 6) {
disable_dma(drv_data->dma_channel);
clear_dma_irqstat(drv_data->dma_channel);
@@ -828,7 +830,7 @@ static void pump_transfers(unsigned long data)
/* IO mode write then read */
dev_dbg(&drv_data->pdev->dev, "doing IO transfer\n");
- if (drv_data->tx != NULL && drv_data->rx != NULL) {
+ if (full_duplex) {
/* full duplex mode */
BUG_ON((drv_data->tx_end - drv_data->tx) !=
(drv_data->rx_end - drv_data->rx));
--
1.5.5
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists