diff options
author | Mike Frysinger <vapier.adi@gmail.com> | 2009-04-06 22:00:35 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-04-07 11:31:04 -0400 |
commit | 04b95d2f7453d64f89ca1d8c3e70bcc7cc38320f (patch) | |
tree | 6a49d81d049445071f077f84be69a1a598864012 | |
parent | ace32865a3767e4e385b883868c228a2a6db225a (diff) |
Blackfin SPI Driver: pass DMA overflow error to the higher level
If the SPI bus registers a receive overflow error, pass the result back up
to the higher levels.
Signed-off-by: Mike Frysinger <vapier.adi@gmail.com>
Signed-off-by: Bryan Wu <cooloney@kernel.org>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index 6d3f6064871e..2e0c024bbde7 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -559,6 +559,7 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
559 | struct driver_data *drv_data = dev_id; | 559 | struct driver_data *drv_data = dev_id; |
560 | struct chip_data *chip = drv_data->cur_chip; | 560 | struct chip_data *chip = drv_data->cur_chip; |
561 | struct spi_message *msg = drv_data->cur_msg; | 561 | struct spi_message *msg = drv_data->cur_msg; |
562 | u16 spistat = read_STAT(drv_data); | ||
562 | 563 | ||
563 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); | 564 | dev_dbg(&drv_data->pdev->dev, "in dma_irq_handler\n"); |
564 | clear_dma_irqstat(drv_data->dma_channel); | 565 | clear_dma_irqstat(drv_data->dma_channel); |
@@ -582,13 +583,18 @@ static irqreturn_t dma_irq_handler(int irq, void *dev_id) | |||
582 | while (!(read_STAT(drv_data) & SPIF)) | 583 | while (!(read_STAT(drv_data) & SPIF)) |
583 | cpu_relax(); | 584 | cpu_relax(); |
584 | 585 | ||
585 | msg->actual_length += drv_data->len_in_bytes; | 586 | if (spistat & RBSY) { |
587 | msg->state = ERROR_STATE; | ||
588 | dev_err(&drv_data->pdev->dev, "dma receive: fifo/buffer overflow\n"); | ||
589 | } else { | ||
590 | msg->actual_length += drv_data->len_in_bytes; | ||
586 | 591 | ||
587 | if (drv_data->cs_change) | 592 | if (drv_data->cs_change) |
588 | cs_deactive(drv_data, chip); | 593 | cs_deactive(drv_data, chip); |
589 | 594 | ||
590 | /* Move to next transfer */ | 595 | /* Move to next transfer */ |
591 | msg->state = next_transfer(drv_data); | 596 | msg->state = next_transfer(drv_data); |
597 | } | ||
592 | 598 | ||
593 | /* Schedule transfer tasklet */ | 599 | /* Schedule transfer tasklet */ |
594 | tasklet_schedule(&drv_data->pump_transfers); | 600 | tasklet_schedule(&drv_data->pump_transfers); |