diff options
-rw-r--r-- | drivers/spi/spi_bfin5xx.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/spi/spi_bfin5xx.c b/drivers/spi/spi_bfin5xx.c index b797ece0b10c..88dee87fc420 100644 --- a/drivers/spi/spi_bfin5xx.c +++ b/drivers/spi/spi_bfin5xx.c | |||
@@ -761,11 +761,10 @@ static void pump_transfers(unsigned long data) | |||
761 | if (!full_duplex && drv_data->cur_chip->enable_dma | 761 | if (!full_duplex && drv_data->cur_chip->enable_dma |
762 | && drv_data->len > 6) { | 762 | && drv_data->len > 6) { |
763 | 763 | ||
764 | unsigned long dma_start_addr; | 764 | unsigned long dma_start_addr, flags; |
765 | 765 | ||
766 | disable_dma(drv_data->dma_channel); | 766 | disable_dma(drv_data->dma_channel); |
767 | clear_dma_irqstat(drv_data->dma_channel); | 767 | clear_dma_irqstat(drv_data->dma_channel); |
768 | bfin_spi_disable(drv_data); | ||
769 | 768 | ||
770 | /* config dma channel */ | 769 | /* config dma channel */ |
771 | dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); | 770 | dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n"); |
@@ -796,8 +795,7 @@ static void pump_transfers(unsigned long data) | |||
796 | enable_dma(drv_data->dma_channel); | 795 | enable_dma(drv_data->dma_channel); |
797 | 796 | ||
798 | /* start SPI transfer */ | 797 | /* start SPI transfer */ |
799 | write_CTRL(drv_data, | 798 | write_CTRL(drv_data, cr | BIT_CTL_TIMOD_DMA_TX); |
800 | (cr | BIT_CTL_TIMOD_DMA_TX | BIT_CTL_ENABLE)); | ||
801 | 799 | ||
802 | /* just return here, there can only be one transfer | 800 | /* just return here, there can only be one transfer |
803 | * in this mode | 801 | * in this mode |
@@ -842,14 +840,22 @@ static void pump_transfers(unsigned long data) | |||
842 | } else | 840 | } else |
843 | BUG(); | 841 | BUG(); |
844 | 842 | ||
845 | /* start dma */ | 843 | /* oh man, here there be monsters ... and i dont mean the |
846 | dma_enable_irq(drv_data->dma_channel); | 844 | * fluffy cute ones from pixar, i mean the kind that'll eat |
847 | set_dma_config(drv_data->dma_channel, dma_config); | 845 | * your data, kick your dog, and love it all. do *not* try |
846 | * and change these lines unless you (1) heavily test DMA | ||
847 | * with SPI flashes on a loaded system (e.g. ping floods), | ||
848 | * (2) know just how broken the DMA engine interaction with | ||
849 | * the SPI peripheral is, and (3) have someone else to blame | ||
850 | * when you screw it all up anyways. | ||
851 | */ | ||
848 | set_dma_start_addr(drv_data->dma_channel, dma_start_addr); | 852 | set_dma_start_addr(drv_data->dma_channel, dma_start_addr); |
853 | set_dma_config(drv_data->dma_channel, dma_config); | ||
854 | local_irq_save(flags); | ||
849 | enable_dma(drv_data->dma_channel); | 855 | enable_dma(drv_data->dma_channel); |
850 | 856 | write_CTRL(drv_data, cr); | |
851 | /* start SPI transfer */ | 857 | dma_enable_irq(drv_data->dma_channel); |
852 | write_CTRL(drv_data, (cr | BIT_CTL_ENABLE)); | 858 | local_irq_restore(flags); |
853 | 859 | ||
854 | } else { | 860 | } else { |
855 | /* IO mode write then read */ | 861 | /* IO mode write then read */ |