diff options
author | Nicolas Ferre <nicolas.ferre@atmel.com> | 2013-03-19 03:45:01 -0400 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2013-04-01 09:43:31 -0400 |
commit | 823cd0454325509d84dbf8e301c182c8a2711c65 (patch) | |
tree | 946544a3120294c3b7788a5f25efb9ede9ad0e43 /drivers/spi/spi-atmel.c | |
parent | 1888e8f2f55c40656d8eff68572abb3748068b96 (diff) |
spi/spi-atmel: status information passed through controller data
The status of transfer is stored in controller data structure
so that it can be used not only by atmel_spi_msg_done() function.
This will be useful for upcoming dmaengine enabled driver.
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Wenyou Yang <wenyou.yang@atmel.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/spi/spi-atmel.c')
-rw-r--r-- | drivers/spi/spi-atmel.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/spi/spi-atmel.c b/drivers/spi/spi-atmel.c index 3c5ec603bcb0..ab2ed75d42f4 100644 --- a/drivers/spi/spi-atmel.c +++ b/drivers/spi/spi-atmel.c | |||
@@ -208,6 +208,7 @@ struct atmel_spi { | |||
208 | unsigned long current_remaining_bytes; | 208 | unsigned long current_remaining_bytes; |
209 | struct spi_transfer *next_transfer; | 209 | struct spi_transfer *next_transfer; |
210 | unsigned long next_remaining_bytes; | 210 | unsigned long next_remaining_bytes; |
211 | int done_status; | ||
211 | 212 | ||
212 | void *buffer; | 213 | void *buffer; |
213 | dma_addr_t buffer_dma; | 214 | dma_addr_t buffer_dma; |
@@ -553,15 +554,15 @@ static void atmel_spi_dma_unmap_xfer(struct spi_master *master, | |||
553 | 554 | ||
554 | static void | 555 | static void |
555 | atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as, | 556 | atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as, |
556 | struct spi_message *msg, int status, int stay) | 557 | struct spi_message *msg, int stay) |
557 | { | 558 | { |
558 | if (!stay || status < 0) | 559 | if (!stay || as->done_status < 0) |
559 | cs_deactivate(as, msg->spi); | 560 | cs_deactivate(as, msg->spi); |
560 | else | 561 | else |
561 | as->stay = msg->spi; | 562 | as->stay = msg->spi; |
562 | 563 | ||
563 | list_del(&msg->queue); | 564 | list_del(&msg->queue); |
564 | msg->status = status; | 565 | msg->status = as->done_status; |
565 | 566 | ||
566 | dev_dbg(master->dev.parent, | 567 | dev_dbg(master->dev.parent, |
567 | "xfer complete: %u bytes transferred\n", | 568 | "xfer complete: %u bytes transferred\n", |
@@ -573,6 +574,7 @@ atmel_spi_msg_done(struct spi_master *master, struct atmel_spi *as, | |||
573 | 574 | ||
574 | as->current_transfer = NULL; | 575 | as->current_transfer = NULL; |
575 | as->next_transfer = NULL; | 576 | as->next_transfer = NULL; |
577 | as->done_status = 0; | ||
576 | 578 | ||
577 | /* continue if needed */ | 579 | /* continue if needed */ |
578 | if (list_empty(&as->queue) || as->stopping) | 580 | if (list_empty(&as->queue) || as->stopping) |
@@ -650,7 +652,8 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
650 | /* Clear any overrun happening while cleaning up */ | 652 | /* Clear any overrun happening while cleaning up */ |
651 | spi_readl(as, SR); | 653 | spi_readl(as, SR); |
652 | 654 | ||
653 | atmel_spi_msg_done(master, as, msg, -EIO, 0); | 655 | as->done_status = -EIO; |
656 | atmel_spi_msg_done(master, as, msg, 0); | ||
654 | } else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) { | 657 | } else if (pending & (SPI_BIT(RXBUFF) | SPI_BIT(ENDRX))) { |
655 | ret = IRQ_HANDLED; | 658 | ret = IRQ_HANDLED; |
656 | 659 | ||
@@ -668,7 +671,7 @@ atmel_spi_interrupt(int irq, void *dev_id) | |||
668 | 671 | ||
669 | if (atmel_spi_xfer_is_last(msg, xfer)) { | 672 | if (atmel_spi_xfer_is_last(msg, xfer)) { |
670 | /* report completed message */ | 673 | /* report completed message */ |
671 | atmel_spi_msg_done(master, as, msg, 0, | 674 | atmel_spi_msg_done(master, as, msg, |
672 | xfer->cs_change); | 675 | xfer->cs_change); |
673 | } else { | 676 | } else { |
674 | if (xfer->cs_change) { | 677 | if (xfer->cs_change) { |