]> git.wh0rd.org - patches.git/blame - spi-flash-dma.patch
sync vapier-m
[patches.git] / spi-flash-dma.patch
CommitLineData
b77ff2bc
MF
1--- spi_bfin5xx.c (revision 5493)
2+++ spi_bfin5xx.c (working copy)
3@@ -619,6 +619,7 @@ static void pump_transfers(unsigned long
4 struct spi_transfer *transfer = NULL;
5 struct spi_transfer *previous = NULL;
6 struct chip_data *chip = NULL;
7+ unsigned long flags;
8 u8 width;
9 u16 cr, dma_width, dma_config;
10 u32 tranf_success = 1;
11@@ -766,7 +767,6 @@ static void pump_transfers(unsigned long
12
13 disable_dma(drv_data->dma_channel);
14 clear_dma_irqstat(drv_data->dma_channel);
15- bfin_spi_disable(drv_data);
16
17 /* config dma channel */
18 dev_dbg(&drv_data->pdev->dev, "doing dma transfer\n");
19@@ -797,8 +797,7 @@ static void pump_transfers(unsigned long
20 enable_dma(drv_data->dma_channel);
21
22 /* start SPI transfer */
23- write_CTRL(drv_data,
24- (cr | BIT_CTL_TIMOD_DMA_TX | BIT_CTL_ENABLE));
25+ write_CTRL(drv_data, cr | BIT_CTL_TIMOD_DMA_TX);
26
27 /* just return here, there can only be one transfer
28 * in this mode
29@@ -840,14 +839,22 @@ static void pump_transfers(unsigned long
30 } else
31 BUG();
32
33- /* start dma */
34- dma_enable_irq(drv_data->dma_channel);
35- set_dma_config(drv_data->dma_channel, dma_config);
36+ /* oh man, here there be monsters ... and i dont mean the
37+ * fluffy cute ones from pixar, i mean the kind that'll eat
38+ * your data, kick your dog, and love it all. do *not* try
39+ * and change these lines unless you (1) heavily test DMA
40+ * with SPI flashes on a loaded system (e.g. ping floods),
41+ * (2) know just how broken the DMA engine interaction with
42+ * the SPI peripheral is, and (3) have someone else to blame
43+ * when you screw it all up anyways.
44+ */
45 set_dma_start_addr(drv_data->dma_channel, dma_start_addr);
46+ set_dma_config(drv_data->dma_channel, dma_config);
47+ local_irq_save(flags);
48 enable_dma(drv_data->dma_channel);
49-
50- /* start SPI transfer */
51- write_CTRL(drv_data, (cr | BIT_CTL_ENABLE));
52+ write_CTRL(drv_data, cr);
53+ dma_enable_irq(drv_data->dma_channel);
54+ local_irq_restore(flags);
55
56 } else {
57 /* IO mode write then read */