omap_hsmmc: be more conservative with dma params
authorGrazvydas Ignotas <notasas@gmail.com>
Sun, 7 Feb 2016 17:03:07 +0000 (19:03 +0200)
committerGrazvydas Ignotas <notasas@gmail.com>
Sun, 28 Feb 2016 01:55:13 +0000 (03:55 +0200)
dgame reported something what seems to be a SD read corruption he is
getting after a palemoon crash. After more testing done by him it
seems to be caused by 9e0b4807ca06, so only limit the tuned params
to MMC3 now to still get the wifi benefit.

Also revert parameters that are not helping wifi, just to be safe:
- OMAP_DMA_DST_SYNC_PREFETCH
- OMAP_DMA_WRITE_LAST_NON_POSTED

Testing is difficult and only dgame can reproduce it, so the exact
cause of his issue remains unclear.

drivers/mmc/host/omap_hsmmc.c

index 3c4a0e4..6a960c1 100644 (file)
@@ -1380,17 +1380,16 @@ static void omap_hsmmc_config_dma_params_once(struct omap_hsmmc_host *host,
                                              struct mmc_data *data,
                                              int dma_ch)
 {
+       /* pandora hack: only benefits wifi, so only set there, just in case */
+       if (host->id != OMAP_MMC3_DEVID)
+               return;
+
        if (data->flags & MMC_DATA_WRITE) {
-               omap_set_dma_dest_params(dma_ch, 0, OMAP_DMA_AMODE_CONSTANT,
-                       (host->mapbase + OMAP_HSMMC_DATA), 0, 0);
                omap_set_dma_src_burst_mode(dma_ch, OMAP_DMA_DATA_BURST_16);
                omap_set_dma_src_data_pack(dma_ch, 1);
        } else {
-               omap_set_dma_src_params(dma_ch, 0, OMAP_DMA_AMODE_CONSTANT,
-                       (host->mapbase + OMAP_HSMMC_DATA), 0, 0);
                omap_set_dma_dest_burst_mode(dma_ch, OMAP_DMA_DATA_BURST_16);
                omap_set_dma_dest_data_pack(dma_ch, 1);
-               omap_set_dma_write_mode(dma_ch, OMAP_DMA_WRITE_LAST_NON_POSTED);
        }
 }
 
@@ -1402,10 +1401,14 @@ static void omap_hsmmc_config_dma_params(struct omap_hsmmc_host *host,
 
        dma_ch = host->dma_ch;
        if (data->flags & MMC_DATA_WRITE) {
+               omap_set_dma_dest_params(dma_ch, 0, OMAP_DMA_AMODE_CONSTANT,
+                       (host->mapbase + OMAP_HSMMC_DATA), 0, 0);
                omap_set_dma_src_params(dma_ch, 0, OMAP_DMA_AMODE_POST_INC,
                        sg_dma_address(sgl), 0, 0);
-               sync = OMAP_DMA_DST_SYNC_PREFETCH;
+               sync = OMAP_DMA_DST_SYNC;
        } else {
+               omap_set_dma_src_params(dma_ch, 0, OMAP_DMA_AMODE_CONSTANT,
+                       (host->mapbase + OMAP_HSMMC_DATA), 0, 0);
                omap_set_dma_dest_params(dma_ch, 0, OMAP_DMA_AMODE_POST_INC,
                        sg_dma_address(sgl), 0, 0);
                sync = OMAP_DMA_SRC_SYNC;